code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public void handleNotification(Notification notification, Object handback) {
if (notification instanceof AttributeChangeNotification) {
AttributeChangeNotification attributeChangeNotification = (AttributeChangeNotification) notification;
JobReport jobReport = (JobReport)attributeChangeNotification.getNewValue();
onJobReportUpdate(jobReport);
}
if (notification instanceof JMXConnectionNotification) {
JMXConnectionNotification jmxConnectionNotification = (JMXConnectionNotification) notification;
String type = jmxConnectionNotification.getType();
switch (type) {
case JMXConnectionNotification.OPENED: onConnectionOpened(); break;
case JMXConnectionNotification.CLOSED: onConnectionClosed(); break;
default: break;
}
}
} } | public class class_name {
public void handleNotification(Notification notification, Object handback) {
if (notification instanceof AttributeChangeNotification) {
AttributeChangeNotification attributeChangeNotification = (AttributeChangeNotification) notification;
JobReport jobReport = (JobReport)attributeChangeNotification.getNewValue();
onJobReportUpdate(jobReport); // depends on control dependency: [if], data = [none]
}
if (notification instanceof JMXConnectionNotification) {
JMXConnectionNotification jmxConnectionNotification = (JMXConnectionNotification) notification;
String type = jmxConnectionNotification.getType();
switch (type) {
case JMXConnectionNotification.OPENED: onConnectionOpened(); break;
case JMXConnectionNotification.CLOSED: onConnectionClosed(); break;
default: break;
}
}
} } |
public class class_name {
protected KeyBucket makeBucket(char c) {
if (c > this.buckets.length) {
// can't handle non-ASCII chars
return null;
}
int index = c;
// if we're case-insensitive, push uppercase into lowercase buckets
if (!isCaseSensitive() && (c >= 'A' && c <= 'Z')) {
index += 32;
}
if (null == this.buckets[index]) {
this.buckets[index] = new KeyBucket();
}
return this.buckets[index];
} } | public class class_name {
protected KeyBucket makeBucket(char c) {
if (c > this.buckets.length) {
// can't handle non-ASCII chars
return null; // depends on control dependency: [if], data = [none]
}
int index = c;
// if we're case-insensitive, push uppercase into lowercase buckets
if (!isCaseSensitive() && (c >= 'A' && c <= 'Z')) {
index += 32; // depends on control dependency: [if], data = [none]
}
if (null == this.buckets[index]) {
this.buckets[index] = new KeyBucket(); // depends on control dependency: [if], data = [none]
}
return this.buckets[index];
} } |
public class class_name {
public static ByteBuf wrappedBuffer(byte[] array) {
if (array.length == 0) {
return EMPTY_BUFFER;
}
return new UnpooledHeapByteBuf(ALLOC, array, array.length);
} } | public class class_name {
public static ByteBuf wrappedBuffer(byte[] array) {
if (array.length == 0) {
return EMPTY_BUFFER; // depends on control dependency: [if], data = [none]
}
return new UnpooledHeapByteBuf(ALLOC, array, array.length);
} } |
public class class_name {
@UnstableApi
public static Object[] staticMockMarker(Class<?>... clazz) {
Object[] markers = new Object[clazz.length];
for (int i = 0; i < clazz.length; i++) {
for (StaticMockitoSession session : sessions) {
markers[i] = session.staticMockMarker(clazz[i]);
if (markers[i] != null) {
break;
}
}
if (markers[i] == null) {
return null;
}
}
return markers;
} } | public class class_name {
@UnstableApi
public static Object[] staticMockMarker(Class<?>... clazz) {
Object[] markers = new Object[clazz.length];
for (int i = 0; i < clazz.length; i++) {
for (StaticMockitoSession session : sessions) {
markers[i] = session.staticMockMarker(clazz[i]); // depends on control dependency: [for], data = [session]
if (markers[i] != null) {
break;
}
}
if (markers[i] == null) {
return null; // depends on control dependency: [if], data = [none]
}
}
return markers;
} } |
public class class_name {
public static void insertTerm(Term[] terms, Term term, InsertTermType type) {
Term self = terms[term.getOffe()];
if (self == null) {
terms[term.getOffe()] = term;
return;
}
int len = term.getName().length();
// 如果是第一位置
if (self.getName().length() == len) {
if (type == InsertTermType.REPLACE) {
term.setNext(self.next());
terms[term.getOffe()] = term;
} else if (type == InsertTermType.SCORE_ADD_SORT) {
self.score(self.score() + term.score());
self.selfScore(self.selfScore() + term.selfScore());
}
return;
}
if (self.getName().length() > len) {
term.setNext(self);
terms[term.getOffe()] = term;
return;
}
Term next = self;
Term before = self;
while ((next = before.next()) != null) {
if (next.getName().length() == len) {
if (type == InsertTermType.REPLACE) {
term.setNext(next.next());
before.setNext(term);
} else if (type == InsertTermType.SCORE_ADD_SORT) {
next.score(next.score() + term.score());
next.selfScore(next.selfScore() + term.selfScore());
}
return;
} else if (next.getName().length() > len) {
before.setNext(term);
term.setNext(next);
return;
}
before = next;
}
before.setNext(term); // 如果都没有命中
} } | public class class_name {
public static void insertTerm(Term[] terms, Term term, InsertTermType type) {
Term self = terms[term.getOffe()];
if (self == null) {
terms[term.getOffe()] = term; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
int len = term.getName().length();
// 如果是第一位置
if (self.getName().length() == len) {
if (type == InsertTermType.REPLACE) {
term.setNext(self.next()); // depends on control dependency: [if], data = [none]
terms[term.getOffe()] = term; // depends on control dependency: [if], data = [none]
} else if (type == InsertTermType.SCORE_ADD_SORT) {
self.score(self.score() + term.score()); // depends on control dependency: [if], data = [none]
self.selfScore(self.selfScore() + term.selfScore()); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
if (self.getName().length() > len) {
term.setNext(self); // depends on control dependency: [if], data = [none]
terms[term.getOffe()] = term; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
Term next = self;
Term before = self;
while ((next = before.next()) != null) {
if (next.getName().length() == len) {
if (type == InsertTermType.REPLACE) {
term.setNext(next.next()); // depends on control dependency: [if], data = [none]
before.setNext(term); // depends on control dependency: [if], data = [none]
} else if (type == InsertTermType.SCORE_ADD_SORT) {
next.score(next.score() + term.score()); // depends on control dependency: [if], data = [none]
next.selfScore(next.selfScore() + term.selfScore()); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
} else if (next.getName().length() > len) {
before.setNext(term); // depends on control dependency: [if], data = [none]
term.setNext(next); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
before = next; // depends on control dependency: [while], data = [none]
}
before.setNext(term); // 如果都没有命中
} } |
public class class_name {
protected Runnable newProcessStreamReader(InputStream in) {
return () -> {
if (isRunning()) {
BufferedReader reader = newReader(in);
try {
for (String input = reader.readLine(); input != null; input = reader.readLine()) {
this.compositeProcessStreamListener.onInput(input);
}
}
catch (IOException ignore) {
// Ignore IO error and just stop reading from the process input stream
// The IO error occurred most likely because the process was terminated
}
finally {
close(reader);
}
}
};
} } | public class class_name {
protected Runnable newProcessStreamReader(InputStream in) {
return () -> {
if (isRunning()) {
BufferedReader reader = newReader(in);
try {
for (String input = reader.readLine(); input != null; input = reader.readLine()) {
this.compositeProcessStreamListener.onInput(input); // depends on control dependency: [for], data = [input]
}
}
catch (IOException ignore) {
// Ignore IO error and just stop reading from the process input stream
// The IO error occurred most likely because the process was terminated
} // depends on control dependency: [catch], data = [none]
finally {
close(reader);
}
}
};
} } |
public class class_name {
@Override
public String getPortletTitle(
IPortletWindowId portletWindowId,
HttpServletRequest request,
HttpServletResponse response) {
final IPortletDefinition portletDefinition = getPortletDefinition(portletWindowId, request);
final IPortletDefinitionParameter disableDynamicTitle =
portletDefinition.getParameter("disableDynamicTitle");
if (disableDynamicTitle == null || !Boolean.parseBoolean(disableDynamicTitle.getValue())) {
try {
final PortletRenderResult portletRenderResult =
getPortletRenderResult(portletWindowId, request, response);
if (portletRenderResult != null) {
final String title = portletRenderResult.getTitle();
if (title != null) {
return title;
}
}
} catch (Exception e) {
logger.warn(
"unable to get portlet title, falling back to title defined in channel definition for portletWindowId "
+ portletWindowId);
}
}
// we assume that response locale has been set to correct value
String locale = response.getLocale().toString();
// return portlet title from channel definition
return portletDefinition.getTitle(locale);
} } | public class class_name {
@Override
public String getPortletTitle(
IPortletWindowId portletWindowId,
HttpServletRequest request,
HttpServletResponse response) {
final IPortletDefinition portletDefinition = getPortletDefinition(portletWindowId, request);
final IPortletDefinitionParameter disableDynamicTitle =
portletDefinition.getParameter("disableDynamicTitle");
if (disableDynamicTitle == null || !Boolean.parseBoolean(disableDynamicTitle.getValue())) {
try {
final PortletRenderResult portletRenderResult =
getPortletRenderResult(portletWindowId, request, response);
if (portletRenderResult != null) {
final String title = portletRenderResult.getTitle();
if (title != null) {
return title; // depends on control dependency: [if], data = [none]
}
}
} catch (Exception e) {
logger.warn(
"unable to get portlet title, falling back to title defined in channel definition for portletWindowId "
+ portletWindowId);
} // depends on control dependency: [catch], data = [none]
}
// we assume that response locale has been set to correct value
String locale = response.getLocale().toString();
// return portlet title from channel definition
return portletDefinition.getTitle(locale);
} } |
public class class_name {
public void sendAlert(Type type, String message) {
CmsNotificationMessage notificationMessage = new CmsNotificationMessage(Mode.BROADCAST, type, message);
m_messages.add(notificationMessage);
if (hasWidget()) {
m_widget.addMessage(notificationMessage);
}
} } | public class class_name {
public void sendAlert(Type type, String message) {
CmsNotificationMessage notificationMessage = new CmsNotificationMessage(Mode.BROADCAST, type, message);
m_messages.add(notificationMessage);
if (hasWidget()) {
m_widget.addMessage(notificationMessage); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ScreenParent makeScreen(ScreenLoc itsLocation, ComponentParent parentScreen, int iDocMode, Map<String,Object> properties)
{
ScreenParent screen = null;
if ((iDocMode & MessageLog.MESSAGE_SCREEN_MODE) == MessageLog.MESSAGE_SCREEN_MODE)
{
if ((this.getEditMode() == DBConstants.EDIT_ADD) || (this.getEditMode() == DBConstants.EDIT_NONE))
{
String strObjectID = parentScreen.getProperty(DBConstants.OBJECT_ID);
if ((strObjectID != null) && (strObjectID.length() > 0))
{
try {
this.setHandle(strObjectID, DBConstants.BOOKMARK_HANDLE);
} catch (DBException ex) {
ex.printStackTrace();
}
}
}
if ((this.getEditMode() == DBConstants.EDIT_CURRENT) || (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
{
String strScreenClass = this.getProperty(ScreenMessageTransport.SCREEN_SCREEN);
if (strScreenClass == null)
strScreenClass = this.getProperty(DBParams.SCREEN);
if (strScreenClass != null)
{
parentScreen.setProperty(TrxMessageHeader.LOG_TRX_ID, this.getProperty(TrxMessageHeader.LOG_TRX_ID));
screen = Record.makeNewScreen(strScreenClass, itsLocation, parentScreen, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties, null, true);
}
}
if (screen == null) // ? I don't NOW what else to do?
screen = Record.makeNewScreen(MESSAGE_LOG_SCREEN_CLASS, itsLocation, parentScreen, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties, this, true);
}
else if ((iDocMode & MessageLog.SOURCE_SCREEN_MODE) == MessageLog.SOURCE_SCREEN_MODE)
{
String strReferenceClass = this.getProperty(TrxMessageHeader.REFERENCE_CLASS);
String strReferenceID = this.getField(MessageLog.REFERENCE_ID).toString();
if (strReferenceID == null)
strReferenceID = this.getProperty(TrxMessageHeader.REFERENCE_ID);
if ((strReferenceClass != null) && (strReferenceID != null))
{
Record record = Record.makeRecordFromClassName(strReferenceClass, this.findRecordOwner());
if (record != null)
{
try {
record.addNew();
record.getCounterField().setString(strReferenceID);
if (record.seek(null))
{
iDocMode = ScreenConstants.MAINT_MODE;
screen = record.makeScreen(itsLocation, parentScreen, iDocMode, properties);
}
} catch (DBException e) {
e.printStackTrace();
}
}
}
}
else if ((iDocMode & ScreenConstants.MAINT_MODE) == ScreenConstants.MAINT_MODE)
screen = Record.makeNewScreen(MESSAGE_LOG_SCREEN_CLASS, itsLocation, parentScreen, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties, this, true);
else
screen = Record.makeNewScreen(MESSAGE_LOG_GRID_SCREEN_CLASS, itsLocation, parentScreen, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties, this, true);
return screen;
} } | public class class_name {
public ScreenParent makeScreen(ScreenLoc itsLocation, ComponentParent parentScreen, int iDocMode, Map<String,Object> properties)
{
ScreenParent screen = null;
if ((iDocMode & MessageLog.MESSAGE_SCREEN_MODE) == MessageLog.MESSAGE_SCREEN_MODE)
{
if ((this.getEditMode() == DBConstants.EDIT_ADD) || (this.getEditMode() == DBConstants.EDIT_NONE))
{
String strObjectID = parentScreen.getProperty(DBConstants.OBJECT_ID);
if ((strObjectID != null) && (strObjectID.length() > 0))
{
try {
this.setHandle(strObjectID, DBConstants.BOOKMARK_HANDLE); // depends on control dependency: [try], data = [none]
} catch (DBException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
}
if ((this.getEditMode() == DBConstants.EDIT_CURRENT) || (this.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
{
String strScreenClass = this.getProperty(ScreenMessageTransport.SCREEN_SCREEN);
if (strScreenClass == null)
strScreenClass = this.getProperty(DBParams.SCREEN);
if (strScreenClass != null)
{
parentScreen.setProperty(TrxMessageHeader.LOG_TRX_ID, this.getProperty(TrxMessageHeader.LOG_TRX_ID)); // depends on control dependency: [if], data = [none]
screen = Record.makeNewScreen(strScreenClass, itsLocation, parentScreen, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties, null, true); // depends on control dependency: [if], data = [(strScreenClass]
}
}
if (screen == null) // ? I don't NOW what else to do?
screen = Record.makeNewScreen(MESSAGE_LOG_SCREEN_CLASS, itsLocation, parentScreen, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties, this, true);
}
else if ((iDocMode & MessageLog.SOURCE_SCREEN_MODE) == MessageLog.SOURCE_SCREEN_MODE)
{
String strReferenceClass = this.getProperty(TrxMessageHeader.REFERENCE_CLASS);
String strReferenceID = this.getField(MessageLog.REFERENCE_ID).toString();
if (strReferenceID == null)
strReferenceID = this.getProperty(TrxMessageHeader.REFERENCE_ID);
if ((strReferenceClass != null) && (strReferenceID != null))
{
Record record = Record.makeRecordFromClassName(strReferenceClass, this.findRecordOwner());
if (record != null)
{
try {
record.addNew(); // depends on control dependency: [try], data = [none]
record.getCounterField().setString(strReferenceID); // depends on control dependency: [try], data = [none]
if (record.seek(null))
{
iDocMode = ScreenConstants.MAINT_MODE; // depends on control dependency: [if], data = [none]
screen = record.makeScreen(itsLocation, parentScreen, iDocMode, properties); // depends on control dependency: [if], data = [none]
}
} catch (DBException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
}
}
else if ((iDocMode & ScreenConstants.MAINT_MODE) == ScreenConstants.MAINT_MODE)
screen = Record.makeNewScreen(MESSAGE_LOG_SCREEN_CLASS, itsLocation, parentScreen, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties, this, true);
else
screen = Record.makeNewScreen(MESSAGE_LOG_GRID_SCREEN_CLASS, itsLocation, parentScreen, iDocMode | ScreenConstants.DONT_DISPLAY_FIELD_DESC, properties, this, true);
return screen;
} } |
public class class_name {
@Override
protected ResolutionResult resolveDependencies(String projectFolder, String topLevelFolder, Set<String> bomFiles) {
Collection<DependencyInfo> dependencies = new LinkedList<>();
for (String htmlFile : bomFiles) {
Document htmlFileDocument;
try {
// todo consider collect other tags - not ser only
htmlFileDocument = Jsoup.parse(new File(htmlFile), Constants.UTF8);
Elements script = htmlFileDocument.getElementsByAttribute(Constants.SRC);
// create list of links for .js files for each html file
List<String> scriptUrls = new LinkedList<>();
for (Element srcLink : script) {
String src = srcLink.attr(Constants.SRC);
if (src != null && isLegitSrcUrl(src)) {
String srcUrl = fixUrls(src);
if (srcUrl != null) {
scriptUrls.add(srcUrl);
}
}
}
dependencies.addAll(collectJsFilesAndCalcHashes(scriptUrls, htmlFile, this.urlResponseMap));
} catch (IOException e) {
logger.debug("Cannot parse the html file: {}", htmlFile);
}
}
// delete parent folder of HTML Resolver
try {
new TempFolders().deleteTempFoldersHelper(Paths.get(System.getProperty("java.io.tmpdir"), TempFolders.UNIQUE_HTML_TEMP_FOLDER).toString());
} catch (Exception e) {
logger.debug("Failed to delete HTML Dependency Resolver Folder{}", e.getMessage());
}
// check the type and excludes
return new ResolutionResult(dependencies, getExcludes(), getDependencyType(), topLevelFolder);
} } | public class class_name {
@Override
protected ResolutionResult resolveDependencies(String projectFolder, String topLevelFolder, Set<String> bomFiles) {
Collection<DependencyInfo> dependencies = new LinkedList<>();
for (String htmlFile : bomFiles) {
Document htmlFileDocument;
try {
// todo consider collect other tags - not ser only
htmlFileDocument = Jsoup.parse(new File(htmlFile), Constants.UTF8); // depends on control dependency: [try], data = [none]
Elements script = htmlFileDocument.getElementsByAttribute(Constants.SRC);
// create list of links for .js files for each html file
List<String> scriptUrls = new LinkedList<>();
for (Element srcLink : script) {
String src = srcLink.attr(Constants.SRC);
if (src != null && isLegitSrcUrl(src)) {
String srcUrl = fixUrls(src);
if (srcUrl != null) {
scriptUrls.add(srcUrl); // depends on control dependency: [if], data = [(srcUrl]
}
}
}
dependencies.addAll(collectJsFilesAndCalcHashes(scriptUrls, htmlFile, this.urlResponseMap)); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.debug("Cannot parse the html file: {}", htmlFile);
} // depends on control dependency: [catch], data = [none]
}
// delete parent folder of HTML Resolver
try {
new TempFolders().deleteTempFoldersHelper(Paths.get(System.getProperty("java.io.tmpdir"), TempFolders.UNIQUE_HTML_TEMP_FOLDER).toString()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.debug("Failed to delete HTML Dependency Resolver Folder{}", e.getMessage());
} // depends on control dependency: [catch], data = [none]
// check the type and excludes
return new ResolutionResult(dependencies, getExcludes(), getDependencyType(), topLevelFolder);
} } |
public class class_name {
protected void addUserAgentRequestHeader(HttpState state,
HttpConnection conn)
throws IOException, HttpException {
LOG.trace("enter HttpMethodBase.addUserAgentRequestHeaders(HttpState, "
+ "HttpConnection)");
if (getRequestHeader("User-Agent") == null) {
String agent = (String)getParams().getParameter(HttpMethodParams.USER_AGENT);
if (agent == null) {
agent = "Jakarta Commons-HttpClient";
}
setRequestHeader("User-Agent", agent);
}
} } | public class class_name {
protected void addUserAgentRequestHeader(HttpState state,
HttpConnection conn)
throws IOException, HttpException {
LOG.trace("enter HttpMethodBase.addUserAgentRequestHeaders(HttpState, "
+ "HttpConnection)");
if (getRequestHeader("User-Agent") == null) {
String agent = (String)getParams().getParameter(HttpMethodParams.USER_AGENT);
if (agent == null) {
agent = "Jakarta Commons-HttpClient"; // depends on control dependency: [if], data = [none]
}
setRequestHeader("User-Agent", agent);
}
} } |
public class class_name {
public static Tag valueOf(String tagName, ParseSettings settings) {
Validate.notNull(tagName);
Tag tag = tags.get(tagName);
if (tag == null) {
tagName = settings.normalizeTag(tagName);
Validate.notEmpty(tagName);
tag = tags.get(tagName);
if (tag == null) {
// not defined: create default; go anywhere, do anything! (incl be inside a <p>)
tag = new Tag(tagName);
tag.isBlock = false;
}
}
return tag;
} } | public class class_name {
public static Tag valueOf(String tagName, ParseSettings settings) {
Validate.notNull(tagName);
Tag tag = tags.get(tagName);
if (tag == null) {
tagName = settings.normalizeTag(tagName); // depends on control dependency: [if], data = [(tag]
Validate.notEmpty(tagName); // depends on control dependency: [if], data = [(tag]
tag = tags.get(tagName); // depends on control dependency: [if], data = [(tag]
if (tag == null) {
// not defined: create default; go anywhere, do anything! (incl be inside a <p>)
tag = new Tag(tagName); // depends on control dependency: [if], data = [(tag]
tag.isBlock = false; // depends on control dependency: [if], data = [none]
}
}
return tag;
} } |
public class class_name {
@Override
public void create(PlatformMode platformMode, KubernetesListBuilder builder) {
final String name = config.getNamespace();
if (name == null || name.isEmpty()) {
return;
}
if (!KubernetesResourceUtil.checkForKind(builder, NAMESPACE_KINDS)) {
String type = getConfig(Config.type);
if ("project".equalsIgnoreCase(type) || "namespace".equalsIgnoreCase(type)) {
if (platformMode == PlatformMode.kubernetes) {
log.info("Adding a default Namespace:" + config.getNamespace());
Namespace namespace = handlerHub.getNamespaceHandler().getNamespace(config.getNamespace());
builder.addToNamespaceItems(namespace);
} else {
log.info("Adding a default Project" + config.getNamespace());
Project project = handlerHub.getProjectHandler().getProject(config.getNamespace());
builder.addToProjectItems(project);
}
}
}
} } | public class class_name {
@Override
public void create(PlatformMode platformMode, KubernetesListBuilder builder) {
final String name = config.getNamespace();
if (name == null || name.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
if (!KubernetesResourceUtil.checkForKind(builder, NAMESPACE_KINDS)) {
String type = getConfig(Config.type);
if ("project".equalsIgnoreCase(type) || "namespace".equalsIgnoreCase(type)) {
if (platformMode == PlatformMode.kubernetes) {
log.info("Adding a default Namespace:" + config.getNamespace()); // depends on control dependency: [if], data = [none]
Namespace namespace = handlerHub.getNamespaceHandler().getNamespace(config.getNamespace());
builder.addToNamespaceItems(namespace); // depends on control dependency: [if], data = [none]
} else {
log.info("Adding a default Project" + config.getNamespace()); // depends on control dependency: [if], data = [none]
Project project = handlerHub.getProjectHandler().getProject(config.getNamespace());
builder.addToProjectItems(project); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public static List<ImageConfiguration> resolveImages(Logger logger,
List<ImageConfiguration> images,
Resolver imageResolver,
String imageNameFilter,
Customizer imageCustomizer) {
List<ImageConfiguration> ret = resolveConfiguration(imageResolver, images);
ret = imageCustomizer.customizeConfig(ret);
List<ImageConfiguration> filtered = filterImages(imageNameFilter,ret);
if (ret.size() > 0 && filtered.size() == 0 && imageNameFilter != null) {
List<String> imageNames = new ArrayList<>();
for (ImageConfiguration image : ret) {
imageNames.add(image.getName());
}
logger.warn("None of the resolved images [%s] match the configured filter '%s'",
StringUtils.join(imageNames.iterator(), ","), imageNameFilter);
}
return filtered;
} } | public class class_name {
public static List<ImageConfiguration> resolveImages(Logger logger,
List<ImageConfiguration> images,
Resolver imageResolver,
String imageNameFilter,
Customizer imageCustomizer) {
List<ImageConfiguration> ret = resolveConfiguration(imageResolver, images);
ret = imageCustomizer.customizeConfig(ret);
List<ImageConfiguration> filtered = filterImages(imageNameFilter,ret);
if (ret.size() > 0 && filtered.size() == 0 && imageNameFilter != null) {
List<String> imageNames = new ArrayList<>();
for (ImageConfiguration image : ret) {
imageNames.add(image.getName()); // depends on control dependency: [for], data = [image]
}
logger.warn("None of the resolved images [%s] match the configured filter '%s'",
StringUtils.join(imageNames.iterator(), ","), imageNameFilter); // depends on control dependency: [if], data = [none]
}
return filtered;
} } |
public class class_name {
public Helix getByLowestAngle() {
double angle = Double.MAX_VALUE;
Helix lowest = null;
for (Helix helix: helices) {
if (helix.getAngle() < angle) {
angle = helix.getAngle();
lowest = helix;
}
}
return lowest;
} } | public class class_name {
public Helix getByLowestAngle() {
double angle = Double.MAX_VALUE;
Helix lowest = null;
for (Helix helix: helices) {
if (helix.getAngle() < angle) {
angle = helix.getAngle(); // depends on control dependency: [if], data = [none]
lowest = helix; // depends on control dependency: [if], data = [none]
}
}
return lowest;
} } |
public class class_name {
public Double getDoubleFrom(JsonValue json) {
if (json.isNumber()) {
return json.asDouble();
} else {
return Double.valueOf(json.asString());
}
} } | public class class_name {
public Double getDoubleFrom(JsonValue json) {
if (json.isNumber()) {
return json.asDouble(); // depends on control dependency: [if], data = [none]
} else {
return Double.valueOf(json.asString()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public JimfsPath emptyPath() {
JimfsPath result = emptyPath;
if (result == null) {
// use createPathInternal to avoid recursive call from createPath()
result = createPathInternal(null, ImmutableList.of(Name.EMPTY));
emptyPath = result;
return result;
}
return result;
} } | public class class_name {
public JimfsPath emptyPath() {
JimfsPath result = emptyPath;
if (result == null) {
// use createPathInternal to avoid recursive call from createPath()
result = createPathInternal(null, ImmutableList.of(Name.EMPTY)); // depends on control dependency: [if], data = [none]
emptyPath = result; // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
@Implementation @HiddenApi
protected final int loadResourceBagValue(int ident, int bagEntryId, TypedValue outValue,
boolean resolve) {
CppAssetManager am = assetManagerForJavaObject();
if (am == null) {
return 0;
}
final ResTable res = am.getResources();
return loadResourceBagValueInternal(ident, bagEntryId, outValue, resolve, res);
} } | public class class_name {
@Implementation @HiddenApi
protected final int loadResourceBagValue(int ident, int bagEntryId, TypedValue outValue,
boolean resolve) {
CppAssetManager am = assetManagerForJavaObject();
if (am == null) {
return 0; // depends on control dependency: [if], data = [none]
}
final ResTable res = am.getResources();
return loadResourceBagValueInternal(ident, bagEntryId, outValue, resolve, res);
} } |
public class class_name {
public String printDefaultValue() {
if (setter instanceof Getter) {
Getter getter = (Getter)setter;
List<T> defaultValues = getter.getValueList();
StringBuilder buf = new StringBuilder();
for (T v : defaultValues) {
if (buf.length()>0) buf.append(delimiter);
buf.append(print(v));
}
return buf.toString();
}
return null;
} } | public class class_name {
public String printDefaultValue() {
if (setter instanceof Getter) {
Getter getter = (Getter)setter;
List<T> defaultValues = getter.getValueList();
StringBuilder buf = new StringBuilder();
for (T v : defaultValues) {
if (buf.length()>0) buf.append(delimiter);
buf.append(print(v)); // depends on control dependency: [for], data = [v]
}
return buf.toString(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public static TreeSet<Class<?>> getAllInterfaces(Class<?> cls) {
final TreeSet<Class<?>> interfacesFound = new TreeSet<>(
(c1, c2) -> {
if (c1.equals(c2)) {
return 0;
} else if (c1.isAssignableFrom(c2)) {
return 1;
} else {
return -1;
}
}
);
getAllInterfaces(cls, interfacesFound);
return interfacesFound;
} } | public class class_name {
public static TreeSet<Class<?>> getAllInterfaces(Class<?> cls) {
final TreeSet<Class<?>> interfacesFound = new TreeSet<>(
(c1, c2) -> {
if (c1.equals(c2)) {
return 0; // depends on control dependency: [if], data = [none]
} else if (c1.isAssignableFrom(c2)) {
return 1; // depends on control dependency: [if], data = [none]
} else {
return -1; // depends on control dependency: [if], data = [none]
}
}
);
getAllInterfaces(cls, interfacesFound);
return interfacesFound;
} } |
public class class_name {
public Socket accept() throws IOException{
Socket s;
if(!doing_direct){
if(proxy == null) return null;
ProxyMessage msg = proxy.accept();
s = msg.ip == null? new SocksSocket(msg.host,msg.port,proxy)
: new SocksSocket(msg.ip,msg.port,proxy);
//Set timeout back to 0
proxy.proxySocket.setSoTimeout(0);
}else{ //Direct Connection
//Mimic the proxy behaviour,
//only accept connections from the speciefed host.
while(true){
s = super.accept();
if(s.getInetAddress().equals(remoteAddr)){
//got the connection from the right host
//Close listenning socket.
break;
}else
s.close(); //Drop all connections from other hosts
}
}
proxy = null;
//Return accepted socket
return s;
} } | public class class_name {
public Socket accept() throws IOException{
Socket s;
if(!doing_direct){
if(proxy == null) return null;
ProxyMessage msg = proxy.accept();
s = msg.ip == null? new SocksSocket(msg.host,msg.port,proxy)
: new SocksSocket(msg.ip,msg.port,proxy);
//Set timeout back to 0
proxy.proxySocket.setSoTimeout(0);
}else{ //Direct Connection
//Mimic the proxy behaviour,
//only accept connections from the speciefed host.
while(true){
s = super.accept(); // depends on control dependency: [while], data = [none]
if(s.getInetAddress().equals(remoteAddr)){
//got the connection from the right host
//Close listenning socket.
break;
}else
s.close(); //Drop all connections from other hosts
}
}
proxy = null;
//Return accepted socket
return s;
} } |
public class class_name {
private void clearStaleTimeouts() {
Iterator iterator = knownAlarms.values().iterator();
long currentTime = System.currentTimeMillis();
while (iterator.hasNext()) {
Long firstSeenTime = (Long)iterator.next();
// if period has expired remove reference to the notification
if ((firstSeenTime.longValue() + period) < currentTime) {
iterator.remove();
}
}
} } | public class class_name {
private void clearStaleTimeouts() {
Iterator iterator = knownAlarms.values().iterator();
long currentTime = System.currentTimeMillis();
while (iterator.hasNext()) {
Long firstSeenTime = (Long)iterator.next();
// if period has expired remove reference to the notification
if ((firstSeenTime.longValue() + period) < currentTime) {
iterator.remove(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void marshall(InstanceSnapshot instanceSnapshot, ProtocolMarshaller protocolMarshaller) {
if (instanceSnapshot == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(instanceSnapshot.getName(), NAME_BINDING);
protocolMarshaller.marshall(instanceSnapshot.getArn(), ARN_BINDING);
protocolMarshaller.marshall(instanceSnapshot.getSupportCode(), SUPPORTCODE_BINDING);
protocolMarshaller.marshall(instanceSnapshot.getCreatedAt(), CREATEDAT_BINDING);
protocolMarshaller.marshall(instanceSnapshot.getLocation(), LOCATION_BINDING);
protocolMarshaller.marshall(instanceSnapshot.getResourceType(), RESOURCETYPE_BINDING);
protocolMarshaller.marshall(instanceSnapshot.getTags(), TAGS_BINDING);
protocolMarshaller.marshall(instanceSnapshot.getState(), STATE_BINDING);
protocolMarshaller.marshall(instanceSnapshot.getProgress(), PROGRESS_BINDING);
protocolMarshaller.marshall(instanceSnapshot.getFromAttachedDisks(), FROMATTACHEDDISKS_BINDING);
protocolMarshaller.marshall(instanceSnapshot.getFromInstanceName(), FROMINSTANCENAME_BINDING);
protocolMarshaller.marshall(instanceSnapshot.getFromInstanceArn(), FROMINSTANCEARN_BINDING);
protocolMarshaller.marshall(instanceSnapshot.getFromBlueprintId(), FROMBLUEPRINTID_BINDING);
protocolMarshaller.marshall(instanceSnapshot.getFromBundleId(), FROMBUNDLEID_BINDING);
protocolMarshaller.marshall(instanceSnapshot.getSizeInGb(), SIZEINGB_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(InstanceSnapshot instanceSnapshot, ProtocolMarshaller protocolMarshaller) {
if (instanceSnapshot == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(instanceSnapshot.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSnapshot.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSnapshot.getSupportCode(), SUPPORTCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSnapshot.getCreatedAt(), CREATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSnapshot.getLocation(), LOCATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSnapshot.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSnapshot.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSnapshot.getState(), STATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSnapshot.getProgress(), PROGRESS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSnapshot.getFromAttachedDisks(), FROMATTACHEDDISKS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSnapshot.getFromInstanceName(), FROMINSTANCENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSnapshot.getFromInstanceArn(), FROMINSTANCEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSnapshot.getFromBlueprintId(), FROMBLUEPRINTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSnapshot.getFromBundleId(), FROMBUNDLEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(instanceSnapshot.getSizeInGb(), SIZEINGB_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 JSON readFromFile( File file ) {
if( file == null ){
throw new JSONException( "File is null" );
}
if( !file.canRead() ){
throw new JSONException( "Can't read input file" );
}
if( file.isDirectory() ){
throw new JSONException( "File is a directory" );
}
try{
return readFromStream( new FileInputStream( file ) );
}catch( IOException ioe ){
throw new JSONException( ioe );
}
} } | public class class_name {
public JSON readFromFile( File file ) {
if( file == null ){
throw new JSONException( "File is null" );
}
if( !file.canRead() ){
throw new JSONException( "Can't read input file" );
}
if( file.isDirectory() ){
throw new JSONException( "File is a directory" );
}
try{
return readFromStream( new FileInputStream( file ) ); // depends on control dependency: [try], data = [none]
}catch( IOException ioe ){
throw new JSONException( ioe );
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public EntityManager em(String name) {
EntityManagerFactory emf = emfs.get(name);
if (emf == null) {
return null;
}
return emf.createEntityManager();
} } | public class class_name {
public EntityManager em(String name) {
EntityManagerFactory emf = emfs.get(name);
if (emf == null) {
return null; // depends on control dependency: [if], data = [none]
}
return emf.createEntityManager();
} } |
public class class_name {
public static Map<File, Exception> addFolderToClasspath(File folder, FileFilter fileFilter) throws ReflectiveOperationException {
Map<File, Exception> ret = Maps.newHashMap();
URLClassLoader sysURLClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
Class<? extends URLClassLoader> classLoaderClass = URLClassLoader.class;
Method method = classLoaderClass.getDeclaredMethod("addURL", URL.class);
method.setAccessible(true);
for (File f : folder.listFiles(fileFilter)) {
try {
method.invoke(sysURLClassLoader, f.toURI().toURL());
} catch (ReflectiveOperationException | IOException e) {
ret.put(f, e);
}
}
return ret;
} } | public class class_name {
public static Map<File, Exception> addFolderToClasspath(File folder, FileFilter fileFilter) throws ReflectiveOperationException {
Map<File, Exception> ret = Maps.newHashMap();
URLClassLoader sysURLClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
Class<? extends URLClassLoader> classLoaderClass = URLClassLoader.class;
Method method = classLoaderClass.getDeclaredMethod("addURL", URL.class);
method.setAccessible(true);
for (File f : folder.listFiles(fileFilter)) {
try {
method.invoke(sysURLClassLoader, f.toURI().toURL()); // depends on control dependency: [try], data = [none]
} catch (ReflectiveOperationException | IOException e) {
ret.put(f, e);
} // depends on control dependency: [catch], data = [none]
}
return ret;
} } |
public class class_name {
TreePath makeTreePath(TreeNode node) {
ArrayList<TreeNode> path = new ArrayList<>();
path.add( node);
TreeNode parent = node.getParent();
while (parent != null) {
path.add(0, parent);
parent = parent.getParent();
}
Object[] paths = path.toArray();
return new TreePath(paths);
} } | public class class_name {
TreePath makeTreePath(TreeNode node) {
ArrayList<TreeNode> path = new ArrayList<>();
path.add( node);
TreeNode parent = node.getParent();
while (parent != null) {
path.add(0, parent); // depends on control dependency: [while], data = [none]
parent = parent.getParent(); // depends on control dependency: [while], data = [none]
}
Object[] paths = path.toArray();
return new TreePath(paths);
} } |
public class class_name {
public void setFolderList(java.util.Collection<String> folderList) {
if (folderList == null) {
this.folderList = null;
return;
}
this.folderList = new com.amazonaws.internal.SdkInternalList<String>(folderList);
} } | public class class_name {
public void setFolderList(java.util.Collection<String> folderList) {
if (folderList == null) {
this.folderList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.folderList = new com.amazonaws.internal.SdkInternalList<String>(folderList);
} } |
public class class_name {
public void marshall(PushSync pushSync, ProtocolMarshaller protocolMarshaller) {
if (pushSync == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(pushSync.getApplicationArns(), APPLICATIONARNS_BINDING);
protocolMarshaller.marshall(pushSync.getRoleArn(), ROLEARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(PushSync pushSync, ProtocolMarshaller protocolMarshaller) {
if (pushSync == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(pushSync.getApplicationArns(), APPLICATIONARNS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(pushSync.getRoleArn(), ROLEARN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected void createNewFile(final File file) {
try {
file.createNewFile();
setFileNotWorldReadablePermissions(file);
} catch (IOException e){
throw new RuntimeException(e);
}
} } | public class class_name {
protected void createNewFile(final File file) {
try {
file.createNewFile(); // depends on control dependency: [try], data = [none]
setFileNotWorldReadablePermissions(file); // depends on control dependency: [try], data = [none]
} catch (IOException e){
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void parsePattern(List<NT> ntList, List<Vertex> vertexList, final WordNet wordNetOptimum, final WordNet wordNetAll)
{
// ListIterator<Vertex> listIterator = vertexList.listIterator();
StringBuilder sbPattern = new StringBuilder(ntList.size());
for (NT nt : ntList)
{
sbPattern.append(nt.toString());
}
String pattern = sbPattern.toString();
final Vertex[] wordArray = vertexList.toArray(new Vertex[0]);
trie.parseText(pattern, new AhoCorasickDoubleArrayTrie.IHit<String>()
{
@Override
public void hit(int begin, int end, String keyword)
{
StringBuilder sbName = new StringBuilder();
for (int i = begin; i < end; ++i)
{
sbName.append(wordArray[i].realWord);
}
String name = sbName.toString();
// 对一些bad case做出调整
if (isBadCase(name)) return;
// 正式算它是一个名字
if (HanLP.Config.DEBUG)
{
System.out.printf("识别出机构名:%s %s\n", name, keyword);
}
int offset = 0;
for (int i = 0; i < begin; ++i)
{
offset += wordArray[i].realWord.length();
}
wordNetOptimum.insert(offset, new Vertex(Predefine.TAG_GROUP, name, ATTRIBUTE, WORD_ID), wordNetAll);
}
});
} } | public class class_name {
public static void parsePattern(List<NT> ntList, List<Vertex> vertexList, final WordNet wordNetOptimum, final WordNet wordNetAll)
{
// ListIterator<Vertex> listIterator = vertexList.listIterator();
StringBuilder sbPattern = new StringBuilder(ntList.size());
for (NT nt : ntList)
{
sbPattern.append(nt.toString()); // depends on control dependency: [for], data = [nt]
}
String pattern = sbPattern.toString();
final Vertex[] wordArray = vertexList.toArray(new Vertex[0]);
trie.parseText(pattern, new AhoCorasickDoubleArrayTrie.IHit<String>()
{
@Override
public void hit(int begin, int end, String keyword)
{
StringBuilder sbName = new StringBuilder();
for (int i = begin; i < end; ++i)
{
sbName.append(wordArray[i].realWord); // depends on control dependency: [for], data = [i]
}
String name = sbName.toString();
// 对一些bad case做出调整
if (isBadCase(name)) return;
// 正式算它是一个名字
if (HanLP.Config.DEBUG)
{
System.out.printf("识别出机构名:%s %s\n", name, keyword); // depends on control dependency: [if], data = [none]
}
int offset = 0;
for (int i = 0; i < begin; ++i)
{
offset += wordArray[i].realWord.length(); // depends on control dependency: [for], data = [i]
}
wordNetOptimum.insert(offset, new Vertex(Predefine.TAG_GROUP, name, ATTRIBUTE, WORD_ID), wordNetAll);
}
});
} } |
public class class_name {
public static Map<InetAddress, Map<String,String>> loadDcRackInfo()
{
Map<InetAddress, Map<String, String>> result = new HashMap<InetAddress, Map<String, String>>();
for (UntypedResultSet.Row row : executeInternal("SELECT peer, data_center, rack from system." + PEERS_CF))
{
InetAddress peer = row.getInetAddress("peer");
if (row.has("data_center") && row.has("rack"))
{
Map<String, String> dcRack = new HashMap<String, String>();
dcRack.put("data_center", row.getString("data_center"));
dcRack.put("rack", row.getString("rack"));
result.put(peer, dcRack);
}
}
return result;
} } | public class class_name {
public static Map<InetAddress, Map<String,String>> loadDcRackInfo()
{
Map<InetAddress, Map<String, String>> result = new HashMap<InetAddress, Map<String, String>>();
for (UntypedResultSet.Row row : executeInternal("SELECT peer, data_center, rack from system." + PEERS_CF))
{
InetAddress peer = row.getInetAddress("peer");
if (row.has("data_center") && row.has("rack"))
{
Map<String, String> dcRack = new HashMap<String, String>();
dcRack.put("data_center", row.getString("data_center")); // depends on control dependency: [if], data = [none]
dcRack.put("rack", row.getString("rack")); // depends on control dependency: [if], data = [none]
result.put(peer, dcRack); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public T typeface(Typeface tf) {
if (view instanceof TextView) {
TextView tv = (TextView) view;
tv.setTypeface(tf);
}
return self();
} } | public class class_name {
public T typeface(Typeface tf) {
if (view instanceof TextView) {
TextView tv = (TextView) view;
tv.setTypeface(tf); // depends on control dependency: [if], data = [none]
}
return self();
} } |
public class class_name {
public static Double getMaxZ(Geometry geom) {
if (geom != null) {
return CoordinateUtils.zMinMax(geom.getCoordinates())[1];
} else {
return null;
}
} } | public class class_name {
public static Double getMaxZ(Geometry geom) {
if (geom != null) {
return CoordinateUtils.zMinMax(geom.getCoordinates())[1]; // depends on control dependency: [if], data = [(geom]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static DependencyVersion parseVersion(String text, boolean firstMatchOnly) {
if (text == null) {
return null;
}
//'-' is a special case used within the CVE entries, just include it as the version.
if ("-".equals(text)) {
final DependencyVersion dv = new DependencyVersion();
final List<String> list = new ArrayList<>();
list.add(text);
dv.setVersionParts(list);
return dv;
}
String version = null;
Matcher matcher = RX_VERSION.matcher(text);
if (matcher.find()) {
version = matcher.group();
}
//throw away the results if there are two things that look like version numbers
if (!firstMatchOnly && matcher.find()) {
return null;
}
if (version == null) {
matcher = RX_SINGLE_VERSION.matcher(text);
if (matcher.find()) {
version = matcher.group();
} else {
return null;
}
//throw away the results if there are two things that look like version numbers
if (matcher.find()) {
return null;
}
}
if (version != null && version.endsWith("-py2") && version.length() > 4) {
version = version.substring(0, version.length() - 4);
}
return new DependencyVersion(version);
} } | public class class_name {
public static DependencyVersion parseVersion(String text, boolean firstMatchOnly) {
if (text == null) {
return null; // depends on control dependency: [if], data = [none]
}
//'-' is a special case used within the CVE entries, just include it as the version.
if ("-".equals(text)) {
final DependencyVersion dv = new DependencyVersion();
final List<String> list = new ArrayList<>();
list.add(text); // depends on control dependency: [if], data = [none]
dv.setVersionParts(list); // depends on control dependency: [if], data = [none]
return dv; // depends on control dependency: [if], data = [none]
}
String version = null;
Matcher matcher = RX_VERSION.matcher(text);
if (matcher.find()) {
version = matcher.group(); // depends on control dependency: [if], data = [none]
}
//throw away the results if there are two things that look like version numbers
if (!firstMatchOnly && matcher.find()) {
return null; // depends on control dependency: [if], data = [none]
}
if (version == null) {
matcher = RX_SINGLE_VERSION.matcher(text); // depends on control dependency: [if], data = [none]
if (matcher.find()) {
version = matcher.group(); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
//throw away the results if there are two things that look like version numbers
if (matcher.find()) {
return null; // depends on control dependency: [if], data = [none]
}
}
if (version != null && version.endsWith("-py2") && version.length() > 4) {
version = version.substring(0, version.length() - 4); // depends on control dependency: [if], data = [none]
}
return new DependencyVersion(version);
} } |
public class class_name {
private void getInfo(Formatter buf) {
int countGridset = 0;
for (Gridset gs : gridsetHash.values()) {
GridCoordSystem gcs = gs.getGeoCoordSystem();
buf.format("%nGridset %d coordSys=%s", countGridset, gcs);
buf.format(" LLbb=%s ", gcs.getLatLonBoundingBox());
if ((gcs.getProjection() != null) && !gcs.getProjection().isLatLon())
buf.format(" bb= %s", gcs.getBoundingBox());
buf.format("%n");
buf.format("Name__________________________Unit__________________________hasMissing_Description%n");
for (GridDatatype grid : gs.getGrids()) {
buf.format("%s%n", grid.getInfo());
}
countGridset++;
buf.format("%n");
}
buf.format("%nGeoReferencing Coordinate Axes%n");
buf.format("Name__________________________Units_______________Type______Description%n");
for (CoordinateAxis axis : ncd.getCoordinateAxes()) {
if (axis.getAxisType() == null) continue;
axis.getInfo(buf);
buf.format("%n");
}
} } | public class class_name {
private void getInfo(Formatter buf) {
int countGridset = 0;
for (Gridset gs : gridsetHash.values()) {
GridCoordSystem gcs = gs.getGeoCoordSystem();
buf.format("%nGridset %d coordSys=%s", countGridset, gcs);
// depends on control dependency: [for], data = [none]
buf.format(" LLbb=%s ", gcs.getLatLonBoundingBox());
// depends on control dependency: [for], data = [none]
if ((gcs.getProjection() != null) && !gcs.getProjection().isLatLon())
buf.format(" bb= %s", gcs.getBoundingBox());
buf.format("%n");
// depends on control dependency: [for], data = [none]
buf.format("Name__________________________Unit__________________________hasMissing_Description%n");
// depends on control dependency: [for], data = [none]
for (GridDatatype grid : gs.getGrids()) {
buf.format("%s%n", grid.getInfo());
// depends on control dependency: [for], data = [grid]
}
countGridset++;
// depends on control dependency: [for], data = [none]
buf.format("%n");
// depends on control dependency: [for], data = [none]
}
buf.format("%nGeoReferencing Coordinate Axes%n");
buf.format("Name__________________________Units_______________Type______Description%n");
for (CoordinateAxis axis : ncd.getCoordinateAxes()) {
if (axis.getAxisType() == null) continue;
axis.getInfo(buf);
// depends on control dependency: [for], data = [axis]
buf.format("%n");
// depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
protected <T extends MavenProjectDescriptor> T resolveProject(MavenProject project, Class<T> expectedType, ScannerContext scannerContext) {
Store store = scannerContext.getStore();
String id = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
MavenProjectDescriptor projectDescriptor = store.find(MavenProjectDescriptor.class, id);
if (projectDescriptor == null) {
projectDescriptor = store.create(expectedType, id);
projectDescriptor.setName(project.getName());
projectDescriptor.setGroupId(project.getGroupId());
projectDescriptor.setArtifactId(project.getArtifactId());
projectDescriptor.setVersion(project.getVersion());
projectDescriptor.setPackaging(project.getPackaging());
projectDescriptor.setFullQualifiedName(id);
} else if (!expectedType.isAssignableFrom(projectDescriptor.getClass())) {
projectDescriptor = store.addDescriptorType(projectDescriptor, expectedType);
}
return expectedType.cast(projectDescriptor);
} } | public class class_name {
protected <T extends MavenProjectDescriptor> T resolveProject(MavenProject project, Class<T> expectedType, ScannerContext scannerContext) {
Store store = scannerContext.getStore();
String id = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
MavenProjectDescriptor projectDescriptor = store.find(MavenProjectDescriptor.class, id);
if (projectDescriptor == null) {
projectDescriptor = store.create(expectedType, id); // depends on control dependency: [if], data = [none]
projectDescriptor.setName(project.getName()); // depends on control dependency: [if], data = [none]
projectDescriptor.setGroupId(project.getGroupId()); // depends on control dependency: [if], data = [none]
projectDescriptor.setArtifactId(project.getArtifactId()); // depends on control dependency: [if], data = [none]
projectDescriptor.setVersion(project.getVersion()); // depends on control dependency: [if], data = [none]
projectDescriptor.setPackaging(project.getPackaging()); // depends on control dependency: [if], data = [none]
projectDescriptor.setFullQualifiedName(id); // depends on control dependency: [if], data = [none]
} else if (!expectedType.isAssignableFrom(projectDescriptor.getClass())) {
projectDescriptor = store.addDescriptorType(projectDescriptor, expectedType); // depends on control dependency: [if], data = [none]
}
return expectedType.cast(projectDescriptor);
} } |
public class class_name {
public static Class<?> loadClass(ClassLoader classLoader, String className) {
try {
// If input classLoader is null, use current thread's ClassLoader, if that is null, use
// default (calling class') ClassLoader.
ClassLoader cl =
classLoader != null ? classLoader : Thread.currentThread().getContextClassLoader();
if (cl != null) {
return Class.forName(className, true, cl);
} else {
return Class.forName(className);
}
} catch (ClassNotFoundException e) {
return null;
}
} } | public class class_name {
public static Class<?> loadClass(ClassLoader classLoader, String className) {
try {
// If input classLoader is null, use current thread's ClassLoader, if that is null, use
// default (calling class') ClassLoader.
ClassLoader cl =
classLoader != null ? classLoader : Thread.currentThread().getContextClassLoader();
if (cl != null) {
return Class.forName(className, true, cl); // depends on control dependency: [if], data = [(cl]
} else {
return Class.forName(className); // depends on control dependency: [if], data = [(cl]
}
} catch (ClassNotFoundException e) {
return null;
}
} } |
public class class_name {
public static Matrix fromMatrixMarket(InputStream is) throws IOException {
BufferedReader body = new BufferedReader(new InputStreamReader(is));
String headerString = body.readLine();
StringTokenizer header = new StringTokenizer(headerString);
if (!"%%MatrixMarket".equals(header.nextToken())) {
throw new IllegalArgumentException("Wrong input file format: can not read header '%%MatrixMarket'.");
}
String object = header.nextToken();
if (!"matrix".equals(object)) {
throw new IllegalArgumentException("Unexpected object: " + object + ".");
}
String format = header.nextToken();
if (!"coordinate".equals(format) && !"array".equals(format)) {
throw new IllegalArgumentException("Unknown format: " + format + ".");
}
String field = header.nextToken();
if (!"real".equals(field)) {
throw new IllegalArgumentException("Unknown field type: " + field + ".");
}
String symmetry = header.nextToken();
if (!symmetry.equals("general")) {
throw new IllegalArgumentException("Unknown symmetry type: " + symmetry + ".");
}
String majority = (header.hasMoreTokens()) ? header.nextToken() : "row-major";
String nextToken = body.readLine();
while (nextToken.startsWith("%")) {
nextToken = body.readLine();
}
if ("coordinate".equals(format)) {
StringTokenizer lines = new StringTokenizer(nextToken);
int rows = Integer.parseInt(lines.nextToken());
int columns = Integer.parseInt(lines.nextToken());
int cardinality = Integer.parseInt(lines.nextToken());
Matrix result = "row-major".equals(majority) ?
RowMajorSparseMatrix.zero(rows, columns, cardinality) :
ColumnMajorSparseMatrix.zero(rows, columns, cardinality);
for (int k = 0; k < cardinality; k++) {
lines = new StringTokenizer(body.readLine());
int i = Integer.valueOf(lines.nextToken());
int j = Integer.valueOf(lines.nextToken());
double x = Double.valueOf(lines.nextToken());
result.set(i - 1, j - 1, x);
}
return result;
} else {
StringTokenizer lines = new StringTokenizer(nextToken);
int rows = Integer.valueOf(lines.nextToken());
int columns = Integer.valueOf(lines.nextToken());
Matrix result = DenseMatrix.zero(rows, columns);
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
result.set(i, j, Double.valueOf(body.readLine()));
}
}
return result;
}
} } | public class class_name {
public static Matrix fromMatrixMarket(InputStream is) throws IOException {
BufferedReader body = new BufferedReader(new InputStreamReader(is));
String headerString = body.readLine();
StringTokenizer header = new StringTokenizer(headerString);
if (!"%%MatrixMarket".equals(header.nextToken())) {
throw new IllegalArgumentException("Wrong input file format: can not read header '%%MatrixMarket'.");
}
String object = header.nextToken();
if (!"matrix".equals(object)) {
throw new IllegalArgumentException("Unexpected object: " + object + ".");
}
String format = header.nextToken();
if (!"coordinate".equals(format) && !"array".equals(format)) {
throw new IllegalArgumentException("Unknown format: " + format + ".");
}
String field = header.nextToken();
if (!"real".equals(field)) {
throw new IllegalArgumentException("Unknown field type: " + field + ".");
}
String symmetry = header.nextToken();
if (!symmetry.equals("general")) {
throw new IllegalArgumentException("Unknown symmetry type: " + symmetry + ".");
}
String majority = (header.hasMoreTokens()) ? header.nextToken() : "row-major";
String nextToken = body.readLine();
while (nextToken.startsWith("%")) {
nextToken = body.readLine();
}
if ("coordinate".equals(format)) {
StringTokenizer lines = new StringTokenizer(nextToken);
int rows = Integer.parseInt(lines.nextToken());
int columns = Integer.parseInt(lines.nextToken());
int cardinality = Integer.parseInt(lines.nextToken());
Matrix result = "row-major".equals(majority) ?
RowMajorSparseMatrix.zero(rows, columns, cardinality) :
ColumnMajorSparseMatrix.zero(rows, columns, cardinality);
for (int k = 0; k < cardinality; k++) {
lines = new StringTokenizer(body.readLine()); // depends on control dependency: [for], data = [none]
int i = Integer.valueOf(lines.nextToken());
int j = Integer.valueOf(lines.nextToken());
double x = Double.valueOf(lines.nextToken());
result.set(i - 1, j - 1, x); // depends on control dependency: [for], data = [none]
}
return result;
} else {
StringTokenizer lines = new StringTokenizer(nextToken);
int rows = Integer.valueOf(lines.nextToken());
int columns = Integer.valueOf(lines.nextToken());
Matrix result = DenseMatrix.zero(rows, columns);
for (int i = 0; i < rows; i++) {
for (int j = 0; j < columns; j++) {
result.set(i, j, Double.valueOf(body.readLine())); // depends on control dependency: [for], data = [j]
}
}
return result;
}
} } |
public class class_name {
private void shutdownIfComplete() {
// only shut down if you have updated build results AND profile information
if (!buildProfileComplete.get() || !buildResultComplete.get()) {
return;
}
MetricsDispatcher dispatcher = this.dispatcherSupplier.get();
logger.info("Shutting down dispatcher");
try {
dispatcher.stopAsync().awaitTerminated(TIMEOUT_MS, TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
logger.debug("Timed out after {}ms while waiting for metrics dispatcher to terminate", TIMEOUT_MS);
} catch (IllegalStateException e) {
logger.debug("Could not stop metrics dispatcher service (error message: {})", getRootCauseMessage(e));
}
Optional<String> receipt = dispatcher.receipt();
if (receipt.isPresent()) {
logger.warn(receipt.get());
}
} } | public class class_name {
private void shutdownIfComplete() {
// only shut down if you have updated build results AND profile information
if (!buildProfileComplete.get() || !buildResultComplete.get()) {
return; // depends on control dependency: [if], data = [none]
}
MetricsDispatcher dispatcher = this.dispatcherSupplier.get();
logger.info("Shutting down dispatcher");
try {
dispatcher.stopAsync().awaitTerminated(TIMEOUT_MS, TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none]
} catch (TimeoutException e) {
logger.debug("Timed out after {}ms while waiting for metrics dispatcher to terminate", TIMEOUT_MS);
} catch (IllegalStateException e) { // depends on control dependency: [catch], data = [none]
logger.debug("Could not stop metrics dispatcher service (error message: {})", getRootCauseMessage(e));
} // depends on control dependency: [catch], data = [none]
Optional<String> receipt = dispatcher.receipt();
if (receipt.isPresent()) {
logger.warn(receipt.get()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private boolean accepted(Row row, List<IndexExpression> expressions) {
if (!expressions.isEmpty()) {
Columns columns = rowMapper.columns(row);
for (IndexExpression expression : expressions) {
if (!accepted(columns, expression)) {
return false;
}
}
}
return true;
} } | public class class_name {
private boolean accepted(Row row, List<IndexExpression> expressions) {
if (!expressions.isEmpty()) {
Columns columns = rowMapper.columns(row);
for (IndexExpression expression : expressions) {
if (!accepted(columns, expression)) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
return true;
} } |
public class class_name {
private void rePrimeNF8(AxiomSet as, IConceptMap<IConceptSet> subsumptions) {
int size = as.getNf8Axioms().size();
if (size == 0) return;
FeatureMap<MonotonicCollection<NF8>> deltaNF8 = new FeatureMap<MonotonicCollection<NF8>>(size);
for (NF8 nf8 : as.getNf8Axioms()) {
addTerms(deltaNF8, nf8);
}
FeatureSet fs = deltaNF8.keySet();
for (int fid = fs.nextSetBit(0); fid >= 0; fid = fs.nextSetBit(fid+1)) {
for (IntIterator it = ontologyNF7.keyIterator(); it.hasNext();) {
int a = it.next();
Context aCtx = contextIndex.get(a);
for (Iterator<NF7> i = ontologyNF7.get(a).iterator(); i.hasNext();) {
NF7 nf7 = i.next();
if (nf7.rhsD.getFeature() == fid) {
aCtx.addFeatureQueueEntry(nf7);
affectedContexts.add(aCtx);
aCtx.startTracking();
if (aCtx.activate()) {
todo.add(aCtx);
}
}
}
}
}
} } | public class class_name {
private void rePrimeNF8(AxiomSet as, IConceptMap<IConceptSet> subsumptions) {
int size = as.getNf8Axioms().size();
if (size == 0) return;
FeatureMap<MonotonicCollection<NF8>> deltaNF8 = new FeatureMap<MonotonicCollection<NF8>>(size);
for (NF8 nf8 : as.getNf8Axioms()) {
addTerms(deltaNF8, nf8); // depends on control dependency: [for], data = [nf8]
}
FeatureSet fs = deltaNF8.keySet();
for (int fid = fs.nextSetBit(0); fid >= 0; fid = fs.nextSetBit(fid+1)) {
for (IntIterator it = ontologyNF7.keyIterator(); it.hasNext();) {
int a = it.next();
Context aCtx = contextIndex.get(a);
for (Iterator<NF7> i = ontologyNF7.get(a).iterator(); i.hasNext();) {
NF7 nf7 = i.next();
if (nf7.rhsD.getFeature() == fid) {
aCtx.addFeatureQueueEntry(nf7); // depends on control dependency: [if], data = [none]
affectedContexts.add(aCtx); // depends on control dependency: [if], data = [none]
aCtx.startTracking(); // depends on control dependency: [if], data = [none]
if (aCtx.activate()) {
todo.add(aCtx); // depends on control dependency: [if], data = [none]
}
}
}
}
}
} } |
public class class_name {
private void onScrollImpl(final Vector3Axis offset, final LayoutScroller.OnScrollListener listener) {
if (!isScrolling()) {
mScroller = new ScrollingProcessor(offset, listener);
mScroller.scroll();
}
} } | public class class_name {
private void onScrollImpl(final Vector3Axis offset, final LayoutScroller.OnScrollListener listener) {
if (!isScrolling()) {
mScroller = new ScrollingProcessor(offset, listener); // depends on control dependency: [if], data = [none]
mScroller.scroll(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public boolean removeAll(Collection<?> c) {
boolean b = queue.removeAll(c);
if (b){
signalSizeReduced();
}
return b;
} } | public class class_name {
@Override
public boolean removeAll(Collection<?> c) {
boolean b = queue.removeAll(c);
if (b){
signalSizeReduced(); // depends on control dependency: [if], data = [none]
}
return b;
} } |
public class class_name {
public static synchronized void register(Class<?> clazz)
{
if (clazz.isAnnotationPresent(javax.ws.rs.ext.Provider.class))
{
classes.add(clazz);
revision++;
}
else
{
throw new RuntimeException("Class " + clazz.getName() + " is not annotated with javax.ws.rs.ext.Provider");
}
} } | public class class_name {
public static synchronized void register(Class<?> clazz)
{
if (clazz.isAnnotationPresent(javax.ws.rs.ext.Provider.class))
{
classes.add(clazz); // depends on control dependency: [if], data = [none]
revision++; // depends on control dependency: [if], data = [none]
}
else
{
throw new RuntimeException("Class " + clazz.getName() + " is not annotated with javax.ws.rs.ext.Provider");
}
} } |
public class class_name {
public void updateBackupElements(Map<String, CmsContainerElementData> updateElements) {
ArrayList<CmsContainerPageElementPanel> updatedList = new ArrayList<CmsContainerPageElementPanel>();
String containerId = m_groupContainer.getContainerId();
for (CmsContainerPageElementPanel element : m_backUpElements) {
if (updateElements.containsKey(element.getId())
&& CmsStringUtil.isNotEmptyOrWhitespaceOnly(
updateElements.get(element.getId()).getContents().get(containerId))) {
CmsContainerElementData elementData = updateElements.get(element.getId());
try {
CmsContainerPageElementPanel replacer = m_controller.getContainerpageUtil().createElement(
elementData,
m_groupContainer,
false);
if (element.getInheritanceInfo() != null) {
// in case of inheritance container editing, keep the inheritance info
replacer.setInheritanceInfo(element.getInheritanceInfo());
}
updatedList.add(replacer);
} catch (Exception e) {
// in this case keep the old version
updatedList.add(element);
}
} else {
updatedList.add(element);
}
}
m_backUpElements = updatedList;
} } | public class class_name {
public void updateBackupElements(Map<String, CmsContainerElementData> updateElements) {
ArrayList<CmsContainerPageElementPanel> updatedList = new ArrayList<CmsContainerPageElementPanel>();
String containerId = m_groupContainer.getContainerId();
for (CmsContainerPageElementPanel element : m_backUpElements) {
if (updateElements.containsKey(element.getId())
&& CmsStringUtil.isNotEmptyOrWhitespaceOnly(
updateElements.get(element.getId()).getContents().get(containerId))) {
CmsContainerElementData elementData = updateElements.get(element.getId());
try {
CmsContainerPageElementPanel replacer = m_controller.getContainerpageUtil().createElement(
elementData,
m_groupContainer,
false);
if (element.getInheritanceInfo() != null) {
// in case of inheritance container editing, keep the inheritance info
replacer.setInheritanceInfo(element.getInheritanceInfo()); // depends on control dependency: [if], data = [(element.getInheritanceInfo()]
}
updatedList.add(replacer); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// in this case keep the old version
updatedList.add(element);
} // depends on control dependency: [catch], data = [none]
} else {
updatedList.add(element); // depends on control dependency: [if], data = [none]
}
}
m_backUpElements = updatedList;
} } |
public class class_name {
public static void setFessConfig(final FessConfig fessConfig) {
ComponentUtil.fessConfig = fessConfig;
if (fessConfig == null) {
FessProp.propMap.clear();
componentMap.clear();
}
} } | public class class_name {
public static void setFessConfig(final FessConfig fessConfig) {
ComponentUtil.fessConfig = fessConfig;
if (fessConfig == null) {
FessProp.propMap.clear(); // depends on control dependency: [if], data = [none]
componentMap.clear(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void writeExpression(Expression oldExp)
{
if (null == oldExp)
{
throw new NullPointerException();
}
boolean oldWritingObject = writingObject;
writingObject = true;
// get expression value
Object oldValue = expressionValue(oldExp);
// check existence
if (oldValue == null || get(oldValue) != null && (oldWritingObject || oldValue.getClass() != String.class))
{
return;
}
// record how the object is obtained
if (!isBasicType(oldValue) || (!oldWritingObject && oldValue.getClass() == String.class))
{
recordExpression(oldValue, oldExp);
}
// try to detect if we run into a dead loop
if (checkDeadLoop(oldValue))
{
return;
}
super.writeExpression(oldExp);
writingObject = oldWritingObject;
} } | public class class_name {
@Override
public void writeExpression(Expression oldExp)
{
if (null == oldExp)
{
throw new NullPointerException();
}
boolean oldWritingObject = writingObject;
writingObject = true;
// get expression value
Object oldValue = expressionValue(oldExp);
// check existence
if (oldValue == null || get(oldValue) != null && (oldWritingObject || oldValue.getClass() != String.class))
{
return; // depends on control dependency: [if], data = [none]
}
// record how the object is obtained
if (!isBasicType(oldValue) || (!oldWritingObject && oldValue.getClass() == String.class))
{
recordExpression(oldValue, oldExp); // depends on control dependency: [if], data = [none]
}
// try to detect if we run into a dead loop
if (checkDeadLoop(oldValue))
{
return; // depends on control dependency: [if], data = [none]
}
super.writeExpression(oldExp);
writingObject = oldWritingObject;
} } |
public class class_name {
public void visitProvide(final String service, final String... providers) {
if (mv != null) {
mv.visitProvide(service, providers);
}
} } | public class class_name {
public void visitProvide(final String service, final String... providers) {
if (mv != null) {
mv.visitProvide(service, providers); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("fallthrough")
protected DCText quotedString() {
int pos = bp;
nextChar();
loop:
while (bp < buflen) {
switch (ch) {
case '\n': case '\r': case '\f':
newline = true;
break;
case ' ': case '\t':
break;
case '"':
nextChar();
// trim trailing white-space?
return m.at(pos).newTextTree(newString(pos, bp));
case '@':
if (newline)
break loop;
}
nextChar();
}
return null;
} } | public class class_name {
@SuppressWarnings("fallthrough")
protected DCText quotedString() {
int pos = bp;
nextChar();
loop:
while (bp < buflen) {
switch (ch) {
case '\n': case '\r': case '\f':
newline = true;
break;
case ' ': case '\t':
break;
case '"':
nextChar();
// trim trailing white-space?
return m.at(pos).newTextTree(newString(pos, bp));
case '@':
if (newline)
break loop;
}
nextChar(); // depends on control dependency: [while], data = [none]
}
return null;
} } |
public class class_name {
public static int getCatalogIndexSize(Index index) {
int indexSize = 0;
String jsonstring = index.getExpressionsjson();
if (jsonstring.isEmpty()) {
indexSize = getSortedCatalogItems(index.getColumns(), "index").size();
} else {
try {
indexSize = AbstractExpression.fromJSONArrayString(jsonstring, null).size();
} catch (JSONException e) {
e.printStackTrace();
}
}
return indexSize;
} } | public class class_name {
public static int getCatalogIndexSize(Index index) {
int indexSize = 0;
String jsonstring = index.getExpressionsjson();
if (jsonstring.isEmpty()) {
indexSize = getSortedCatalogItems(index.getColumns(), "index").size(); // depends on control dependency: [if], data = [none]
} else {
try {
indexSize = AbstractExpression.fromJSONArrayString(jsonstring, null).size(); // depends on control dependency: [try], data = [none]
} catch (JSONException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return indexSize;
} } |
public class class_name {
public void setFacesInitializer(FacesInitializer facesInitializer) // TODO who uses this method?
{
if (_facesInitializer != null && _facesInitializer != facesInitializer && _servletContext != null)
{
_facesInitializer.destroyFaces(_servletContext);
}
_facesInitializer = facesInitializer;
if (_servletContext != null)
{
facesInitializer.initFaces(_servletContext);
}
} } | public class class_name {
public void setFacesInitializer(FacesInitializer facesInitializer) // TODO who uses this method?
{
if (_facesInitializer != null && _facesInitializer != facesInitializer && _servletContext != null)
{
_facesInitializer.destroyFaces(_servletContext); // depends on control dependency: [if], data = [none]
}
_facesInitializer = facesInitializer;
if (_servletContext != null)
{
facesInitializer.initFaces(_servletContext); // depends on control dependency: [if], data = [(_servletContext]
}
} } |
public class class_name {
public static Cookie getCookie (HttpServletRequest req, String name)
{
Cookie[] cookies = req.getCookies();
if (cookies != null) {
for (int ii=0, nn=cookies.length; ii < nn; ii++) {
if (cookies[ii].getName().equals(name)) {
return cookies[ii];
}
}
}
return null; // not found
} } | public class class_name {
public static Cookie getCookie (HttpServletRequest req, String name)
{
Cookie[] cookies = req.getCookies();
if (cookies != null) {
for (int ii=0, nn=cookies.length; ii < nn; ii++) {
if (cookies[ii].getName().equals(name)) {
return cookies[ii]; // depends on control dependency: [if], data = [none]
}
}
}
return null; // not found
} } |
public class class_name {
public boolean isPartitionedOnFields(FieldSet fields) {
if (this.partitioning.isPartitionedOnKey() && fields.isValidSubset(this.partitioningFields)) {
return true;
} else if (this.uniqueFieldCombinations != null) {
for (FieldSet set : this.uniqueFieldCombinations) {
if (fields.isValidSubset(set)) {
return true;
}
}
return false;
} else {
return false;
}
} } | public class class_name {
public boolean isPartitionedOnFields(FieldSet fields) {
if (this.partitioning.isPartitionedOnKey() && fields.isValidSubset(this.partitioningFields)) {
return true; // depends on control dependency: [if], data = [none]
} else if (this.uniqueFieldCombinations != null) {
for (FieldSet set : this.uniqueFieldCombinations) {
if (fields.isValidSubset(set)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static ApiKey[] loadApiKeys(File file) throws FileNotFoundException {
ArrayList<ApiKey> keys = new ArrayList<>();
Scanner scanner = null;
try {
scanner = new Scanner(new BufferedInputStream(new FileInputStream(file)));
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
if ("".equals(line.trim())) {
// skip over empty lines
continue;
} else if (line.startsWith("#")) {
// skip over comments
continue;
}
String key = line.trim();
String keyDetails = scanner.nextLine().trim();
RateRule[] rules = null;
if (DEVELOPMENT.equals(keyDetails)) {
rules = RateRule.getDevelopmentRates();
} else if (PRODUCTION.equals(keyDetails)) {
rules = RateRule.getProductionRates();
} else {
rules = parseRules(keyDetails, scanner);
}
keys.add(new ApiKey(key, rules));
}
} finally {
if (scanner != null) {
scanner.close();
}
}
return keys.toArray(new ApiKey[keys.size()]);
} } | public class class_name {
public static ApiKey[] loadApiKeys(File file) throws FileNotFoundException {
ArrayList<ApiKey> keys = new ArrayList<>();
Scanner scanner = null;
try {
scanner = new Scanner(new BufferedInputStream(new FileInputStream(file)));
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
if ("".equals(line.trim())) {
// skip over empty lines
continue;
} else if (line.startsWith("#")) {
// skip over comments
continue;
}
String key = line.trim();
String keyDetails = scanner.nextLine().trim();
RateRule[] rules = null;
if (DEVELOPMENT.equals(keyDetails)) {
rules = RateRule.getDevelopmentRates(); // depends on control dependency: [if], data = [none]
} else if (PRODUCTION.equals(keyDetails)) {
rules = RateRule.getProductionRates(); // depends on control dependency: [if], data = [none]
} else {
rules = parseRules(keyDetails, scanner); // depends on control dependency: [if], data = [none]
}
keys.add(new ApiKey(key, rules)); // depends on control dependency: [while], data = [none]
}
} finally {
if (scanner != null) {
scanner.close(); // depends on control dependency: [if], data = [none]
}
}
return keys.toArray(new ApiKey[keys.size()]);
} } |
public class class_name {
public void addAll(Attributes incoming) {
if (incoming.size() == 0)
return;
checkCapacity(size + incoming.size);
for (Attribute attr : incoming) {
// todo - should this be case insensitive?
put(attr);
}
} } | public class class_name {
public void addAll(Attributes incoming) {
if (incoming.size() == 0)
return;
checkCapacity(size + incoming.size);
for (Attribute attr : incoming) {
// todo - should this be case insensitive?
put(attr); // depends on control dependency: [for], data = [attr]
}
} } |
public class class_name {
public void setTermMeta(final long termId, final List<Meta> termMeta) throws SQLException {
clearTermMeta(termId);
if(termMeta == null || termMeta.size() == 0) {
return;
}
Connection conn = null;
PreparedStatement stmt = null;
Timer.Context ctx = metrics.setTermMetaTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(insertTermMetaSQL);
for(Meta meta : termMeta) {
stmt.setLong(1, termId);
stmt.setString(2, meta.key);
stmt.setString(3, meta.value);
stmt.executeUpdate();
}
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt);
}
} } | public class class_name {
public void setTermMeta(final long termId, final List<Meta> termMeta) throws SQLException {
clearTermMeta(termId);
if(termMeta == null || termMeta.size() == 0) {
return;
}
Connection conn = null;
PreparedStatement stmt = null;
Timer.Context ctx = metrics.setTermMetaTimer.time();
try {
conn = connectionSupplier.getConnection();
stmt = conn.prepareStatement(insertTermMetaSQL);
for(Meta meta : termMeta) {
stmt.setLong(1, termId); // depends on control dependency: [for], data = [none]
stmt.setString(2, meta.key); // depends on control dependency: [for], data = [meta]
stmt.setString(3, meta.value); // depends on control dependency: [for], data = [meta]
stmt.executeUpdate(); // depends on control dependency: [for], data = [none]
}
} finally {
ctx.stop();
SQLUtil.closeQuietly(conn, stmt);
}
} } |
public class class_name {
JTree getTreeAlert() {
if (treeAlert == null) {
treeAlert = new JTree() {
private static final long serialVersionUID = 1L;
@Override
public Point getPopupLocation(final MouseEvent event) {
if (event != null) {
// Select item on right click
TreePath tp = treeAlert.getPathForLocation(event.getX(), event.getY());
if (tp != null) {
// Only select a new item if the current item is not
// already selected - this is to allow multiple items
// to be selected
if (!treeAlert.getSelectionModel().isPathSelected(tp)) {
treeAlert.getSelectionModel().setSelectionPath(tp);
}
}
}
return super.getPopupLocation(event);
}
};
treeAlert.setName(ALERT_TREE_PANEL_NAME);
treeAlert.setShowsRootHandles(true);
treeAlert.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,0,0,0));
treeAlert.setComponentPopupMenu(new JPopupMenu() {
private static final long serialVersionUID = 1L;
@Override
public void show(Component invoker, int x, int y) {
final int countSelectedNodes = treeAlert.getSelectionCount();
final ArrayList<HistoryReference> uniqueHistoryReferences = new ArrayList<>(countSelectedNodes);
if (countSelectedNodes > 0) {
SortedSet<Integer> historyReferenceIdsAdded = new TreeSet<>();
for (TreePath path : treeAlert.getSelectionPaths()) {
final AlertNode node = (AlertNode) path.getLastPathComponent();
final Object userObject = node.getUserObject();
if (userObject instanceof Alert) {
HistoryReference historyReference = ((Alert) userObject).getHistoryRef();
if (historyReference != null && !historyReferenceIdsAdded
.contains(historyReference.getHistoryId())) {
historyReferenceIdsAdded.add(historyReference.getHistoryId());
uniqueHistoryReferences.add(historyReference);
}
}
}
uniqueHistoryReferences.trimToSize();
}
SelectableHistoryReferencesContainer messageContainer = new DefaultSelectableHistoryReferencesContainer(
treeAlert.getName(),
treeAlert,
Collections.<HistoryReference> emptyList(),
uniqueHistoryReferences);
view.getPopupMenu().show(messageContainer, x, y);
}
});
treeAlert.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseClicked(java.awt.event.MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() > 1) {
// Its a double click - edit the alert
editSelectedAlert();
}
}
});
treeAlert.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
@Override
public void valueChanged(javax.swing.event.TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) treeAlert.getLastSelectedPathComponent();
if (node != null && node.getUserObject() != null) {
Object obj = node.getUserObject();
if (obj instanceof Alert) {
Alert alert = (Alert) obj;
setMessage(alert.getMessage(), alert.getEvidence());
treeAlert.requestFocusInWindow();
getAlertViewPanel().displayAlert(alert);
} else {
getAlertViewPanel().clearAlert();
}
} else {
getAlertViewPanel().clearAlert();
}
}
});
treeAlert.setCellRenderer(new AlertTreeCellRenderer());
treeAlert.setExpandsSelectedPaths(true);
String deleteAlertKey = "zap.delete.alert";
treeAlert.getInputMap().put(view.getDefaultDeleteKeyStroke(), deleteAlertKey);
treeAlert.getActionMap().put(deleteAlertKey, new AbstractAction() {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
Set<Alert> alerts = getSelectedAlerts();
if (alerts.size() > 1 && View.getSingleton().showConfirmDialog(
Constant.messages.getString("scanner.delete.confirm")) != JOptionPane.OK_OPTION) {
return;
}
for (Alert alert : alerts) {
extension.deleteAlert(alert);
}
}
});
}
return treeAlert;
} } | public class class_name {
JTree getTreeAlert() {
if (treeAlert == null) {
treeAlert = new JTree() {
private static final long serialVersionUID = 1L;
@Override
public Point getPopupLocation(final MouseEvent event) {
if (event != null) {
// Select item on right click
TreePath tp = treeAlert.getPathForLocation(event.getX(), event.getY());
if (tp != null) {
// Only select a new item if the current item is not
// already selected - this is to allow multiple items
// to be selected
if (!treeAlert.getSelectionModel().isPathSelected(tp)) {
treeAlert.getSelectionModel().setSelectionPath(tp);
// depends on control dependency: [if], data = [none]
}
}
}
return super.getPopupLocation(event);
}
};
// depends on control dependency: [if], data = [none]
treeAlert.setName(ALERT_TREE_PANEL_NAME);
// depends on control dependency: [if], data = [none]
treeAlert.setShowsRootHandles(true);
// depends on control dependency: [if], data = [none]
treeAlert.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,0,0,0));
// depends on control dependency: [if], data = [none]
treeAlert.setComponentPopupMenu(new JPopupMenu() {
private static final long serialVersionUID = 1L;
@Override
public void show(Component invoker, int x, int y) {
final int countSelectedNodes = treeAlert.getSelectionCount();
final ArrayList<HistoryReference> uniqueHistoryReferences = new ArrayList<>(countSelectedNodes);
if (countSelectedNodes > 0) {
SortedSet<Integer> historyReferenceIdsAdded = new TreeSet<>();
for (TreePath path : treeAlert.getSelectionPaths()) {
final AlertNode node = (AlertNode) path.getLastPathComponent();
final Object userObject = node.getUserObject();
if (userObject instanceof Alert) {
HistoryReference historyReference = ((Alert) userObject).getHistoryRef();
if (historyReference != null && !historyReferenceIdsAdded
.contains(historyReference.getHistoryId())) {
historyReferenceIdsAdded.add(historyReference.getHistoryId());
// depends on control dependency: [if], data = [(historyReference]
uniqueHistoryReferences.add(historyReference);
// depends on control dependency: [if], data = [(historyReference]
}
}
}
uniqueHistoryReferences.trimToSize();
// depends on control dependency: [if], data = [none]
}
SelectableHistoryReferencesContainer messageContainer = new DefaultSelectableHistoryReferencesContainer(
treeAlert.getName(),
treeAlert,
Collections.<HistoryReference> emptyList(),
uniqueHistoryReferences);
view.getPopupMenu().show(messageContainer, x, y);
}
});
// depends on control dependency: [if], data = [none]
treeAlert.addMouseListener(new java.awt.event.MouseAdapter() {
@Override
public void mouseClicked(java.awt.event.MouseEvent e) {
if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() > 1) {
// Its a double click - edit the alert
editSelectedAlert();
// depends on control dependency: [if], data = [none]
}
}
});
// depends on control dependency: [if], data = [none]
treeAlert.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
@Override
public void valueChanged(javax.swing.event.TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) treeAlert.getLastSelectedPathComponent();
if (node != null && node.getUserObject() != null) {
Object obj = node.getUserObject();
if (obj instanceof Alert) {
Alert alert = (Alert) obj;
setMessage(alert.getMessage(), alert.getEvidence());
// depends on control dependency: [if], data = [none]
treeAlert.requestFocusInWindow();
// depends on control dependency: [if], data = [none]
getAlertViewPanel().displayAlert(alert);
// depends on control dependency: [if], data = [none]
} else {
getAlertViewPanel().clearAlert();
// depends on control dependency: [if], data = [none]
}
} else {
getAlertViewPanel().clearAlert();
// depends on control dependency: [if], data = [none]
}
}
});
// depends on control dependency: [if], data = [none]
treeAlert.setCellRenderer(new AlertTreeCellRenderer());
// depends on control dependency: [if], data = [none]
treeAlert.setExpandsSelectedPaths(true);
// depends on control dependency: [if], data = [none]
String deleteAlertKey = "zap.delete.alert";
treeAlert.getInputMap().put(view.getDefaultDeleteKeyStroke(), deleteAlertKey);
// depends on control dependency: [if], data = [none]
treeAlert.getActionMap().put(deleteAlertKey, new AbstractAction() {
private static final long serialVersionUID = 1L;
@Override
public void actionPerformed(ActionEvent e) {
Set<Alert> alerts = getSelectedAlerts();
if (alerts.size() > 1 && View.getSingleton().showConfirmDialog(
Constant.messages.getString("scanner.delete.confirm")) != JOptionPane.OK_OPTION) {
return;
// depends on control dependency: [if], data = [none]
}
for (Alert alert : alerts) {
extension.deleteAlert(alert);
// depends on control dependency: [for], data = [alert]
}
}
});
// depends on control dependency: [if], data = [none]
}
return treeAlert;
} } |
public class class_name {
public boolean removeAfter(Node node) {
if (node == null || node.next == null) {
return false;
}
if (node.next == last) {
last = node;
}
node.next = node.next.next;
return true;
} } | public class class_name {
public boolean removeAfter(Node node) {
if (node == null || node.next == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (node.next == last) {
last = node; // depends on control dependency: [if], data = [none]
}
node.next = node.next.next;
return true;
} } |
public class class_name {
@Override
public int doEndTag() throws JspException {
TimeZone timeZone = null;
if (value == null) {
timeZone = TimeZone.getTimeZone("GMT");
} else if (value instanceof String) {
if (((String) value).trim().equals("")) {
timeZone = TimeZone.getTimeZone("GMT");
} else {
timeZone = TimeZone.getTimeZone((String) value);
}
} else {
timeZone = (TimeZone) value;
}
if (var != null) {
pageContext.setAttribute(var, timeZone, scope);
} else {
Config.set(pageContext, Config.FMT_TIME_ZONE, timeZone, scope);
}
return EVAL_PAGE;
} } | public class class_name {
@Override
public int doEndTag() throws JspException {
TimeZone timeZone = null;
if (value == null) {
timeZone = TimeZone.getTimeZone("GMT");
} else if (value instanceof String) {
if (((String) value).trim().equals("")) {
timeZone = TimeZone.getTimeZone("GMT"); // depends on control dependency: [if], data = [none]
} else {
timeZone = TimeZone.getTimeZone((String) value); // depends on control dependency: [if], data = [none]
}
} else {
timeZone = (TimeZone) value;
}
if (var != null) {
pageContext.setAttribute(var, timeZone, scope);
} else {
Config.set(pageContext, Config.FMT_TIME_ZONE, timeZone, scope);
}
return EVAL_PAGE;
} } |
public class class_name {
protected void commitHelper(boolean losingFocus) {
if (editorNode == null) {
return;
}
try {
builder.validateValue();
commitEdit((T) builder.getValue());
builder.nullEditorNode();
editorNode = null;
} catch (Exception ex) {
if (commitExceptionConsumer != null) {
commitExceptionConsumer.accept(ex);
}
if (losingFocus) {
cancelEdit();
}
}
} } | public class class_name {
protected void commitHelper(boolean losingFocus) {
if (editorNode == null) {
return; // depends on control dependency: [if], data = [none]
}
try {
builder.validateValue(); // depends on control dependency: [try], data = [none]
commitEdit((T) builder.getValue()); // depends on control dependency: [try], data = [none]
builder.nullEditorNode(); // depends on control dependency: [try], data = [none]
editorNode = null; // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
if (commitExceptionConsumer != null) {
commitExceptionConsumer.accept(ex); // depends on control dependency: [if], data = [none]
}
if (losingFocus) {
cancelEdit(); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static Throwable throwable(Throwable throwable, String message, Object... args) {
Throwable t = throwable;
if (t instanceof InvocationException && t.getCause() != null) {
t = t.getCause();
}
if (t instanceof InvocationTargetException && ((InvocationTargetException)t).getTargetException() != null) {
t = ((InvocationTargetException) t).getTargetException();
}
message = String.format(message, args);
log.dump(message, t);
return t;
} } | public class class_name {
private static Throwable throwable(Throwable throwable, String message, Object... args) {
Throwable t = throwable;
if (t instanceof InvocationException && t.getCause() != null) {
t = t.getCause();
// depends on control dependency: [if], data = [none]
}
if (t instanceof InvocationTargetException && ((InvocationTargetException)t).getTargetException() != null) {
t = ((InvocationTargetException) t).getTargetException();
// depends on control dependency: [if], data = [none]
}
message = String.format(message, args);
log.dump(message, t);
return t;
} } |
public class class_name {
@Override
public final GeoCodeItem find(final String placeName,
final String modernPlaceName) {
if (modernPlaceName == null || modernPlaceName.isEmpty()) {
return find(placeName);
}
logger.debug(
"find(\"" + placeName + "\", \"" + modernPlaceName + "\")");
final GeoDocument geoDocument = getDocument(placeName);
if (geoDocument != null) {
// We found one.
if (modernPlaceName.equals(geoDocument.getModernName())) {
// Modern name matches existing, so we don't have a change.
if (geoDocument.getResult() == null) {
return modernWithNoResult(placeName, modernPlaceName,
geoDocument);
} else {
// Fully formed return it.
return geoDocument.getGeoItem();
}
} else {
// Modern place names don't match, replace.
// No result, try to get.
final GeocodingResult[] results = geoCoder.geocode(
modernPlaceName);
if (results.length == 0) {
return noModernResult(placeName, modernPlaceName);
} else {
return newModernResult(placeName, modernPlaceName, results);
}
}
}
GeoCodeItem gcce;
// Not found in cache. Let's see what we can find.
final GeocodingResult[] results = geoCoder.geocode(modernPlaceName);
if (results.length > 0) {
/* Work with the first result. */
gcce = new GeoCodeItem(placeName, modernPlaceName, results[0]);
} else {
// Not found, create empty.
gcce = new GeoCodeItem(placeName, modernPlaceName);
}
add(gcce);
return gcce;
} } | public class class_name {
@Override
public final GeoCodeItem find(final String placeName,
final String modernPlaceName) {
if (modernPlaceName == null || modernPlaceName.isEmpty()) {
return find(placeName); // depends on control dependency: [if], data = [none]
}
logger.debug(
"find(\"" + placeName + "\", \"" + modernPlaceName + "\")");
final GeoDocument geoDocument = getDocument(placeName);
if (geoDocument != null) {
// We found one.
if (modernPlaceName.equals(geoDocument.getModernName())) {
// Modern name matches existing, so we don't have a change.
if (geoDocument.getResult() == null) {
return modernWithNoResult(placeName, modernPlaceName,
geoDocument);
} else {
// Fully formed return it.
return geoDocument.getGeoItem();
}
} else {
// Modern place names don't match, replace.
// No result, try to get.
final GeocodingResult[] results = geoCoder.geocode(
modernPlaceName);
if (results.length == 0) {
return noModernResult(placeName, modernPlaceName);
} else {
return newModernResult(placeName, modernPlaceName, results);
}
}
}
GeoCodeItem gcce;
// Not found in cache. Let's see what we can find.
final GeocodingResult[] results = geoCoder.geocode(modernPlaceName);
if (results.length > 0) {
/* Work with the first result. */
gcce = new GeoCodeItem(placeName, modernPlaceName, results[0]);
} else {
// Not found, create empty.
gcce = new GeoCodeItem(placeName, modernPlaceName);
}
add(gcce);
return gcce;
} } |
public class class_name {
private void qcrit( RenderedImage slope, RenderedImage ab, RandomIter trasmissivityRI, RandomIter frictionRI,
RandomIter cohesionRI, RandomIter hsIter, RandomIter effectiveRI, RandomIter densityRI ) {
HashMap<String, Double> regionMap = CoverageUtilities.getRegionParamsFromGridCoverage(inSlope);
int cols = regionMap.get(CoverageUtilities.COLS).intValue();
int rows = regionMap.get(CoverageUtilities.ROWS).intValue();
RandomIter slopeRI = RandomIterFactory.create(slope, null);
RandomIter abRI = RandomIterFactory.create(ab, null);
WritableRaster qcritWR = CoverageUtilities.createWritableRaster(cols, rows, null, null, null);
WritableRandomIter qcritIter = RandomIterFactory.createWritable(qcritWR, null);
WritableRaster classiWR = CoverageUtilities.createWritableRaster(cols, rows, null, null, null);
WritableRandomIter classiIter = RandomIterFactory.createWritable(classiWR, null);
pm.beginTask("Creating qcrit map...", rows);
for( int j = 0; j < rows; j++ ) {
pm.worked(1);
for( int i = 0; i < cols; i++ ) {
double slopeValue = slopeRI.getSampleDouble(i, j, 0);
double tanPhiValue = frictionRI.getSampleDouble(i, j, 0);
double cohValue = cohesionRI.getSampleDouble(i, j, 0);
double rhoValue = densityRI.getSampleDouble(i, j, 0);
double hsValue = hsIter.getSampleDouble(i, j, 0);
if (!isNovalue(slopeValue) && !isNovalue(tanPhiValue) && !isNovalue(cohValue) && !isNovalue(rhoValue)
&& !isNovalue(hsValue)) {
if (hsValue <= EPS || slopeValue > pRock) {
qcritIter.setSample(i, j, 0, ROCK);
} else {
double checkUnstable = tanPhiValue + cohValue / (9810.0 * rhoValue * hsValue) * (1 + pow(slopeValue, 2));
if (slopeValue >= checkUnstable) {
/*
* uncond unstable
*/
qcritIter.setSample(i, j, 0, 5);
} else {
double checkStable = tanPhiValue * (1 - 1 / rhoValue) + cohValue / (9810 * rhoValue * hsValue)
* (1 + pow(slopeValue, 2));
if (slopeValue < checkStable) {
/*
* uncond. stable
*/
qcritIter.setSample(i, j, 0, 0);
} else {
double qCrit = trasmissivityRI.getSampleDouble(i, j, 0)
* sin(atan(slopeValue))
/ abRI.getSampleDouble(i, j, 0)
* rhoValue
* (1 - slopeValue / tanPhiValue + cohValue / (9810 * rhoValue * hsValue * tanPhiValue)
* (1 + pow(slopeValue, 2))) * 1000;
qcritIter.setSample(i, j, 0, qCrit);
/*
* see the Qcrit (critical effective
* precipitation) that leads the slope to
* instability (see article of Montgomery et Al,
* Hydrological Processes, 12, 943-955, 1998)
*/
double value = qcritIter.getSampleDouble(i, j, 0);
if (value > 0 && value < 50)
qcritIter.setSample(i, j, 0, 1);
if (value >= 50 && value < 100)
qcritIter.setSample(i, j, 0, 2);
if (value >= 100 && value < 200)
qcritIter.setSample(i, j, 0, 3);
if (value >= 200)
qcritIter.setSample(i, j, 0, 4);
}
}
}
} else {
qcritIter.setSample(i, j, 0, doubleNovalue);
}
}
}
pm.done();
/*
* build the class matrix 1=inc inst 2=inc stab 3=stab 4=instab
* rock=presence of rock
*/
pm.beginTask("Creating stability map...", rows);
double Tq = 0;
for( int j = 0; j < rows; j++ ) {
pm.worked(1);
for( int i = 0; i < cols; i++ ) {
Tq = trasmissivityRI.getSampleDouble(i, j, 0) / (effectiveRI.getSampleDouble(i, j, 0) / 1000.0);
double slopeValue = slopeRI.getSampleDouble(i, j, 0);
double abValue = abRI.getSampleDouble(i, j, 0);
double tangPhiValue = frictionRI.getSampleDouble(i, j, 0);
double cohValue = cohesionRI.getSampleDouble(i, j, 0);
double rhoValue = densityRI.getSampleDouble(i, j, 0);
double hsValue = hsIter.getSampleDouble(i, j, 0);
if (!isNovalue(slopeValue) && !isNovalue(abValue) && !isNovalue(tangPhiValue) && !isNovalue(cohValue)
&& !isNovalue(rhoValue) && !isNovalue(hsValue)) {
if (hsValue <= EPS || slopeValue > pRock) {
classiIter.setSample(i, j, 0, ROCK);
} else {
double checkUncondUnstable = tangPhiValue + cohValue / (9810 * rhoValue * hsValue)
* (1 + pow(slopeValue, 2));
double checkUncondStable = tangPhiValue * (1 - 1 / rhoValue) + cohValue / (9810 * rhoValue * hsValue)
* (1 + pow(slopeValue, 2));
double checkStable = Tq
* sin(atan(slopeValue))
* rhoValue
* (1 - slopeValue / tangPhiValue + cohValue / (9810 * rhoValue * hsValue * tangPhiValue)
* (1 + pow(slopeValue, 2)));
if (slopeValue >= checkUncondUnstable) {
classiIter.setSample(i, j, 0, 1);
} else if (slopeValue < checkUncondStable) {
classiIter.setSample(i, j, 0, 2);
} else if (abValue < checkStable && classiIter.getSampleDouble(i, j, 0) != 1
&& classiIter.getSampleDouble(i, j, 0) != 2) {
classiIter.setSample(i, j, 0, 3);
} else {
classiIter.setSample(i, j, 0, 4);
}
}
} else {
classiIter.setSample(i, j, 0, doubleNovalue);
}
}
}
pm.done();
outQcrit = CoverageUtilities.buildCoverage("qcrit", qcritWR, regionMap, inSlope.getCoordinateReferenceSystem());
outShalstab = CoverageUtilities.buildCoverage("classi", classiWR, regionMap, inSlope.getCoordinateReferenceSystem());
} } | public class class_name {
private void qcrit( RenderedImage slope, RenderedImage ab, RandomIter trasmissivityRI, RandomIter frictionRI,
RandomIter cohesionRI, RandomIter hsIter, RandomIter effectiveRI, RandomIter densityRI ) {
HashMap<String, Double> regionMap = CoverageUtilities.getRegionParamsFromGridCoverage(inSlope);
int cols = regionMap.get(CoverageUtilities.COLS).intValue();
int rows = regionMap.get(CoverageUtilities.ROWS).intValue();
RandomIter slopeRI = RandomIterFactory.create(slope, null);
RandomIter abRI = RandomIterFactory.create(ab, null);
WritableRaster qcritWR = CoverageUtilities.createWritableRaster(cols, rows, null, null, null);
WritableRandomIter qcritIter = RandomIterFactory.createWritable(qcritWR, null);
WritableRaster classiWR = CoverageUtilities.createWritableRaster(cols, rows, null, null, null);
WritableRandomIter classiIter = RandomIterFactory.createWritable(classiWR, null);
pm.beginTask("Creating qcrit map...", rows);
for( int j = 0; j < rows; j++ ) {
pm.worked(1); // depends on control dependency: [for], data = [none]
for( int i = 0; i < cols; i++ ) {
double slopeValue = slopeRI.getSampleDouble(i, j, 0);
double tanPhiValue = frictionRI.getSampleDouble(i, j, 0);
double cohValue = cohesionRI.getSampleDouble(i, j, 0);
double rhoValue = densityRI.getSampleDouble(i, j, 0);
double hsValue = hsIter.getSampleDouble(i, j, 0);
if (!isNovalue(slopeValue) && !isNovalue(tanPhiValue) && !isNovalue(cohValue) && !isNovalue(rhoValue)
&& !isNovalue(hsValue)) {
if (hsValue <= EPS || slopeValue > pRock) {
qcritIter.setSample(i, j, 0, ROCK); // depends on control dependency: [if], data = [none]
} else {
double checkUnstable = tanPhiValue + cohValue / (9810.0 * rhoValue * hsValue) * (1 + pow(slopeValue, 2));
if (slopeValue >= checkUnstable) {
/*
* uncond unstable
*/
qcritIter.setSample(i, j, 0, 5); // depends on control dependency: [if], data = [none]
} else {
double checkStable = tanPhiValue * (1 - 1 / rhoValue) + cohValue / (9810 * rhoValue * hsValue)
* (1 + pow(slopeValue, 2));
if (slopeValue < checkStable) {
/*
* uncond. stable
*/
qcritIter.setSample(i, j, 0, 0); // depends on control dependency: [if], data = [none]
} else {
double qCrit = trasmissivityRI.getSampleDouble(i, j, 0)
* sin(atan(slopeValue))
/ abRI.getSampleDouble(i, j, 0)
* rhoValue
* (1 - slopeValue / tanPhiValue + cohValue / (9810 * rhoValue * hsValue * tanPhiValue)
* (1 + pow(slopeValue, 2))) * 1000;
qcritIter.setSample(i, j, 0, qCrit); // depends on control dependency: [if], data = [none]
/*
* see the Qcrit (critical effective
* precipitation) that leads the slope to
* instability (see article of Montgomery et Al,
* Hydrological Processes, 12, 943-955, 1998)
*/
double value = qcritIter.getSampleDouble(i, j, 0);
if (value > 0 && value < 50)
qcritIter.setSample(i, j, 0, 1);
if (value >= 50 && value < 100)
qcritIter.setSample(i, j, 0, 2);
if (value >= 100 && value < 200)
qcritIter.setSample(i, j, 0, 3);
if (value >= 200)
qcritIter.setSample(i, j, 0, 4);
}
}
}
} else {
qcritIter.setSample(i, j, 0, doubleNovalue); // depends on control dependency: [if], data = [none]
}
}
}
pm.done();
/*
* build the class matrix 1=inc inst 2=inc stab 3=stab 4=instab
* rock=presence of rock
*/
pm.beginTask("Creating stability map...", rows);
double Tq = 0;
for( int j = 0; j < rows; j++ ) {
pm.worked(1); // depends on control dependency: [for], data = [none]
for( int i = 0; i < cols; i++ ) {
Tq = trasmissivityRI.getSampleDouble(i, j, 0) / (effectiveRI.getSampleDouble(i, j, 0) / 1000.0); // depends on control dependency: [for], data = [i]
double slopeValue = slopeRI.getSampleDouble(i, j, 0);
double abValue = abRI.getSampleDouble(i, j, 0);
double tangPhiValue = frictionRI.getSampleDouble(i, j, 0);
double cohValue = cohesionRI.getSampleDouble(i, j, 0);
double rhoValue = densityRI.getSampleDouble(i, j, 0);
double hsValue = hsIter.getSampleDouble(i, j, 0);
if (!isNovalue(slopeValue) && !isNovalue(abValue) && !isNovalue(tangPhiValue) && !isNovalue(cohValue)
&& !isNovalue(rhoValue) && !isNovalue(hsValue)) {
if (hsValue <= EPS || slopeValue > pRock) {
classiIter.setSample(i, j, 0, ROCK); // depends on control dependency: [if], data = [none]
} else {
double checkUncondUnstable = tangPhiValue + cohValue / (9810 * rhoValue * hsValue)
* (1 + pow(slopeValue, 2));
double checkUncondStable = tangPhiValue * (1 - 1 / rhoValue) + cohValue / (9810 * rhoValue * hsValue)
* (1 + pow(slopeValue, 2));
double checkStable = Tq
* sin(atan(slopeValue))
* rhoValue
* (1 - slopeValue / tangPhiValue + cohValue / (9810 * rhoValue * hsValue * tangPhiValue)
* (1 + pow(slopeValue, 2)));
if (slopeValue >= checkUncondUnstable) {
classiIter.setSample(i, j, 0, 1); // depends on control dependency: [if], data = [none]
} else if (slopeValue < checkUncondStable) {
classiIter.setSample(i, j, 0, 2); // depends on control dependency: [if], data = [none]
} else if (abValue < checkStable && classiIter.getSampleDouble(i, j, 0) != 1
&& classiIter.getSampleDouble(i, j, 0) != 2) {
classiIter.setSample(i, j, 0, 3); // depends on control dependency: [if], data = [none]
} else {
classiIter.setSample(i, j, 0, 4); // depends on control dependency: [if], data = [none]
}
}
} else {
classiIter.setSample(i, j, 0, doubleNovalue); // depends on control dependency: [if], data = [none]
}
}
}
pm.done();
outQcrit = CoverageUtilities.buildCoverage("qcrit", qcritWR, regionMap, inSlope.getCoordinateReferenceSystem());
outShalstab = CoverageUtilities.buildCoverage("classi", classiWR, regionMap, inSlope.getCoordinateReferenceSystem());
} } |
public class class_name {
protected BaseDescr lhsForall(CEDescrBuilder<?, ?> ce) throws RecognitionException {
ForallDescrBuilder<?> forall = helper.start(ce,
ForallDescrBuilder.class,
null);
try {
match(input,
DRL6Lexer.ID,
DroolsSoftKeywords.FORALL,
null,
DroolsEditorType.KEYWORD);
if (state.failed)
return null;
match(input,
DRL6Lexer.LEFT_PAREN,
null,
null,
DroolsEditorType.SYMBOL);
if (state.failed)
return null;
do {
lhsPatternBind(forall,
false);
if (state.failed)
return null;
if (input.LA(1) == DRL6Lexer.COMMA) {
match(input,
DRL6Lexer.COMMA,
null,
null,
DroolsEditorType.SYMBOL);
if (state.failed)
return null;
}
} while (input.LA(1) != DRL6Lexer.EOF && input.LA(1) != DRL6Lexer.RIGHT_PAREN);
match(input,
DRL6Lexer.RIGHT_PAREN,
null,
null,
DroolsEditorType.SYMBOL);
if (state.failed)
return null;
} finally {
helper.end(ForallDescrBuilder.class,
forall);
}
return forall != null ? forall.getDescr() : null;
} } | public class class_name {
protected BaseDescr lhsForall(CEDescrBuilder<?, ?> ce) throws RecognitionException {
ForallDescrBuilder<?> forall = helper.start(ce,
ForallDescrBuilder.class,
null);
try {
match(input,
DRL6Lexer.ID,
DroolsSoftKeywords.FORALL,
null,
DroolsEditorType.KEYWORD);
if (state.failed)
return null;
match(input,
DRL6Lexer.LEFT_PAREN,
null,
null,
DroolsEditorType.SYMBOL);
if (state.failed)
return null;
do {
lhsPatternBind(forall,
false);
if (state.failed)
return null;
if (input.LA(1) == DRL6Lexer.COMMA) {
match(input,
DRL6Lexer.COMMA,
null,
null,
DroolsEditorType.SYMBOL); // depends on control dependency: [if], data = [none]
if (state.failed)
return null;
}
} while (input.LA(1) != DRL6Lexer.EOF && input.LA(1) != DRL6Lexer.RIGHT_PAREN);
match(input,
DRL6Lexer.RIGHT_PAREN,
null,
null,
DroolsEditorType.SYMBOL);
if (state.failed)
return null;
} finally {
helper.end(ForallDescrBuilder.class,
forall);
}
return forall != null ? forall.getDescr() : null;
} } |
public class class_name {
protected Object addToIndiciesIgnoringTransaction(MithraObject result, boolean weak)
{
TransactionalIndex primaryKeyIndex = ((TransactionalIndex) this.getPrimaryKeyIndex());
Object old = primaryKeyIndex.putIgnoringTransaction(result, result.zGetCurrentData(), weak);
Index[] indices = this.getIndices();
for(int i=1;i<indices.length;i++)
{
TransactionalIndex index = (TransactionalIndex) indices[i];
index.putIgnoringTransaction(result, result.zGetCurrentData(), weak);
}
return old;
} } | public class class_name {
protected Object addToIndiciesIgnoringTransaction(MithraObject result, boolean weak)
{
TransactionalIndex primaryKeyIndex = ((TransactionalIndex) this.getPrimaryKeyIndex());
Object old = primaryKeyIndex.putIgnoringTransaction(result, result.zGetCurrentData(), weak);
Index[] indices = this.getIndices();
for(int i=1;i<indices.length;i++)
{
TransactionalIndex index = (TransactionalIndex) indices[i];
index.putIgnoringTransaction(result, result.zGetCurrentData(), weak);
// depends on control dependency: [for], data = [none]
}
return old;
} } |
public class class_name {
public void marshall(CreateInstanceRequest createInstanceRequest, ProtocolMarshaller protocolMarshaller) {
if (createInstanceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createInstanceRequest.getStackId(), STACKID_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getLayerIds(), LAYERIDS_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getInstanceType(), INSTANCETYPE_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getAutoScalingType(), AUTOSCALINGTYPE_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getHostname(), HOSTNAME_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getOs(), OS_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getAmiId(), AMIID_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getSshKeyName(), SSHKEYNAME_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getAvailabilityZone(), AVAILABILITYZONE_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getVirtualizationType(), VIRTUALIZATIONTYPE_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getSubnetId(), SUBNETID_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getArchitecture(), ARCHITECTURE_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getRootDeviceType(), ROOTDEVICETYPE_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getBlockDeviceMappings(), BLOCKDEVICEMAPPINGS_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getInstallUpdatesOnBoot(), INSTALLUPDATESONBOOT_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getEbsOptimized(), EBSOPTIMIZED_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getAgentVersion(), AGENTVERSION_BINDING);
protocolMarshaller.marshall(createInstanceRequest.getTenancy(), TENANCY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateInstanceRequest createInstanceRequest, ProtocolMarshaller protocolMarshaller) {
if (createInstanceRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createInstanceRequest.getStackId(), STACKID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getLayerIds(), LAYERIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getInstanceType(), INSTANCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getAutoScalingType(), AUTOSCALINGTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getHostname(), HOSTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getOs(), OS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getAmiId(), AMIID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getSshKeyName(), SSHKEYNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getAvailabilityZone(), AVAILABILITYZONE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getVirtualizationType(), VIRTUALIZATIONTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getSubnetId(), SUBNETID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getArchitecture(), ARCHITECTURE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getRootDeviceType(), ROOTDEVICETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getBlockDeviceMappings(), BLOCKDEVICEMAPPINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getInstallUpdatesOnBoot(), INSTALLUPDATESONBOOT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getEbsOptimized(), EBSOPTIMIZED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getAgentVersion(), AGENTVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createInstanceRequest.getTenancy(), TENANCY_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 byte[] toByteArray(final ByteBuffer buffer)
{
if (buffer.hasArray()
&& buffer.arrayOffset() == 0
&& buffer.position() == 0
&& buffer.array().length == buffer.limit()) {
return buffer.array();
} else {
final byte[] retVal = new byte[buffer.remaining()];
buffer.duplicate().get(retVal);
return retVal;
}
} } | public class class_name {
private static byte[] toByteArray(final ByteBuffer buffer)
{
if (buffer.hasArray()
&& buffer.arrayOffset() == 0
&& buffer.position() == 0
&& buffer.array().length == buffer.limit()) {
return buffer.array(); // depends on control dependency: [if], data = [none]
} else {
final byte[] retVal = new byte[buffer.remaining()];
buffer.duplicate().get(retVal); // depends on control dependency: [if], data = [none]
return retVal; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public OperationFuture<Server> modify(Server server, ModifyServerConfig modifyServerConfig) {
List<ModifyServerRequest> request = serverConverter.buildModifyServerRequest(modifyServerConfig,
modifyServerConfig.getCustomFields().isEmpty() ? null : client.getCustomFields());
Link response = client.modify(idByRef(server), request);
OperationFuture<Server> modifyServerFuture;
if (response == null) {
modifyServerFuture = new OperationFuture<>(
server,
new NoWaitingJobFuture()
);
} else {
modifyServerFuture = new OperationFuture<>(
server,
response.getId(),
queueClient
);
}
if (modifyServerConfig.getMachineConfig() != null &&
modifyServerConfig.getMachineConfig().getAutoscalePolicy() != null) {
return new OperationFuture<>(
server,
new ParallelJobsFuture(
modifyServerFuture.jobFuture(),
autoscalePolicyServiceSupplier.get().setAutoscalePolicyOnServer(
modifyServerConfig.getMachineConfig().getAutoscalePolicy(), server
).jobFuture()
)
);
}
return modifyServerFuture;
} } | public class class_name {
public OperationFuture<Server> modify(Server server, ModifyServerConfig modifyServerConfig) {
List<ModifyServerRequest> request = serverConverter.buildModifyServerRequest(modifyServerConfig,
modifyServerConfig.getCustomFields().isEmpty() ? null : client.getCustomFields());
Link response = client.modify(idByRef(server), request);
OperationFuture<Server> modifyServerFuture;
if (response == null) {
modifyServerFuture = new OperationFuture<>(
server,
new NoWaitingJobFuture()
); // depends on control dependency: [if], data = [none]
} else {
modifyServerFuture = new OperationFuture<>(
server,
response.getId(),
queueClient
); // depends on control dependency: [if], data = [none]
}
if (modifyServerConfig.getMachineConfig() != null &&
modifyServerConfig.getMachineConfig().getAutoscalePolicy() != null) {
return new OperationFuture<>(
server,
new ParallelJobsFuture(
modifyServerFuture.jobFuture(),
autoscalePolicyServiceSupplier.get().setAutoscalePolicyOnServer(
modifyServerConfig.getMachineConfig().getAutoscalePolicy(), server
).jobFuture()
)
); // depends on control dependency: [if], data = [none]
}
return modifyServerFuture;
} } |
public class class_name {
public static synchronized void shutdown() {
if (BACKGROUND_SERVICE != null) {
try {
BACKGROUND_SERVICE.stop();
} catch (Throwable t) {
LOGGER.error("Exception stopping Stackify Metrics API service", t);
}
INITIALIZED.compareAndSet(true, false);
}
} } | public class class_name {
public static synchronized void shutdown() {
if (BACKGROUND_SERVICE != null) {
try {
BACKGROUND_SERVICE.stop(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
LOGGER.error("Exception stopping Stackify Metrics API service", t);
} // depends on control dependency: [catch], data = [none]
INITIALIZED.compareAndSet(true, false); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public boolean recordNoCollapse() {
if (!currentInfo.isNoCollapse()) {
currentInfo.setNoCollapse(true);
populated = true;
return true;
} else {
return false;
}
} } | public class class_name {
public boolean recordNoCollapse() {
if (!currentInfo.isNoCollapse()) {
currentInfo.setNoCollapse(true); // depends on control dependency: [if], data = [none]
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 String getProperty(String key,String defaultValue)
{
String value=null;
try
{
value=this.JOB.getProperty(key);
}
catch(Exception exception)
{
throw new FaxException("Error while extracting job property.",exception);
}
if(value==null)
{
value=defaultValue;
}
return value;
} } | public class class_name {
public String getProperty(String key,String defaultValue)
{
String value=null;
try
{
value=this.JOB.getProperty(key); // depends on control dependency: [try], data = [none]
}
catch(Exception exception)
{
throw new FaxException("Error while extracting job property.",exception);
} // depends on control dependency: [catch], data = [none]
if(value==null)
{
value=defaultValue; // depends on control dependency: [if], data = [none]
}
return value;
} } |
public class class_name {
public static void process(GrayF32 orig, GrayF32 derivX, GrayF32 derivY, @Nullable ImageBorder_F32 border) {
InputSanityCheck.reshapeOneIn(orig, derivX, derivY);
// GradientSobel_Outer.process_F32(orig, derivX, derivY);
if( BoofConcurrency.USE_CONCURRENT ) {
GradientSobel_UnrolledOuter_MT.process_F32_sub(orig, derivX, derivY);
} else {
GradientSobel_UnrolledOuter.process_F32_sub(orig, derivX, derivY);
}
if( border != null ) {
border.setImage(orig);
ConvolveJustBorder_General_SB.convolve(kernelDerivX_F32, border,derivX);
ConvolveJustBorder_General_SB.convolve(kernelDerivY_F32, border,derivY);
}
} } | public class class_name {
public static void process(GrayF32 orig, GrayF32 derivX, GrayF32 derivY, @Nullable ImageBorder_F32 border) {
InputSanityCheck.reshapeOneIn(orig, derivX, derivY);
// GradientSobel_Outer.process_F32(orig, derivX, derivY);
if( BoofConcurrency.USE_CONCURRENT ) {
GradientSobel_UnrolledOuter_MT.process_F32_sub(orig, derivX, derivY); // depends on control dependency: [if], data = [none]
} else {
GradientSobel_UnrolledOuter.process_F32_sub(orig, derivX, derivY); // depends on control dependency: [if], data = [none]
}
if( border != null ) {
border.setImage(orig); // depends on control dependency: [if], data = [none]
ConvolveJustBorder_General_SB.convolve(kernelDerivX_F32, border,derivX); // depends on control dependency: [if], data = [none]
ConvolveJustBorder_General_SB.convolve(kernelDerivY_F32, border,derivY); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
@FFDCIgnore(Throwable.class)
public void run() {
Future<R> result = null;
Throwable thrownException = null;
try {
ArrayList<ThreadContext> contextAppliedToThread = null;
if (this.threadContext != null) {
//apply the JEE contexts to the thread before calling the inner task
contextAppliedToThread = this.threadContext.taskStarting();
}
try {
result = innerTask.call();
} finally {
if (contextAppliedToThread != null) {
//remove the JEE contexts again since the thread will be re-used
this.threadContext.taskStopping(contextAppliedToThread);
}
}
} catch (Throwable e) {
if (e instanceof com.ibm.ws.microprofile.faulttolerance.spi.ExecutionException) {
thrownException = e.getCause();
} else {
thrownException = e;
}
} finally {
// We've finished running and caught any exceptions that occurred, now store the result in the resultFuture
// If abort() has already been called then the result future will already be completed and the result (or exception) here is discarded.
if (thrownException == null) {
resultFuture.complete(result);
} else {
resultFuture.completeExceptionally(thrownException);
}
}
} } | public class class_name {
@Override
@FFDCIgnore(Throwable.class)
public void run() {
Future<R> result = null;
Throwable thrownException = null;
try {
ArrayList<ThreadContext> contextAppliedToThread = null;
if (this.threadContext != null) {
//apply the JEE contexts to the thread before calling the inner task
contextAppliedToThread = this.threadContext.taskStarting(); // depends on control dependency: [if], data = [none]
}
try {
result = innerTask.call(); // depends on control dependency: [try], data = [none]
} finally {
if (contextAppliedToThread != null) {
//remove the JEE contexts again since the thread will be re-used
this.threadContext.taskStopping(contextAppliedToThread); // depends on control dependency: [if], data = [(contextAppliedToThread]
}
}
} catch (Throwable e) {
if (e instanceof com.ibm.ws.microprofile.faulttolerance.spi.ExecutionException) {
thrownException = e.getCause(); // depends on control dependency: [if], data = [none]
} else {
thrownException = e; // depends on control dependency: [if], data = [none]
}
} finally { // depends on control dependency: [catch], data = [none]
// We've finished running and caught any exceptions that occurred, now store the result in the resultFuture
// If abort() has already been called then the result future will already be completed and the result (or exception) here is discarded.
if (thrownException == null) {
resultFuture.complete(result); // depends on control dependency: [if], data = [none]
} else {
resultFuture.completeExceptionally(thrownException); // depends on control dependency: [if], data = [(thrownException]
}
}
} } |
public class class_name {
public void delete(String key) {
if (!ramMode.equals(DualCacheRamMode.DISABLE)) {
ramCacheLru.remove(key);
}
if (!diskMode.equals(DualCacheDiskMode.DISABLE)) {
try {
dualCacheLock.lockDiskEntryWrite(key);
diskLruCache.remove(key);
} catch (IOException e) {
logger.logError(e);
} finally {
dualCacheLock.unLockDiskEntryWrite(key);
}
}
} } | public class class_name {
public void delete(String key) {
if (!ramMode.equals(DualCacheRamMode.DISABLE)) {
ramCacheLru.remove(key); // depends on control dependency: [if], data = [none]
}
if (!diskMode.equals(DualCacheDiskMode.DISABLE)) {
try {
dualCacheLock.lockDiskEntryWrite(key); // depends on control dependency: [try], data = [none]
diskLruCache.remove(key); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.logError(e);
} finally { // depends on control dependency: [catch], data = [none]
dualCacheLock.unLockDiskEntryWrite(key);
}
}
} } |
public class class_name {
void updateImageMetrics() {
if (metrics == null) {
return;
}
int failedImageDirs = 0;
for (ImageManager im : imageManagers) {
if(im.isImageDisabled()) {
failedImageDirs++;
}
}
// update only images, journals are handled in JournalSet
metrics.imagesFailed.set(failedImageDirs);
} } | public class class_name {
void updateImageMetrics() {
if (metrics == null) {
return; // depends on control dependency: [if], data = [none]
}
int failedImageDirs = 0;
for (ImageManager im : imageManagers) {
if(im.isImageDisabled()) {
failedImageDirs++; // depends on control dependency: [if], data = [none]
}
}
// update only images, journals are handled in JournalSet
metrics.imagesFailed.set(failedImageDirs);
} } |
public class class_name {
@Override
public IModuleBuilder getModuleBuilder(String mid, IResource res) {
IModuleBuilder builder = null;
String path = res.getPath();
int idx = path.lastIndexOf("."); //$NON-NLS-1$
String ext = (idx == -1) ? "" : path.substring(idx+1); //$NON-NLS-1$
if (ext.contains("/")) { //$NON-NLS-1$
ext = ""; //$NON-NLS-1$
}
for (IAggregatorExtension extension : getExtensions(IModuleBuilderExtensionPoint.ID)) {
String extAttrib = extension.getAttribute(IModuleBuilderExtensionPoint.EXTENSION_ATTRIBUTE);
if (ext.equals(extAttrib) || "*".equals(extAttrib)) { //$NON-NLS-1$
IModuleBuilder test = (IModuleBuilder)extension.getInstance();
if (test.handles(mid, res)) {
builder = test;
break;
}
}
}
if (builder == null) {
throw new UnsupportedOperationException(
"No module builder for " + mid //$NON-NLS-1$
);
}
return builder;
} } | public class class_name {
@Override
public IModuleBuilder getModuleBuilder(String mid, IResource res) {
IModuleBuilder builder = null;
String path = res.getPath();
int idx = path.lastIndexOf("."); //$NON-NLS-1$
String ext = (idx == -1) ? "" : path.substring(idx+1); //$NON-NLS-1$
if (ext.contains("/")) { //$NON-NLS-1$
ext = ""; //$NON-NLS-1$
// depends on control dependency: [if], data = [none]
}
for (IAggregatorExtension extension : getExtensions(IModuleBuilderExtensionPoint.ID)) {
String extAttrib = extension.getAttribute(IModuleBuilderExtensionPoint.EXTENSION_ATTRIBUTE);
if (ext.equals(extAttrib) || "*".equals(extAttrib)) { //$NON-NLS-1$
IModuleBuilder test = (IModuleBuilder)extension.getInstance();
if (test.handles(mid, res)) {
builder = test;
// depends on control dependency: [if], data = [none]
break;
}
}
}
if (builder == null) {
throw new UnsupportedOperationException(
"No module builder for " + mid //$NON-NLS-1$
);
}
return builder;
} } |
public class class_name {
public String substituteLink(
CmsObject cms,
String link,
String siteRoot,
String targetDetailPage,
boolean forceSecure) {
if (targetDetailPage != null) {
return m_linkSubstitutionHandler.getLink(cms, link, siteRoot, targetDetailPage, forceSecure);
} else {
return m_linkSubstitutionHandler.getLink(cms, link, siteRoot, forceSecure);
}
} } | public class class_name {
public String substituteLink(
CmsObject cms,
String link,
String siteRoot,
String targetDetailPage,
boolean forceSecure) {
if (targetDetailPage != null) {
return m_linkSubstitutionHandler.getLink(cms, link, siteRoot, targetDetailPage, forceSecure); // depends on control dependency: [if], data = [none]
} else {
return m_linkSubstitutionHandler.getLink(cms, link, siteRoot, forceSecure); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public Observable<ServiceResponse<String>> supportedVpnDevicesWithServiceResponseAsync(String resourceGroupName, String virtualNetworkGatewayName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (virtualNetworkGatewayName == null) {
throw new IllegalArgumentException("Parameter virtualNetworkGatewayName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2017-10-01";
return service.supportedVpnDevices(resourceGroupName, virtualNetworkGatewayName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<String>>>() {
@Override
public Observable<ServiceResponse<String>> call(Response<ResponseBody> response) {
try {
ServiceResponse<String> clientResponse = supportedVpnDevicesDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<String>> supportedVpnDevicesWithServiceResponseAsync(String resourceGroupName, String virtualNetworkGatewayName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (virtualNetworkGatewayName == null) {
throw new IllegalArgumentException("Parameter virtualNetworkGatewayName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
final String apiVersion = "2017-10-01";
return service.supportedVpnDevices(resourceGroupName, virtualNetworkGatewayName, this.client.subscriptionId(), apiVersion, this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<String>>>() {
@Override
public Observable<ServiceResponse<String>> call(Response<ResponseBody> response) {
try {
ServiceResponse<String> clientResponse = supportedVpnDevicesDelegate(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 {
@SneakyThrows
public static SamlRegisteredService newSamlServiceProviderService(final AbstractSamlSPProperties sp,
final SamlRegisteredServiceCachingMetadataResolver resolver) {
if (StringUtils.isBlank(sp.getMetadata())) {
LOGGER.debug("Skipped registration of [{}] since no metadata location is found", sp.getName());
return null;
}
val service = new SamlRegisteredService();
service.setName(sp.getName());
service.setDescription(sp.getDescription());
service.setEvaluationOrder(Ordered.HIGHEST_PRECEDENCE);
service.setMetadataLocation(sp.getMetadata());
val attributesToRelease = new ArrayList<String>(sp.getAttributes());
if (StringUtils.isNotBlank(sp.getNameIdAttribute())) {
attributesToRelease.add(sp.getNameIdAttribute());
service.setUsernameAttributeProvider(new PrincipalAttributeRegisteredServiceUsernameProvider(sp.getNameIdAttribute()));
}
if (StringUtils.isNotBlank(sp.getNameIdFormat())) {
service.setRequiredNameIdFormat(sp.getNameIdFormat());
}
val attributes = CoreAuthenticationUtils.transformPrincipalAttributesListIntoMultiMap(attributesToRelease);
val policy = new ChainingAttributeReleasePolicy();
policy.addPolicy(new ReturnMappedAttributeReleasePolicy(CollectionUtils.wrap(attributes)));
service.setAttributeReleasePolicy(policy);
service.setMetadataCriteriaRoles(SPSSODescriptor.DEFAULT_ELEMENT_NAME.getLocalPart());
service.setMetadataCriteriaRemoveEmptyEntitiesDescriptors(true);
service.setMetadataCriteriaRemoveRolelessEntityDescriptors(true);
if (StringUtils.isNotBlank(sp.getSignatureLocation())) {
service.setMetadataSignatureLocation(sp.getSignatureLocation());
}
val entityIDList = determineEntityIdList(sp, resolver, service);
if (entityIDList.isEmpty()) {
LOGGER.warn("Skipped registration of [{}] since no metadata entity ids could be found", sp.getName());
return null;
}
val entityIds = org.springframework.util.StringUtils.collectionToDelimitedString(entityIDList, "|");
service.setMetadataCriteriaDirection(PredicateFilter.Direction.INCLUDE.name());
service.setMetadataCriteriaPattern(entityIds);
LOGGER.debug("Registering saml service [{}] by entity id [{}]", sp.getName(), entityIds);
service.setServiceId(entityIds);
service.setSignAssertions(sp.isSignAssertions());
service.setSignResponses(sp.isSignResponses());
return service;
} } | public class class_name {
@SneakyThrows
public static SamlRegisteredService newSamlServiceProviderService(final AbstractSamlSPProperties sp,
final SamlRegisteredServiceCachingMetadataResolver resolver) {
if (StringUtils.isBlank(sp.getMetadata())) {
LOGGER.debug("Skipped registration of [{}] since no metadata location is found", sp.getName()); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
val service = new SamlRegisteredService();
service.setName(sp.getName());
service.setDescription(sp.getDescription());
service.setEvaluationOrder(Ordered.HIGHEST_PRECEDENCE);
service.setMetadataLocation(sp.getMetadata());
val attributesToRelease = new ArrayList<String>(sp.getAttributes());
if (StringUtils.isNotBlank(sp.getNameIdAttribute())) {
attributesToRelease.add(sp.getNameIdAttribute()); // depends on control dependency: [if], data = [none]
service.setUsernameAttributeProvider(new PrincipalAttributeRegisteredServiceUsernameProvider(sp.getNameIdAttribute())); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isNotBlank(sp.getNameIdFormat())) {
service.setRequiredNameIdFormat(sp.getNameIdFormat()); // depends on control dependency: [if], data = [none]
}
val attributes = CoreAuthenticationUtils.transformPrincipalAttributesListIntoMultiMap(attributesToRelease);
val policy = new ChainingAttributeReleasePolicy();
policy.addPolicy(new ReturnMappedAttributeReleasePolicy(CollectionUtils.wrap(attributes)));
service.setAttributeReleasePolicy(policy);
service.setMetadataCriteriaRoles(SPSSODescriptor.DEFAULT_ELEMENT_NAME.getLocalPart());
service.setMetadataCriteriaRemoveEmptyEntitiesDescriptors(true);
service.setMetadataCriteriaRemoveRolelessEntityDescriptors(true);
if (StringUtils.isNotBlank(sp.getSignatureLocation())) {
service.setMetadataSignatureLocation(sp.getSignatureLocation()); // depends on control dependency: [if], data = [none]
}
val entityIDList = determineEntityIdList(sp, resolver, service);
if (entityIDList.isEmpty()) {
LOGGER.warn("Skipped registration of [{}] since no metadata entity ids could be found", sp.getName()); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
val entityIds = org.springframework.util.StringUtils.collectionToDelimitedString(entityIDList, "|");
service.setMetadataCriteriaDirection(PredicateFilter.Direction.INCLUDE.name());
service.setMetadataCriteriaPattern(entityIds);
LOGGER.debug("Registering saml service [{}] by entity id [{}]", sp.getName(), entityIds);
service.setServiceId(entityIds);
service.setSignAssertions(sp.isSignAssertions());
service.setSignResponses(sp.isSignResponses());
return service;
} } |
public class class_name {
public static HttpResponse postJson(String urlStr, String body)
throws IOException {
URL url = new URL(urlStr);
HttpURLConnection urlConnection = (HttpURLConnection) url
.openConnection();
urlConnection.addRequestProperty("Accept", "application/json");
urlConnection.setRequestMethod("POST");
urlConnection.addRequestProperty("Content-Type", "application/json");
urlConnection.addRequestProperty("Content-Length",
Integer.toString(body.length()));
urlConnection.setDoOutput(true);
urlConnection.setDoInput(true);
urlConnection.setUseCaches(false);
OutputStream out = urlConnection.getOutputStream();
out.write(body.getBytes());
ByteStreams.copy(new ByteArrayInputStream(body.getBytes()),
out);
BufferedReader in = null;
try {
int errorCode = urlConnection.getResponseCode();
if ((errorCode <= 202) && (errorCode >= 200)) {
in = new BufferedReader(new InputStreamReader(
urlConnection.getInputStream()));
} else {
InputStream error = urlConnection.getErrorStream();
if (error != null) {
in = new BufferedReader(new InputStreamReader(error));
}
}
String json = null;
if (in != null) {
json = CharStreams.toString(in);
}
return new HttpResponse(errorCode, json);
} finally {
if(in != null){
in.close();
}
}
} } | public class class_name {
public static HttpResponse postJson(String urlStr, String body)
throws IOException {
URL url = new URL(urlStr);
HttpURLConnection urlConnection = (HttpURLConnection) url
.openConnection();
urlConnection.addRequestProperty("Accept", "application/json");
urlConnection.setRequestMethod("POST");
urlConnection.addRequestProperty("Content-Type", "application/json");
urlConnection.addRequestProperty("Content-Length",
Integer.toString(body.length()));
urlConnection.setDoOutput(true);
urlConnection.setDoInput(true);
urlConnection.setUseCaches(false);
OutputStream out = urlConnection.getOutputStream();
out.write(body.getBytes());
ByteStreams.copy(new ByteArrayInputStream(body.getBytes()),
out);
BufferedReader in = null;
try {
int errorCode = urlConnection.getResponseCode();
if ((errorCode <= 202) && (errorCode >= 200)) {
in = new BufferedReader(new InputStreamReader(
urlConnection.getInputStream())); // depends on control dependency: [if], data = [none]
} else {
InputStream error = urlConnection.getErrorStream();
if (error != null) {
in = new BufferedReader(new InputStreamReader(error)); // depends on control dependency: [if], data = [(error]
}
}
String json = null;
if (in != null) {
json = CharStreams.toString(in); // depends on control dependency: [if], data = [(in]
}
return new HttpResponse(errorCode, json);
} finally {
if(in != null){
in.close(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public EntityResult<SqlResultSetMapping<T>> getOrCreateEntityResult()
{
List<Node> nodeList = childNode.get("entity-result");
if (nodeList != null && nodeList.size() > 0)
{
return new EntityResultImpl<SqlResultSetMapping<T>>(this, "entity-result", childNode, nodeList.get(0));
}
return createEntityResult();
} } | public class class_name {
public EntityResult<SqlResultSetMapping<T>> getOrCreateEntityResult()
{
List<Node> nodeList = childNode.get("entity-result");
if (nodeList != null && nodeList.size() > 0)
{
return new EntityResultImpl<SqlResultSetMapping<T>>(this, "entity-result", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createEntityResult();
} } |
public class class_name {
public void addNum(double d) {
if( isUUID() || isString() ) { addNA(); return; }
boolean predicate = _sparseNA ? !Double.isNaN(d) : isSparseZero()?d != 0:true;
if(predicate) {
if(_ms != null) {
if((long)d == d){
addNum((long)d,0);
return;
}
switch_to_doubles();
}
//if ds not big enough
if(_sparseLen == _ds.length ) {
append2slowd();
// call addNum again since append2slowd might have flipped to sparse
addNum(d);
assert _sparseLen <= _len;
return;
}
if(_id != null)_id[_sparseLen] = _len;
_ds[_sparseLen] = d;
_sparseLen++;
}
_len++;
assert _sparseLen <= _len;
} } | public class class_name {
public void addNum(double d) {
if( isUUID() || isString() ) { addNA(); return; } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
boolean predicate = _sparseNA ? !Double.isNaN(d) : isSparseZero()?d != 0:true;
if(predicate) {
if(_ms != null) {
if((long)d == d){
addNum((long)d,0); // depends on control dependency: [if], data = [((long)d]
return; // depends on control dependency: [if], data = [none]
}
switch_to_doubles(); // depends on control dependency: [if], data = [none]
}
//if ds not big enough
if(_sparseLen == _ds.length ) {
append2slowd(); // depends on control dependency: [if], data = [none]
// call addNum again since append2slowd might have flipped to sparse
addNum(d); // depends on control dependency: [if], data = [none]
assert _sparseLen <= _len;
return; // depends on control dependency: [if], data = [none]
}
if(_id != null)_id[_sparseLen] = _len;
_ds[_sparseLen] = d; // depends on control dependency: [if], data = [none]
_sparseLen++; // depends on control dependency: [if], data = [none]
}
_len++;
assert _sparseLen <= _len;
} } |
public class class_name {
public void split()
{
//this.statisticsOtherBranchSplit = this.learningNode.getStatisticsOtherBranchSplit();
//create a split node,
int splitIndex = this.learningNode.getSplitIndex();
InstanceConditionalTest st=this.learningNode.getBestSuggestion().splitTest;
if(st instanceof NumericAttributeBinaryTest ) {
NumericAttributeBinaryTest splitTest = (NumericAttributeBinaryTest) st;
NumericAttributeBinaryRulePredicate predicate = new NumericAttributeBinaryRulePredicate(
splitTest.getAttsTestDependsOn()[0], splitTest.getSplitValue(),
splitIndex + 1);
RuleSplitNode ruleSplitNode = new RuleSplitNode(predicate, this.learningNode.getStatisticsBranchSplit() );
if (this.nodeListAdd(ruleSplitNode) == true) {
// create a new learning node
RuleActiveLearningNode newLearningNode = newRuleActiveLearningNode(this.getBuilder().statistics(this.learningNode.getStatisticsNewRuleActiveLearningNode()));
newLearningNode.initialize(this.learningNode);
this.learningNode = newLearningNode;
}
}
else
throw new UnsupportedOperationException("AMRules (currently) only supports numerical attributes.");
} } | public class class_name {
public void split()
{
//this.statisticsOtherBranchSplit = this.learningNode.getStatisticsOtherBranchSplit();
//create a split node,
int splitIndex = this.learningNode.getSplitIndex();
InstanceConditionalTest st=this.learningNode.getBestSuggestion().splitTest;
if(st instanceof NumericAttributeBinaryTest ) {
NumericAttributeBinaryTest splitTest = (NumericAttributeBinaryTest) st;
NumericAttributeBinaryRulePredicate predicate = new NumericAttributeBinaryRulePredicate(
splitTest.getAttsTestDependsOn()[0], splitTest.getSplitValue(),
splitIndex + 1);
RuleSplitNode ruleSplitNode = new RuleSplitNode(predicate, this.learningNode.getStatisticsBranchSplit() );
if (this.nodeListAdd(ruleSplitNode) == true) {
// create a new learning node
RuleActiveLearningNode newLearningNode = newRuleActiveLearningNode(this.getBuilder().statistics(this.learningNode.getStatisticsNewRuleActiveLearningNode()));
newLearningNode.initialize(this.learningNode); // depends on control dependency: [if], data = [none]
this.learningNode = newLearningNode; // depends on control dependency: [if], data = [none]
}
}
else
throw new UnsupportedOperationException("AMRules (currently) only supports numerical attributes.");
} } |
public class class_name {
public void resetForReUse( OutputStream out ) {
if ( closed )
throw new RuntimeException("Can't reuse closed stream");
getCodec().reset(null);
if ( out != null ) {
getCodec().setOutstream(out);
}
objects.clearForWrite(conf);
} } | public class class_name {
public void resetForReUse( OutputStream out ) {
if ( closed )
throw new RuntimeException("Can't reuse closed stream");
getCodec().reset(null);
if ( out != null ) {
getCodec().setOutstream(out); // depends on control dependency: [if], data = [none]
}
objects.clearForWrite(conf);
} } |
public class class_name {
protected Object cookie(Type type, String name) {
return parameter(type, name, new Function<String, Object>() {
public Object apply(String name) {
Cookie[] cookies = context.request().getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
if (cookie.getName().equals(name)) {
return cookie.getValue();
}
}
}
return null;
}
}, new Function<String, Collection<Object>>() {
public Collection<Object> apply(String name) {
HttpServletRequest request = context.request();
Map<String, Object> map = new TreeMap<String, Object>();
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
String key = cookie.getName();
if (key.startsWith(name + "[")) {
map.put(key, cookie.getValue());
}
}
}
return (map.isEmpty()) ? null : map.values();
}
});
} } | public class class_name {
protected Object cookie(Type type, String name) {
return parameter(type, name, new Function<String, Object>() {
public Object apply(String name) {
Cookie[] cookies = context.request().getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
if (cookie.getName().equals(name)) {
return cookie.getValue(); // depends on control dependency: [if], data = [none]
}
}
}
return null;
}
}, new Function<String, Collection<Object>>() {
public Collection<Object> apply(String name) {
HttpServletRequest request = context.request();
Map<String, Object> map = new TreeMap<String, Object>();
Cookie[] cookies = request.getCookies();
if (cookies != null) {
for (Cookie cookie : cookies) {
String key = cookie.getName();
if (key.startsWith(name + "[")) {
map.put(key, cookie.getValue()); // depends on control dependency: [if], data = [none]
}
}
}
return (map.isEmpty()) ? null : map.values();
}
});
} } |
public class class_name {
public BuildPhase withContexts(PhaseContext... contexts) {
if (this.contexts == null) {
setContexts(new java.util.ArrayList<PhaseContext>(contexts.length));
}
for (PhaseContext ele : contexts) {
this.contexts.add(ele);
}
return this;
} } | public class class_name {
public BuildPhase withContexts(PhaseContext... contexts) {
if (this.contexts == null) {
setContexts(new java.util.ArrayList<PhaseContext>(contexts.length)); // depends on control dependency: [if], data = [none]
}
for (PhaseContext ele : contexts) {
this.contexts.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public ServerInstanceLogRecordList getLogListForServerInstance(Date time, final LogRecordHeaderFilter filter) {
ServerInstanceByTime instance = new ServerInstanceByTime(time == null ? -1 : time.getTime());
if (instance.logs == null && instance.traces == null) {
return EMPTY_LIST;
} else {
return new ServerInstanceLogRecordListImpl(instance.logs, instance.traces, false) {
@Override
public OnePidRecordListImpl queryResult(LogRepositoryBrowser browser) {
return new LogRecordBrowser(browser).recordsInProcess(-1, -1, filter);
}
};
}
} } | public class class_name {
public ServerInstanceLogRecordList getLogListForServerInstance(Date time, final LogRecordHeaderFilter filter) {
ServerInstanceByTime instance = new ServerInstanceByTime(time == null ? -1 : time.getTime());
if (instance.logs == null && instance.traces == null) {
return EMPTY_LIST; // depends on control dependency: [if], data = [none]
} else {
return new ServerInstanceLogRecordListImpl(instance.logs, instance.traces, false) {
@Override
public OnePidRecordListImpl queryResult(LogRepositoryBrowser browser) {
return new LogRecordBrowser(browser).recordsInProcess(-1, -1, filter);
}
}; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public synchronized void stop(StopContext context) {
final DeploymentScanner scanner = this.scanner;
notificationRegistryValue.getValue().unregisterNotificationHandler(ANY_ADDRESS, this.scanner, DEPLOYMENT_FILTER);
this.scanner = null;
scanner.stopScanner();
scheduledExecutorValue.getValue().shutdown();
if (callbackHandle != null) {
callbackHandle.remove();
}
} } | public class class_name {
@Override
public synchronized void stop(StopContext context) {
final DeploymentScanner scanner = this.scanner;
notificationRegistryValue.getValue().unregisterNotificationHandler(ANY_ADDRESS, this.scanner, DEPLOYMENT_FILTER);
this.scanner = null;
scanner.stopScanner();
scheduledExecutorValue.getValue().shutdown();
if (callbackHandle != null) {
callbackHandle.remove(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public String getModuleName() {
if (moduleID != null) {
return moduleID;
}
if (path != null && path.length > MODULE_INDEX)
return path[1];
else
return null;
} } | public class class_name {
public String getModuleName() {
if (moduleID != null) {
return moduleID; // depends on control dependency: [if], data = [none]
}
if (path != null && path.length > MODULE_INDEX)
return path[1];
else
return null;
} } |
public class class_name {
@Override
public void actionPerformed(java.awt.event.ActionEvent event) {
if (event.getSource().equals(CLOCK_TIMER)) {
// Seconds
secondPointerAngle = java.util.Calendar.getInstance().get(java.util.Calendar.SECOND) * ANGLE_STEP + java.util.Calendar.getInstance().get(java.util.Calendar.MILLISECOND) * ANGLE_STEP / 1000;
// Hours
hour = java.util.Calendar.getInstance().get(java.util.Calendar.HOUR) - this.timeZoneOffsetHour;
if (hour > 12) {
hour -= 12;
}
if (hour < 0) {
hour += 12;
}
// Minutes
minute = java.util.Calendar.getInstance().get(java.util.Calendar.MINUTE) + this.timeZoneOffsetMinute;
if (minute > 60) {
minute -= 60;
hour++;
}
if (minute < 0) {
minute += 60;
hour--;
}
// Calculate angles from current hour and minute values
hourPointerAngle = hour * ANGLE_STEP * 5 + (0.5) * minute;
minutePointerAngle = minute * ANGLE_STEP;
repaint(getInnerBounds());
}
} } | public class class_name {
@Override
public void actionPerformed(java.awt.event.ActionEvent event) {
if (event.getSource().equals(CLOCK_TIMER)) {
// Seconds
secondPointerAngle = java.util.Calendar.getInstance().get(java.util.Calendar.SECOND) * ANGLE_STEP + java.util.Calendar.getInstance().get(java.util.Calendar.MILLISECOND) * ANGLE_STEP / 1000; // depends on control dependency: [if], data = [none]
// Hours
hour = java.util.Calendar.getInstance().get(java.util.Calendar.HOUR) - this.timeZoneOffsetHour; // depends on control dependency: [if], data = [none]
if (hour > 12) {
hour -= 12; // depends on control dependency: [if], data = [none]
}
if (hour < 0) {
hour += 12; // depends on control dependency: [if], data = [none]
}
// Minutes
minute = java.util.Calendar.getInstance().get(java.util.Calendar.MINUTE) + this.timeZoneOffsetMinute; // depends on control dependency: [if], data = [none]
if (minute > 60) {
minute -= 60; // depends on control dependency: [if], data = [none]
hour++; // depends on control dependency: [if], data = [none]
}
if (minute < 0) {
minute += 60; // depends on control dependency: [if], data = [none]
hour--; // depends on control dependency: [if], data = [none]
}
// Calculate angles from current hour and minute values
hourPointerAngle = hour * ANGLE_STEP * 5 + (0.5) * minute; // depends on control dependency: [if], data = [none]
minutePointerAngle = minute * ANGLE_STEP; // depends on control dependency: [if], data = [none]
repaint(getInnerBounds()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setContextPath(String _contextPath){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME,"setContextPath", "contextPath -> "+ _contextPath +" ,this -> " + this);
}
this._contextPath = _contextPath;
} } | public class class_name {
public void setContextPath(String _contextPath){
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME,"setContextPath", "contextPath -> "+ _contextPath +" ,this -> " + this); // depends on control dependency: [if], data = [none]
}
this._contextPath = _contextPath;
} } |
public class class_name {
public static RSAPrivateKey getPrivateKey(String modulus, String exponent) {
try {
BigInteger b1 = new BigInteger(modulus);
BigInteger b2 = new BigInteger(exponent);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(b1, b2);
return (RSAPrivateKey) keyFactory.generatePrivate(keySpec);
} catch (Exception e) {
e.printStackTrace();
return null;
}
} } | public class class_name {
public static RSAPrivateKey getPrivateKey(String modulus, String exponent) {
try {
BigInteger b1 = new BigInteger(modulus);
BigInteger b2 = new BigInteger(exponent);
KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
RSAPrivateKeySpec keySpec = new RSAPrivateKeySpec(b1, b2);
return (RSAPrivateKey) keyFactory.generatePrivate(keySpec); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
e.printStackTrace();
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static boolean mergeResRefs(ComponentNameSpaceConfiguration masterCompNSConfig,
List<ComponentNameSpaceConfiguration> compNSConfigs,
Map<String, ResourceRefConfig[]> totalResRefs) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.entry(tc, "mergeResRefs");
ResourceRefConfigList resRefList = InternalInjectionEngineAccessor.getInstance().createResourceRefConfigList();
masterCompNSConfig.setResourceRefConfigList(resRefList);
List<ResourceRefConfig.MergeConflict> conflicts = new ArrayList<ResourceRefConfig.MergeConflict>();
for (Map.Entry<String, ResourceRefConfig[]> entry : totalResRefs.entrySet()) {
ResourceRefConfig mergedResRef = resRefList.findOrAddByName(entry.getKey());
mergedResRef.mergeBindingsAndExtensions(entry.getValue(), conflicts);
}
boolean success = conflicts.isEmpty();
if (!success) {
for (ResourceRefConfig.MergeConflict conflict : conflicts) {
Tr.error(tc, "CONFLICTING_REFERENCES_CWNEN0062E",
compNSConfigs.get(conflict.getIndex1()).getDisplayName(),
compNSConfigs.get(conflict.getIndex2()).getDisplayName(),
masterCompNSConfig.getModuleName(),
masterCompNSConfig.getApplicationName(),
conflict.getAttributeName(),
conflict.getResourceRefConfig().getName(),
conflict.getValue1(),
conflict.getValue2());
}
}
if (isTraceOn && tc.isDebugEnabled())
Tr.exit(tc, "mergeResRefs: " + success);
return success;
} } | public class class_name {
private static boolean mergeResRefs(ComponentNameSpaceConfiguration masterCompNSConfig,
List<ComponentNameSpaceConfiguration> compNSConfigs,
Map<String, ResourceRefConfig[]> totalResRefs) {
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isDebugEnabled())
Tr.entry(tc, "mergeResRefs");
ResourceRefConfigList resRefList = InternalInjectionEngineAccessor.getInstance().createResourceRefConfigList();
masterCompNSConfig.setResourceRefConfigList(resRefList);
List<ResourceRefConfig.MergeConflict> conflicts = new ArrayList<ResourceRefConfig.MergeConflict>();
for (Map.Entry<String, ResourceRefConfig[]> entry : totalResRefs.entrySet()) {
ResourceRefConfig mergedResRef = resRefList.findOrAddByName(entry.getKey());
mergedResRef.mergeBindingsAndExtensions(entry.getValue(), conflicts); // depends on control dependency: [for], data = [entry]
}
boolean success = conflicts.isEmpty();
if (!success) {
for (ResourceRefConfig.MergeConflict conflict : conflicts) {
Tr.error(tc, "CONFLICTING_REFERENCES_CWNEN0062E",
compNSConfigs.get(conflict.getIndex1()).getDisplayName(),
compNSConfigs.get(conflict.getIndex2()).getDisplayName(),
masterCompNSConfig.getModuleName(),
masterCompNSConfig.getApplicationName(),
conflict.getAttributeName(),
conflict.getResourceRefConfig().getName(),
conflict.getValue1(),
conflict.getValue2()); // depends on control dependency: [for], data = [none]
}
}
if (isTraceOn && tc.isDebugEnabled())
Tr.exit(tc, "mergeResRefs: " + success);
return success;
} } |
public class class_name {
@Override
public List<org.fcrepo.server.types.gen.Datastream> getDatastreamHistory(String pid,
String dsID) {
assertInitialized();
try {
MessageContext ctx = context.getMessageContext();
org.fcrepo.server.storage.types.Datastream[] intDatastreams =
m_management.getDatastreamHistory(ReadOnlyContext
.getSoapContext(ctx), pid, dsID);
return getGenDatastreams(intDatastreams);
} catch (Throwable th) {
LOG.error("Error getting datastream history", th);
throw CXFUtility.getFault(th);
}
} } | public class class_name {
@Override
public List<org.fcrepo.server.types.gen.Datastream> getDatastreamHistory(String pid,
String dsID) {
assertInitialized();
try {
MessageContext ctx = context.getMessageContext();
org.fcrepo.server.storage.types.Datastream[] intDatastreams =
m_management.getDatastreamHistory(ReadOnlyContext
.getSoapContext(ctx), pid, dsID);
return getGenDatastreams(intDatastreams); // depends on control dependency: [try], data = [none]
} catch (Throwable th) {
LOG.error("Error getting datastream history", th);
throw CXFUtility.getFault(th);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private ESat isConsistent() {
int[][] l = new int[nbDims][nbBins];
for (int i = 0; i < bins.length; i++) {
if (bins[i].isInstantiated()) {
for (int d = 0; d < nbDims; d++) {
int v = bins[i].getValue();
l[d][v] += iSizes[d][i];
if (l[d][v] > loads[d][v].getUB()) {
return ESat.FALSE;
}
}
}
}
return ESat.TRUE;
} } | public class class_name {
private ESat isConsistent() {
int[][] l = new int[nbDims][nbBins];
for (int i = 0; i < bins.length; i++) {
if (bins[i].isInstantiated()) {
for (int d = 0; d < nbDims; d++) {
int v = bins[i].getValue();
l[d][v] += iSizes[d][i];
// depends on control dependency: [for], data = [d]
if (l[d][v] > loads[d][v].getUB()) {
return ESat.FALSE;
// depends on control dependency: [if], data = [none]
}
}
}
}
return ESat.TRUE;
} } |
public class class_name {
public static Duration standardHours(long hours) {
if (hours == 0) {
return ZERO;
}
return new Duration(FieldUtils.safeMultiply(hours, DateTimeConstants.MILLIS_PER_HOUR));
} } | public class class_name {
public static Duration standardHours(long hours) {
if (hours == 0) {
return ZERO; // depends on control dependency: [if], data = [none]
}
return new Duration(FieldUtils.safeMultiply(hours, DateTimeConstants.MILLIS_PER_HOUR));
} } |
public class class_name {
public static Set<TypeDef> unrollHierarchy(TypeDef typeDef) {
if (OBJECT.equals(typeDef)) {
return new HashSet<>();
}
Set<TypeDef> hierarchy = new HashSet<>();
hierarchy.add(typeDef);
hierarchy.addAll(typeDef.getExtendsList().stream().flatMap(s -> unrollHierarchy(s.getDefinition()).stream()).collect(Collectors.toSet()));
return hierarchy;
} } | public class class_name {
public static Set<TypeDef> unrollHierarchy(TypeDef typeDef) {
if (OBJECT.equals(typeDef)) {
return new HashSet<>(); // depends on control dependency: [if], data = [none]
}
Set<TypeDef> hierarchy = new HashSet<>();
hierarchy.add(typeDef);
hierarchy.addAll(typeDef.getExtendsList().stream().flatMap(s -> unrollHierarchy(s.getDefinition()).stream()).collect(Collectors.toSet()));
return hierarchy;
} } |
public class class_name {
public void complete(VirtualConnection vc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "complete() called: " + vc);
}
// can't do anything with a null VC
if (null == vc) {
return;
}
Object o = vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPISC);
if (null == o) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ERROR: null ISC in complete()");
}
return;
}
HttpInboundServiceContextImpl sc = (HttpInboundServiceContextImpl) o;
// need to continue the purge of the request body
try {
VirtualConnection rc = null;
do {
WsByteBuffer buffer = sc.getRequestBodyBuffer();
if (null != buffer) {
buffer.release();
rc = sc.getRequestBodyBuffer(this, false);
} else {
// end of body found
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Reached end of the body being purged");
}
sc.getLink().close(vc, null);
return;
}
} while (null != rc);
} catch (Exception purgeException) {
// no FFDC required
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception purging request body: " + purgeException);
}
sc.getLink().close(vc, purgeException);
}
// if we get here then we're waiting for the next callback usage
} } | public class class_name {
public void complete(VirtualConnection vc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "complete() called: " + vc); // depends on control dependency: [if], data = [none]
}
// can't do anything with a null VC
if (null == vc) {
return; // depends on control dependency: [if], data = [none]
}
Object o = vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPISC);
if (null == o) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "ERROR: null ISC in complete()"); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
HttpInboundServiceContextImpl sc = (HttpInboundServiceContextImpl) o;
// need to continue the purge of the request body
try {
VirtualConnection rc = null;
do {
WsByteBuffer buffer = sc.getRequestBodyBuffer();
if (null != buffer) {
buffer.release(); // depends on control dependency: [if], data = [none]
rc = sc.getRequestBodyBuffer(this, false); // depends on control dependency: [if], data = [none]
} else {
// end of body found
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Reached end of the body being purged"); // depends on control dependency: [if], data = [none]
}
sc.getLink().close(vc, null); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
} while (null != rc);
} catch (Exception purgeException) {
// no FFDC required
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Exception purging request body: " + purgeException); // depends on control dependency: [if], data = [none]
}
sc.getLink().close(vc, purgeException);
} // depends on control dependency: [catch], data = [none]
// if we get here then we're waiting for the next callback usage
} } |
public class class_name {
public MimeMappingType<WebAppDescriptor> getOrCreateMimeMapping()
{
List<Node> nodeList = model.get("mime-mapping");
if (nodeList != null && nodeList.size() > 0)
{
return new MimeMappingTypeImpl<WebAppDescriptor>(this, "mime-mapping", model, nodeList.get(0));
}
return createMimeMapping();
} } | public class class_name {
public MimeMappingType<WebAppDescriptor> getOrCreateMimeMapping()
{
List<Node> nodeList = model.get("mime-mapping");
if (nodeList != null && nodeList.size() > 0)
{
return new MimeMappingTypeImpl<WebAppDescriptor>(this, "mime-mapping", model, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createMimeMapping();
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.