code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public synchronized String getGlobalProperty(String name, String defaultValue) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "getGlobalProperty", new Object[] { name, defaultValue });
String value = getGlobalProperty(name);
if (value == null) {
value = defaultValue;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "getGlobalProperty -> " + value);
return value;
} } | public class class_name {
public synchronized String getGlobalProperty(String name, String defaultValue) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "getGlobalProperty", new Object[] { name, defaultValue });
String value = getGlobalProperty(name);
if (value == null) {
value = defaultValue; // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "getGlobalProperty -> " + value);
return value;
} } |
public class class_name {
public DrawerView addProfile(DrawerProfile profile) {
if (profile.getId() <= 0) {
profile.setId(System.nanoTime() * 100 + Math.round(Math.random() * 100));
}
for (DrawerProfile oldProfile : mProfileAdapter.getItems()) {
if (oldProfile.getId() == profile.getId()) {
mProfileAdapter.remove(oldProfile);
break;
}
}
profile.attachTo(this);
mProfileAdapter.add(profile);
if (mProfileAdapter.getCount() == 1) {
selectProfile(profile);
}
updateProfile();
return this;
} } | public class class_name {
public DrawerView addProfile(DrawerProfile profile) {
if (profile.getId() <= 0) {
profile.setId(System.nanoTime() * 100 + Math.round(Math.random() * 100)); // depends on control dependency: [if], data = [none]
}
for (DrawerProfile oldProfile : mProfileAdapter.getItems()) {
if (oldProfile.getId() == profile.getId()) {
mProfileAdapter.remove(oldProfile); // depends on control dependency: [if], data = [none]
break;
}
}
profile.attachTo(this);
mProfileAdapter.add(profile);
if (mProfileAdapter.getCount() == 1) {
selectProfile(profile); // depends on control dependency: [if], data = [none]
}
updateProfile();
return this;
} } |
public class class_name {
@Override
public String[] getRequestValue(final Request request) {
if (isPresent(request)) {
String[] paramValues = request.getParameterValues(getId());
return removeEmptyStrings(paramValues);
} else {
return getValue();
}
} } | public class class_name {
@Override
public String[] getRequestValue(final Request request) {
if (isPresent(request)) {
String[] paramValues = request.getParameterValues(getId());
return removeEmptyStrings(paramValues); // depends on control dependency: [if], data = [none]
} else {
return getValue(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<String> getParamNames() {
if (!Strings.contains(content, ":")) { return Collections.emptyList(); }
final List<String> params = new ArrayList<String>();
int index = 0;
do {
final int colonIndex = content.indexOf(':', index);
if (-1 == colonIndex) {
break;
}
index = colonIndex + 1;
while (index < content.length()) {
final char c = content.charAt(index);
if (isValidIdentifierStarter(c)) {
index++;
} else {
break;
}
}
final String paramName = content.substring(colonIndex + 1, index);
if (!params.contains(paramName)) {
params.add(paramName);
}
} while (index < content.length());
return params;
} } | public class class_name {
public List<String> getParamNames() {
if (!Strings.contains(content, ":")) { return Collections.emptyList(); } // depends on control dependency: [if], data = [none]
final List<String> params = new ArrayList<String>();
int index = 0;
do {
final int colonIndex = content.indexOf(':', index);
if (-1 == colonIndex) {
break;
}
index = colonIndex + 1;
while (index < content.length()) {
final char c = content.charAt(index);
if (isValidIdentifierStarter(c)) {
index++; // depends on control dependency: [if], data = [none]
} else {
break;
}
}
final String paramName = content.substring(colonIndex + 1, index);
if (!params.contains(paramName)) {
params.add(paramName); // depends on control dependency: [if], data = [none]
}
} while (index < content.length());
return params;
} } |
public class class_name {
private void setRDFAsDatastream(StringBuffer buf) {
DatastreamXMLMetadata ds = new DatastreamXMLMetadata();
// set the attrs common to all datastream versions
ds.DatastreamID = "RELS-INT";
ds.DSVersionable = false;
ds.DSFormatURI = m_dsFormatURI;
ds.DatastreamAltIDs = m_dsAltIDs;
ds.DSVersionID = "RELS-INT.0";
ds.DSLabel =
"DO NOT EDIT: System-generated datastream to preserve METS DMDID/ADMID relationships.";
ds.DSCreateDT = new Date();
ds.DSMIME = "application/rdf+xml";
// set the attrs specific to datastream version
ds.DSControlGrp = "X";
ds.DSState = "A";
ds.DSLocation =
m_obj.getPid() + "+" + ds.DatastreamID + "+" + ds.DSVersionID;
ds.DSLocationType = Datastream.DS_LOCATION_TYPE_INTERNAL;
ds.DSInfoType = "DATA";
ds.DSMDClass = DatastreamXMLMetadata.TECHNICAL;
// now set the xml content stream itself...
try {
ds.xmlContent = buf.toString().getBytes(m_characterEncoding);
ds.DSSize = ds.xmlContent.length;
} catch (UnsupportedEncodingException uee) {
logger.error("Encoding error when creating RELS-INT datastream", uee);
}
// FINALLY! add the RDF and an inline xml datastream in the digital object
m_obj.addDatastreamVersion(ds, true);
} } | public class class_name {
private void setRDFAsDatastream(StringBuffer buf) {
DatastreamXMLMetadata ds = new DatastreamXMLMetadata();
// set the attrs common to all datastream versions
ds.DatastreamID = "RELS-INT";
ds.DSVersionable = false;
ds.DSFormatURI = m_dsFormatURI;
ds.DatastreamAltIDs = m_dsAltIDs;
ds.DSVersionID = "RELS-INT.0";
ds.DSLabel =
"DO NOT EDIT: System-generated datastream to preserve METS DMDID/ADMID relationships.";
ds.DSCreateDT = new Date();
ds.DSMIME = "application/rdf+xml";
// set the attrs specific to datastream version
ds.DSControlGrp = "X";
ds.DSState = "A";
ds.DSLocation =
m_obj.getPid() + "+" + ds.DatastreamID + "+" + ds.DSVersionID;
ds.DSLocationType = Datastream.DS_LOCATION_TYPE_INTERNAL;
ds.DSInfoType = "DATA";
ds.DSMDClass = DatastreamXMLMetadata.TECHNICAL;
// now set the xml content stream itself...
try {
ds.xmlContent = buf.toString().getBytes(m_characterEncoding); // depends on control dependency: [try], data = [none]
ds.DSSize = ds.xmlContent.length; // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException uee) {
logger.error("Encoding error when creating RELS-INT datastream", uee);
} // depends on control dependency: [catch], data = [none]
// FINALLY! add the RDF and an inline xml datastream in the digital object
m_obj.addDatastreamVersion(ds, true);
} } |
public class class_name {
public DefaultPojoDaoFactory build() {
if(executor == null) {
executor = Executors.newFixedThreadPool(threadPoolSize, r -> new Thread(r, "Hecate"));
}
if(statementFactory == null) {
statementFactory = new DefaultPojoStatementFactory(session);
}
if(contextFactory == null) {
contextFactory = new DefaultPojoQueryContextFactory(session, statementFactory, maximumCacheSize);
}
if(converterRegistry == null) {
DefaultConverterRegistry reg = new DefaultConverterRegistry();
converterProviders.forEach(reg::registerConverter);
this.converterRegistry = reg;
}
if(bindingFactory == null) {
bindingFactory = new DefaultPojoBindingFactory(facetProvider, converterRegistry, namingStrategy);
}
DefaultPojoDaoFactory factory = new DefaultPojoDaoFactory(session, bindingFactory, statementFactory, contextFactory, namingStrategy, executor);
pojoFactoryListeners.forEach(factory::addListener);
return factory;
} } | public class class_name {
public DefaultPojoDaoFactory build() {
if(executor == null) {
executor = Executors.newFixedThreadPool(threadPoolSize, r -> new Thread(r, "Hecate")); // depends on control dependency: [if], data = [none]
}
if(statementFactory == null) {
statementFactory = new DefaultPojoStatementFactory(session); // depends on control dependency: [if], data = [none]
}
if(contextFactory == null) {
contextFactory = new DefaultPojoQueryContextFactory(session, statementFactory, maximumCacheSize); // depends on control dependency: [if], data = [none]
}
if(converterRegistry == null) {
DefaultConverterRegistry reg = new DefaultConverterRegistry();
converterProviders.forEach(reg::registerConverter); // depends on control dependency: [if], data = [none]
this.converterRegistry = reg; // depends on control dependency: [if], data = [none]
}
if(bindingFactory == null) {
bindingFactory = new DefaultPojoBindingFactory(facetProvider, converterRegistry, namingStrategy); // depends on control dependency: [if], data = [none]
}
DefaultPojoDaoFactory factory = new DefaultPojoDaoFactory(session, bindingFactory, statementFactory, contextFactory, namingStrategy, executor);
pojoFactoryListeners.forEach(factory::addListener);
return factory;
} } |
public class class_name {
private void initConnection() throws XMPPException {
boolean isFirstInitialization = packetReader == null
|| packetWriter == null;
compressionHandler = null;
serverAckdCompression = false;
// Set the reader and writer instance variables
initReaderAndWriter();
try {
if (isFirstInitialization) {
packetWriter = new PacketWriter(this);
packetReader = new PacketReader(this);
// If debugging is enabled, we should start the thread that will
// listen for
// all packets and then log them.
if (config.isDebuggerEnabled()) {
addPacketListener(debugger.getReaderListener(), null);
if (debugger.getWriterListener() != null) {
addPacketSendingListener(debugger.getWriterListener(),
null);
}
}
} else {
packetWriter.init();
packetReader.init();
}
// Start the packet writer. This will open a XMPP stream to the
// server
packetWriter.startup();
// Start the packet reader. The startup() method will block until we
// get an opening stream packet back from server.
packetReader.startup();
// Make note of the fact that we're now connected.
connected = true;
if (isFirstInitialization) {
// Notify listeners that a new connection has been established
for (ConnectionCreationListener listener : getConnectionCreationListeners()) {
listener.connectionCreated(this);
}
}
} catch (XMPPException ex) {
// An exception occurred in setting up the connection. Make sure we
// shut down the
// readers and writers and close the socket.
if (packetWriter != null) {
try {
packetWriter.shutdown();
} catch (Throwable ignore) { /* ignore */
}
packetWriter = null;
}
if (packetReader != null) {
try {
packetReader.shutdown();
} catch (Throwable ignore) { /* ignore */
}
packetReader = null;
}
if (reader != null) {
try {
reader.close();
} catch (Throwable ignore) { /* ignore */
}
reader = null;
}
if (writer != null) {
try {
writer.close();
} catch (Throwable ignore) { /* ignore */
}
writer = null;
}
if (socket != null) {
try {
socket.close();
} catch (Exception e) { /* ignore */
}
socket = null;
}
this.setWasAuthenticated(authenticated);
authenticated = false;
connected = false;
throw ex; // Everything stoppped. Now throw the exception.
}
} } | public class class_name {
private void initConnection() throws XMPPException {
boolean isFirstInitialization = packetReader == null
|| packetWriter == null;
compressionHandler = null;
serverAckdCompression = false;
// Set the reader and writer instance variables
initReaderAndWriter();
try {
if (isFirstInitialization) {
packetWriter = new PacketWriter(this); // depends on control dependency: [if], data = [none]
packetReader = new PacketReader(this); // depends on control dependency: [if], data = [none]
// If debugging is enabled, we should start the thread that will
// listen for
// all packets and then log them.
if (config.isDebuggerEnabled()) {
addPacketListener(debugger.getReaderListener(), null); // depends on control dependency: [if], data = [none]
if (debugger.getWriterListener() != null) {
addPacketSendingListener(debugger.getWriterListener(),
null); // depends on control dependency: [if], data = [none]
}
}
} else {
packetWriter.init(); // depends on control dependency: [if], data = [none]
packetReader.init(); // depends on control dependency: [if], data = [none]
}
// Start the packet writer. This will open a XMPP stream to the
// server
packetWriter.startup();
// Start the packet reader. The startup() method will block until we
// get an opening stream packet back from server.
packetReader.startup();
// Make note of the fact that we're now connected.
connected = true;
if (isFirstInitialization) {
// Notify listeners that a new connection has been established
for (ConnectionCreationListener listener : getConnectionCreationListeners()) {
listener.connectionCreated(this); // depends on control dependency: [for], data = [listener]
}
}
} catch (XMPPException ex) {
// An exception occurred in setting up the connection. Make sure we
// shut down the
// readers and writers and close the socket.
if (packetWriter != null) {
try {
packetWriter.shutdown(); // depends on control dependency: [try], data = [none]
} catch (Throwable ignore) { /* ignore */
} // depends on control dependency: [catch], data = [none]
packetWriter = null; // depends on control dependency: [if], data = [none]
}
if (packetReader != null) {
try {
packetReader.shutdown(); // depends on control dependency: [try], data = [none]
} catch (Throwable ignore) { /* ignore */
} // depends on control dependency: [catch], data = [none]
packetReader = null; // depends on control dependency: [if], data = [none]
}
if (reader != null) {
try {
reader.close(); // depends on control dependency: [try], data = [none]
} catch (Throwable ignore) { /* ignore */
} // depends on control dependency: [catch], data = [none]
reader = null; // depends on control dependency: [if], data = [none]
}
if (writer != null) {
try {
writer.close(); // depends on control dependency: [try], data = [none]
} catch (Throwable ignore) { /* ignore */
} // depends on control dependency: [catch], data = [none]
writer = null; // depends on control dependency: [if], data = [none]
}
if (socket != null) {
try {
socket.close(); // depends on control dependency: [try], data = [none]
} catch (Exception e) { /* ignore */
} // depends on control dependency: [catch], data = [none]
socket = null; // depends on control dependency: [if], data = [none]
}
this.setWasAuthenticated(authenticated);
authenticated = false;
connected = false;
throw ex; // Everything stoppped. Now throw the exception.
}
} } |
public class class_name {
public boolean recordVersion(String version) {
if (currentInfo.documentVersion(version)) {
populated = true;
return true;
} else {
return false;
}
} } | public class class_name {
public boolean recordVersion(String version) {
if (currentInfo.documentVersion(version)) {
populated = true; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void stopTimer() {
if(this.WRITE_CACHE_ENABLED) {
if(timerWriteCache != null) {
timerWriteCache.cancel();
}
if(writeTimer != null){
writeTimer.cancel();
}
if(timerDeleteCache != null) {
timerDeleteCache.cancel();
}
if(deleteTimer != null){
deleteTimer.cancel();
}
}
} } | public class class_name {
public void stopTimer() {
if(this.WRITE_CACHE_ENABLED) {
if(timerWriteCache != null) {
timerWriteCache.cancel(); // depends on control dependency: [if], data = [none]
}
if(writeTimer != null){
writeTimer.cancel(); // depends on control dependency: [if], data = [none]
}
if(timerDeleteCache != null) {
timerDeleteCache.cancel(); // depends on control dependency: [if], data = [none]
}
if(deleteTimer != null){
deleteTimer.cancel(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected void scanJspConfig() throws IOException, SAXException {
JspConfigDescriptor jspConfigDescriptor = context.getJspConfigDescriptor();
if (jspConfigDescriptor == null) {
return;
}
Collection<TaglibDescriptor> descriptors = jspConfigDescriptor.getTaglibs();
for (TaglibDescriptor descriptor : descriptors) {
if (descriptor == null) {
continue;
}
String taglibURI = descriptor.getTaglibURI();
String resourcePath = descriptor.getTaglibLocation();
// Note: Whilst the Servlet 2.4 DTD implies that the location must
// be a context-relative path starting with '/', JSP.7.3.6.1 states
// explicitly how paths that do not start with '/' should be
// handled.
if (!resourcePath.startsWith("/")) {
resourcePath = WEB_INF + resourcePath;
}
if (uriTldResourcePathMap.containsKey(taglibURI)) {
LOG.warn(Localizer.getMessage(MSG + ".webxmlSkip", resourcePath, taglibURI));
continue;
}
if (LOG.isTraceEnabled()) {
LOG.trace(Localizer.getMessage(MSG + ".webxmlAdd", resourcePath, taglibURI));
}
URL url = context.getResource(resourcePath);
if (url != null) {
TldResourcePath tldResourcePath;
if (resourcePath.endsWith(".jar")) {
// if the path points to a jar file, the TLD is presumed to
// be
// inside at META-INF/taglib.tld
tldResourcePath = new TldResourcePath(url, resourcePath, "META-INF/taglib.tld");
} else {
tldResourcePath = new TldResourcePath(url, resourcePath);
}
// parse TLD but store using the URI supplied in the descriptor
TaglibXml tld = tldParser.parse(tldResourcePath);
uriTldResourcePathMap.put(taglibURI, tldResourcePath);
tldResourcePathTaglibXmlMap.put(tldResourcePath, tld);
if (tld.getListeners() != null) {
listeners.addAll(tld.getListeners());
}
} else {
LOG.warn(Localizer.getMessage(MSG + ".webxmlFailPathDoesNotExist", resourcePath, taglibURI));
continue;
}
}
} } | public class class_name {
protected void scanJspConfig() throws IOException, SAXException {
JspConfigDescriptor jspConfigDescriptor = context.getJspConfigDescriptor();
if (jspConfigDescriptor == null) {
return;
}
Collection<TaglibDescriptor> descriptors = jspConfigDescriptor.getTaglibs();
for (TaglibDescriptor descriptor : descriptors) {
if (descriptor == null) {
continue;
}
String taglibURI = descriptor.getTaglibURI();
String resourcePath = descriptor.getTaglibLocation();
// Note: Whilst the Servlet 2.4 DTD implies that the location must
// be a context-relative path starting with '/', JSP.7.3.6.1 states
// explicitly how paths that do not start with '/' should be
// handled.
if (!resourcePath.startsWith("/")) {
resourcePath = WEB_INF + resourcePath; // depends on control dependency: [if], data = [none]
}
if (uriTldResourcePathMap.containsKey(taglibURI)) {
LOG.warn(Localizer.getMessage(MSG + ".webxmlSkip", resourcePath, taglibURI)); // depends on control dependency: [if], data = [none]
continue;
}
if (LOG.isTraceEnabled()) {
LOG.trace(Localizer.getMessage(MSG + ".webxmlAdd", resourcePath, taglibURI)); // depends on control dependency: [if], data = [none]
}
URL url = context.getResource(resourcePath);
if (url != null) {
TldResourcePath tldResourcePath;
if (resourcePath.endsWith(".jar")) {
// if the path points to a jar file, the TLD is presumed to
// be
// inside at META-INF/taglib.tld
tldResourcePath = new TldResourcePath(url, resourcePath, "META-INF/taglib.tld");
} else {
tldResourcePath = new TldResourcePath(url, resourcePath); // depends on control dependency: [if], data = [none]
}
// parse TLD but store using the URI supplied in the descriptor
TaglibXml tld = tldParser.parse(tldResourcePath);
uriTldResourcePathMap.put(taglibURI, tldResourcePath); // depends on control dependency: [if], data = [none]
tldResourcePathTaglibXmlMap.put(tldResourcePath, tld); // depends on control dependency: [if], data = [none]
if (tld.getListeners() != null) {
listeners.addAll(tld.getListeners()); // depends on control dependency: [if], data = [(tld.getListeners()]
}
} else {
LOG.warn(Localizer.getMessage(MSG + ".webxmlFailPathDoesNotExist", resourcePath, taglibURI)); // depends on control dependency: [if], data = [none]
continue;
}
}
} } |
public class class_name {
protected final void endClientExecution(
AWSRequestMetrics awsRequestMetrics, Request<?> request,
Response<?> response, @Deprecated boolean loggingAwsRequestMetrics) {
if (request != null) {
awsRequestMetrics.endEvent(Field.ClientExecuteTime);
awsRequestMetrics.getTimingInfo().endTiming();
RequestMetricCollector c = findRequestMetricCollector(
request.getOriginalRequest().getRequestMetricCollector());
c.collectMetrics(request, response);
awsRequestMetrics.log();
}
} } | public class class_name {
protected final void endClientExecution(
AWSRequestMetrics awsRequestMetrics, Request<?> request,
Response<?> response, @Deprecated boolean loggingAwsRequestMetrics) {
if (request != null) {
awsRequestMetrics.endEvent(Field.ClientExecuteTime); // depends on control dependency: [if], data = [none]
awsRequestMetrics.getTimingInfo().endTiming(); // depends on control dependency: [if], data = [none]
RequestMetricCollector c = findRequestMetricCollector(
request.getOriginalRequest().getRequestMetricCollector());
c.collectMetrics(request, response); // depends on control dependency: [if], data = [(request]
awsRequestMetrics.log(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String getLinkCopyText(JSONObject jsonObject){
if(jsonObject == null) return "";
try {
JSONObject copyObject = jsonObject.has("copyText") ? jsonObject.getJSONObject("copyText") : null;
if(copyObject != null){
return copyObject.has("text") ? copyObject.getString("text") : "";
}else{
return "";
}
} catch (JSONException e) {
Logger.v("Unable to get Link Text with JSON - "+e.getLocalizedMessage());
return "";
}
} } | public class class_name {
public String getLinkCopyText(JSONObject jsonObject){
if(jsonObject == null) return "";
try {
JSONObject copyObject = jsonObject.has("copyText") ? jsonObject.getJSONObject("copyText") : null;
if(copyObject != null){
return copyObject.has("text") ? copyObject.getString("text") : ""; // depends on control dependency: [if], data = [none]
}else{
return ""; // depends on control dependency: [if], data = [none]
}
} catch (JSONException e) {
Logger.v("Unable to get Link Text with JSON - "+e.getLocalizedMessage());
return "";
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean acquireLock (String name)
{
// check for the existence of the lock in the list and add it if it's not already there
Object[] list = ListUtil.testAndAdd(_locks, name);
if (list == null) {
// a null list means the object was already in the list
return false;
} else {
// a non-null list means the object was added
_locks = list;
return true;
}
} } | public class class_name {
public boolean acquireLock (String name)
{
// check for the existence of the lock in the list and add it if it's not already there
Object[] list = ListUtil.testAndAdd(_locks, name);
if (list == null) {
// a null list means the object was already in the list
return false; // depends on control dependency: [if], data = [none]
} else {
// a non-null list means the object was added
_locks = list; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void showDialog(boolean showRoot, String panel) {
expandRoot();
try {
DefaultMutableTreeNode node = null;
if (panel != null) {
node = getTreeNodeFromPanelName(panel);
}
if (node == null) {
if (nameLastSelectedPanel != null) {
node = getTreeNodeFromPanelName(nameLastSelectedPanel);
} else if (showRoot) {
node = (DefaultMutableTreeNode) getTreeModel().getRoot();
} else if (((DefaultMutableTreeNode) getTreeModel().getRoot()).getChildCount() > 0) {
node = (DefaultMutableTreeNode) ((DefaultMutableTreeNode) getTreeModel().getRoot()).getChildAt(0);
}
}
if (node != null) {
showParamPanel(node.toString());
}
} catch (Exception e) {
// ZAP: log errors
log.error(e.getMessage(), e);
}
} } | public class class_name {
public void showDialog(boolean showRoot, String panel) {
expandRoot();
try {
DefaultMutableTreeNode node = null;
if (panel != null) {
node = getTreeNodeFromPanelName(panel);
// depends on control dependency: [if], data = [(panel]
}
if (node == null) {
if (nameLastSelectedPanel != null) {
node = getTreeNodeFromPanelName(nameLastSelectedPanel);
// depends on control dependency: [if], data = [(nameLastSelectedPanel]
} else if (showRoot) {
node = (DefaultMutableTreeNode) getTreeModel().getRoot();
// depends on control dependency: [if], data = [none]
} else if (((DefaultMutableTreeNode) getTreeModel().getRoot()).getChildCount() > 0) {
node = (DefaultMutableTreeNode) ((DefaultMutableTreeNode) getTreeModel().getRoot()).getChildAt(0);
// depends on control dependency: [if], data = [0)]
}
}
if (node != null) {
showParamPanel(node.toString());
// depends on control dependency: [if], data = [(node]
}
} catch (Exception e) {
// ZAP: log errors
log.error(e.getMessage(), e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public final void nonWildcardTypeArguments() throws RecognitionException {
int nonWildcardTypeArguments_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 136) ) { return; }
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1275:5: ( '<' typeList '>' )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1275:7: '<' typeList '>'
{
match(input,53,FOLLOW_53_in_nonWildcardTypeArguments6218); if (state.failed) return;
pushFollow(FOLLOW_typeList_in_nonWildcardTypeArguments6220);
typeList();
state._fsp--;
if (state.failed) return;
match(input,56,FOLLOW_56_in_nonWildcardTypeArguments6222); if (state.failed) return;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 136, nonWildcardTypeArguments_StartIndex); }
}
} } | public class class_name {
public final void nonWildcardTypeArguments() throws RecognitionException {
int nonWildcardTypeArguments_StartIndex = input.index();
try {
if ( state.backtracking>0 && alreadyParsedRule(input, 136) ) { return; } // depends on control dependency: [if], data = [none]
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1275:5: ( '<' typeList '>' )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1275:7: '<' typeList '>'
{
match(input,53,FOLLOW_53_in_nonWildcardTypeArguments6218); if (state.failed) return;
pushFollow(FOLLOW_typeList_in_nonWildcardTypeArguments6220);
typeList();
state._fsp--;
if (state.failed) return;
match(input,56,FOLLOW_56_in_nonWildcardTypeArguments6222); if (state.failed) return;
}
}
catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
finally {
// do for sure before leaving
if ( state.backtracking>0 ) { memoize(input, 136, nonWildcardTypeArguments_StartIndex); } // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private HORIZONTAL_DIRECTION processHorizontalDirection(float[] output, float midRangeHigh, float midRangeLow) {
output[1] = (output[1] < 0)? 0.0f : output[1];
if (output[1] < midRangeLow) {
output[1] *= -1;
return HORIZONTAL_DIRECTION.RIGHT;
}
else if (output[1] > midRangeHigh) {
return HORIZONTAL_DIRECTION.LEFT;
}
else {
return HORIZONTAL_DIRECTION.NONE;
}
} } | public class class_name {
private HORIZONTAL_DIRECTION processHorizontalDirection(float[] output, float midRangeHigh, float midRangeLow) {
output[1] = (output[1] < 0)? 0.0f : output[1];
if (output[1] < midRangeLow) {
output[1] *= -1; // depends on control dependency: [if], data = [none]
return HORIZONTAL_DIRECTION.RIGHT; // depends on control dependency: [if], data = [none]
}
else if (output[1] > midRangeHigh) {
return HORIZONTAL_DIRECTION.LEFT; // depends on control dependency: [if], data = [none]
}
else {
return HORIZONTAL_DIRECTION.NONE; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void run() {
if(log.isDebugEnabled()) {
log.debug("ListenerThread Starting.");
}
while(running) {
try {
Socket clientSocket = serverSocket.accept();
WorkerThread worker = new WorkerThread(container, clientSocket);
worker.start();
} catch(SocketTimeoutException ste) {
// Ignore. We receive one of these every second, when the accept()
// method times out. This is done to give us the opportunity to break
// out of the blocking accept() call in order to shut down cleanly.
} catch(Exception e) {
if(log.isErrorEnabled()) {
log.error("Error Accepting: " + e.toString(), e);
}
}
}
try {
serverSocket.close();
} catch (IOException e) {
if(log.isErrorEnabled()) {
log.error("Error closing the server socket: " + e.toString(), e);
}
}
} } | public class class_name {
public void run() {
if(log.isDebugEnabled()) {
log.debug("ListenerThread Starting."); // depends on control dependency: [if], data = [none]
}
while(running) {
try {
Socket clientSocket = serverSocket.accept();
WorkerThread worker = new WorkerThread(container, clientSocket);
worker.start(); // depends on control dependency: [try], data = [none]
} catch(SocketTimeoutException ste) {
// Ignore. We receive one of these every second, when the accept()
// method times out. This is done to give us the opportunity to break
// out of the blocking accept() call in order to shut down cleanly.
} catch(Exception e) { // depends on control dependency: [catch], data = [none]
if(log.isErrorEnabled()) {
log.error("Error Accepting: " + e.toString(), e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
try {
serverSocket.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
if(log.isErrorEnabled()) {
log.error("Error closing the server socket: " + e.toString(), e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Observable<ComapiResult<List<Map<String, Object>>>> queryProfiles(@NonNull final String queryString) {
final String token = getToken();
if (sessionController.isCreatingSession()) {
return getTaskQueue().queueQueryProfiles(queryString);
} else if (TextUtils.isEmpty(token)) {
return Observable.error(getSessionStateErrorDescription());
} else {
return doQueryProfiles(token, queryString);
}
} } | public class class_name {
public Observable<ComapiResult<List<Map<String, Object>>>> queryProfiles(@NonNull final String queryString) {
final String token = getToken();
if (sessionController.isCreatingSession()) {
return getTaskQueue().queueQueryProfiles(queryString); // depends on control dependency: [if], data = [none]
} else if (TextUtils.isEmpty(token)) {
return Observable.error(getSessionStateErrorDescription()); // depends on control dependency: [if], data = [none]
} else {
return doQueryProfiles(token, queryString); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void loadContext(Context ctx) {
validateContextNotNull(ctx);
for (ContextDataFactory cdf : this.contextDataFactories) {
cdf.loadContextData(getSession(), ctx);
}
} } | public class class_name {
public void loadContext(Context ctx) {
validateContextNotNull(ctx);
for (ContextDataFactory cdf : this.contextDataFactories) {
cdf.loadContextData(getSession(), ctx);
// depends on control dependency: [for], data = [cdf]
}
} } |
public class class_name {
public Integer getNetworkPrefixLength() {
if(isAddress()) {
return parsedHost.asAddress().getNetworkPrefixLength();
} else if(isAddressString()) {
return parsedHost.asGenericAddressString().getNetworkPrefixLength();
}
return isValid() ? parsedHost.getNetworkPrefixLength() : null;
} } | public class class_name {
public Integer getNetworkPrefixLength() {
if(isAddress()) {
return parsedHost.asAddress().getNetworkPrefixLength(); // depends on control dependency: [if], data = [none]
} else if(isAddressString()) {
return parsedHost.asGenericAddressString().getNetworkPrefixLength(); // depends on control dependency: [if], data = [none]
}
return isValid() ? parsedHost.getNetworkPrefixLength() : null;
} } |
public class class_name {
public void setBusy(String message) {
busyMessage = message = StrUtil.formatMessage(message);
if (busyDisabled) {
busyPending = true;
} else if (message != null) {
disableActions(true);
ClientUtil.busy(container, message);
busyPending = !isVisible();
} else {
disableActions(false);
ClientUtil.busy(container, null);
busyPending = false;
}
} } | public class class_name {
public void setBusy(String message) {
busyMessage = message = StrUtil.formatMessage(message);
if (busyDisabled) {
busyPending = true; // depends on control dependency: [if], data = [none]
} else if (message != null) {
disableActions(true); // depends on control dependency: [if], data = [none]
ClientUtil.busy(container, message); // depends on control dependency: [if], data = [none]
busyPending = !isVisible(); // depends on control dependency: [if], data = [none]
} else {
disableActions(false); // depends on control dependency: [if], data = [none]
ClientUtil.busy(container, null); // depends on control dependency: [if], data = [null)]
busyPending = false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void zero( DMatrixSparseCSC A , int row0, int row1, int col0, int col1 ) {
for (int col = col1-1; col >= col0; col--) {
int numRemoved = 0;
int idx0 = A.col_idx[col], idx1 = A.col_idx[col+1];
for (int i = idx0; i < idx1; i++) {
int row = A.nz_rows[i];
// if sorted a faster technique could be used
if( row >= row0 && row < row1 ) {
numRemoved++;
} else if( numRemoved > 0 ){
A.nz_rows[i-numRemoved]=row;
A.nz_values[i-numRemoved]=A.nz_values[i];
}
}
if( numRemoved > 0 ) {
// this could be done more intelligently. Each time a column is adjusted all the columns are adjusted
// after it. Maybe accumulate the changes in each column and do it in one pass? Need an array to store
// those results though
for (int i = idx1; i < A.nz_length; i++) {
A.nz_rows[i - numRemoved] = A.nz_rows[i];
A.nz_values[i - numRemoved] = A.nz_values[i];
}
A.nz_length -= numRemoved;
for (int i = col+1; i <= A.numCols; i++) {
A.col_idx[i] -= numRemoved;
}
}
}
} } | public class class_name {
public static void zero( DMatrixSparseCSC A , int row0, int row1, int col0, int col1 ) {
for (int col = col1-1; col >= col0; col--) {
int numRemoved = 0;
int idx0 = A.col_idx[col], idx1 = A.col_idx[col+1];
for (int i = idx0; i < idx1; i++) {
int row = A.nz_rows[i];
// if sorted a faster technique could be used
if( row >= row0 && row < row1 ) {
numRemoved++; // depends on control dependency: [if], data = [none]
} else if( numRemoved > 0 ){
A.nz_rows[i-numRemoved]=row; // depends on control dependency: [if], data = [none]
A.nz_values[i-numRemoved]=A.nz_values[i]; // depends on control dependency: [if], data = [none]
}
}
if( numRemoved > 0 ) {
// this could be done more intelligently. Each time a column is adjusted all the columns are adjusted
// after it. Maybe accumulate the changes in each column and do it in one pass? Need an array to store
// those results though
for (int i = idx1; i < A.nz_length; i++) {
A.nz_rows[i - numRemoved] = A.nz_rows[i]; // depends on control dependency: [for], data = [i]
A.nz_values[i - numRemoved] = A.nz_values[i]; // depends on control dependency: [for], data = [i]
}
A.nz_length -= numRemoved; // depends on control dependency: [if], data = [none]
for (int i = col+1; i <= A.numCols; i++) {
A.col_idx[i] -= numRemoved; // depends on control dependency: [for], data = [i]
}
}
}
} } |
public class class_name {
@Override
public void removeByCPDefinitionId(long CPDefinitionId) {
for (CPDefinitionLocalization cpDefinitionLocalization : findByCPDefinitionId(
CPDefinitionId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinitionLocalization);
}
} } | public class class_name {
@Override
public void removeByCPDefinitionId(long CPDefinitionId) {
for (CPDefinitionLocalization cpDefinitionLocalization : findByCPDefinitionId(
CPDefinitionId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(cpDefinitionLocalization); // depends on control dependency: [for], data = [cpDefinitionLocalization]
}
} } |
public class class_name {
private JPanel getJPanel1() {
if (jPanel1 == null) {
jLabel2 = new JLabel();
GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
jPanel1 = new JPanel();
jPanel1.setLayout(new GridBagLayout());
gridBagConstraints7.gridx = 1;
gridBagConstraints7.gridy = 0;
gridBagConstraints7.insets = new java.awt.Insets(5,5,5,5);
gridBagConstraints7.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints8.gridx = 2;
gridBagConstraints8.gridy = 0;
gridBagConstraints8.insets = new java.awt.Insets(5,5,5,5);
gridBagConstraints8.anchor = java.awt.GridBagConstraints.EAST;
jLabel2.setText(" ");
gridBagConstraints9.anchor = java.awt.GridBagConstraints.EAST;
gridBagConstraints9.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints9.insets = new java.awt.Insets(5,2,5,2);
gridBagConstraints9.weightx = 1.0D;
gridBagConstraints9.gridx = 0;
gridBagConstraints9.gridy = 0;
jPanel1.add(jLabel2, gridBagConstraints9);
jPanel1.add(getBtnOK(), gridBagConstraints7);
jPanel1.add(getBtnCancel(), gridBagConstraints8);
}
return jPanel1;
} } | public class class_name {
private JPanel getJPanel1() {
if (jPanel1 == null) {
jLabel2 = new JLabel();
// depends on control dependency: [if], data = [none]
GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
jPanel1 = new JPanel();
// depends on control dependency: [if], data = [none]
jPanel1.setLayout(new GridBagLayout());
// depends on control dependency: [if], data = [none]
gridBagConstraints7.gridx = 1;
// depends on control dependency: [if], data = [none]
gridBagConstraints7.gridy = 0;
// depends on control dependency: [if], data = [none]
gridBagConstraints7.insets = new java.awt.Insets(5,5,5,5);
// depends on control dependency: [if], data = [none]
gridBagConstraints7.anchor = java.awt.GridBagConstraints.EAST;
// depends on control dependency: [if], data = [none]
gridBagConstraints8.gridx = 2;
// depends on control dependency: [if], data = [none]
gridBagConstraints8.gridy = 0;
// depends on control dependency: [if], data = [none]
gridBagConstraints8.insets = new java.awt.Insets(5,5,5,5);
// depends on control dependency: [if], data = [none]
gridBagConstraints8.anchor = java.awt.GridBagConstraints.EAST;
// depends on control dependency: [if], data = [none]
jLabel2.setText(" ");
// depends on control dependency: [if], data = [none]
gridBagConstraints9.anchor = java.awt.GridBagConstraints.EAST;
// depends on control dependency: [if], data = [none]
gridBagConstraints9.fill = java.awt.GridBagConstraints.HORIZONTAL;
// depends on control dependency: [if], data = [none]
gridBagConstraints9.insets = new java.awt.Insets(5,2,5,2);
// depends on control dependency: [if], data = [none]
gridBagConstraints9.weightx = 1.0D;
// depends on control dependency: [if], data = [none]
gridBagConstraints9.gridx = 0;
// depends on control dependency: [if], data = [none]
gridBagConstraints9.gridy = 0;
// depends on control dependency: [if], data = [none]
jPanel1.add(jLabel2, gridBagConstraints9);
// depends on control dependency: [if], data = [none]
jPanel1.add(getBtnOK(), gridBagConstraints7);
// depends on control dependency: [if], data = [none]
jPanel1.add(getBtnCancel(), gridBagConstraints8);
// depends on control dependency: [if], data = [none]
}
return jPanel1;
} } |
public class class_name {
public PrivacyItem getItem(String listName, int order) {
// CHECKSTYLE:OFF
Iterator<PrivacyItem> values = getPrivacyList(listName).iterator();
PrivacyItem itemFound = null;
while (itemFound == null && values.hasNext()) {
PrivacyItem element = values.next();
if (element.getOrder() == order) {
itemFound = element;
}
}
return itemFound;
// CHECKSTYLE:ON
} } | public class class_name {
public PrivacyItem getItem(String listName, int order) {
// CHECKSTYLE:OFF
Iterator<PrivacyItem> values = getPrivacyList(listName).iterator();
PrivacyItem itemFound = null;
while (itemFound == null && values.hasNext()) {
PrivacyItem element = values.next();
if (element.getOrder() == order) {
itemFound = element; // depends on control dependency: [if], data = [none]
}
}
return itemFound;
// CHECKSTYLE:ON
} } |
public class class_name {
public static String strFromUnicodeByteArray(byte[] ba, int len) {
if (ba == null) {
return "";
}
byte[] newBa = new byte[len];
for (int i = 0; i < len; i++)
newBa[i] = ba[i];
StringBuffer sb = new StringBuffer();
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(
newBa));
while (true) {
try {
char c = dis.readChar();
sb.append(c);
} catch (Exception e) {
break;
}
}
return sb.toString();
} } | public class class_name {
public static String strFromUnicodeByteArray(byte[] ba, int len) {
if (ba == null) {
return ""; // depends on control dependency: [if], data = [none]
}
byte[] newBa = new byte[len];
for (int i = 0; i < len; i++)
newBa[i] = ba[i];
StringBuffer sb = new StringBuffer();
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(
newBa));
while (true) {
try {
char c = dis.readChar();
sb.append(c); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
break;
} // depends on control dependency: [catch], data = [none]
}
return sb.toString();
} } |
public class class_name {
private void signalNotFull() {
final ReentrantLock putLock = this.putLock;
putLock.lock();
try {
notFull.signal();
} finally {
putLock.unlock();
}
} } | public class class_name {
private void signalNotFull() {
final ReentrantLock putLock = this.putLock;
putLock.lock();
try {
notFull.signal(); // depends on control dependency: [try], data = [none]
} finally {
putLock.unlock();
}
} } |
public class class_name {
public static CWSEvaluator.Result evaluate(Segment segment, String outputPath, String goldFile, String dictPath) throws IOException
{
IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(goldFile);
BufferedWriter bw = IOUtil.newBufferedWriter(outputPath);
for (String line : lineIterator)
{
List<Term> termList = segment.seg(line.replaceAll("\\s+", "")); // 一些testFile与goldFile根本不匹配,比如MSR的testFile有些行缺少单词,所以用goldFile去掉空格代替
int i = 0;
for (Term term : termList)
{
bw.write(term.word);
if (++i != termList.size())
bw.write(" ");
}
bw.newLine();
}
bw.close();
CWSEvaluator.Result result = CWSEvaluator.evaluate(goldFile, outputPath, dictPath);
return result;
} } | public class class_name {
public static CWSEvaluator.Result evaluate(Segment segment, String outputPath, String goldFile, String dictPath) throws IOException
{
IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(goldFile);
BufferedWriter bw = IOUtil.newBufferedWriter(outputPath);
for (String line : lineIterator)
{
List<Term> termList = segment.seg(line.replaceAll("\\s+", "")); // 一些testFile与goldFile根本不匹配,比如MSR的testFile有些行缺少单词,所以用goldFile去掉空格代替
int i = 0;
for (Term term : termList)
{
bw.write(term.word); // depends on control dependency: [for], data = [term]
if (++i != termList.size())
bw.write(" ");
}
bw.newLine();
}
bw.close();
CWSEvaluator.Result result = CWSEvaluator.evaluate(goldFile, outputPath, dictPath);
return result;
} } |
public class class_name {
@Override
public boolean contains(IVersion version)
{
for (IVersionRange range : ranges) {
if (range.contains(version)) {
return true;
}
}
return false;
} } | public class class_name {
@Override
public boolean contains(IVersion version)
{
for (IVersionRange range : ranges) {
if (range.contains(version)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public static <T> Iterable<T> depthFirst(TreeDef<T> treeDef, T node) {
return () -> new Iterator<T>() {
Deque<T> queue = new ArrayDeque<>(Arrays.asList(node));
@Override
public boolean hasNext() {
return !queue.isEmpty();
}
@Override
public T next() {
if (queue.isEmpty()) {
throw new NoSuchElementException();
}
T next = queue.removeLast();
List<T> children = treeDef.childrenOf(next);
ListIterator<T> iterator = children.listIterator(children.size());
while (iterator.hasPrevious()) {
queue.addLast(iterator.previous());
}
return next;
}
};
} } | public class class_name {
public static <T> Iterable<T> depthFirst(TreeDef<T> treeDef, T node) {
return () -> new Iterator<T>() {
Deque<T> queue = new ArrayDeque<>(Arrays.asList(node));
@Override
public boolean hasNext() {
return !queue.isEmpty();
}
@Override
public T next() {
if (queue.isEmpty()) {
throw new NoSuchElementException();
}
T next = queue.removeLast();
List<T> children = treeDef.childrenOf(next);
ListIterator<T> iterator = children.listIterator(children.size());
while (iterator.hasPrevious()) {
queue.addLast(iterator.previous()); // depends on control dependency: [while], data = [none]
}
return next;
}
};
} } |
public class class_name {
public void invokeOperator(PdfLiteral operator, ArrayList operands) {
ContentOperator op = operators.get(operator.toString());
if (op == null) {
// skipping unssupported operator
return;
}
op.invoke(this, operator, operands);
} } | public class class_name {
public void invokeOperator(PdfLiteral operator, ArrayList operands) {
ContentOperator op = operators.get(operator.toString());
if (op == null) {
// skipping unssupported operator
return;
// depends on control dependency: [if], data = [none]
}
op.invoke(this, operator, operands);
} } |
public class class_name {
public static URI convertUriWithoutSchemeToFileScheme(URI uri) {
if (uri.getScheme() == null) {
return Paths.get(uri.getPath()).toUri();
}
return uri;
} } | public class class_name {
public static URI convertUriWithoutSchemeToFileScheme(URI uri) {
if (uri.getScheme() == null) {
return Paths.get(uri.getPath()).toUri(); // depends on control dependency: [if], data = [none]
}
return uri;
} } |
public class class_name {
@ApiModelProperty(value = "Categories of services registered. Not used at the moment")
public List<String> getCategories() {
Set<String> keySet = this.services.keySet();
Iterator<String> it = keySet.iterator();
List<String> categories = new ArrayList<String>();
DescribeService service;
while (it.hasNext()) {
service = this.services.get(it.next());
for (String category : service.getCategories()) {
if (!categories.contains(category)) {
categories.add(category);
}
}
}
return categories;
} } | public class class_name {
@ApiModelProperty(value = "Categories of services registered. Not used at the moment")
public List<String> getCategories() {
Set<String> keySet = this.services.keySet();
Iterator<String> it = keySet.iterator();
List<String> categories = new ArrayList<String>();
DescribeService service;
while (it.hasNext()) {
service = this.services.get(it.next()); // depends on control dependency: [while], data = [none]
for (String category : service.getCategories()) {
if (!categories.contains(category)) {
categories.add(category); // depends on control dependency: [if], data = [none]
}
}
}
return categories;
} } |
public class class_name {
@Override
public synchronized void remove(URI jobURI) {
Preconditions.checkState(state() == State.RUNNING, String.format("%s is not running.", this.getClass().getName()));
try {
long startTime = System.currentTimeMillis();
JobSpec jobSpec = getJobSpec(jobURI);
Path jobSpecPath = getPathForURI(this.jobConfDirPath, jobURI);
if (fs.exists(jobSpecPath)) {
fs.delete(jobSpecPath, false);
this.mutableMetrics.updateRemoveJobTime(startTime);
this.listeners.onDeleteJob(jobURI, jobSpec.getVersion());
} else {
LOGGER.warn("No file with URI:" + jobSpecPath + " is found. Deletion failed.");
}
} catch (IOException e) {
throw new RuntimeException("When removing a JobConf. file, issues unexpected happen:" + e.getMessage());
} catch (SpecNotFoundException e) {
LOGGER.warn("No file with URI:" + jobURI + " is found. Deletion failed.");
}
} } | public class class_name {
@Override
public synchronized void remove(URI jobURI) {
Preconditions.checkState(state() == State.RUNNING, String.format("%s is not running.", this.getClass().getName()));
try {
long startTime = System.currentTimeMillis();
JobSpec jobSpec = getJobSpec(jobURI);
Path jobSpecPath = getPathForURI(this.jobConfDirPath, jobURI);
if (fs.exists(jobSpecPath)) {
fs.delete(jobSpecPath, false); // depends on control dependency: [if], data = [none]
this.mutableMetrics.updateRemoveJobTime(startTime); // depends on control dependency: [if], data = [none]
this.listeners.onDeleteJob(jobURI, jobSpec.getVersion()); // depends on control dependency: [if], data = [none]
} else {
LOGGER.warn("No file with URI:" + jobSpecPath + " is found. Deletion failed."); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
throw new RuntimeException("When removing a JobConf. file, issues unexpected happen:" + e.getMessage());
} catch (SpecNotFoundException e) { // depends on control dependency: [catch], data = [none]
LOGGER.warn("No file with URI:" + jobURI + " is found. Deletion failed.");
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(GetMaintenanceWindowExecutionRequest getMaintenanceWindowExecutionRequest, ProtocolMarshaller protocolMarshaller) {
if (getMaintenanceWindowExecutionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getMaintenanceWindowExecutionRequest.getWindowExecutionId(), WINDOWEXECUTIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetMaintenanceWindowExecutionRequest getMaintenanceWindowExecutionRequest, ProtocolMarshaller protocolMarshaller) {
if (getMaintenanceWindowExecutionRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getMaintenanceWindowExecutionRequest.getWindowExecutionId(), WINDOWEXECUTIONID_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 static void logErrors(J2EEName j2eeName,
List<String> errors)
throws EJBConfigurationException
{
if (errors.size() > 0)
{
String heading = "Merged EJB DD Validation results for " + j2eeName;
// Log to SystemOut.log only if the property is enabled. d680497.1
if (ValidateMergedXML)
{
System.out.println(heading);
for (String error : errors) {
System.out.println(error);
}
}
else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, heading);
for (String error : errors) {
Tr.debug(tc, error);
}
}
// Errors will be in Systemout.log if this property is enabled
if (ValidateMergedXMLFail)
{
throw new EJBConfigurationException("Merged EJB DD for " + j2eeName +
" is not correct. See SystemOut.log for details.");
}
}
} } | public class class_name {
private static void logErrors(J2EEName j2eeName,
List<String> errors)
throws EJBConfigurationException
{
if (errors.size() > 0)
{
String heading = "Merged EJB DD Validation results for " + j2eeName;
// Log to SystemOut.log only if the property is enabled. d680497.1
if (ValidateMergedXML)
{
System.out.println(heading);
for (String error : errors) {
System.out.println(error); // depends on control dependency: [for], data = [error]
}
}
else if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{
Tr.debug(tc, heading);
for (String error : errors) {
Tr.debug(tc, error); // depends on control dependency: [for], data = [error]
}
}
// Errors will be in Systemout.log if this property is enabled
if (ValidateMergedXMLFail)
{
throw new EJBConfigurationException("Merged EJB DD for " + j2eeName +
" is not correct. See SystemOut.log for details.");
}
}
} } |
public class class_name {
private boolean isEmptyImplementation(MethodGen methodGen){
boolean invokeInst = false;
boolean loadField = false;
for (Iterator itIns = methodGen.getInstructionList().iterator();itIns.hasNext();) {
Instruction inst = ((InstructionHandle) itIns.next()).getInstruction();
if (DEBUG)
System.out.println(inst.toString(true));
if (inst instanceof InvokeInstruction) {
invokeInst = true;
}
if (inst instanceof GETFIELD) {
loadField = true;
}
}
return !invokeInst && !loadField;
} } | public class class_name {
private boolean isEmptyImplementation(MethodGen methodGen){
boolean invokeInst = false;
boolean loadField = false;
for (Iterator itIns = methodGen.getInstructionList().iterator();itIns.hasNext();) {
Instruction inst = ((InstructionHandle) itIns.next()).getInstruction();
if (DEBUG)
System.out.println(inst.toString(true));
if (inst instanceof InvokeInstruction) {
invokeInst = true; // depends on control dependency: [if], data = [none]
}
if (inst instanceof GETFIELD) {
loadField = true; // depends on control dependency: [if], data = [none]
}
}
return !invokeInst && !loadField;
} } |
public class class_name {
public EClass getIfcVertex() {
if (ifcVertexEClass == null) {
ifcVertexEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(633);
}
return ifcVertexEClass;
} } | public class class_name {
public EClass getIfcVertex() {
if (ifcVertexEClass == null) {
ifcVertexEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(633);
// depends on control dependency: [if], data = [none]
}
return ifcVertexEClass;
} } |
public class class_name {
private void setBar(final double VALUE) {
barCtx.clearRect(0, 0, size, size);
barCtx.setLineCap(StrokeLineCap.BUTT);
barCtx.setStroke(barColor);
barCtx.setLineWidth(barWidth);
if (sectionsVisible) {
int listSize = sections.size();
for (int i = 0 ; i < listSize ;i++) {
Section section = sections.get(i);
if (section.contains(VALUE)) {
barCtx.setStroke(section.getColor());
break;
}
}
}
if (thresholdVisible && VALUE > gauge.getThreshold()) {
barCtx.setStroke(thresholdColor);
}
double v = (VALUE - minValue) * angleStep;
int minValueAngle = (int) (-minValue * angleStep);
if (!isStartFromZero) {
for (int i = 0; i < 280; i++) {
if (i % 10 == 0 && i < v) {
barCtx.strokeArc(barWidth * 0.5 + barWidth * 0.1, barWidth * 0.5 + barWidth * 0.1, size - barWidth - barWidth * 0.2, size - barWidth - barWidth * 0.2, (-i - 139), 9.2, ArcType.OPEN);
}
}
} else {
if (Double.compare(VALUE, 0) != 0) {
if (VALUE < 0) {
for (int i = Math.min(minValueAngle, 280) - 1; i >= 0; i--) {
if (i % 10 == 0 && i > v - 10) {
barCtx.strokeArc(barWidth * 0.5 + barWidth * 0.1, barWidth * 0.5 + barWidth * 0.1, size - barWidth - barWidth * 0.2, size - barWidth - barWidth * 0.2, (-i - 139), 9.2, ArcType.OPEN);
}
}
} else {
for (int i = Math.max(minValueAngle, 0) - 5; i < 280; i++) {
if (i % 10 == 0 && i < v) {
barCtx.strokeArc(barWidth * 0.5 + barWidth * 0.1, barWidth * 0.5 + barWidth * 0.1, size - barWidth - barWidth * 0.2, size - barWidth - barWidth * 0.2, (-i - 139), 9.2, ArcType.OPEN);
}
}
}
}
}
valueText.setText(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), VALUE));
valueText.setLayoutX(valueBkgText.getLayoutBounds().getMaxX() - valueText.getLayoutBounds().getWidth());
} } | public class class_name {
private void setBar(final double VALUE) {
barCtx.clearRect(0, 0, size, size);
barCtx.setLineCap(StrokeLineCap.BUTT);
barCtx.setStroke(barColor);
barCtx.setLineWidth(barWidth);
if (sectionsVisible) {
int listSize = sections.size();
for (int i = 0 ; i < listSize ;i++) {
Section section = sections.get(i);
if (section.contains(VALUE)) {
barCtx.setStroke(section.getColor()); // depends on control dependency: [if], data = [none]
break;
}
}
}
if (thresholdVisible && VALUE > gauge.getThreshold()) {
barCtx.setStroke(thresholdColor); // depends on control dependency: [if], data = [none]
}
double v = (VALUE - minValue) * angleStep;
int minValueAngle = (int) (-minValue * angleStep);
if (!isStartFromZero) {
for (int i = 0; i < 280; i++) {
if (i % 10 == 0 && i < v) {
barCtx.strokeArc(barWidth * 0.5 + barWidth * 0.1, barWidth * 0.5 + barWidth * 0.1, size - barWidth - barWidth * 0.2, size - barWidth - barWidth * 0.2, (-i - 139), 9.2, ArcType.OPEN); // depends on control dependency: [if], data = [none]
}
}
} else {
if (Double.compare(VALUE, 0) != 0) {
if (VALUE < 0) {
for (int i = Math.min(minValueAngle, 280) - 1; i >= 0; i--) {
if (i % 10 == 0 && i > v - 10) {
barCtx.strokeArc(barWidth * 0.5 + barWidth * 0.1, barWidth * 0.5 + barWidth * 0.1, size - barWidth - barWidth * 0.2, size - barWidth - barWidth * 0.2, (-i - 139), 9.2, ArcType.OPEN); // depends on control dependency: [if], data = [none]
}
}
} else {
for (int i = Math.max(minValueAngle, 0) - 5; i < 280; i++) {
if (i % 10 == 0 && i < v) {
barCtx.strokeArc(barWidth * 0.5 + barWidth * 0.1, barWidth * 0.5 + barWidth * 0.1, size - barWidth - barWidth * 0.2, size - barWidth - barWidth * 0.2, (-i - 139), 9.2, ArcType.OPEN); // depends on control dependency: [if], data = [none]
}
}
}
}
}
valueText.setText(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), VALUE));
valueText.setLayoutX(valueBkgText.getLayoutBounds().getMaxX() - valueText.getLayoutBounds().getWidth());
} } |
public class class_name {
public void marshall(DeleteApnsVoipSandboxChannelRequest deleteApnsVoipSandboxChannelRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteApnsVoipSandboxChannelRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteApnsVoipSandboxChannelRequest.getApplicationId(), APPLICATIONID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteApnsVoipSandboxChannelRequest deleteApnsVoipSandboxChannelRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteApnsVoipSandboxChannelRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteApnsVoipSandboxChannelRequest.getApplicationId(), APPLICATIONID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public long getTotalSize() {
if (totalSize == HasTotalSize.NOT_DEPLETED && !hasNext()) {
totalSize = hasTotalSize == null ? HasTotalSize.NOT_DEPLETED : hasTotalSize.getTotalSize();
}
return totalSize;
} } | public class class_name {
@Override
public long getTotalSize() {
if (totalSize == HasTotalSize.NOT_DEPLETED && !hasNext()) {
totalSize = hasTotalSize == null ? HasTotalSize.NOT_DEPLETED : hasTotalSize.getTotalSize(); // depends on control dependency: [if], data = [none]
}
return totalSize;
} } |
public class class_name {
public void marshall(UpdateBuildRequest updateBuildRequest, ProtocolMarshaller protocolMarshaller) {
if (updateBuildRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateBuildRequest.getBuildId(), BUILDID_BINDING);
protocolMarshaller.marshall(updateBuildRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(updateBuildRequest.getVersion(), VERSION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateBuildRequest updateBuildRequest, ProtocolMarshaller protocolMarshaller) {
if (updateBuildRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateBuildRequest.getBuildId(), BUILDID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateBuildRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateBuildRequest.getVersion(), VERSION_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void startMetricReportingWithFileSuffix(State state, String metricsFileSuffix) {
Properties metricsReportingProps = new Properties();
metricsReportingProps.putAll(state.getProperties());
String oldMetricsFileSuffix =
state.getProp(ConfigurationKeys.METRICS_FILE_SUFFIX, ConfigurationKeys.DEFAULT_METRICS_FILE_SUFFIX);
if (Strings.isNullOrEmpty(oldMetricsFileSuffix)) {
oldMetricsFileSuffix = metricsFileSuffix;
} else {
oldMetricsFileSuffix += "." + metricsFileSuffix;
}
metricsReportingProps.setProperty(ConfigurationKeys.METRICS_FILE_SUFFIX, oldMetricsFileSuffix);
startMetricReporting(metricsReportingProps);
} } | public class class_name {
public void startMetricReportingWithFileSuffix(State state, String metricsFileSuffix) {
Properties metricsReportingProps = new Properties();
metricsReportingProps.putAll(state.getProperties());
String oldMetricsFileSuffix =
state.getProp(ConfigurationKeys.METRICS_FILE_SUFFIX, ConfigurationKeys.DEFAULT_METRICS_FILE_SUFFIX);
if (Strings.isNullOrEmpty(oldMetricsFileSuffix)) {
oldMetricsFileSuffix = metricsFileSuffix; // depends on control dependency: [if], data = [none]
} else {
oldMetricsFileSuffix += "." + metricsFileSuffix; // depends on control dependency: [if], data = [none]
}
metricsReportingProps.setProperty(ConfigurationKeys.METRICS_FILE_SUFFIX, oldMetricsFileSuffix);
startMetricReporting(metricsReportingProps);
} } |
public class class_name {
public NumberExpression<T> sum() {
if (sum == null) {
sum = Expressions.numberOperation(getType(), Ops.AggOps.SUM_AGG, mixin);
}
return sum;
} } | public class class_name {
public NumberExpression<T> sum() {
if (sum == null) {
sum = Expressions.numberOperation(getType(), Ops.AggOps.SUM_AGG, mixin); // depends on control dependency: [if], data = [none]
}
return sum;
} } |
public class class_name {
public static boolean isSequential(String group, String unit) {
try {
return UnitRouter.SINGLETON.newestDefinition(Unit.fullName(group, unit)).getInput().isSequential();
} catch (UnitUndefinedException e) {
throw new RuntimeException("Please call UnitJudge.defined() first.", e);
}
} } | public class class_name {
public static boolean isSequential(String group, String unit) {
try {
return UnitRouter.SINGLETON.newestDefinition(Unit.fullName(group, unit)).getInput().isSequential(); // depends on control dependency: [try], data = [none]
} catch (UnitUndefinedException e) {
throw new RuntimeException("Please call UnitJudge.defined() first.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public AspFactory createAspFactory(String aspName, String associationName, boolean isHeartBeatEnabled) throws Exception {
long aspid = 0L;
boolean regenerateFlag = true;
while (regenerateFlag) {
aspid = AspFactoryImpl.generateId();
if (aspfactories.size() == 0) {
// Special case where this is first Asp added
break;
}
for (FastList.Node<AspFactory> n = aspfactories.head(), end = aspfactories.tail(); (n = n.getNext()) != end;) {
AspFactoryImpl aspFactoryImpl = (AspFactoryImpl) n.getValue();
if (aspid == aspFactoryImpl.getAspid().getAspId()) {
regenerateFlag = true;
break;
} else {
regenerateFlag = false;
}
}// for
}// while
return this.createAspFactory(aspName, associationName, aspid, isHeartBeatEnabled);
} } | public class class_name {
public AspFactory createAspFactory(String aspName, String associationName, boolean isHeartBeatEnabled) throws Exception {
long aspid = 0L;
boolean regenerateFlag = true;
while (regenerateFlag) {
aspid = AspFactoryImpl.generateId();
if (aspfactories.size() == 0) {
// Special case where this is first Asp added
break;
}
for (FastList.Node<AspFactory> n = aspfactories.head(), end = aspfactories.tail(); (n = n.getNext()) != end;) {
AspFactoryImpl aspFactoryImpl = (AspFactoryImpl) n.getValue();
if (aspid == aspFactoryImpl.getAspid().getAspId()) {
regenerateFlag = true; // depends on control dependency: [if], data = [none]
break;
} else {
regenerateFlag = false; // depends on control dependency: [if], data = [none]
}
}// for
}// while
return this.createAspFactory(aspName, associationName, aspid, isHeartBeatEnabled);
} } |
public class class_name {
public void waitTillAllUpdatesExecuted() throws InterruptedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "waitTillAllUpdatesExecuted");
synchronized (this)
{
while (enqueuedUnits.size() > 0 || executing)
{
try
{
this.wait();
}
catch (InterruptedException e)
{
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "waitTillAllUpdatesExecuted", e);
throw e;
}
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "waitTillAllUpdatesExecuted");
} } | public class class_name {
public void waitTillAllUpdatesExecuted() throws InterruptedException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "waitTillAllUpdatesExecuted");
synchronized (this)
{
while (enqueuedUnits.size() > 0 || executing)
{
try
{
this.wait(); // depends on control dependency: [try], data = [none]
}
catch (InterruptedException e)
{
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "waitTillAllUpdatesExecuted", e);
throw e;
} // depends on control dependency: [catch], data = [none]
}
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "waitTillAllUpdatesExecuted");
} } |
public class class_name {
public Observable<ServiceResponseWithHeaders<CloudTask, TaskGetHeaders>> getWithServiceResponseAsync(String jobId, String taskId, TaskGetOptions taskGetOptions) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (jobId == null) {
throw new IllegalArgumentException("Parameter jobId is required and cannot be null.");
}
if (taskId == null) {
throw new IllegalArgumentException("Parameter taskId is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(taskGetOptions);
String select = null;
if (taskGetOptions != null) {
select = taskGetOptions.select();
}
String expand = null;
if (taskGetOptions != null) {
expand = taskGetOptions.expand();
}
Integer timeout = null;
if (taskGetOptions != null) {
timeout = taskGetOptions.timeout();
}
UUID clientRequestId = null;
if (taskGetOptions != null) {
clientRequestId = taskGetOptions.clientRequestId();
}
Boolean returnClientRequestId = null;
if (taskGetOptions != null) {
returnClientRequestId = taskGetOptions.returnClientRequestId();
}
DateTime ocpDate = null;
if (taskGetOptions != null) {
ocpDate = taskGetOptions.ocpDate();
}
String ifMatch = null;
if (taskGetOptions != null) {
ifMatch = taskGetOptions.ifMatch();
}
String ifNoneMatch = null;
if (taskGetOptions != null) {
ifNoneMatch = taskGetOptions.ifNoneMatch();
}
DateTime ifModifiedSince = null;
if (taskGetOptions != null) {
ifModifiedSince = taskGetOptions.ifModifiedSince();
}
DateTime ifUnmodifiedSince = null;
if (taskGetOptions != null) {
ifUnmodifiedSince = taskGetOptions.ifUnmodifiedSince();
}
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate);
}
DateTimeRfc1123 ifModifiedSinceConverted = null;
if (ifModifiedSince != null) {
ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince);
}
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
if (ifUnmodifiedSince != null) {
ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince);
}
return service.get(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), select, expand, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<CloudTask, TaskGetHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<CloudTask, TaskGetHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<CloudTask, TaskGetHeaders> clientResponse = getDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponseWithHeaders<CloudTask, TaskGetHeaders>> getWithServiceResponseAsync(String jobId, String taskId, TaskGetOptions taskGetOptions) {
if (this.client.batchUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.batchUrl() is required and cannot be null.");
}
if (jobId == null) {
throw new IllegalArgumentException("Parameter jobId is required and cannot be null.");
}
if (taskId == null) {
throw new IllegalArgumentException("Parameter taskId is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(taskGetOptions);
String select = null;
if (taskGetOptions != null) {
select = taskGetOptions.select(); // depends on control dependency: [if], data = [none]
}
String expand = null;
if (taskGetOptions != null) {
expand = taskGetOptions.expand(); // depends on control dependency: [if], data = [none]
}
Integer timeout = null;
if (taskGetOptions != null) {
timeout = taskGetOptions.timeout(); // depends on control dependency: [if], data = [none]
}
UUID clientRequestId = null;
if (taskGetOptions != null) {
clientRequestId = taskGetOptions.clientRequestId(); // depends on control dependency: [if], data = [none]
}
Boolean returnClientRequestId = null;
if (taskGetOptions != null) {
returnClientRequestId = taskGetOptions.returnClientRequestId(); // depends on control dependency: [if], data = [none]
}
DateTime ocpDate = null;
if (taskGetOptions != null) {
ocpDate = taskGetOptions.ocpDate(); // depends on control dependency: [if], data = [none]
}
String ifMatch = null;
if (taskGetOptions != null) {
ifMatch = taskGetOptions.ifMatch(); // depends on control dependency: [if], data = [none]
}
String ifNoneMatch = null;
if (taskGetOptions != null) {
ifNoneMatch = taskGetOptions.ifNoneMatch(); // depends on control dependency: [if], data = [none]
}
DateTime ifModifiedSince = null;
if (taskGetOptions != null) {
ifModifiedSince = taskGetOptions.ifModifiedSince(); // depends on control dependency: [if], data = [none]
}
DateTime ifUnmodifiedSince = null;
if (taskGetOptions != null) {
ifUnmodifiedSince = taskGetOptions.ifUnmodifiedSince(); // depends on control dependency: [if], data = [none]
}
String parameterizedHost = Joiner.on(", ").join("{batchUrl}", this.client.batchUrl());
DateTimeRfc1123 ocpDateConverted = null;
if (ocpDate != null) {
ocpDateConverted = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate]
}
DateTimeRfc1123 ifModifiedSinceConverted = null;
if (ifModifiedSince != null) {
ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); // depends on control dependency: [if], data = [(ifModifiedSince]
}
DateTimeRfc1123 ifUnmodifiedSinceConverted = null;
if (ifUnmodifiedSince != null) {
ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); // depends on control dependency: [if], data = [(ifUnmodifiedSince]
}
return service.get(jobId, taskId, this.client.apiVersion(), this.client.acceptLanguage(), select, expand, timeout, clientRequestId, returnClientRequestId, ocpDateConverted, ifMatch, ifNoneMatch, ifModifiedSinceConverted, ifUnmodifiedSinceConverted, parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<CloudTask, TaskGetHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<CloudTask, TaskGetHeaders>> call(Response<ResponseBody> response) {
try {
ServiceResponseWithHeaders<CloudTask, TaskGetHeaders> clientResponse = getDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public void marshall(CountPendingActivityTasksRequest countPendingActivityTasksRequest, ProtocolMarshaller protocolMarshaller) {
if (countPendingActivityTasksRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(countPendingActivityTasksRequest.getDomain(), DOMAIN_BINDING);
protocolMarshaller.marshall(countPendingActivityTasksRequest.getTaskList(), TASKLIST_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CountPendingActivityTasksRequest countPendingActivityTasksRequest, ProtocolMarshaller protocolMarshaller) {
if (countPendingActivityTasksRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(countPendingActivityTasksRequest.getDomain(), DOMAIN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(countPendingActivityTasksRequest.getTaskList(), TASKLIST_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 String getValues() {
//
String info = "";
//
for ( int i = 0; i < vsL.size(); i ++ ) {
//
info += vsL.get( i ) + "|";
}
//
return info;
} } | public class class_name {
public String getValues() {
//
String info = "";
//
for ( int i = 0; i < vsL.size(); i ++ ) {
//
info += vsL.get( i ) + "|"; // depends on control dependency: [for], data = [i]
}
//
return info;
} } |
public class class_name {
public void bind( final FilterBinding handler )
{
final Method method = handler.getMethod();
final String path = handler.getPath();
logger.info( "Using appId: {} and default version: {}", appAcceptId, defaultVersion );
List<String> versions = handler.getVersions();
if ( versions == null || versions.isEmpty() )
{
versions = Collections.singletonList( defaultVersion );
}
for ( final String version : versions )
{
final Set<Method> methods = new HashSet<>();
if ( method == Method.ANY )
{
for ( final Method m : Method.values() )
{
methods.add( m );
}
}
else
{
methods.add( method );
}
for ( final Method m : methods )
{
final BindingKey key = new BindingKey( m, version );
logger.info( "ADD: {}, Pattern: {}, Filter: {}\n", key, path, handler );
List<PatternFilterBinding> allFilterBindings = this.filterBindings.get( key );
if ( allFilterBindings == null )
{
allFilterBindings = new ArrayList<>();
this.filterBindings.put( key, allFilterBindings );
}
boolean found = false;
for ( final PatternFilterBinding binding : allFilterBindings )
{
if ( binding.getPattern()
.pattern()
.equals( handler.getPath() ) )
{
binding.addFilter( handler );
found = true;
break;
}
}
if ( !found )
{
final PatternFilterBinding binding = new PatternFilterBinding( handler.getPath(), handler );
allFilterBindings.add( binding );
}
}
}
} } | public class class_name {
public void bind( final FilterBinding handler )
{
final Method method = handler.getMethod();
final String path = handler.getPath();
logger.info( "Using appId: {} and default version: {}", appAcceptId, defaultVersion );
List<String> versions = handler.getVersions();
if ( versions == null || versions.isEmpty() )
{
versions = Collections.singletonList( defaultVersion ); // depends on control dependency: [if], data = [none]
}
for ( final String version : versions )
{
final Set<Method> methods = new HashSet<>();
if ( method == Method.ANY )
{
for ( final Method m : Method.values() )
{
methods.add( m ); // depends on control dependency: [for], data = [m]
}
}
else
{
methods.add( method ); // depends on control dependency: [if], data = [( method]
}
for ( final Method m : methods )
{
final BindingKey key = new BindingKey( m, version );
logger.info( "ADD: {}, Pattern: {}, Filter: {}\n", key, path, handler ); // depends on control dependency: [for], data = [none]
List<PatternFilterBinding> allFilterBindings = this.filterBindings.get( key );
if ( allFilterBindings == null )
{
allFilterBindings = new ArrayList<>(); // depends on control dependency: [if], data = [none]
this.filterBindings.put( key, allFilterBindings ); // depends on control dependency: [if], data = [none]
}
boolean found = false;
for ( final PatternFilterBinding binding : allFilterBindings )
{
if ( binding.getPattern()
.pattern()
.equals( handler.getPath() ) )
{
binding.addFilter( handler ); // depends on control dependency: [if], data = [none]
found = true; // depends on control dependency: [if], data = [none]
break;
}
}
if ( !found )
{
final PatternFilterBinding binding = new PatternFilterBinding( handler.getPath(), handler );
allFilterBindings.add( binding ); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public Collection<BoxGroupMembership.Info> getMemberships() {
final BoxAPIConnection api = this.getAPI();
final String groupID = this.getID();
Iterable<BoxGroupMembership.Info> iter = new Iterable<BoxGroupMembership.Info>() {
public Iterator<BoxGroupMembership.Info> iterator() {
URL url = MEMBERSHIPS_URL_TEMPLATE.build(api.getBaseURL(), groupID);
return new BoxGroupMembershipIterator(api, url);
}
};
// We need to iterate all results because this method must return a Collection. This logic should be removed in
// the next major version, and instead return the Iterable directly.
Collection<BoxGroupMembership.Info> memberships = new ArrayList<BoxGroupMembership.Info>();
for (BoxGroupMembership.Info membership : iter) {
memberships.add(membership);
}
return memberships;
} } | public class class_name {
public Collection<BoxGroupMembership.Info> getMemberships() {
final BoxAPIConnection api = this.getAPI();
final String groupID = this.getID();
Iterable<BoxGroupMembership.Info> iter = new Iterable<BoxGroupMembership.Info>() {
public Iterator<BoxGroupMembership.Info> iterator() {
URL url = MEMBERSHIPS_URL_TEMPLATE.build(api.getBaseURL(), groupID);
return new BoxGroupMembershipIterator(api, url);
}
};
// We need to iterate all results because this method must return a Collection. This logic should be removed in
// the next major version, and instead return the Iterable directly.
Collection<BoxGroupMembership.Info> memberships = new ArrayList<BoxGroupMembership.Info>();
for (BoxGroupMembership.Info membership : iter) {
memberships.add(membership); // depends on control dependency: [for], data = [membership]
}
return memberships;
} } |
public class class_name {
public void muteAudio(boolean mute) {
if ((null != localStream) && isActive()) {
for (MediaStreamTrack eachTrack : localStream.audioTracks) {
eachTrack.setEnabled(!mute);
}
}
} } | public class class_name {
public void muteAudio(boolean mute) {
if ((null != localStream) && isActive()) {
for (MediaStreamTrack eachTrack : localStream.audioTracks) {
eachTrack.setEnabled(!mute); // depends on control dependency: [for], data = [eachTrack]
}
}
} } |
public class class_name {
public void retrieveMatchingTopicAcls(
DestinationHandler topicSpace,
String discriminator,
JsMessage msg,
MessageProcessorSearchResults searchResults)
throws SIDiscriminatorSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"retrieveMatchingTopicAcls",
new Object[] { topicSpace, discriminator, msg, searchResults });
// Get the uuid for the topicspace
SIBUuid12 topicSpaceUuid = topicSpace.getBaseUuid();
String topicSpaceStr = topicSpaceUuid.toString();
// Combine the topicSpace and topic
String theTopic = buildSendTopicExpression(topicSpaceStr, discriminator);
// Check that the topic doesn't contain wildcards
try
{
_syntaxChecker.checkEventTopicSyntax(theTopic);
}
catch (InvalidTopicSyntaxException e)
{
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "retrieveMatchingTopicAcls", e);
SIMPDiscriminatorSyntaxException ee = new SIMPDiscriminatorSyntaxException(
nls.getFormattedMessage(
"INVALID_TOPIC_ERROR_CWSIP0372",
new Object[] { theTopic },
null));
ee.setExceptionReason(SIRCConstants.SIRC0901_INTERNAL_MESSAGING_ERROR);
ee.setExceptionInserts(new String[] {"com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
"1:2027:1.117.1.11",
SIMPUtils.getStackTrace(e)});
throw ee;
}
//Retrieve the set of wrapped consumer points from the matchspace
try
{
// Set up an evaluation cache (need to keep one of these per thread. Newing up is expensive)
EvalCache cache = _matching.createEvalCache();
// Set up Results object to hold the results from the MatchSpace traversal
searchResults.reset();
// Set a reference to the destination into the search results
// This is used to avoid ACL checks where a topicspace does not require access
// checks (e.g admin flag set, temporary topicspace, etc)
if(_isBusSecure)
{
searchResults.setTopicSpace(topicSpace);
}
search(theTopic, // keyed on destination name
(MatchSpaceKey) msg, cache, searchResults);
}
catch (BadMessageFormatMatchingException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching.retrieveMatchingTopicAcls",
"1:2059:1.117.1.11",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "retrieveMatchingTopicAcls", e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
"1:2070:1.117.1.11",
e });
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
"1:2078:1.117.1.11",
e },
null),
e);
}
catch (MatchingException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching.retrieveMatchingTopicAcls",
"1:2089:1.117.1.11",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "retrieveMatchingTopicAcls", "SIErrorException");
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
"1:2099:1.117.1.11",
e });
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
"1:2107:1.117.1.11",
e },
null),
e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "retrieveMatchingTopicAcls");
} } | public class class_name {
public void retrieveMatchingTopicAcls(
DestinationHandler topicSpace,
String discriminator,
JsMessage msg,
MessageProcessorSearchResults searchResults)
throws SIDiscriminatorSyntaxException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(
tc,
"retrieveMatchingTopicAcls",
new Object[] { topicSpace, discriminator, msg, searchResults });
// Get the uuid for the topicspace
SIBUuid12 topicSpaceUuid = topicSpace.getBaseUuid();
String topicSpaceStr = topicSpaceUuid.toString();
// Combine the topicSpace and topic
String theTopic = buildSendTopicExpression(topicSpaceStr, discriminator);
// Check that the topic doesn't contain wildcards
try
{
_syntaxChecker.checkEventTopicSyntax(theTopic); // depends on control dependency: [try], data = [none]
}
catch (InvalidTopicSyntaxException e)
{
// No FFDC code needed
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "retrieveMatchingTopicAcls", e);
SIMPDiscriminatorSyntaxException ee = new SIMPDiscriminatorSyntaxException(
nls.getFormattedMessage(
"INVALID_TOPIC_ERROR_CWSIP0372",
new Object[] { theTopic },
null));
ee.setExceptionReason(SIRCConstants.SIRC0901_INTERNAL_MESSAGING_ERROR);
ee.setExceptionInserts(new String[] {"com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
"1:2027:1.117.1.11",
SIMPUtils.getStackTrace(e)});
throw ee;
} // depends on control dependency: [catch], data = [none]
//Retrieve the set of wrapped consumer points from the matchspace
try
{
// Set up an evaluation cache (need to keep one of these per thread. Newing up is expensive)
EvalCache cache = _matching.createEvalCache();
// Set up Results object to hold the results from the MatchSpace traversal
searchResults.reset(); // depends on control dependency: [try], data = [none]
// Set a reference to the destination into the search results
// This is used to avoid ACL checks where a topicspace does not require access
// checks (e.g admin flag set, temporary topicspace, etc)
if(_isBusSecure)
{
searchResults.setTopicSpace(topicSpace); // depends on control dependency: [if], data = [none]
}
search(theTopic, // keyed on destination name
(MatchSpaceKey) msg, cache, searchResults); // depends on control dependency: [try], data = [none]
}
catch (BadMessageFormatMatchingException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching.retrieveMatchingTopicAcls",
"1:2059:1.117.1.11",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "retrieveMatchingTopicAcls", e);
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
"1:2070:1.117.1.11",
e });
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
"1:2078:1.117.1.11",
e },
null),
e);
} // depends on control dependency: [catch], data = [none]
catch (MatchingException e)
{
// FFDC
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching.retrieveMatchingTopicAcls",
"1:2089:1.117.1.11",
this);
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "retrieveMatchingTopicAcls", "SIErrorException");
SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
"1:2099:1.117.1.11",
e });
throw new SIErrorException(
nls.getFormattedMessage(
"INTERNAL_MESSAGING_ERROR_CWSIP0002",
new Object[] {
"com.ibm.ws.sib.processor.matching.MessageProcessorMatching",
"1:2107:1.117.1.11",
e },
null),
e);
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "retrieveMatchingTopicAcls");
} } |
public class class_name {
public void setHlsManifests(java.util.Collection<HlsManifest> hlsManifests) {
if (hlsManifests == null) {
this.hlsManifests = null;
return;
}
this.hlsManifests = new java.util.ArrayList<HlsManifest>(hlsManifests);
} } | public class class_name {
public void setHlsManifests(java.util.Collection<HlsManifest> hlsManifests) {
if (hlsManifests == null) {
this.hlsManifests = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.hlsManifests = new java.util.ArrayList<HlsManifest>(hlsManifests);
} } |
public class class_name {
static void transformMappedBys(EntityType entityType, Map<String, Attribute> newAttributes) {
if (newAttributes.isEmpty()) {
return;
}
stream(entityType.getAtomicAttributes())
.filter(Attribute::isMappedBy)
.forEach(attr -> transformMappedBy(attr, newAttributes));
} } | public class class_name {
static void transformMappedBys(EntityType entityType, Map<String, Attribute> newAttributes) {
if (newAttributes.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
stream(entityType.getAtomicAttributes())
.filter(Attribute::isMappedBy)
.forEach(attr -> transformMappedBy(attr, newAttributes));
} } |
public class class_name {
@Override
public Cells transformElement(Tuple2<Object, LinkedMapWritable> tuple,
DeepJobConfig<Cells, ? extends DeepJobConfig> config) {
try {
return UtilES.getCellFromJson(tuple._2(), deepJobConfig.getNameSpace());
} catch (Exception e) {
LOG.error("Cannot convert JSON: ", e);
throw new DeepTransformException("Could not transform from Json to Cell " + e.getMessage());
}
} } | public class class_name {
@Override
public Cells transformElement(Tuple2<Object, LinkedMapWritable> tuple,
DeepJobConfig<Cells, ? extends DeepJobConfig> config) {
try {
return UtilES.getCellFromJson(tuple._2(), deepJobConfig.getNameSpace()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error("Cannot convert JSON: ", e);
throw new DeepTransformException("Could not transform from Json to Cell " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Rectangle getBarcodeSize() {
float fontX = 0;
float fontY = 0;
String text = code;
if (generateChecksum && checksumText)
text = calculateChecksum(code);
if (!startStopText)
text = text.substring(1, text.length() - 1);
if (font != null) {
if (baseline > 0)
fontY = baseline - font.getFontDescriptor(BaseFont.DESCENT, size);
else
fontY = -baseline + size;
fontX = font.getWidthPoint(altText != null ? altText : text, size);
}
text = code;
if (generateChecksum)
text = calculateChecksum(code);
byte bars[] = getBarsCodabar(text);
int wide = 0;
for (int k = 0; k < bars.length; ++k) {
wide += bars[k];
}
int narrow = bars.length - wide;
float fullWidth = x * (narrow + wide * n);
fullWidth = Math.max(fullWidth, fontX);
float fullHeight = barHeight + fontY;
return new Rectangle(fullWidth, fullHeight);
} } | public class class_name {
public Rectangle getBarcodeSize() {
float fontX = 0;
float fontY = 0;
String text = code;
if (generateChecksum && checksumText)
text = calculateChecksum(code);
if (!startStopText)
text = text.substring(1, text.length() - 1);
if (font != null) {
if (baseline > 0)
fontY = baseline - font.getFontDescriptor(BaseFont.DESCENT, size);
else
fontY = -baseline + size;
fontX = font.getWidthPoint(altText != null ? altText : text, size); // depends on control dependency: [if], data = [none]
}
text = code;
if (generateChecksum)
text = calculateChecksum(code);
byte bars[] = getBarsCodabar(text);
int wide = 0;
for (int k = 0; k < bars.length; ++k) {
wide += bars[k]; // depends on control dependency: [for], data = [k]
}
int narrow = bars.length - wide;
float fullWidth = x * (narrow + wide * n);
fullWidth = Math.max(fullWidth, fontX);
float fullHeight = barHeight + fontY;
return new Rectangle(fullWidth, fullHeight);
} } |
public class class_name {
public void marshall(CreateReplicationSubnetGroupRequest createReplicationSubnetGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (createReplicationSubnetGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createReplicationSubnetGroupRequest.getReplicationSubnetGroupIdentifier(), REPLICATIONSUBNETGROUPIDENTIFIER_BINDING);
protocolMarshaller.marshall(createReplicationSubnetGroupRequest.getReplicationSubnetGroupDescription(), REPLICATIONSUBNETGROUPDESCRIPTION_BINDING);
protocolMarshaller.marshall(createReplicationSubnetGroupRequest.getSubnetIds(), SUBNETIDS_BINDING);
protocolMarshaller.marshall(createReplicationSubnetGroupRequest.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateReplicationSubnetGroupRequest createReplicationSubnetGroupRequest, ProtocolMarshaller protocolMarshaller) {
if (createReplicationSubnetGroupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createReplicationSubnetGroupRequest.getReplicationSubnetGroupIdentifier(), REPLICATIONSUBNETGROUPIDENTIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createReplicationSubnetGroupRequest.getReplicationSubnetGroupDescription(), REPLICATIONSUBNETGROUPDESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createReplicationSubnetGroupRequest.getSubnetIds(), SUBNETIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createReplicationSubnetGroupRequest.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static long start(Range<Long> range) {
if (range.lowerBoundType() == BoundType.OPEN) {
return DiscreteDomain.longs().next(range.lowerEndpoint());
} else {
return range.lowerEndpoint();
}
} } | public class class_name {
private static long start(Range<Long> range) {
if (range.lowerBoundType() == BoundType.OPEN) {
return DiscreteDomain.longs().next(range.lowerEndpoint()); // depends on control dependency: [if], data = [none]
} else {
return range.lowerEndpoint(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String getHadoopUser() {
try {
Class<?> ugiClass = Class.forName(
"org.apache.hadoop.security.UserGroupInformation",
false,
EnvironmentInformation.class.getClassLoader());
Method currentUserMethod = ugiClass.getMethod("getCurrentUser");
Method shortUserNameMethod = ugiClass.getMethod("getShortUserName");
Object ugi = currentUserMethod.invoke(null);
return (String) shortUserNameMethod.invoke(ugi);
}
catch (ClassNotFoundException e) {
return "<no hadoop dependency found>";
}
catch (LinkageError e) {
// hadoop classes are not in the classpath
LOG.debug("Cannot determine user/group information using Hadoop utils. " +
"Hadoop classes not loaded or compatible", e);
}
catch (Throwable t) {
// some other error occurred that we should log and make known
LOG.warn("Error while accessing user/group information via Hadoop utils.", t);
}
return UNKNOWN;
} } | public class class_name {
public static String getHadoopUser() {
try {
Class<?> ugiClass = Class.forName(
"org.apache.hadoop.security.UserGroupInformation",
false,
EnvironmentInformation.class.getClassLoader());
Method currentUserMethod = ugiClass.getMethod("getCurrentUser");
Method shortUserNameMethod = ugiClass.getMethod("getShortUserName");
Object ugi = currentUserMethod.invoke(null); // depends on control dependency: [try], data = [none]
return (String) shortUserNameMethod.invoke(ugi); // depends on control dependency: [try], data = [none]
}
catch (ClassNotFoundException e) {
return "<no hadoop dependency found>";
} // depends on control dependency: [catch], data = [none]
catch (LinkageError e) {
// hadoop classes are not in the classpath
LOG.debug("Cannot determine user/group information using Hadoop utils. " +
"Hadoop classes not loaded or compatible", e);
} // depends on control dependency: [catch], data = [none]
catch (Throwable t) {
// some other error occurred that we should log and make known
LOG.warn("Error while accessing user/group information via Hadoop utils.", t);
} // depends on control dependency: [catch], data = [none]
return UNKNOWN;
} } |
public class class_name {
public Token get(Object key,
Transaction transaction)
throws ObjectManagerException
{
try {
for (Iterator iterator = entrySet().iterator();;) {
Entry entry = (Entry) iterator.next(transaction);
Object entryKey = entry.getKey();
if (key == entryKey || key.equals(entryKey)) {
return entry.getValue();
}
}
} catch (java.util.NoSuchElementException exception) {
// No FFDC code needed, just exited search.
return null;
} // try.
} } | public class class_name {
public Token get(Object key,
Transaction transaction)
throws ObjectManagerException
{
try {
for (Iterator iterator = entrySet().iterator();;) {
Entry entry = (Entry) iterator.next(transaction);
Object entryKey = entry.getKey();
if (key == entryKey || key.equals(entryKey)) {
return entry.getValue(); // depends on control dependency: [if], data = [none]
}
}
} catch (java.util.NoSuchElementException exception) {
// No FFDC code needed, just exited search.
return null;
} // try.
} } |
public class class_name {
public void setCostParameters(CostParameters newCostParameters) {
if (newCostParameters != costParameters) {
NotificationChain msgs = null;
if (costParameters != null)
msgs = ((InternalEObject)costParameters).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - BpsimPackage.ELEMENT_PARAMETERS__COST_PARAMETERS, null, msgs);
if (newCostParameters != null)
msgs = ((InternalEObject)newCostParameters).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - BpsimPackage.ELEMENT_PARAMETERS__COST_PARAMETERS, null, msgs);
msgs = basicSetCostParameters(newCostParameters, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BpsimPackage.ELEMENT_PARAMETERS__COST_PARAMETERS, newCostParameters, newCostParameters));
} } | public class class_name {
public void setCostParameters(CostParameters newCostParameters) {
if (newCostParameters != costParameters) {
NotificationChain msgs = null;
if (costParameters != null)
msgs = ((InternalEObject)costParameters).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - BpsimPackage.ELEMENT_PARAMETERS__COST_PARAMETERS, null, msgs);
if (newCostParameters != null)
msgs = ((InternalEObject)newCostParameters).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - BpsimPackage.ELEMENT_PARAMETERS__COST_PARAMETERS, null, msgs);
msgs = basicSetCostParameters(newCostParameters, msgs); // depends on control dependency: [if], data = [(newCostParameters]
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, BpsimPackage.ELEMENT_PARAMETERS__COST_PARAMETERS, newCostParameters, newCostParameters));
} } |
public class class_name {
public void removeLoggerEventListener(final LoggerEventListener listener) {
synchronized (loggerEventListeners) {
HierarchyEventListenerProxy proxy =
(HierarchyEventListenerProxy) loggerEventListeners.get(listener);
if (proxy == null) {
LogLog.warn(
"Ignoring attempt to remove a non-registered LoggerEventListener.");
} else {
loggerEventListeners.remove(listener);
proxy.disable();
}
}
} } | public class class_name {
public void removeLoggerEventListener(final LoggerEventListener listener) {
synchronized (loggerEventListeners) {
HierarchyEventListenerProxy proxy =
(HierarchyEventListenerProxy) loggerEventListeners.get(listener);
if (proxy == null) {
LogLog.warn(
"Ignoring attempt to remove a non-registered LoggerEventListener."); // depends on control dependency: [if], data = [none]
} else {
loggerEventListeners.remove(listener); // depends on control dependency: [if], data = [none]
proxy.disable(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void createReadCaches() {
recalculateSizeReadCaches();
if (log.isDebugEnabled()) {
log.debug(this.getClass().getName() + "::createReadCaches readCacheInternal=" + readCacheInternal
+ " readCacheLeaf=" + readCacheLeaf);
}
cacheInternalNodes = createCacheLRUlinked(readCacheInternal);
cacheLeafNodes = createCacheLRUlinked(readCacheLeaf);
} } | public class class_name {
private void createReadCaches() {
recalculateSizeReadCaches();
if (log.isDebugEnabled()) {
log.debug(this.getClass().getName() + "::createReadCaches readCacheInternal=" + readCacheInternal
+ " readCacheLeaf=" + readCacheLeaf); // depends on control dependency: [if], data = [none]
}
cacheInternalNodes = createCacheLRUlinked(readCacheInternal);
cacheLeafNodes = createCacheLRUlinked(readCacheLeaf);
} } |
public class class_name {
public IPromise ordered(Function<T, IPromise> toCall) {
final IPromise result = toCall.apply((T) actors[index]);
index++;
if (index==actors.length)
index = 0;
if ( prev == null ) {
prev = new Promise();
result.then(prev);
return prev;
} else {
Promise p = new Promise();
prev.getNext().finallyDo((res, err) -> result.then((res1, err1) -> p.complete(res1, err1)));
prev = p;
return p;
}
} } | public class class_name {
public IPromise ordered(Function<T, IPromise> toCall) {
final IPromise result = toCall.apply((T) actors[index]);
index++;
if (index==actors.length)
index = 0;
if ( prev == null ) {
prev = new Promise(); // depends on control dependency: [if], data = [none]
result.then(prev); // depends on control dependency: [if], data = [none]
return prev; // depends on control dependency: [if], data = [none]
} else {
Promise p = new Promise();
prev.getNext().finallyDo((res, err) -> result.then((res1, err1) -> p.complete(res1, err1))); // depends on control dependency: [if], data = [none]
prev = p; // depends on control dependency: [if], data = [none]
return p; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static ServerRequest getExtendedServerRequest(String requestPath, JSONObject post, Context context) {
ServerRequest extendedReq = null;
if (requestPath.equalsIgnoreCase(Defines.RequestPath.CompletedAction.getPath())) {
extendedReq = new ServerRequestActionCompleted(requestPath, post, context);
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.GetURL.getPath())) {
extendedReq = new ServerRequestCreateUrl(requestPath, post, context);
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.GetCreditHistory.getPath())) {
extendedReq = new ServerRequestGetRewardHistory(requestPath, post, context);
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.GetCredits.getPath())) {
extendedReq = new ServerRequestGetRewards(requestPath, post, context);
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.IdentifyUser.getPath())) {
extendedReq = new ServerRequestIdentifyUserRequest(requestPath, post, context);
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.Logout.getPath())) {
extendedReq = new ServerRequestLogout(requestPath, post, context);
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.RedeemRewards.getPath())) {
extendedReq = new ServerRequestRedeemRewards(requestPath, post, context);
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.RegisterClose.getPath())) {
extendedReq = new ServerRequestRegisterClose(requestPath, post, context);
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.RegisterInstall.getPath())) {
extendedReq = new ServerRequestRegisterInstall(requestPath, post, context);
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.RegisterOpen.getPath())) {
extendedReq = new ServerRequestRegisterOpen(requestPath, post, context);
}
return extendedReq;
} } | public class class_name {
private static ServerRequest getExtendedServerRequest(String requestPath, JSONObject post, Context context) {
ServerRequest extendedReq = null;
if (requestPath.equalsIgnoreCase(Defines.RequestPath.CompletedAction.getPath())) {
extendedReq = new ServerRequestActionCompleted(requestPath, post, context); // depends on control dependency: [if], data = [none]
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.GetURL.getPath())) {
extendedReq = new ServerRequestCreateUrl(requestPath, post, context); // depends on control dependency: [if], data = [none]
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.GetCreditHistory.getPath())) {
extendedReq = new ServerRequestGetRewardHistory(requestPath, post, context); // depends on control dependency: [if], data = [none]
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.GetCredits.getPath())) {
extendedReq = new ServerRequestGetRewards(requestPath, post, context); // depends on control dependency: [if], data = [none]
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.IdentifyUser.getPath())) {
extendedReq = new ServerRequestIdentifyUserRequest(requestPath, post, context); // depends on control dependency: [if], data = [none]
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.Logout.getPath())) {
extendedReq = new ServerRequestLogout(requestPath, post, context); // depends on control dependency: [if], data = [none]
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.RedeemRewards.getPath())) {
extendedReq = new ServerRequestRedeemRewards(requestPath, post, context); // depends on control dependency: [if], data = [none]
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.RegisterClose.getPath())) {
extendedReq = new ServerRequestRegisterClose(requestPath, post, context); // depends on control dependency: [if], data = [none]
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.RegisterInstall.getPath())) {
extendedReq = new ServerRequestRegisterInstall(requestPath, post, context); // depends on control dependency: [if], data = [none]
} else if (requestPath.equalsIgnoreCase(Defines.RequestPath.RegisterOpen.getPath())) {
extendedReq = new ServerRequestRegisterOpen(requestPath, post, context); // depends on control dependency: [if], data = [none]
}
return extendedReq;
} } |
public class class_name {
private static List<String> convertSqref(final CellRangeAddressList region) {
List<String> sqref = new ArrayList<>();
for(CellRangeAddress range : region.getCellRangeAddresses()) {
sqref.add(range.formatAsString());
}
return sqref;
} } | public class class_name {
private static List<String> convertSqref(final CellRangeAddressList region) {
List<String> sqref = new ArrayList<>();
for(CellRangeAddress range : region.getCellRangeAddresses()) {
sqref.add(range.formatAsString());
// depends on control dependency: [for], data = [range]
}
return sqref;
} } |
public class class_name {
public void stopWorking() {
try {
threadPoolExecutor.shutdownNow();
Thread.sleep(1000);
threadPoolExecutor = initThreadPoolExecutor();
LOGGER.info("stop working succeed ");
} catch (Throwable t) {
LOGGER.error("stop working failed ", t);
}
} } | public class class_name {
public void stopWorking() {
try {
threadPoolExecutor.shutdownNow(); // depends on control dependency: [try], data = [none]
Thread.sleep(1000); // depends on control dependency: [try], data = [none]
threadPoolExecutor = initThreadPoolExecutor(); // depends on control dependency: [try], data = [none]
LOGGER.info("stop working succeed "); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
LOGGER.error("stop working failed ", t);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setString(String string) {
rawString = string;
colorIndices.clear();
// Search for color codes
final StringBuilder stringBuilder = new StringBuilder(string);
final Matcher matcher = COLOR_PATTERN.matcher(string);
int removedCount = 0;
while (matcher.find()) {
final int index = matcher.start() - removedCount;
// Ignore escaped color codes
if (index > 0 && stringBuilder.charAt(index - 1) == '\\') {
// Remove the escape character
stringBuilder.deleteCharAt(index - 1);
removedCount++;
continue;
}
// Add the color for the index and delete it from the string
final String colorCode = matcher.group();
colorIndices.put(index, CausticUtil.fromPackedARGB(Long.decode(colorCode).intValue()));
final int length = colorCode.length();
stringBuilder.delete(index, index + length);
removedCount += length;
}
// Color code free string
this.string = stringBuilder.toString();
} } | public class class_name {
public void setString(String string) {
rawString = string;
colorIndices.clear();
// Search for color codes
final StringBuilder stringBuilder = new StringBuilder(string);
final Matcher matcher = COLOR_PATTERN.matcher(string);
int removedCount = 0;
while (matcher.find()) {
final int index = matcher.start() - removedCount;
// Ignore escaped color codes
if (index > 0 && stringBuilder.charAt(index - 1) == '\\') {
// Remove the escape character
stringBuilder.deleteCharAt(index - 1); // depends on control dependency: [if], data = [none]
removedCount++; // depends on control dependency: [if], data = [none]
continue;
}
// Add the color for the index and delete it from the string
final String colorCode = matcher.group();
colorIndices.put(index, CausticUtil.fromPackedARGB(Long.decode(colorCode).intValue())); // depends on control dependency: [while], data = [none]
final int length = colorCode.length();
stringBuilder.delete(index, index + length); // depends on control dependency: [while], data = [none]
removedCount += length; // depends on control dependency: [while], data = [none]
}
// Color code free string
this.string = stringBuilder.toString();
} } |
public class class_name {
public ConnectionListener getActiveConnectionListener(Credential credential)
{
if (cm.getTransactionSupport() == TransactionSupportLevel.NoTransaction)
return null;
try
{
TransactionalConnectionManager txCM = (TransactionalConnectionManager) cm;
Transaction tx = txCM.getTransactionIntegration().getTransactionManager().getTransaction();
if (TxUtils.isUncommitted(tx))
{
Object id = txCM.getTransactionIntegration().getTransactionSynchronizationRegistry().getTransactionKey();
Map<ManagedConnectionPool, ConnectionListener> currentMap = transactionMap.get(id);
ManagedConnectionPool key = pools.get(credential);
return currentMap.get(key);
}
}
catch (Exception e)
{
log.tracef(e, "getActiveConnectionListener(%s)", credential);
}
return null;
} } | public class class_name {
public ConnectionListener getActiveConnectionListener(Credential credential)
{
if (cm.getTransactionSupport() == TransactionSupportLevel.NoTransaction)
return null;
try
{
TransactionalConnectionManager txCM = (TransactionalConnectionManager) cm;
Transaction tx = txCM.getTransactionIntegration().getTransactionManager().getTransaction();
if (TxUtils.isUncommitted(tx))
{
Object id = txCM.getTransactionIntegration().getTransactionSynchronizationRegistry().getTransactionKey();
Map<ManagedConnectionPool, ConnectionListener> currentMap = transactionMap.get(id);
ManagedConnectionPool key = pools.get(credential);
return currentMap.get(key); // depends on control dependency: [if], data = [none]
}
}
catch (Exception e)
{
log.tracef(e, "getActiveConnectionListener(%s)", credential);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public static boolean isIPAddr(String addr) {
if (StringUtils.isEmpty(addr)) {
return false;
}
String[] ips = StringUtils.split(addr, '.');
if (ips == null || ips.length != 4) {
return false;
}
try {
int ipa = Integer.parseInt(ips[0]);
int ipb = Integer.parseInt(ips[1]);
int ipc = Integer.parseInt(ips[2]);
int ipd = Integer.parseInt(ips[3]);
return ipa >= 0 && ipa <= 255 && ipb >= 0 && ipb <= 255 && ipc >= 0
&& ipc <= 255 && ipd >= 0 && ipd <= 255;
} catch (Exception ignored) {
}
return false;
} } | public class class_name {
public static boolean isIPAddr(String addr) {
if (StringUtils.isEmpty(addr)) {
return false; // depends on control dependency: [if], data = [none]
}
String[] ips = StringUtils.split(addr, '.');
if (ips == null || ips.length != 4) {
return false; // depends on control dependency: [if], data = [none]
}
try {
int ipa = Integer.parseInt(ips[0]);
int ipb = Integer.parseInt(ips[1]);
int ipc = Integer.parseInt(ips[2]);
int ipd = Integer.parseInt(ips[3]);
return ipa >= 0 && ipa <= 255 && ipb >= 0 && ipb <= 255 && ipc >= 0
&& ipc <= 255 && ipd >= 0 && ipd <= 255; // depends on control dependency: [try], data = [none]
} catch (Exception ignored) {
} // depends on control dependency: [catch], data = [none]
return false;
} } |
public class class_name {
private void nabla_mask( RandomIter elevationIter, WritableRaster nablaRaster, double thNabla ) {
int y;
double[] z = new double[9];
double derivate2;
int[][] v = ModelsEngine.DIR;
// grid contains the dimension of pixels according with flow directions
double[] grid = new double[9];
grid[0] = 0;
grid[1] = grid[5] = xRes;
grid[3] = grid[7] = yRes;
grid[2] = grid[4] = grid[6] = grid[8] = Math.sqrt(grid[1] * grid[1] + grid[3] * grid[3]);
pm.beginTask("Processing nabla...", nCols * 2);
for( int c = 1; c < nCols - 1; c++ ) {
for( int r = 1; r < nRows - 1; r++ ) {
z[0] = elevationIter.getSampleDouble(c, r, 0);
if (!isNovalue(z[0])) {
y = 1;
// if there is a no value around the current pixel then do nothing.
for( int h = 1; h <= 8; h++ ) {
z[h] = elevationIter.getSampleDouble(c + v[h][0], r + v[h][1], 0);
if (isNovalue(z[h])) {
y = 0;
break;
}
}
if (y == 0) {
nablaRaster.setSample(c, r, 0, 1);
} else {
derivate2 = 0.5 * ((z[1] + z[5] - 2 * z[0]) / (grid[1] * grid[1]) + (z[3] + z[7] - 2 * z[0])
/ (grid[3] * grid[3]));
derivate2 = derivate2 + 0.5 * ((z[2] + z[4] + z[6] + z[8] - 4 * z[0]) / (grid[6] * grid[6]));
if (Math.abs(derivate2) <= thNabla || derivate2 > thNabla) {
nablaRaster.setSample(c, r, 0, 0);
} else {
nablaRaster.setSample(c, r, 0, 1);
}
}
} else {
nablaRaster.setSample(c, r, 0, doubleNovalue);
}
}
pm.worked(1);
}
pm.done();
} } | public class class_name {
private void nabla_mask( RandomIter elevationIter, WritableRaster nablaRaster, double thNabla ) {
int y;
double[] z = new double[9];
double derivate2;
int[][] v = ModelsEngine.DIR;
// grid contains the dimension of pixels according with flow directions
double[] grid = new double[9];
grid[0] = 0;
grid[1] = grid[5] = xRes;
grid[3] = grid[7] = yRes;
grid[2] = grid[4] = grid[6] = grid[8] = Math.sqrt(grid[1] * grid[1] + grid[3] * grid[3]);
pm.beginTask("Processing nabla...", nCols * 2);
for( int c = 1; c < nCols - 1; c++ ) {
for( int r = 1; r < nRows - 1; r++ ) {
z[0] = elevationIter.getSampleDouble(c, r, 0); // depends on control dependency: [for], data = [r]
if (!isNovalue(z[0])) {
y = 1; // depends on control dependency: [if], data = [none]
// if there is a no value around the current pixel then do nothing.
for( int h = 1; h <= 8; h++ ) {
z[h] = elevationIter.getSampleDouble(c + v[h][0], r + v[h][1], 0); // depends on control dependency: [for], data = [h]
if (isNovalue(z[h])) {
y = 0; // depends on control dependency: [if], data = [none]
break;
}
}
if (y == 0) {
nablaRaster.setSample(c, r, 0, 1); // depends on control dependency: [if], data = [none]
} else {
derivate2 = 0.5 * ((z[1] + z[5] - 2 * z[0]) / (grid[1] * grid[1]) + (z[3] + z[7] - 2 * z[0])
/ (grid[3] * grid[3])); // depends on control dependency: [if], data = [none]
derivate2 = derivate2 + 0.5 * ((z[2] + z[4] + z[6] + z[8] - 4 * z[0]) / (grid[6] * grid[6])); // depends on control dependency: [if], data = [none]
if (Math.abs(derivate2) <= thNabla || derivate2 > thNabla) {
nablaRaster.setSample(c, r, 0, 0); // depends on control dependency: [if], data = [none]
} else {
nablaRaster.setSample(c, r, 0, 1); // depends on control dependency: [if], data = [none]
}
}
} else {
nablaRaster.setSample(c, r, 0, doubleNovalue); // depends on control dependency: [if], data = [none]
}
}
pm.worked(1); // depends on control dependency: [for], data = [none]
}
pm.done();
} } |
public class class_name {
private void animateView(final int diff, final float animationSpeed,
@NonNull final AnimationListener animationListener,
@NonNull final Interpolator interpolator) {
if (!isDragging() && !isAnimationRunning()) {
long duration = calculateAnimationDuration(diff, animationSpeed);
Animation animation =
new DraggableViewAnimation(this, diff, duration, animationListener);
animation.setInterpolator(interpolator);
startAnimation(animation);
}
} } | public class class_name {
private void animateView(final int diff, final float animationSpeed,
@NonNull final AnimationListener animationListener,
@NonNull final Interpolator interpolator) {
if (!isDragging() && !isAnimationRunning()) {
long duration = calculateAnimationDuration(diff, animationSpeed);
Animation animation =
new DraggableViewAnimation(this, diff, duration, animationListener);
animation.setInterpolator(interpolator); // depends on control dependency: [if], data = [none]
startAnimation(animation); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public JSONObject videoFaceliveness(String sessionId, byte[] video, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("session_id", sessionId);
String base64Content = Base64Util.encode(video);
request.addBody("video_base64", base64Content);
if (options != null) {
request.addBody(options);
}
request.setUri(FaceConsts.VIDEO_FACELIVENESS);
postOperation(request);
return requestServer(request);
} } | public class class_name {
public JSONObject videoFaceliveness(String sessionId, byte[] video, HashMap<String, String> options) {
AipRequest request = new AipRequest();
preOperation(request);
request.addBody("session_id", sessionId);
String base64Content = Base64Util.encode(video);
request.addBody("video_base64", base64Content);
if (options != null) {
request.addBody(options); // depends on control dependency: [if], data = [(options]
}
request.setUri(FaceConsts.VIDEO_FACELIVENESS);
postOperation(request);
return requestServer(request);
} } |
public class class_name {
@InterfaceAudience.Public
public boolean registerEncryptionKey(Object keyOrPassword, String databaseName) {
if (databaseName == null)
return false;
if (keyOrPassword != null) {
encryptionKeys.put(databaseName, keyOrPassword);
} else
encryptionKeys.remove(databaseName);
return true;
} } | public class class_name {
@InterfaceAudience.Public
public boolean registerEncryptionKey(Object keyOrPassword, String databaseName) {
if (databaseName == null)
return false;
if (keyOrPassword != null) {
encryptionKeys.put(databaseName, keyOrPassword); // depends on control dependency: [if], data = [none]
} else
encryptionKeys.remove(databaseName);
return true;
} } |
public class class_name {
public static boolean waitForFile(File file) {
if (file.isFile()) {
return true;
} else {
// Start waiting 10 seconds maximum
long timeout = System.currentTimeMillis() + FILE_WAIT_TIMEOUT;
while (System.currentTimeMillis() <= timeout) {
sleepQuietly(10);
if (file.isFile()) {
return true;
}
}
}
// Timeout reached
return false;
} } | public class class_name {
public static boolean waitForFile(File file) {
if (file.isFile()) {
return true; // depends on control dependency: [if], data = [none]
} else {
// Start waiting 10 seconds maximum
long timeout = System.currentTimeMillis() + FILE_WAIT_TIMEOUT;
while (System.currentTimeMillis() <= timeout) {
sleepQuietly(10); // depends on control dependency: [while], data = [none]
if (file.isFile()) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
// Timeout reached
return false;
} } |
public class class_name {
public URL getResourceFrom(String name, AbstractClassLoader first) {
if (name.length() == 0) return null;
if (name.charAt(0) == '/') name = name.substring(1);
URL url = null;
// try with the first one
if (first != null)
url = first.getResourceURL(name);
// then, try on other libraries
if (url == null) {
for (int i = 0; i < libs.size(); i++) {
AbstractClassLoader cl = libs.get(i);
if (cl == first) continue;
url = cl.getResourceURL(name);
if (url != null) break;
}
}
if (url == null)
url = AppClassLoader.class.getClassLoader().getResource(name);
return url;
} } | public class class_name {
public URL getResourceFrom(String name, AbstractClassLoader first) {
if (name.length() == 0) return null;
if (name.charAt(0) == '/') name = name.substring(1);
URL url = null;
// try with the first one
if (first != null)
url = first.getResourceURL(name);
// then, try on other libraries
if (url == null) {
for (int i = 0; i < libs.size(); i++) {
AbstractClassLoader cl = libs.get(i);
if (cl == first) continue;
url = cl.getResourceURL(name);
// depends on control dependency: [for], data = [none]
if (url != null) break;
}
}
if (url == null)
url = AppClassLoader.class.getClassLoader().getResource(name);
return url;
} } |
public class class_name {
public boolean createOrUpdate(TileScaling tileScaling) {
boolean success = false;
tileScaling.setTableName(tableName);
getOrCreateExtension();
try {
if (!tileScalingDao.isTableExists()) {
geoPackage.createTileScalingTable();
}
CreateOrUpdateStatus status = tileScalingDao
.createOrUpdate(tileScaling);
success = status.isCreated() || status.isUpdated();
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to create or update tile scaling for GeoPackage: "
+ geoPackage.getName() + ", Tile Table: "
+ tableName, e);
}
return success;
} } | public class class_name {
public boolean createOrUpdate(TileScaling tileScaling) {
boolean success = false;
tileScaling.setTableName(tableName);
getOrCreateExtension();
try {
if (!tileScalingDao.isTableExists()) {
geoPackage.createTileScalingTable(); // depends on control dependency: [if], data = [none]
}
CreateOrUpdateStatus status = tileScalingDao
.createOrUpdate(tileScaling);
success = status.isCreated() || status.isUpdated();
} catch (SQLException e) {
throw new GeoPackageException(
"Failed to create or update tile scaling for GeoPackage: "
+ geoPackage.getName() + ", Tile Table: "
+ tableName, e);
}
return success;
} } |
public class class_name {
private void keepLastUpdatedUnique() {
Map<String, SingleTokenStats> temp = new HashMap<>();
this.tokenStats.forEach(candidate -> {
SingleTokenStats current = temp.get(candidate.tokenUuid);
if (current == null) {
temp.put(candidate.tokenUuid, candidate);
} else {
int comparison = SingleTokenStats.COMP_BY_LAST_USE_THEN_COUNTER.compare(current, candidate);
if (comparison < 0) {
// candidate was updated more recently (or has a bigger counter in case of perfectly equivalent dates)
temp.put(candidate.tokenUuid, candidate);
}
}
});
this.tokenStats = new ArrayList<>(temp.values());
} } | public class class_name {
private void keepLastUpdatedUnique() {
Map<String, SingleTokenStats> temp = new HashMap<>();
this.tokenStats.forEach(candidate -> {
SingleTokenStats current = temp.get(candidate.tokenUuid);
if (current == null) {
temp.put(candidate.tokenUuid, candidate); // depends on control dependency: [if], data = [none]
} else {
int comparison = SingleTokenStats.COMP_BY_LAST_USE_THEN_COUNTER.compare(current, candidate);
if (comparison < 0) {
// candidate was updated more recently (or has a bigger counter in case of perfectly equivalent dates)
temp.put(candidate.tokenUuid, candidate); // depends on control dependency: [if], data = [none]
}
}
});
this.tokenStats = new ArrayList<>(temp.values());
} } |
public class class_name {
public static double[] getDoubleData(INDArray buf) {
if (buf.data().dataType() != DataType.DOUBLE)
throw new IllegalArgumentException("Double data must be obtained from a double buffer");
if (buf.data().allocationMode() == DataBuffer.AllocationMode.HEAP) {
return buf.data().asDouble();
} else {
double[] ret = new double[(int) buf.length()];
INDArray linear = buf.reshape(-1);
for (int i = 0; i < buf.length(); i++)
ret[i] = linear.getDouble(i);
return ret;
}
} } | public class class_name {
public static double[] getDoubleData(INDArray buf) {
if (buf.data().dataType() != DataType.DOUBLE)
throw new IllegalArgumentException("Double data must be obtained from a double buffer");
if (buf.data().allocationMode() == DataBuffer.AllocationMode.HEAP) {
return buf.data().asDouble(); // depends on control dependency: [if], data = [none]
} else {
double[] ret = new double[(int) buf.length()];
INDArray linear = buf.reshape(-1);
for (int i = 0; i < buf.length(); i++)
ret[i] = linear.getDouble(i);
return ret; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void listAllVoices() {
System.out.println();
System.out.println("All voices available:");
VoiceManager voiceManager = VoiceManager.getInstance();
Voice[] voices = voiceManager.getVoices();
for (int i = 0; i < voices.length; i++) {
System.out.println(" " + voices[i].getName()
+ " (" + voices[i].getDomain() + " domain)");
}
} } | public class class_name {
public static void listAllVoices() {
System.out.println();
System.out.println("All voices available:");
VoiceManager voiceManager = VoiceManager.getInstance();
Voice[] voices = voiceManager.getVoices();
for (int i = 0; i < voices.length; i++) {
System.out.println(" " + voices[i].getName()
+ " (" + voices[i].getDomain() + " domain)"); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
private void runTasks() {
// Execute any tasks that were queue during execution of the command.
if (!tasks.isEmpty()) {
for (Runnable task : tasks) {
log.trace("Executing task {}", task);
task.run();
}
tasks.clear();
}
} } | public class class_name {
private void runTasks() {
// Execute any tasks that were queue during execution of the command.
if (!tasks.isEmpty()) {
for (Runnable task : tasks) {
log.trace("Executing task {}", task); // depends on control dependency: [for], data = [task]
task.run(); // depends on control dependency: [for], data = [task]
}
tasks.clear(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void extract(DMatrixSparseCSC src, int srcY0, int srcY1, int srcX0, int srcX1,
DMatrixSparseCSC dst, int dstY0, int dstX0)
{
if( srcY1 < srcY0 || srcY0 < 0 || srcY1 > src.getNumRows() )
throw new MatrixDimensionException("srcY1 < srcY0 || srcY0 < 0 || srcY1 > src.numRows. "+stringShapes(src,dst));
if( srcX1 < srcX0 || srcX0 < 0 || srcX1 > src.getNumCols() )
throw new MatrixDimensionException("srcX1 < srcX0 || srcX0 < 0 || srcX1 > src.numCols. "+stringShapes(src,dst));
int w = srcX1-srcX0;
int h = srcY1-srcY0;
if( dstY0+h > dst.getNumRows() )
throw new IllegalArgumentException("dst is too small in rows. "+dst.getNumRows()+" < "+(dstY0+h));
if( dstX0+w > dst.getNumCols() )
throw new IllegalArgumentException("dst is too small in columns. "+dst.getNumCols()+" < "+(dstX0+w));
zero(dst,dstY0,dstY0+h,dstX0,dstX0+w);
// NOTE: One possible optimization would be to determine the non-zero pattern in dst after the change is
// applied, modify it's structure, then copy the values in. That way you aren't shifting memory constantly.
//
// NOTE: Another optimization would be to sort the src so that it doesn't need to go through every row
for (int colSrc = srcX0; colSrc < srcX1; colSrc++) {
int idxS0 = src.col_idx[colSrc];
int idxS1 = src.col_idx[colSrc + 1];
for (int i = idxS0; i < idxS1; i++) {
int row = src.nz_rows[i];
if (row >= srcY0 && row < srcY1) {
dst.set(row - srcY0 + dstY0, colSrc - srcX0 + dstX0, src.nz_values[i]);
}
}
}
} } | public class class_name {
public static void extract(DMatrixSparseCSC src, int srcY0, int srcY1, int srcX0, int srcX1,
DMatrixSparseCSC dst, int dstY0, int dstX0)
{
if( srcY1 < srcY0 || srcY0 < 0 || srcY1 > src.getNumRows() )
throw new MatrixDimensionException("srcY1 < srcY0 || srcY0 < 0 || srcY1 > src.numRows. "+stringShapes(src,dst));
if( srcX1 < srcX0 || srcX0 < 0 || srcX1 > src.getNumCols() )
throw new MatrixDimensionException("srcX1 < srcX0 || srcX0 < 0 || srcX1 > src.numCols. "+stringShapes(src,dst));
int w = srcX1-srcX0;
int h = srcY1-srcY0;
if( dstY0+h > dst.getNumRows() )
throw new IllegalArgumentException("dst is too small in rows. "+dst.getNumRows()+" < "+(dstY0+h));
if( dstX0+w > dst.getNumCols() )
throw new IllegalArgumentException("dst is too small in columns. "+dst.getNumCols()+" < "+(dstX0+w));
zero(dst,dstY0,dstY0+h,dstX0,dstX0+w);
// NOTE: One possible optimization would be to determine the non-zero pattern in dst after the change is
// applied, modify it's structure, then copy the values in. That way you aren't shifting memory constantly.
//
// NOTE: Another optimization would be to sort the src so that it doesn't need to go through every row
for (int colSrc = srcX0; colSrc < srcX1; colSrc++) {
int idxS0 = src.col_idx[colSrc];
int idxS1 = src.col_idx[colSrc + 1];
for (int i = idxS0; i < idxS1; i++) {
int row = src.nz_rows[i];
if (row >= srcY0 && row < srcY1) {
dst.set(row - srcY0 + dstY0, colSrc - srcX0 + dstX0, src.nz_values[i]); // depends on control dependency: [if], data = [(row]
}
}
}
} } |
public class class_name {
private void addGroups(final User user, final Set<Group> userGroups, final Group currentGroup,
final List<Group> stack, final boolean inheritOnly)
{
if((currentGroup != null) && !stack.contains(currentGroup))
{
stack.add(currentGroup);
if(currentGroup.getMemberUsers().contains(user))
{
userGroups.add(currentGroup);
// Add the ancestor groups as well
boolean inherit = !inheritOnly || currentGroup.isInheritingRoles();
Group group;
for(int i = stack.size() - 2; inherit && (i >= 0); i--)
{
group = stack.get(i);
userGroups.add(group);
inherit = !inheritOnly || group.isInheritingRoles();
}
}
for(final Group group : currentGroup.getMemberGroups())
{
this.addGroups(user, userGroups, group, stack, inheritOnly);
}
}
} } | public class class_name {
private void addGroups(final User user, final Set<Group> userGroups, final Group currentGroup,
final List<Group> stack, final boolean inheritOnly)
{
if((currentGroup != null) && !stack.contains(currentGroup))
{
stack.add(currentGroup); // depends on control dependency: [if], data = [none]
if(currentGroup.getMemberUsers().contains(user))
{
userGroups.add(currentGroup); // depends on control dependency: [if], data = [none]
// Add the ancestor groups as well
boolean inherit = !inheritOnly || currentGroup.isInheritingRoles();
Group group;
for(int i = stack.size() - 2; inherit && (i >= 0); i--)
{
group = stack.get(i); // depends on control dependency: [for], data = [i]
userGroups.add(group); // depends on control dependency: [for], data = [none]
inherit = !inheritOnly || group.isInheritingRoles(); // depends on control dependency: [for], data = [none]
}
}
for(final Group group : currentGroup.getMemberGroups())
{
this.addGroups(user, userGroups, group, stack, inheritOnly); // depends on control dependency: [for], data = [group]
}
}
} } |
public class class_name {
@Override
public List<Metric> transform(QueryContext queryContext, List<Metric>... listOfList) {
List<Metric> result = new ArrayList<>();
for (List<Metric> list : listOfList) {
for (Metric metric : list) {
result.add(metric);
}
}
return result;
} } | public class class_name {
@Override
public List<Metric> transform(QueryContext queryContext, List<Metric>... listOfList) {
List<Metric> result = new ArrayList<>();
for (List<Metric> list : listOfList) {
for (Metric metric : list) {
result.add(metric); // depends on control dependency: [for], data = [metric]
}
}
return result;
} } |
public class class_name {
public void apply(WAMInstruction next)
{
shift(next);
// Anonymous or singleton variable optimizations.
if ((UnifyVar == next.getMnemonic()) && isVoidVariable(next))
{
if (state != State.UVE)
{
voidCount = 0;
}
discard((voidCount == 0) ? 1 : 2);
WAMInstruction unifyVoid = new WAMInstruction(UnifyVoid, WAMInstruction.REG_ADDR, (byte) ++voidCount);
shift(unifyVoid);
state = State.UVE;
/*log.fine(next + " -> " + unifyVoid);*/
}
else if ((SetVar == next.getMnemonic()) && isVoidVariable(next))
{
if (state != State.SVE)
{
voidCount = 0;
}
discard((voidCount == 0) ? 1 : 2);
WAMInstruction setVoid = new WAMInstruction(SetVoid, WAMInstruction.REG_ADDR, (byte) ++voidCount);
shift(setVoid);
state = State.SVE;
/*log.fine(next + " -> " + setVoid);*/
}
else if ((GetVar == next.getMnemonic()) && (next.getMode1() == WAMInstruction.REG_ADDR) &&
(next.getReg1() == next.getReg2()))
{
discard(1);
/*log.fine(next + " -> eliminated");*/
state = State.NM;
}
// Constant optimizations.
else if ((UnifyVar == next.getMnemonic()) && isConstant(next) && isNonArg(next))
{
discard(1);
FunctorName functorName = interner.getDeinternedFunctorName(next.getFunctorNameReg1());
WAMInstruction unifyConst = new WAMInstruction(UnifyConstant, functorName);
shift(unifyConst);
flush();
state = State.NM;
/*log.fine(next + " -> " + unifyConst);*/
}
else if ((GetStruc == next.getMnemonic()) && isConstant(next) && isNonArg(next))
{
discard(1);
state = State.NM;
/*log.fine(next + " -> eliminated");*/
}
else if ((GetStruc == next.getMnemonic()) && isConstant(next) && !isNonArg(next))
{
discard(1);
WAMInstruction getConst = new WAMInstruction(GetConstant, next.getMode1(), next.getReg1(), next.getFn());
shift(getConst);
flush();
state = State.NM;
/*log.fine(next + " -> " + getConst);*/
}
else if ((PutStruc == next.getMnemonic()) && isConstant(next) && isNonArg(next))
{
discard(1);
state = State.NM;
/*log.fine(next + " -> eliminated");*/
}
else if ((PutStruc == next.getMnemonic()) && isConstant(next) && !isNonArg(next))
{
discard(1);
WAMInstruction putConst = new WAMInstruction(PutConstant, next.getMode1(), next.getReg1(), next.getFn());
shift(putConst);
state = State.NM;
/*log.fine(next + " -> " + putConst);*/
}
else if ((SetVal == next.getMnemonic()) && isConstant(next) && isNonArg(next))
{
discard(1);
FunctorName functorName = interner.getDeinternedFunctorName(next.getFunctorNameReg1());
WAMInstruction setConst = new WAMInstruction(SetConstant, functorName);
shift(setConst);
flush();
state = State.NM;
/*log.fine(next + " -> " + setConst);*/
}
// List optimizations.
else if ((GetStruc == next.getMnemonic()) &&
("cons".equals(next.getFn().getName()) && (next.getFn().getArity() == 2)))
{
discard(1);
WAMInstruction getList = new WAMInstruction(GetList, next.getMode1(), next.getReg1());
shift(getList);
state = State.NM;
/*log.fine(next + " -> " + getList);*/
}
else if ((PutStruc == next.getMnemonic()) &&
("cons".equals(next.getFn().getName()) && (next.getFn().getArity() == 2)))
{
discard(1);
WAMInstruction putList = new WAMInstruction(PutList, next.getMode1(), next.getReg1());
shift(putList);
state = State.NM;
/*log.fine(next + " -> " + putList);*/
}
// Default.
else
{
state = State.NM;
flush();
}
} } | public class class_name {
public void apply(WAMInstruction next)
{
shift(next);
// Anonymous or singleton variable optimizations.
if ((UnifyVar == next.getMnemonic()) && isVoidVariable(next))
{
if (state != State.UVE)
{
voidCount = 0; // depends on control dependency: [if], data = [none]
}
discard((voidCount == 0) ? 1 : 2); // depends on control dependency: [if], data = [none]
WAMInstruction unifyVoid = new WAMInstruction(UnifyVoid, WAMInstruction.REG_ADDR, (byte) ++voidCount);
shift(unifyVoid); // depends on control dependency: [if], data = [none]
state = State.UVE; // depends on control dependency: [if], data = [none]
/*log.fine(next + " -> " + unifyVoid);*/
}
else if ((SetVar == next.getMnemonic()) && isVoidVariable(next))
{
if (state != State.SVE)
{
voidCount = 0; // depends on control dependency: [if], data = [none]
}
discard((voidCount == 0) ? 1 : 2); // depends on control dependency: [if], data = [none]
WAMInstruction setVoid = new WAMInstruction(SetVoid, WAMInstruction.REG_ADDR, (byte) ++voidCount);
shift(setVoid); // depends on control dependency: [if], data = [none]
state = State.SVE; // depends on control dependency: [if], data = [none]
/*log.fine(next + " -> " + setVoid);*/
}
else if ((GetVar == next.getMnemonic()) && (next.getMode1() == WAMInstruction.REG_ADDR) &&
(next.getReg1() == next.getReg2()))
{
discard(1); // depends on control dependency: [if], data = [none]
/*log.fine(next + " -> eliminated");*/
state = State.NM; // depends on control dependency: [if], data = [none]
}
// Constant optimizations.
else if ((UnifyVar == next.getMnemonic()) && isConstant(next) && isNonArg(next))
{
discard(1); // depends on control dependency: [if], data = [none]
FunctorName functorName = interner.getDeinternedFunctorName(next.getFunctorNameReg1());
WAMInstruction unifyConst = new WAMInstruction(UnifyConstant, functorName);
shift(unifyConst); // depends on control dependency: [if], data = [none]
flush(); // depends on control dependency: [if], data = [none]
state = State.NM; // depends on control dependency: [if], data = [none]
/*log.fine(next + " -> " + unifyConst);*/
}
else if ((GetStruc == next.getMnemonic()) && isConstant(next) && isNonArg(next))
{
discard(1); // depends on control dependency: [if], data = [none]
state = State.NM; // depends on control dependency: [if], data = [none]
/*log.fine(next + " -> eliminated");*/
}
else if ((GetStruc == next.getMnemonic()) && isConstant(next) && !isNonArg(next))
{
discard(1); // depends on control dependency: [if], data = [none]
WAMInstruction getConst = new WAMInstruction(GetConstant, next.getMode1(), next.getReg1(), next.getFn());
shift(getConst); // depends on control dependency: [if], data = [none]
flush(); // depends on control dependency: [if], data = [none]
state = State.NM; // depends on control dependency: [if], data = [none]
/*log.fine(next + " -> " + getConst);*/
}
else if ((PutStruc == next.getMnemonic()) && isConstant(next) && isNonArg(next))
{
discard(1); // depends on control dependency: [if], data = [none]
state = State.NM; // depends on control dependency: [if], data = [none]
/*log.fine(next + " -> eliminated");*/
}
else if ((PutStruc == next.getMnemonic()) && isConstant(next) && !isNonArg(next))
{
discard(1); // depends on control dependency: [if], data = [none]
WAMInstruction putConst = new WAMInstruction(PutConstant, next.getMode1(), next.getReg1(), next.getFn());
shift(putConst); // depends on control dependency: [if], data = [none]
state = State.NM; // depends on control dependency: [if], data = [none]
/*log.fine(next + " -> " + putConst);*/
}
else if ((SetVal == next.getMnemonic()) && isConstant(next) && isNonArg(next))
{
discard(1); // depends on control dependency: [if], data = [none]
FunctorName functorName = interner.getDeinternedFunctorName(next.getFunctorNameReg1());
WAMInstruction setConst = new WAMInstruction(SetConstant, functorName);
shift(setConst); // depends on control dependency: [if], data = [none]
flush(); // depends on control dependency: [if], data = [none]
state = State.NM; // depends on control dependency: [if], data = [none]
/*log.fine(next + " -> " + setConst);*/
}
// List optimizations.
else if ((GetStruc == next.getMnemonic()) &&
("cons".equals(next.getFn().getName()) && (next.getFn().getArity() == 2)))
{
discard(1); // depends on control dependency: [if], data = [none]
WAMInstruction getList = new WAMInstruction(GetList, next.getMode1(), next.getReg1());
shift(getList); // depends on control dependency: [if], data = [none]
state = State.NM; // depends on control dependency: [if], data = [none]
/*log.fine(next + " -> " + getList);*/
}
else if ((PutStruc == next.getMnemonic()) &&
("cons".equals(next.getFn().getName()) && (next.getFn().getArity() == 2)))
{
discard(1); // depends on control dependency: [if], data = [none]
WAMInstruction putList = new WAMInstruction(PutList, next.getMode1(), next.getReg1());
shift(putList); // depends on control dependency: [if], data = [none]
state = State.NM; // depends on control dependency: [if], data = [none]
/*log.fine(next + " -> " + putList);*/
}
// Default.
else
{
state = State.NM; // depends on control dependency: [if], data = [none]
flush(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected boolean match(final String path) {
final String methodName = "match";
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, methodName, this, path, ignoreCase, wildcard);
}
if (this.matcher == null) {
if (ignoreCase) {
if (pattern.equalsIgnoreCase(path)) {
return true;
}
if (wildcard && path.toLowerCase().startsWith(pattern)) {
return true;
}
} else {
if (pattern.equals(path)) {
return true;
}
if (wildcard && path.startsWith(pattern)) {
return true;
}
}
} else {
return this.matcher.matcher(path).matches();
}
return false;
} } | public class class_name {
protected boolean match(final String path) {
final String methodName = "match";
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, methodName, this, path, ignoreCase, wildcard); // depends on control dependency: [if], data = [none]
}
if (this.matcher == null) {
if (ignoreCase) {
if (pattern.equalsIgnoreCase(path)) {
return true; // depends on control dependency: [if], data = [none]
}
if (wildcard && path.toLowerCase().startsWith(pattern)) {
return true; // depends on control dependency: [if], data = [none]
}
} else {
if (pattern.equals(path)) {
return true; // depends on control dependency: [if], data = [none]
}
if (wildcard && path.startsWith(pattern)) {
return true; // depends on control dependency: [if], data = [none]
}
}
} else {
return this.matcher.matcher(path).matches(); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public void stop(int mode)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stop");
// Prevent any new async deletion activity kicking off a new background thread.
setIsAsyncDeletionThreadStartable(false);
// stop the async deletion thread if it's currently running.
synchronized (deletionThreadLock)
{
if (asynchDeletionThread != null)
{
asynchDeletionThread.stopThread(messageProcessor.getStoppableThreadCache());
}
}
//Make sure that this is null, so that unittests that only restart MP dont
//see a half stopped asynch deletion thread.
asynchDeletionThread = null;
// Propogate the stop stimulus to the destination handlers...
DestinationTypeFilter destFilter = new DestinationTypeFilter();
destFilter.LOCAL = Boolean.TRUE;
SIMPIterator itr = destinationIndex.iterator(destFilter);
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.stop(mode);
}
itr.finished();
//busses
itr = foreignBusIndex.iterator();
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.stop(mode);
}
itr.finished();
//links
LinkTypeFilter linkFilter = new LinkTypeFilter();
linkFilter.LOCAL = Boolean.TRUE;
itr = linkIndex.iterator(linkFilter); //d266910
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.stop(mode);
}
itr.finished();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "stop");
} } | public class class_name {
public void stop(int mode)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "stop");
// Prevent any new async deletion activity kicking off a new background thread.
setIsAsyncDeletionThreadStartable(false);
// stop the async deletion thread if it's currently running.
synchronized (deletionThreadLock)
{
if (asynchDeletionThread != null)
{
asynchDeletionThread.stopThread(messageProcessor.getStoppableThreadCache()); // depends on control dependency: [if], data = [none]
}
}
//Make sure that this is null, so that unittests that only restart MP dont
//see a half stopped asynch deletion thread.
asynchDeletionThread = null;
// Propogate the stop stimulus to the destination handlers...
DestinationTypeFilter destFilter = new DestinationTypeFilter();
destFilter.LOCAL = Boolean.TRUE;
SIMPIterator itr = destinationIndex.iterator(destFilter);
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.stop(mode); // depends on control dependency: [while], data = [none]
}
itr.finished();
//busses
itr = foreignBusIndex.iterator();
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.stop(mode); // depends on control dependency: [while], data = [none]
}
itr.finished();
//links
LinkTypeFilter linkFilter = new LinkTypeFilter();
linkFilter.LOCAL = Boolean.TRUE;
itr = linkIndex.iterator(linkFilter); //d266910
while (itr.hasNext())
{
DestinationHandler dh = (DestinationHandler) itr.next();
dh.stop(mode); // depends on control dependency: [while], data = [none]
}
itr.finished();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "stop");
} } |
public class class_name {
private int transfer(int state, int[] ids)
{
for (int c : ids)
{
if ((getBase(state) + c < getBaseArraySize())
&& (getCheck(getBase(state) + c) == state))
{
state = getBase(state) + c;
}
else
{
return -1;
}
}
return state;
} } | public class class_name {
private int transfer(int state, int[] ids)
{
for (int c : ids)
{
if ((getBase(state) + c < getBaseArraySize())
&& (getCheck(getBase(state) + c) == state))
{
state = getBase(state) + c; // depends on control dependency: [if], data = [none]
}
else
{
return -1; // depends on control dependency: [if], data = [none]
}
}
return state;
} } |
public class class_name {
private Optional<IncludeAllPageWithOutput> addOutputInformation(IncludeAllPage pages, FileResource baseResource, Path includeAllBasePath, Locale locale) {
// depth = 0 is the file that has the include-all directive
if (pages.depth == 0) {
return of(new IncludeAllPageWithOutput(pages, pages.files.get(0), pages.files.get(0).getPath(), locale));
}
Path baseResourceParentPath = baseResource.getPath().getParent();
Optional<FileResource> virtualResource = pages.files.stream().findFirst()
.map(fr -> new VirtualPathFileResource(baseResourceParentPath.resolve(includeAllBasePath.relativize(fr.getPath()).toString()), fr));
return virtualResource.map(vr -> {
Path finalOutputPath = outputPathExtractor.apply(vr).normalize();
return new IncludeAllPageWithOutput(pages, vr, finalOutputPath, locale);
});
} } | public class class_name {
private Optional<IncludeAllPageWithOutput> addOutputInformation(IncludeAllPage pages, FileResource baseResource, Path includeAllBasePath, Locale locale) {
// depth = 0 is the file that has the include-all directive
if (pages.depth == 0) {
return of(new IncludeAllPageWithOutput(pages, pages.files.get(0), pages.files.get(0).getPath(), locale)); // depends on control dependency: [if], data = [0)]
}
Path baseResourceParentPath = baseResource.getPath().getParent();
Optional<FileResource> virtualResource = pages.files.stream().findFirst()
.map(fr -> new VirtualPathFileResource(baseResourceParentPath.resolve(includeAllBasePath.relativize(fr.getPath()).toString()), fr));
return virtualResource.map(vr -> {
Path finalOutputPath = outputPathExtractor.apply(vr).normalize();
return new IncludeAllPageWithOutput(pages, vr, finalOutputPath, locale);
});
} } |
public class class_name {
private synchronized void startThenLoadData() {
if (_closed) {
return;
}
try {
_pathCache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);
} catch (Throwable t) {
waitThenStartAgain();
return;
}
loadExistingData();
} } | public class class_name {
private synchronized void startThenLoadData() {
if (_closed) {
return; // depends on control dependency: [if], data = [none]
}
try {
_pathCache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
waitThenStartAgain();
return;
} // depends on control dependency: [catch], data = [none]
loadExistingData();
} } |
public class class_name {
@Override
public void visitClassContext(ClassContext classContext) {
try {
isEnum = classContext.getJavaClass().isEnum();
stack = new OpcodeStack();
uninitializedRegs = new BitSet();
arrayAliases = new HashMap<>();
storedUVs = new HashMap<>();
super.visitClassContext(classContext);
} finally {
stack = null;
uninitializedRegs = null;
arrayAliases = null;
storedUVs = null;
}
} } | public class class_name {
@Override
public void visitClassContext(ClassContext classContext) {
try {
isEnum = classContext.getJavaClass().isEnum(); // depends on control dependency: [try], data = [none]
stack = new OpcodeStack(); // depends on control dependency: [try], data = [none]
uninitializedRegs = new BitSet(); // depends on control dependency: [try], data = [none]
arrayAliases = new HashMap<>(); // depends on control dependency: [try], data = [none]
storedUVs = new HashMap<>(); // depends on control dependency: [try], data = [none]
super.visitClassContext(classContext); // depends on control dependency: [try], data = [none]
} finally {
stack = null;
uninitializedRegs = null;
arrayAliases = null;
storedUVs = null;
}
} } |
public class class_name {
public void pause()
{
try
{
lock.lock();
try
{
released.await();
}
catch (InterruptedException e)
{
// Exception set to null as compensation action of returning immediately with current thread interrupted
// is taken.
e = null;
Thread.currentThread().interrupt();
return;
}
}
finally
{
lock.unlock();
}
} } | public class class_name {
public void pause()
{
try
{
lock.lock(); // depends on control dependency: [try], data = [none]
try
{
released.await(); // depends on control dependency: [try], data = [none]
}
catch (InterruptedException e)
{
// Exception set to null as compensation action of returning immediately with current thread interrupted
// is taken.
e = null;
Thread.currentThread().interrupt();
return;
} // depends on control dependency: [catch], data = [none]
}
finally
{
lock.unlock();
}
} } |
public class class_name {
public boolean stop(Long channelId, boolean needTermin) {
// stop优先级高于pause
updateStatus(channelId, ChannelStatus.STOP);
boolean result = !needTermin;
if (needTermin) {
try {
result |= termin(channelId, TerminType.SHUTDOWN);
} catch (Throwable e) {
updateStatus(channelId, ChannelStatus.STOP); // 出错了,直接挂起
throw new ArbitrateException(e);
}
}
return result;
} } | public class class_name {
public boolean stop(Long channelId, boolean needTermin) {
// stop优先级高于pause
updateStatus(channelId, ChannelStatus.STOP);
boolean result = !needTermin;
if (needTermin) {
try {
result |= termin(channelId, TerminType.SHUTDOWN); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
updateStatus(channelId, ChannelStatus.STOP); // 出错了,直接挂起
throw new ArbitrateException(e);
} // depends on control dependency: [catch], data = [none]
}
return result;
} } |
public class class_name {
@Override
public Boolean isReady() {
try {
validateInitialization();
validateActivation();
validateMiddleware();
return true;
} catch (InvalidStateException e) {
return false;
}
} } | public class class_name {
@Override
public Boolean isReady() {
try {
validateInitialization(); // depends on control dependency: [try], data = [none]
validateActivation(); // depends on control dependency: [try], data = [none]
validateMiddleware(); // depends on control dependency: [try], data = [none]
return true; // depends on control dependency: [try], data = [none]
} catch (InvalidStateException e) {
return false;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static UnitID newUnitID(final String name, final String plural,
final String symbol) {
UnitID id;
try {
id = name == null
? new UnitSymbol(symbol)
: UnitName.newUnitName(name, plural, symbol);
}
catch (final NameException e) {
id = null; // can't happen
}
return id;
} } | public class class_name {
public static UnitID newUnitID(final String name, final String plural,
final String symbol) {
UnitID id;
try {
id = name == null
? new UnitSymbol(symbol)
: UnitName.newUnitName(name, plural, symbol); // depends on control dependency: [try], data = [none]
}
catch (final NameException e) {
id = null; // can't happen
} // depends on control dependency: [catch], data = [none]
return id;
} } |
public class class_name {
public static boolean greater(final Object o1, final Object o2) {
switch (getTypeMark(o1, o2)) {
case BYTE:
case SHORT:
case INTEGER:
return ((Number) o1).intValue() > ((Number) o2).intValue();
case LONG:
return ((Number) o1).longValue() > ((Number) o2).longValue();
case BIG_INTEGER:
if (notDoubleOrFloat(o1, o2)) {
return toBigInteger(o1).compareTo(toBigInteger(o2)) > 0;
}
//Note: else upgrade to BigDecimal
case DOUBLE:
case FLOAT:
//Note: Floating point numbers should not be tested for equality.
case BIG_DECIMAL:
return toBigDecimal(o1).compareTo(toBigDecimal(o2)) > 0;
case CHAR:
return greater(charToInt(o1), charToInt(o2));
default:
}
throw unsupportedTypeException(o1, o2);
} } | public class class_name {
public static boolean greater(final Object o1, final Object o2) {
switch (getTypeMark(o1, o2)) {
case BYTE:
case SHORT:
case INTEGER:
return ((Number) o1).intValue() > ((Number) o2).intValue();
case LONG:
return ((Number) o1).longValue() > ((Number) o2).longValue();
case BIG_INTEGER:
if (notDoubleOrFloat(o1, o2)) {
return toBigInteger(o1).compareTo(toBigInteger(o2)) > 0; // depends on control dependency: [if], data = [none]
}
//Note: else upgrade to BigDecimal
case DOUBLE:
case FLOAT:
//Note: Floating point numbers should not be tested for equality.
case BIG_DECIMAL:
return toBigDecimal(o1).compareTo(toBigDecimal(o2)) > 0;
case CHAR:
return greater(charToInt(o1), charToInt(o2));
default:
}
throw unsupportedTypeException(o1, o2);
} } |
public class class_name {
private static boolean isDeNovoVariant(Member member, Variant variant) {
// We assume the variant iterator will always contain information for one study
StudyEntry study = variant.getStudies().get(0);
Genotype childGt = new Genotype(study.getSampleData(member.getId(), "GT"));
int[] childAlleles = childGt.getAllelesIdx();
if (childAlleles.length > 0) {
// If the individual has parents
if (member.getFather() != null && StringUtils.isNotEmpty(member.getFather().getId()) && member.getMother() != null
&& StringUtils.isNotEmpty(member.getMother().getId())) {
Genotype fatherGt = new Genotype(study.getSampleData(member.getFather().getId(), "GT"));
Genotype motherGt = new Genotype(study.getSampleData(member.getMother().getId(), "GT"));
int[] fatherAlleles = fatherGt.getAllelesIdx();
int[] motherAlleles = motherGt.getAllelesIdx();
if (fatherAlleles.length == 2 && motherAlleles.length == 2 && childAlleles.length == 2 && childAlleles[0] >= 0
&& childAlleles[1] >= 0) { // ChildAlleles cannot be -1
Set<Integer> fatherAllelesSet = new HashSet<>();
for (int fatherAllele : fatherAlleles) {
fatherAllelesSet.add(fatherAllele);
}
Set<Integer> motherAllelesSet = new HashSet<>();
for (int motherAllele : motherAlleles) {
motherAllelesSet.add(motherAllele);
}
int allele1 = childAlleles[0];
int allele2 = childAlleles[1];
if (fatherAllelesSet.contains(allele1) && motherAllelesSet.contains(allele1)) {
// both parents have the same allele. We need to check for allele 2 in both parents as well
if (!fatherAllelesSet.contains(allele2) && !motherAllelesSet.contains(allele2) && !fatherAllelesSet.contains(-1)
&& !motherAllelesSet.contains(-1)) {
// None of them have allele 2 -> de novo !
return true;
}
} else if (fatherAllelesSet.contains(allele2) && motherAllelesSet.contains(allele2)) {
// both parents have the same allele. We need to check for allele 1 in both parents as well
if (!fatherAllelesSet.contains(allele1) && !motherAllelesSet.contains(allele1) && !fatherAllelesSet.contains(-1)
&& !motherAllelesSet.contains(-1)) {
// None of them have allele 2 -> de novo !
return true;
}
} else if (fatherAllelesSet.contains(allele1) && !motherAllelesSet.contains(-1)) {
// only the father has the same allele1
// None of them have allele 2 -> de novo !
return !motherAllelesSet.contains(allele2);
} else if (motherAllelesSet.contains(allele1) && !fatherAllelesSet.contains(-1)) {
// only the mother has the same allele1
// None of them have allele 2 -> de novo !
return !fatherAllelesSet.contains(allele2);
} else if (fatherAllelesSet.contains(allele2) && !motherAllelesSet.contains(-1)) {
// only the father has the same allele2
// None of them have allele 1 -> de novo !
return !motherAllelesSet.contains(allele1);
} else if (motherAllelesSet.contains(allele2) && !fatherAllelesSet.contains(-1)) {
// only the mother has the same allele2
// None of them have allele 1 -> de novo !
return !fatherAllelesSet.contains(allele1);
} else {
return true;
}
}
}
}
return false;
} } | public class class_name {
private static boolean isDeNovoVariant(Member member, Variant variant) {
// We assume the variant iterator will always contain information for one study
StudyEntry study = variant.getStudies().get(0);
Genotype childGt = new Genotype(study.getSampleData(member.getId(), "GT"));
int[] childAlleles = childGt.getAllelesIdx();
if (childAlleles.length > 0) {
// If the individual has parents
if (member.getFather() != null && StringUtils.isNotEmpty(member.getFather().getId()) && member.getMother() != null
&& StringUtils.isNotEmpty(member.getMother().getId())) {
Genotype fatherGt = new Genotype(study.getSampleData(member.getFather().getId(), "GT"));
Genotype motherGt = new Genotype(study.getSampleData(member.getMother().getId(), "GT"));
int[] fatherAlleles = fatherGt.getAllelesIdx();
int[] motherAlleles = motherGt.getAllelesIdx();
if (fatherAlleles.length == 2 && motherAlleles.length == 2 && childAlleles.length == 2 && childAlleles[0] >= 0
&& childAlleles[1] >= 0) { // ChildAlleles cannot be -1
Set<Integer> fatherAllelesSet = new HashSet<>();
for (int fatherAllele : fatherAlleles) {
fatherAllelesSet.add(fatherAllele); // depends on control dependency: [for], data = [fatherAllele]
}
Set<Integer> motherAllelesSet = new HashSet<>();
for (int motherAllele : motherAlleles) {
motherAllelesSet.add(motherAllele); // depends on control dependency: [for], data = [motherAllele]
}
int allele1 = childAlleles[0];
int allele2 = childAlleles[1];
if (fatherAllelesSet.contains(allele1) && motherAllelesSet.contains(allele1)) {
// both parents have the same allele. We need to check for allele 2 in both parents as well
if (!fatherAllelesSet.contains(allele2) && !motherAllelesSet.contains(allele2) && !fatherAllelesSet.contains(-1)
&& !motherAllelesSet.contains(-1)) {
// None of them have allele 2 -> de novo !
return true; // depends on control dependency: [if], data = [none]
}
} else if (fatherAllelesSet.contains(allele2) && motherAllelesSet.contains(allele2)) {
// both parents have the same allele. We need to check for allele 1 in both parents as well
if (!fatherAllelesSet.contains(allele1) && !motherAllelesSet.contains(allele1) && !fatherAllelesSet.contains(-1)
&& !motherAllelesSet.contains(-1)) {
// None of them have allele 2 -> de novo !
return true; // depends on control dependency: [if], data = [none]
}
} else if (fatherAllelesSet.contains(allele1) && !motherAllelesSet.contains(-1)) {
// only the father has the same allele1
// None of them have allele 2 -> de novo !
return !motherAllelesSet.contains(allele2); // depends on control dependency: [if], data = [none]
} else if (motherAllelesSet.contains(allele1) && !fatherAllelesSet.contains(-1)) {
// only the mother has the same allele1
// None of them have allele 2 -> de novo !
return !fatherAllelesSet.contains(allele2); // depends on control dependency: [if], data = [none]
} else if (fatherAllelesSet.contains(allele2) && !motherAllelesSet.contains(-1)) {
// only the father has the same allele2
// None of them have allele 1 -> de novo !
return !motherAllelesSet.contains(allele1); // depends on control dependency: [if], data = [none]
} else if (motherAllelesSet.contains(allele2) && !fatherAllelesSet.contains(-1)) {
// only the mother has the same allele2
// None of them have allele 1 -> de novo !
return !fatherAllelesSet.contains(allele1); // depends on control dependency: [if], data = [none]
} else {
return true; // depends on control dependency: [if], data = [none]
}
}
}
}
return false;
} } |
public class class_name {
public Short getHeaderKey(String value) {
if (StringUtils.isNotEmpty(value) && headerCache != null) {
return headerCache.getKey(value);
}
return null;
} } | public class class_name {
public Short getHeaderKey(String value) {
if (StringUtils.isNotEmpty(value) && headerCache != null) {
return headerCache.getKey(value); // depends on control dependency: [if], data = [none]
}
return null;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.