code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
@Override
public byte[] call(final byte[] memento) {
LOG.log(Level.FINE, "Task started: sleep for: {0} msec.", this.delay);
final long ts = System.currentTimeMillis();
for (long period = this.delay; period > 0; period -= System.currentTimeMillis() - ts) {
try {
Thread.sleep(period);
} catch (final InterruptedException ex) {
LOG.log(Level.FINEST, "Interrupted: {0}", ex);
}
}
LOG.log(Level.FINE, "Task finished after {0} msec.", System.currentTimeMillis() - ts);
return null;
} }
|
public class class_name {
@Override
public byte[] call(final byte[] memento) {
LOG.log(Level.FINE, "Task started: sleep for: {0} msec.", this.delay);
final long ts = System.currentTimeMillis();
for (long period = this.delay; period > 0; period -= System.currentTimeMillis() - ts) {
try {
Thread.sleep(period); // depends on control dependency: [try], data = [none]
} catch (final InterruptedException ex) {
LOG.log(Level.FINEST, "Interrupted: {0}", ex);
} // depends on control dependency: [catch], data = [none]
}
LOG.log(Level.FINE, "Task finished after {0} msec.", System.currentTimeMillis() - ts);
return null;
} }
|
public class class_name {
public void backoffActualHighWatermark() {
JsonElement lowWatermark = this.workUnit.getLowWatermark();
if (lowWatermark == null) {
return;
}
setProp(ConfigurationKeys.WORK_UNIT_STATE_ACTUAL_HIGH_WATER_MARK_KEY, lowWatermark.toString());
} }
|
public class class_name {
public void backoffActualHighWatermark() {
JsonElement lowWatermark = this.workUnit.getLowWatermark();
if (lowWatermark == null) {
return; // depends on control dependency: [if], data = [none]
}
setProp(ConfigurationKeys.WORK_UNIT_STATE_ACTUAL_HIGH_WATER_MARK_KEY, lowWatermark.toString());
} }
|
public class class_name {
private static void adjustQuality(Map<String, Float> pFormatQuality, String pFormat, float pFactor) {
Float oldValue = pFormatQuality.get(pFormat);
if (oldValue != null) {
pFormatQuality.put(pFormat, oldValue * pFactor);
//System.out.println("New vallue after multiplying with " + pFactor + " is " + pFormatQuality.get(pFormat));
}
} }
|
public class class_name {
private static void adjustQuality(Map<String, Float> pFormatQuality, String pFormat, float pFactor) {
Float oldValue = pFormatQuality.get(pFormat);
if (oldValue != null) {
pFormatQuality.put(pFormat, oldValue * pFactor);
// depends on control dependency: [if], data = [none]
//System.out.println("New vallue after multiplying with " + pFactor + " is " + pFormatQuality.get(pFormat));
}
} }
|
public class class_name {
protected String buildFlashVarsString(Map<String, String> flashVars) {
try {
StringBuilder flashvarsString = new StringBuilder();
Iterator<Map.Entry<String, String>> flashvarsIterator = flashVars.entrySet().iterator();
while (flashvarsIterator.hasNext()) {
Map.Entry<String, String> entry = flashvarsIterator.next();
flashvarsString.append(URLEncoder.encode(entry.getKey(), CharEncoding.UTF_8));
flashvarsString.append('=');
flashvarsString.append(URLEncoder.encode(entry.getValue(), CharEncoding.UTF_8));
if (flashvarsIterator.hasNext()) {
flashvarsString.append('&');
}
}
return flashvarsString.toString();
}
catch (UnsupportedEncodingException ex) {
throw new RuntimeException("Unsupported encoding.", ex);
}
} }
|
public class class_name {
protected String buildFlashVarsString(Map<String, String> flashVars) {
try {
StringBuilder flashvarsString = new StringBuilder();
Iterator<Map.Entry<String, String>> flashvarsIterator = flashVars.entrySet().iterator();
while (flashvarsIterator.hasNext()) {
Map.Entry<String, String> entry = flashvarsIterator.next();
flashvarsString.append(URLEncoder.encode(entry.getKey(), CharEncoding.UTF_8)); // depends on control dependency: [while], data = [none]
flashvarsString.append('='); // depends on control dependency: [while], data = [none]
flashvarsString.append(URLEncoder.encode(entry.getValue(), CharEncoding.UTF_8)); // depends on control dependency: [while], data = [none]
if (flashvarsIterator.hasNext()) {
flashvarsString.append('&'); // depends on control dependency: [if], data = [none]
}
}
return flashvarsString.toString(); // depends on control dependency: [try], data = [none]
}
catch (UnsupportedEncodingException ex) {
throw new RuntimeException("Unsupported encoding.", ex);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static synchronized void loadLibrary(File jar) throws NoAvailableBackendException {
try {
/*We are using reflection here to circumvent encapsulation; addURL is not public*/
java.net.URLClassLoader loader = (java.net.URLClassLoader) ClassLoader.getSystemClassLoader();
java.net.URL url = jar.toURI().toURL();
/*Disallow if already loaded*/
for (java.net.URL it : java.util.Arrays.asList(loader.getURLs())) {
if (it.equals(url)) {
return;
}
}
java.lang.reflect.Method method =
java.net.URLClassLoader.class.getDeclaredMethod("addURL", new Class[] {java.net.URL.class});
method.setAccessible(true); /*promote the method to public access*/
method.invoke(loader, new Object[] {url});
} catch (final java.lang.NoSuchMethodException | java.lang.IllegalAccessException
| java.net.MalformedURLException | java.lang.reflect.InvocationTargetException e) {
throw new NoAvailableBackendException(e);
}
} }
|
public class class_name {
public static synchronized void loadLibrary(File jar) throws NoAvailableBackendException {
try {
/*We are using reflection here to circumvent encapsulation; addURL is not public*/
java.net.URLClassLoader loader = (java.net.URLClassLoader) ClassLoader.getSystemClassLoader();
java.net.URL url = jar.toURI().toURL();
/*Disallow if already loaded*/
for (java.net.URL it : java.util.Arrays.asList(loader.getURLs())) {
if (it.equals(url)) {
return; // depends on control dependency: [if], data = [none]
}
}
java.lang.reflect.Method method =
java.net.URLClassLoader.class.getDeclaredMethod("addURL", new Class[] {java.net.URL.class});
method.setAccessible(true); /*promote the method to public access*/
method.invoke(loader, new Object[] {url});
} catch (final java.lang.NoSuchMethodException | java.lang.IllegalAccessException
| java.net.MalformedURLException | java.lang.reflect.InvocationTargetException e) {
throw new NoAvailableBackendException(e);
}
} }
|
public class class_name {
private String buildWhereClause() {
StringBuilder sqlBuf = new StringBuilder();
String join = null;
boolean first = true;
for (Enumeration where = mTables.elements(); where.hasMoreElements();) {
join = (String) where.nextElement();
if (join.length() > 0) {
if (first) {
// Skip " AND " in first iteration
first = false;
}
else {
sqlBuf.append(" AND ");
}
}
sqlBuf.append(join);
}
if (sqlBuf.length() > 0)
return "WHERE " + sqlBuf.toString();
return "WHERE 1 = 1"; // Hacky...
} }
|
public class class_name {
private String buildWhereClause() {
StringBuilder sqlBuf = new StringBuilder();
String join = null;
boolean first = true;
for (Enumeration where = mTables.elements(); where.hasMoreElements();) {
join = (String) where.nextElement();
// depends on control dependency: [for], data = [where]
if (join.length() > 0) {
if (first) {
// Skip " AND " in first iteration
first = false;
// depends on control dependency: [if], data = [none]
}
else {
sqlBuf.append(" AND ");
// depends on control dependency: [if], data = [none]
}
}
sqlBuf.append(join);
// depends on control dependency: [for], data = [none]
}
if (sqlBuf.length() > 0)
return "WHERE " + sqlBuf.toString();
return "WHERE 1 = 1"; // Hacky...
} }
|
public class class_name {
public synchronized void run(){
while (true){
try {
if (incoming == null) {
wait();
}
System.out.println("Socket opening ...");
BufferedReader in = new BufferedReader(new InputStreamReader(
incoming.getInputStream(), "UTF-8"));
//PrintStream out = (PrintStream) incoming.getOutputStream();
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(
incoming.getOutputStream(), "UTF-8"));
String content = "";
while (true){
int ch = in.read();
if (ch == 0) //end of string
break;
content += (char) ch;
}
//System.out.println(content);
String tagged = textpro.process(content);
//Thread.sleep(4000);
out.write(tagged.trim());
out.write((char)0);
out.flush();
}
catch (InterruptedIOException e){
System.out.println("The conection is interrupted");
}
catch (Exception e){
System.out.println(e);
e.printStackTrace();
}
//update pool
//go back in wait queue if there is fewer than max
this.setSocket(null);
Vector<Session> pool = TaggingService.pool;
synchronized (pool) {
if (pool.size() >= TaggingService.maxNSession){
/* too many threads, exit this one*/
return;
}
else {
pool.addElement(this);
}
}
}
} }
|
public class class_name {
public synchronized void run(){
while (true){
try {
if (incoming == null) {
wait();
// depends on control dependency: [if], data = [none]
}
System.out.println("Socket opening ...");
// depends on control dependency: [try], data = [none]
BufferedReader in = new BufferedReader(new InputStreamReader(
incoming.getInputStream(), "UTF-8"));
//PrintStream out = (PrintStream) incoming.getOutputStream();
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(
incoming.getOutputStream(), "UTF-8"));
String content = "";
while (true){
int ch = in.read();
if (ch == 0) //end of string
break;
content += (char) ch;
// depends on control dependency: [while], data = [none]
}
//System.out.println(content);
String tagged = textpro.process(content);
//Thread.sleep(4000);
out.write(tagged.trim());
// depends on control dependency: [try], data = [none]
out.write((char)0);
// depends on control dependency: [try], data = [none]
out.flush();
// depends on control dependency: [try], data = [none]
}
catch (InterruptedIOException e){
System.out.println("The conection is interrupted");
}
// depends on control dependency: [catch], data = [none]
catch (Exception e){
System.out.println(e);
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
//update pool
//go back in wait queue if there is fewer than max
this.setSocket(null);
// depends on control dependency: [while], data = [none]
Vector<Session> pool = TaggingService.pool;
synchronized (pool) {
// depends on control dependency: [while], data = [none]
if (pool.size() >= TaggingService.maxNSession){
/* too many threads, exit this one*/
return;
// depends on control dependency: [if], data = [none]
}
else {
pool.addElement(this);
// depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public UpdateReturnState update(final byte[] data) {
if ((data == null) || (data.length == 0)) {
return RejectedNullOrEmpty;
}
return hashUpdate(hash(data, getSeed())[0] >>> 1);
} }
|
public class class_name {
public UpdateReturnState update(final byte[] data) {
if ((data == null) || (data.length == 0)) {
return RejectedNullOrEmpty; // depends on control dependency: [if], data = [none]
}
return hashUpdate(hash(data, getSeed())[0] >>> 1);
} }
|
public class class_name {
protected void fill() {
m_list.clear();
List<CmsResourceStatusRelationBean> relationBeans = getRelationBeans();
if (relationBeans.isEmpty()) {
CmsSimpleListItem item = new CmsSimpleListItem();
item.add(new Label(getEmptyMessage()));
m_list.add(item);
} else {
for (CmsResourceStatusRelationBean relationBean : relationBeans) {
CmsListItemWidget itemWidget = new CmsListItemWidget(relationBean.getInfoBean());
CmsListItem item = new CmsListItem(itemWidget);
CmsContextMenuButton button = new CmsContextMenuButton(
relationBean.getStructureId(),
m_menuHandler,
AdeContext.resourceinfo);
item.getListItemWidget().addButton(button);
final CmsResourceStatusRelationBean currentRelationBean = relationBean;
final boolean isContainerpage = CmsGwtConstants.TYPE_CONTAINERPAGE.equals(
relationBean.getInfoBean().getResourceType());
final boolean isXmlContent = relationBean.isXmlContent();
final boolean isEditable = (isXmlContent || isContainerpage)
&& relationBean.getPermissionInfo().hasWritePermission()
&& !currentRelationBean.getSitePath().matches(DETAIL_CONTAINER_PATTERN);
if (isEditable) {
m_editButton = new CmsPushButton();
m_editButton.setImageClass(I_CmsButton.PEN_SMALL);
m_editButton.setButtonStyle(ButtonStyle.FONT_ICON, null);
m_editButton.setTitle(
org.opencms.gwt.client.Messages.get().key(
org.opencms.gwt.client.Messages.GUI_BUTTON_ELEMENT_EDIT_0));
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(relationBean.getPermissionInfo().getNoEditReason())) {
m_editButton.disable(relationBean.getPermissionInfo().getNoEditReason());
} else {
m_editButton.setEnabled(true);
}
item.getListItemWidget().addButton(m_editButton);
m_editButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (isContainerpage) {
Window.open(currentRelationBean.getLink(), "_self", "");
} else {
CmsEditableData editableData = new CmsEditableData();
editableData.setElementLanguage(CmsCoreProvider.get().getLocale());
editableData.setStructureId(currentRelationBean.getStructureId());
editableData.setSitePath(currentRelationBean.getSitePath());
CmsContentEditorDialog.get().openEditDialog(
editableData,
false,
null,
new DialogOptions(),
new I_CmsContentEditorHandler() {
public void onClose(
String sitePath,
CmsUUID structureId,
boolean isNew,
boolean hasChangedSettings) {
if (m_popup != null) {
m_popup.hide();
}
}
});
((CmsPushButton)event.getSource()).clearHoverState();
}
}
});
}
if (isContainerpage) {
if (relationBean.getLink() != null) {
final String link = relationBean.getLink();
itemWidget.setIconCursor(Cursor.POINTER);
itemWidget.addIconClickHandler(new ClickHandler() {
public void onClick(ClickEvent e) {
Window.open(link, "_blank", "");
}
});
}
}
m_list.add(item);
}
}
if ((m_mode == Mode.sources) && !m_statusBean.getOtherSiteRelationSources().isEmpty()) {
m_otherSitesList = createList(Messages.get().key(Messages.GUI_RESOURCEINFO_OTHERSITES_LEGEND_0));
for (CmsResourceStatusRelationBean relationBean : m_statusBean.getOtherSiteRelationSources()) {
CmsListItemWidget itemWidget = new CmsListItemWidget(relationBean.getInfoBean());
CmsListItem item = new CmsListItem(itemWidget);
m_otherSitesList.add(item);
}
}
m_list.truncate("RES_INFO", CmsPopup.DEFAULT_WIDTH - 5);
if (m_otherSitesList != null) {
m_otherSitesList.truncate("RES_INFO", CmsPopup.DEFAULT_WIDTH - 5);
}
} }
|
public class class_name {
protected void fill() {
m_list.clear();
List<CmsResourceStatusRelationBean> relationBeans = getRelationBeans();
if (relationBeans.isEmpty()) {
CmsSimpleListItem item = new CmsSimpleListItem();
item.add(new Label(getEmptyMessage()));
// depends on control dependency: [if], data = [none]
m_list.add(item);
// depends on control dependency: [if], data = [none]
} else {
for (CmsResourceStatusRelationBean relationBean : relationBeans) {
CmsListItemWidget itemWidget = new CmsListItemWidget(relationBean.getInfoBean());
CmsListItem item = new CmsListItem(itemWidget);
CmsContextMenuButton button = new CmsContextMenuButton(
relationBean.getStructureId(),
m_menuHandler,
AdeContext.resourceinfo);
item.getListItemWidget().addButton(button);
// depends on control dependency: [for], data = [none]
final CmsResourceStatusRelationBean currentRelationBean = relationBean;
final boolean isContainerpage = CmsGwtConstants.TYPE_CONTAINERPAGE.equals(
relationBean.getInfoBean().getResourceType());
final boolean isXmlContent = relationBean.isXmlContent();
final boolean isEditable = (isXmlContent || isContainerpage)
&& relationBean.getPermissionInfo().hasWritePermission()
&& !currentRelationBean.getSitePath().matches(DETAIL_CONTAINER_PATTERN);
if (isEditable) {
m_editButton = new CmsPushButton();
// depends on control dependency: [if], data = [none]
m_editButton.setImageClass(I_CmsButton.PEN_SMALL);
// depends on control dependency: [if], data = [none]
m_editButton.setButtonStyle(ButtonStyle.FONT_ICON, null);
// depends on control dependency: [if], data = [none]
m_editButton.setTitle(
org.opencms.gwt.client.Messages.get().key(
org.opencms.gwt.client.Messages.GUI_BUTTON_ELEMENT_EDIT_0));
// depends on control dependency: [if], data = [none]
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(relationBean.getPermissionInfo().getNoEditReason())) {
m_editButton.disable(relationBean.getPermissionInfo().getNoEditReason());
// depends on control dependency: [if], data = [none]
} else {
m_editButton.setEnabled(true);
// depends on control dependency: [if], data = [none]
}
item.getListItemWidget().addButton(m_editButton);
// depends on control dependency: [if], data = [none]
m_editButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
if (isContainerpage) {
Window.open(currentRelationBean.getLink(), "_self", "");
// depends on control dependency: [if], data = [none]
} else {
CmsEditableData editableData = new CmsEditableData();
editableData.setElementLanguage(CmsCoreProvider.get().getLocale());
// depends on control dependency: [if], data = [none]
editableData.setStructureId(currentRelationBean.getStructureId());
// depends on control dependency: [if], data = [none]
editableData.setSitePath(currentRelationBean.getSitePath());
// depends on control dependency: [if], data = [none]
CmsContentEditorDialog.get().openEditDialog(
editableData,
false,
null,
new DialogOptions(),
new I_CmsContentEditorHandler() {
public void onClose(
String sitePath,
CmsUUID structureId,
boolean isNew,
boolean hasChangedSettings) {
if (m_popup != null) {
m_popup.hide();
// depends on control dependency: [if], data = [none]
}
}
});
// depends on control dependency: [if], data = [none]
((CmsPushButton)event.getSource()).clearHoverState();
// depends on control dependency: [if], data = [none]
}
}
});
// depends on control dependency: [if], data = [none]
}
if (isContainerpage) {
if (relationBean.getLink() != null) {
final String link = relationBean.getLink();
itemWidget.setIconCursor(Cursor.POINTER);
// depends on control dependency: [if], data = [none]
itemWidget.addIconClickHandler(new ClickHandler() {
public void onClick(ClickEvent e) {
Window.open(link, "_blank", "");
}
});
// depends on control dependency: [if], data = [none]
}
}
m_list.add(item);
// depends on control dependency: [for], data = [none]
}
}
if ((m_mode == Mode.sources) && !m_statusBean.getOtherSiteRelationSources().isEmpty()) {
m_otherSitesList = createList(Messages.get().key(Messages.GUI_RESOURCEINFO_OTHERSITES_LEGEND_0));
// depends on control dependency: [if], data = [none]
for (CmsResourceStatusRelationBean relationBean : m_statusBean.getOtherSiteRelationSources()) {
CmsListItemWidget itemWidget = new CmsListItemWidget(relationBean.getInfoBean());
CmsListItem item = new CmsListItem(itemWidget);
m_otherSitesList.add(item);
// depends on control dependency: [for], data = [none]
}
}
m_list.truncate("RES_INFO", CmsPopup.DEFAULT_WIDTH - 5);
if (m_otherSitesList != null) {
m_otherSitesList.truncate("RES_INFO", CmsPopup.DEFAULT_WIDTH - 5);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public synchronized void close() {
if(!isClosed) {
if(bucket != null) {
LOG.debug("Closing Couchbase bucket");
bucket.close();
}
if(cluster != null) {
LOG.debug("Disconnecting Couchbase cluster");
cluster.disconnect();
}
if(env != null) {
LOG.debug("Shutting down Couchbase environment");
env.shutdown();
}
// Explicitly shutdown the RxJava scheduler threads. Not doing so will leak threads when a pipeline stops.
// Note: this disallows restarting scheduler threads without also explicitly calling Schedulers.start()
// LOG.debug("Stopping RxJava schedulers");
// Schedulers.shutdown();
isClosed = true;
}
} }
|
public class class_name {
public synchronized void close() {
if(!isClosed) {
if(bucket != null) {
LOG.debug("Closing Couchbase bucket"); // depends on control dependency: [if], data = [none]
bucket.close(); // depends on control dependency: [if], data = [none]
}
if(cluster != null) {
LOG.debug("Disconnecting Couchbase cluster"); // depends on control dependency: [if], data = [none]
cluster.disconnect(); // depends on control dependency: [if], data = [none]
}
if(env != null) {
LOG.debug("Shutting down Couchbase environment"); // depends on control dependency: [if], data = [none]
env.shutdown(); // depends on control dependency: [if], data = [none]
}
// Explicitly shutdown the RxJava scheduler threads. Not doing so will leak threads when a pipeline stops.
// Note: this disallows restarting scheduler threads without also explicitly calling Schedulers.start()
// LOG.debug("Stopping RxJava schedulers");
// Schedulers.shutdown();
isClosed = true; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public List<V> getAll(final String name) {
LinkedList<V> values = new LinkedList<>();
int h = hash(name);
int i = index(h);
MapEntry<V> e = entries[i];
while (e != null) {
if (e.hash == h && eq(name, e.key)) {
values.addFirst(e.getValue());
}
e = e.next;
}
return values;
} }
|
public class class_name {
public List<V> getAll(final String name) {
LinkedList<V> values = new LinkedList<>();
int h = hash(name);
int i = index(h);
MapEntry<V> e = entries[i];
while (e != null) {
if (e.hash == h && eq(name, e.key)) {
values.addFirst(e.getValue()); // depends on control dependency: [if], data = [none]
}
e = e.next; // depends on control dependency: [while], data = [none]
}
return values;
} }
|
public class class_name {
private Set<Result> evaluatePids(Set<String> dsids,
String pid,
HttpServletRequest request,
DataResponseWrapper response)
throws ServletException {
RequestCtx[] requests = new RequestCtx[dsids.size()];
int ix = 0;
for (String dsid : dsids) {
logger.debug("Checking: {}/{}", pid, dsid);
Map<URI, AttributeValue> actions =
new HashMap<URI, AttributeValue>();
Map<URI, AttributeValue> resAttr;
try {
actions.put(Constants.ACTION.ID.getURI(),
Constants.ACTION.GET_DATASTREAM
.getStringAttribute());
resAttr = ResourceAttributes.getResources(pid);
resAttr.put(Constants.DATASTREAM.ID.getURI(),
new StringAttribute(dsid));
RequestCtx req =
getContextHandler()
.buildRequest(getSubjects(request),
actions,
resAttr,
getEnvironment(request));
requests[ix++] = req;
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new ServletException(e.getMessage(), e);
}
}
ResponseCtx resCtx = null;
try {
if (logger.isDebugEnabled()) {
logger.debug("Number of requests: " + requests.length);
}
resCtx =
getContextHandler().evaluateBatch(requests);
} catch (MelcoeXacmlException pe) {
throw new ServletException("Error evaluating pids: "
+ pe.getMessage(), pe);
}
@SuppressWarnings("unchecked")
Set<Result> results = resCtx.getResults();
return results;
} }
|
public class class_name {
private Set<Result> evaluatePids(Set<String> dsids,
String pid,
HttpServletRequest request,
DataResponseWrapper response)
throws ServletException {
RequestCtx[] requests = new RequestCtx[dsids.size()];
int ix = 0;
for (String dsid : dsids) {
logger.debug("Checking: {}/{}", pid, dsid);
Map<URI, AttributeValue> actions =
new HashMap<URI, AttributeValue>();
Map<URI, AttributeValue> resAttr;
try {
actions.put(Constants.ACTION.ID.getURI(),
Constants.ACTION.GET_DATASTREAM
.getStringAttribute()); // depends on control dependency: [try], data = [none]
resAttr = ResourceAttributes.getResources(pid); // depends on control dependency: [try], data = [none]
resAttr.put(Constants.DATASTREAM.ID.getURI(),
new StringAttribute(dsid)); // depends on control dependency: [try], data = [none]
RequestCtx req =
getContextHandler()
.buildRequest(getSubjects(request),
actions,
resAttr,
getEnvironment(request));
requests[ix++] = req; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new ServletException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
ResponseCtx resCtx = null;
try {
if (logger.isDebugEnabled()) {
logger.debug("Number of requests: " + requests.length); // depends on control dependency: [if], data = [none]
}
resCtx =
getContextHandler().evaluateBatch(requests);
} catch (MelcoeXacmlException pe) {
throw new ServletException("Error evaluating pids: "
+ pe.getMessage(), pe);
}
@SuppressWarnings("unchecked")
Set<Result> results = resCtx.getResults();
return results;
} }
|
public class class_name {
protected final boolean isSatisfied(AnalyzedToken aToken,
Map<String, List<String>> uFeatures) {
if (allFeatsIn && equivalencesMatched.isEmpty()) {
return false;
}
if (uFeatures == null) {
throw new RuntimeException("isSatisfied called without features being set");
}
unificationFeats = uFeatures;
boolean unified = true;
if (allFeatsIn) {
unified = checkNext(aToken, uFeatures);
} else {
while (equivalencesMatched.size() <= tokCnt) {
equivalencesMatched.add(new ConcurrentHashMap<>());
}
for (Map.Entry<String, List<String>> feat : uFeatures.entrySet()) {
List<String> types = feat.getValue();
if (types == null || types.isEmpty()) {
types = equivalenceFeatures.get(feat.getKey());
}
for (String typeName : types) {
PatternToken testElem = equivalenceTypes
.get(new EquivalenceTypeLocator(feat.getKey(), typeName));
if (testElem == null) {
return false;
}
if (testElem.isMatched(aToken)) {
if (!equivalencesMatched.get(tokCnt).containsKey(feat.getKey())) {
Set<String> typeSet = new HashSet<>();
typeSet.add(typeName);
equivalencesMatched.get(tokCnt).put(feat.getKey(), typeSet);
} else {
equivalencesMatched.get(tokCnt).get(feat.getKey()).add(typeName);
}
}
}
unified = equivalencesMatched.get(tokCnt).containsKey(feat.getKey());
if (!unified) {
equivalencesMatched.remove(tokCnt);
break;
}
}
if (unified) {
if (tokCnt == 0 || tokSequence.isEmpty()) {
tokSequence.add(new AnalyzedTokenReadings(aToken, 0));
List<Map<String, Set<String>>> equivList = new ArrayList<>();
equivList.add(equivalencesMatched.get(tokCnt));
tokSequenceEquivalences.add(equivList);
} else {
tokSequence.get(0).addReading(aToken);
tokSequenceEquivalences.get(0).add(equivalencesMatched.get(tokCnt));
}
tokCnt++;
}
}
return unified;
} }
|
public class class_name {
protected final boolean isSatisfied(AnalyzedToken aToken,
Map<String, List<String>> uFeatures) {
if (allFeatsIn && equivalencesMatched.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
if (uFeatures == null) {
throw new RuntimeException("isSatisfied called without features being set");
}
unificationFeats = uFeatures;
boolean unified = true;
if (allFeatsIn) {
unified = checkNext(aToken, uFeatures); // depends on control dependency: [if], data = [none]
} else {
while (equivalencesMatched.size() <= tokCnt) {
equivalencesMatched.add(new ConcurrentHashMap<>()); // depends on control dependency: [while], data = [none]
}
for (Map.Entry<String, List<String>> feat : uFeatures.entrySet()) {
List<String> types = feat.getValue();
if (types == null || types.isEmpty()) {
types = equivalenceFeatures.get(feat.getKey()); // depends on control dependency: [if], data = [none]
}
for (String typeName : types) {
PatternToken testElem = equivalenceTypes
.get(new EquivalenceTypeLocator(feat.getKey(), typeName));
if (testElem == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (testElem.isMatched(aToken)) {
if (!equivalencesMatched.get(tokCnt).containsKey(feat.getKey())) {
Set<String> typeSet = new HashSet<>();
typeSet.add(typeName); // depends on control dependency: [if], data = [none]
equivalencesMatched.get(tokCnt).put(feat.getKey(), typeSet); // depends on control dependency: [if], data = [none]
} else {
equivalencesMatched.get(tokCnt).get(feat.getKey()).add(typeName); // depends on control dependency: [if], data = [none]
}
}
}
unified = equivalencesMatched.get(tokCnt).containsKey(feat.getKey()); // depends on control dependency: [for], data = [feat]
if (!unified) {
equivalencesMatched.remove(tokCnt); // depends on control dependency: [if], data = [none]
break;
}
}
if (unified) {
if (tokCnt == 0 || tokSequence.isEmpty()) {
tokSequence.add(new AnalyzedTokenReadings(aToken, 0)); // depends on control dependency: [if], data = [none]
List<Map<String, Set<String>>> equivList = new ArrayList<>();
equivList.add(equivalencesMatched.get(tokCnt)); // depends on control dependency: [if], data = [(tokCnt]
tokSequenceEquivalences.add(equivList); // depends on control dependency: [if], data = [none]
} else {
tokSequence.get(0).addReading(aToken); // depends on control dependency: [if], data = [none]
tokSequenceEquivalences.get(0).add(equivalencesMatched.get(tokCnt)); // depends on control dependency: [if], data = [(tokCnt]
}
tokCnt++; // depends on control dependency: [if], data = [none]
}
}
return unified;
} }
|
public class class_name {
private void invokeIgnoreExceptions(Object obj, String method,
Object... args) {
try {
invoke(obj, method, args);
} catch (NoSuchMethodException e) {
logger.trace("Unable to log progress", e);
} catch (InvocationTargetException e) {
logger.trace("Unable to log progress", e);
} catch (IllegalAccessException e) {
logger.trace("Unable to log progress", e);
}
} }
|
public class class_name {
private void invokeIgnoreExceptions(Object obj, String method,
Object... args) {
try {
invoke(obj, method, args); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
logger.trace("Unable to log progress", e);
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
logger.trace("Unable to log progress", e);
} catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none]
logger.trace("Unable to log progress", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public RedBlackTreeNode<Key, Value> ceilingNode(Key key) {
if (isEmpty()) {
return null;
}
RedBlackTreeNode<Key, Value> x = ceiling(root, key);
if (x == null) {
return null;
} else {
return x;
}
} }
|
public class class_name {
public RedBlackTreeNode<Key, Value> ceilingNode(Key key) {
if (isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
RedBlackTreeNode<Key, Value> x = ceiling(root, key);
if (x == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
return x; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void configureBigQueryOutput(
Configuration config,
String projectId,
String datasetId,
String tableId,
String tableSchema)
throws IOException {
// Check preconditions.
Preconditions.checkArgument(
!Strings.isNullOrEmpty(datasetId), "datasetId must not be null or empty.");
Preconditions.checkArgument(
!Strings.isNullOrEmpty(tableId), "tableId must not be null or empty.");
Preconditions.checkArgument(
!Strings.isNullOrEmpty(tableSchema), "tableSchema must not be null or empty.");
// Project is optional, if not set use default project.
if (!Strings.isNullOrEmpty(projectId)) {
logger.atInfo().log("Using specified project-id '%s' for output", projectId);
config.set(OUTPUT_PROJECT_ID_KEY, projectId);
// For user-friendliness, we'll helpfully backfill the input-specific projectId into the
// "global" projectId for now.
// TODO(user): Maybe don't try to be user-friendly here.
if (Strings.isNullOrEmpty(config.get(PROJECT_ID_KEY))) {
logger.atWarning().log(
"No job-level projectId specified in '%s', using '%s' for it.",
PROJECT_ID_KEY, projectId);
config.set(PROJECT_ID_KEY, projectId);
}
} else {
String defaultProjectId = ConfigurationUtil.getMandatoryConfig(config, PROJECT_ID_KEY);
logger.atInfo().log(
"Using default project-id '%s' since none specified for output.", defaultProjectId);
config.set(OUTPUT_PROJECT_ID_KEY, defaultProjectId);
}
config.set(OUTPUT_DATASET_ID_KEY, datasetId);
config.set(OUTPUT_TABLE_ID_KEY, tableId);
config.set(OUTPUT_TABLE_SCHEMA_KEY, tableSchema);
} }
|
public class class_name {
public static void configureBigQueryOutput(
Configuration config,
String projectId,
String datasetId,
String tableId,
String tableSchema)
throws IOException {
// Check preconditions.
Preconditions.checkArgument(
!Strings.isNullOrEmpty(datasetId), "datasetId must not be null or empty.");
Preconditions.checkArgument(
!Strings.isNullOrEmpty(tableId), "tableId must not be null or empty.");
Preconditions.checkArgument(
!Strings.isNullOrEmpty(tableSchema), "tableSchema must not be null or empty.");
// Project is optional, if not set use default project.
if (!Strings.isNullOrEmpty(projectId)) {
logger.atInfo().log("Using specified project-id '%s' for output", projectId);
config.set(OUTPUT_PROJECT_ID_KEY, projectId);
// For user-friendliness, we'll helpfully backfill the input-specific projectId into the
// "global" projectId for now.
// TODO(user): Maybe don't try to be user-friendly here.
if (Strings.isNullOrEmpty(config.get(PROJECT_ID_KEY))) {
logger.atWarning().log(
"No job-level projectId specified in '%s', using '%s' for it.",
PROJECT_ID_KEY, projectId);
config.set(PROJECT_ID_KEY, projectId);
}
} else {
String defaultProjectId = ConfigurationUtil.getMandatoryConfig(config, PROJECT_ID_KEY);
logger.atInfo().log(
"Using default project-id '%s' since none specified for output.", defaultProjectId); // depends on control dependency: [if], data = [none]
config.set(OUTPUT_PROJECT_ID_KEY, defaultProjectId); // depends on control dependency: [if], data = [none]
}
config.set(OUTPUT_DATASET_ID_KEY, datasetId);
config.set(OUTPUT_TABLE_ID_KEY, tableId);
config.set(OUTPUT_TABLE_SCHEMA_KEY, tableSchema);
} }
|
public class class_name {
public Observable<ServiceResponse<PredictionQueryResult>> queryPredictionsWithServiceResponseAsync(UUID projectId, PredictionQueryToken query) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (query == null) {
throw new IllegalArgumentException("Parameter query is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
Validator.validate(query);
return service.queryPredictions(projectId, query, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<PredictionQueryResult>>>() {
@Override
public Observable<ServiceResponse<PredictionQueryResult>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PredictionQueryResult> clientResponse = queryPredictionsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<PredictionQueryResult>> queryPredictionsWithServiceResponseAsync(UUID projectId, PredictionQueryToken query) {
if (projectId == null) {
throw new IllegalArgumentException("Parameter projectId is required and cannot be null.");
}
if (query == null) {
throw new IllegalArgumentException("Parameter query is required and cannot be null.");
}
if (this.client.apiKey() == null) {
throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null.");
}
Validator.validate(query);
return service.queryPredictions(projectId, query, this.client.apiKey(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<PredictionQueryResult>>>() {
@Override
public Observable<ServiceResponse<PredictionQueryResult>> call(Response<ResponseBody> response) {
try {
ServiceResponse<PredictionQueryResult> clientResponse = queryPredictionsDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public final void readLELongs(long lbuf[], int n) throws IOException {
int nLeft = n;
int lCount = 0;
int nToRead = kLongs;
while (nLeft > 0) {
if (nToRead > nLeft)
nToRead = nLeft;
readFully(byteWorkSpace, 0, 8 * nToRead);
int j = 0;
for (int i = 0; i < nToRead; i++) {
lbuf[lCount++] =
(long) (byteWorkSpace[j] & 0xff) |
(long) (byteWorkSpace[j + 1] & 0xff) << 8 |
(long) (byteWorkSpace[j + 2] & 0xff) << 16 |
(long) (byteWorkSpace[j + 3] & 0xff) << 24 |
(long) (byteWorkSpace[j + 4] & 0xff) << 32 |
(long) (byteWorkSpace[j + 5] & 0xff) << 40 |
(long) (byteWorkSpace[j + 6] & 0xff) << 48 |
(long) (byteWorkSpace[j + 7] & 0xff) << 56;
j += 8;
}
nLeft -= nToRead;
}
} }
|
public class class_name {
public final void readLELongs(long lbuf[], int n) throws IOException {
int nLeft = n;
int lCount = 0;
int nToRead = kLongs;
while (nLeft > 0) {
if (nToRead > nLeft)
nToRead = nLeft;
readFully(byteWorkSpace, 0, 8 * nToRead);
int j = 0;
for (int i = 0; i < nToRead; i++) {
lbuf[lCount++] =
(long) (byteWorkSpace[j] & 0xff) |
(long) (byteWorkSpace[j + 1] & 0xff) << 8 |
(long) (byteWorkSpace[j + 2] & 0xff) << 16 |
(long) (byteWorkSpace[j + 3] & 0xff) << 24 |
(long) (byteWorkSpace[j + 4] & 0xff) << 32 |
(long) (byteWorkSpace[j + 5] & 0xff) << 40 |
(long) (byteWorkSpace[j + 6] & 0xff) << 48 |
(long) (byteWorkSpace[j + 7] & 0xff) << 56; // depends on control dependency: [for], data = [none]
j += 8; // depends on control dependency: [for], data = [none]
}
nLeft -= nToRead;
}
} }
|
public class class_name {
public static String encode(byte[] data)
{
StringBuffer result = new StringBuffer();
for (int i = 0; i < data.length; i++) {
result.append(trans[(data[i] >> 4) & 0xf]);
result.append(trans[data[i] & 0xf]);
}
return result.toString();
} }
|
public class class_name {
public static String encode(byte[] data)
{
StringBuffer result = new StringBuffer();
for (int i = 0; i < data.length; i++) {
result.append(trans[(data[i] >> 4) & 0xf]); // depends on control dependency: [for], data = [i]
result.append(trans[data[i] & 0xf]); // depends on control dependency: [for], data = [i]
}
return result.toString();
} }
|
public class class_name {
public static <T> T getRestApiResponseAsObject(String uri,
TypeReference<T> typeReference) {
try {
return JMJson.withJsonString(getResponseAsString(uri),
typeReference);
} catch (Exception e) {
throw JMExceptionManager.handleExceptionAndReturnRuntimeEx(log, e,
"getRestApiResponseAsObject", uri, typeReference);
}
} }
|
public class class_name {
public static <T> T getRestApiResponseAsObject(String uri,
TypeReference<T> typeReference) {
try {
return JMJson.withJsonString(getResponseAsString(uri),
typeReference); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw JMExceptionManager.handleExceptionAndReturnRuntimeEx(log, e,
"getRestApiResponseAsObject", uri, typeReference);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(UserStackAssociationError userStackAssociationError, ProtocolMarshaller protocolMarshaller) {
if (userStackAssociationError == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userStackAssociationError.getUserStackAssociation(), USERSTACKASSOCIATION_BINDING);
protocolMarshaller.marshall(userStackAssociationError.getErrorCode(), ERRORCODE_BINDING);
protocolMarshaller.marshall(userStackAssociationError.getErrorMessage(), ERRORMESSAGE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(UserStackAssociationError userStackAssociationError, ProtocolMarshaller protocolMarshaller) {
if (userStackAssociationError == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userStackAssociationError.getUserStackAssociation(), USERSTACKASSOCIATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userStackAssociationError.getErrorCode(), ERRORCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userStackAssociationError.getErrorMessage(), ERRORMESSAGE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void putInt(int pos, int i) {
adaptSize(pos + 4);
ByteBuffer bb = getBuffer(pos);
int index = pos % _bufferSize;
if (bb.limit() - index >= 4) {
bb.putInt(index, i);
} else {
byte b0 = (byte)i;
byte b1 = (byte)(i >> 8);
byte b2 = (byte)(i >> 16);
byte b3 = (byte)(i >> 24);
if (_order == ByteOrder.BIG_ENDIAN) {
putBytes(pos, b3, b2, b1, b0);
} else {
putBytes(pos, b0, b1, b2, b3);
}
}
} }
|
public class class_name {
public void putInt(int pos, int i) {
adaptSize(pos + 4);
ByteBuffer bb = getBuffer(pos);
int index = pos % _bufferSize;
if (bb.limit() - index >= 4) {
bb.putInt(index, i); // depends on control dependency: [if], data = [none]
} else {
byte b0 = (byte)i;
byte b1 = (byte)(i >> 8);
byte b2 = (byte)(i >> 16);
byte b3 = (byte)(i >> 24);
if (_order == ByteOrder.BIG_ENDIAN) {
putBytes(pos, b3, b2, b1, b0); // depends on control dependency: [if], data = [none]
} else {
putBytes(pos, b0, b1, b2, b3); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static void calculateDsspSecondaryStructure(Structure bioJavaStruct) {
SecStrucCalc ssp = new SecStrucCalc();
try{
ssp.calculate(bioJavaStruct, true);
}
catch(StructureException e) {
LOGGER.warn("Could not calculate secondary structure (error {}). Will try to get a DSSP file from the RCSB web server instead.", e.getMessage());
try {
DSSPParser.fetch(bioJavaStruct.getPDBCode(), bioJavaStruct, true); //download from PDB the DSSP result
} catch(Exception bige){
LOGGER.warn("Could not get a DSSP file from RCSB web server. There will not be secondary structure assignment for this structure ({}). Error: {}", bioJavaStruct.getPDBCode(), bige.getMessage());
}
}
} }
|
public class class_name {
public static void calculateDsspSecondaryStructure(Structure bioJavaStruct) {
SecStrucCalc ssp = new SecStrucCalc();
try{
ssp.calculate(bioJavaStruct, true); // depends on control dependency: [try], data = [none]
}
catch(StructureException e) {
LOGGER.warn("Could not calculate secondary structure (error {}). Will try to get a DSSP file from the RCSB web server instead.", e.getMessage());
try {
DSSPParser.fetch(bioJavaStruct.getPDBCode(), bioJavaStruct, true); //download from PDB the DSSP result // depends on control dependency: [try], data = [none]
} catch(Exception bige){
LOGGER.warn("Could not get a DSSP file from RCSB web server. There will not be secondary structure assignment for this structure ({}). Error: {}", bioJavaStruct.getPDBCode(), bige.getMessage());
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public FieldList setHandle(Object bookmark, int iHandleType) throws DBException
{
if ((iHandleType == DBConstants.BOOKMARK_HANDLE) && (bookmark instanceof String)) // It is okay to pass in a string, but convert it first!
if ((this.getRecord().getCounterField() != null) || (this.getRecord().getKeyArea(DBConstants.MAIN_KEY_AREA).getKeyFields() > 1))
{ // As a convenience convert a string bookmark to the proper bookmark
try {
bookmark = Converter.stripNonNumber(bookmark.toString());
bookmark = new Integer((String)bookmark);
} catch (NumberFormatException ex) {
bookmark = new StrBuffer((String)bookmark);
}
}
if ((this.getRecord().getEditMode() == Constants.EDIT_IN_PROGRESS)
|| (this.getRecord().getEditMode() == Constants.EDIT_CURRENT))
{
Object oldBookmark = this.getHandle(iHandleType);
if (bookmark != null) if (bookmark.equals(oldBookmark)) if (!this.getRecord().isModified(false))
return this.getRecord(); // This is already your current record!
}
m_objectID = null; // No current record
m_dataSource = null;
if (iHandleType == DBConstants.FULL_OBJECT_HANDLE)
{
if (!(bookmark instanceof String))
return null;
int iIndex = ((String)bookmark).lastIndexOf(HANDLE_SEPARATOR);
if ((iIndex == -1) || (iIndex == ((String)bookmark).length() - 1))
return null;
String strRecord = ((String)bookmark).substring(0, iIndex);
int iRecordIndex = strRecord.lastIndexOf(HANDLE_SEPARATOR, iIndex - 1);
int iDBIndex = strRecord.lastIndexOf(HANDLE_SEPARATOR, iRecordIndex - 1);
if (!strRecord.substring(iRecordIndex + 1, iIndex).equalsIgnoreCase(this.getRecord().getTableNames(false)))
if (!strRecord.substring(iDBIndex + 1, iRecordIndex).equalsIgnoreCase(this.getDatabase().getDatabaseName(false)))
return null; // Not the correct record or database
bookmark = ((String)bookmark).substring(iIndex + 1);
iHandleType = DBConstants.OBJECT_ID_HANDLE;
}
m_bIsOpen = false;
boolean bSuccess = this.doSetHandle(bookmark, iHandleType);
m_bIsOpen = true;
if (bSuccess)
{
m_iRecordStatus = DBConstants.RECORD_NORMAL;
this.getRecord().setEditMode(Constants.EDIT_CURRENT);
Object[] rgobjEnabledFields = null;
try {
rgobjEnabledFields = this.getRecord().setEnableFieldListeners(false);
this.dataToFields(this.getRecord());
} catch (DBException ex) {
throw ex;
} finally {
this.getRecord().setEnableFieldListeners(rgobjEnabledFields);
}
this.getRecord().handleValidRecord(); // Display Fields
return this.getRecord();
}
else
{
m_iRecordStatus = DBConstants.RECORD_INVALID | DBConstants.RECORD_AT_BOF | DBConstants.RECORD_AT_EOF;
this.getRecord().handleNewRecord(); //? Display Fields (Should leave record in an indeterminate state!)
this.getRecord().setEditMode(Constants.EDIT_NONE); // Unknown status
return null;
}
} }
|
public class class_name {
public FieldList setHandle(Object bookmark, int iHandleType) throws DBException
{
if ((iHandleType == DBConstants.BOOKMARK_HANDLE) && (bookmark instanceof String)) // It is okay to pass in a string, but convert it first!
if ((this.getRecord().getCounterField() != null) || (this.getRecord().getKeyArea(DBConstants.MAIN_KEY_AREA).getKeyFields() > 1))
{ // As a convenience convert a string bookmark to the proper bookmark
try {
bookmark = Converter.stripNonNumber(bookmark.toString()); // depends on control dependency: [try], data = [none]
bookmark = new Integer((String)bookmark); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException ex) {
bookmark = new StrBuffer((String)bookmark);
} // depends on control dependency: [catch], data = [none]
}
if ((this.getRecord().getEditMode() == Constants.EDIT_IN_PROGRESS)
|| (this.getRecord().getEditMode() == Constants.EDIT_CURRENT))
{
Object oldBookmark = this.getHandle(iHandleType);
if (bookmark != null) if (bookmark.equals(oldBookmark)) if (!this.getRecord().isModified(false))
return this.getRecord(); // This is already your current record!
}
m_objectID = null; // No current record
m_dataSource = null;
if (iHandleType == DBConstants.FULL_OBJECT_HANDLE)
{
if (!(bookmark instanceof String))
return null;
int iIndex = ((String)bookmark).lastIndexOf(HANDLE_SEPARATOR);
if ((iIndex == -1) || (iIndex == ((String)bookmark).length() - 1))
return null;
String strRecord = ((String)bookmark).substring(0, iIndex);
int iRecordIndex = strRecord.lastIndexOf(HANDLE_SEPARATOR, iIndex - 1);
int iDBIndex = strRecord.lastIndexOf(HANDLE_SEPARATOR, iRecordIndex - 1);
if (!strRecord.substring(iRecordIndex + 1, iIndex).equalsIgnoreCase(this.getRecord().getTableNames(false)))
if (!strRecord.substring(iDBIndex + 1, iRecordIndex).equalsIgnoreCase(this.getDatabase().getDatabaseName(false)))
return null; // Not the correct record or database
bookmark = ((String)bookmark).substring(iIndex + 1);
iHandleType = DBConstants.OBJECT_ID_HANDLE;
}
m_bIsOpen = false;
boolean bSuccess = this.doSetHandle(bookmark, iHandleType);
m_bIsOpen = true;
if (bSuccess)
{
m_iRecordStatus = DBConstants.RECORD_NORMAL;
this.getRecord().setEditMode(Constants.EDIT_CURRENT);
Object[] rgobjEnabledFields = null;
try {
rgobjEnabledFields = this.getRecord().setEnableFieldListeners(false); // depends on control dependency: [try], data = [none]
this.dataToFields(this.getRecord()); // depends on control dependency: [try], data = [none]
} catch (DBException ex) {
throw ex;
} finally { // depends on control dependency: [catch], data = [none]
this.getRecord().setEnableFieldListeners(rgobjEnabledFields);
}
this.getRecord().handleValidRecord(); // Display Fields
return this.getRecord();
}
else
{
m_iRecordStatus = DBConstants.RECORD_INVALID | DBConstants.RECORD_AT_BOF | DBConstants.RECORD_AT_EOF;
this.getRecord().handleNewRecord(); //? Display Fields (Should leave record in an indeterminate state!)
this.getRecord().setEditMode(Constants.EDIT_NONE); // Unknown status
return null;
}
} }
|
public class class_name {
private String resolve(String cdr, Function<String,String> map) {
StringBuilder res = new StringBuilder(cdr.length()*2);
int state = 0;
String var = "";
for (int i=0; i < cdr.length(); i++ ) {
char c = cdr.charAt(i);
if ( c == '$' ) {
state = 1;
} else {
switch (state) {
case 0:
res.append(c); break;
case 1: {
if ( Character.isLetterOrDigit(c) ) {
var += c;
} else {
String apply = map.apply(var);
if ( apply != null )
res.append(apply);
else
res.append("$"+var);
state = 0; i--; var = "";
}
break;
}
}
}
}
String expanded = res.toString();
if ( ! expanded.equals(cdr) )
return resolve(expanded,map);
return expanded;
} }
|
public class class_name {
private String resolve(String cdr, Function<String,String> map) {
StringBuilder res = new StringBuilder(cdr.length()*2);
int state = 0;
String var = "";
for (int i=0; i < cdr.length(); i++ ) {
char c = cdr.charAt(i);
if ( c == '$' ) {
state = 1; // depends on control dependency: [if], data = [none]
} else {
switch (state) {
case 0:
res.append(c); break;
case 1: {
if ( Character.isLetterOrDigit(c) ) {
var += c; // depends on control dependency: [if], data = [none]
} else {
String apply = map.apply(var);
if ( apply != null )
res.append(apply);
else
res.append("$"+var);
state = 0; i--; var = ""; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
}
break;
}
}
}
}
String expanded = res.toString();
if ( ! expanded.equals(cdr) )
return resolve(expanded,map);
return expanded;
} }
|
public class class_name {
private JButton makeButton(String imageName, String actionCommand, String toolTipText, String altText) {
//Look for the image.
String imgLocation = "images/" + imageName + "16.png";
URL imageURL = PlotCanvas.class.getResource(imgLocation);
//Create and initialize the button.
JButton button = new JButton();
button.setActionCommand(actionCommand);
button.setToolTipText(toolTipText);
button.addActionListener(this);
if (imageURL != null) { //image found
button.setIcon(new ImageIcon(imageURL, altText));
} else { //no image found
button.setText(altText);
logger.error("Resource not found: {}", imgLocation);
}
return button;
} }
|
public class class_name {
private JButton makeButton(String imageName, String actionCommand, String toolTipText, String altText) {
//Look for the image.
String imgLocation = "images/" + imageName + "16.png";
URL imageURL = PlotCanvas.class.getResource(imgLocation);
//Create and initialize the button.
JButton button = new JButton();
button.setActionCommand(actionCommand);
button.setToolTipText(toolTipText);
button.addActionListener(this);
if (imageURL != null) { //image found
button.setIcon(new ImageIcon(imageURL, altText)); // depends on control dependency: [if], data = [(imageURL]
} else { //no image found
button.setText(altText); // depends on control dependency: [if], data = [none]
logger.error("Resource not found: {}", imgLocation); // depends on control dependency: [if], data = [none]
}
return button;
} }
|
public class class_name {
@Override
public EClass getIfcProductSelect() {
if (ifcProductSelectEClass == null) {
ifcProductSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1151);
}
return ifcProductSelectEClass;
} }
|
public class class_name {
@Override
public EClass getIfcProductSelect() {
if (ifcProductSelectEClass == null) {
ifcProductSelectEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(1151);
// depends on control dependency: [if], data = [none]
}
return ifcProductSelectEClass;
} }
|
public class class_name {
private static <E> boolean addAllImpl(Multiset<E> self, Multiset<? extends E> elements) {
if (elements.isEmpty()) {
return false;
}
elements.forEachEntry(self::add);
return true;
} }
|
public class class_name {
private static <E> boolean addAllImpl(Multiset<E> self, Multiset<? extends E> elements) {
if (elements.isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
elements.forEachEntry(self::add);
return true;
} }
|
public class class_name {
@Override
public CompletableFuture<Acknowledge> updatePartitions(
final ExecutionAttemptID executionAttemptID,
Iterable<PartitionInfo> partitionInfos,
Time timeout) {
final Task task = taskSlotTable.getTask(executionAttemptID);
if (task != null) {
for (final PartitionInfo partitionInfo: partitionInfos) {
IntermediateDataSetID intermediateResultPartitionID = partitionInfo.getIntermediateDataSetID();
final SingleInputGate singleInputGate = task.getInputGateById(intermediateResultPartitionID);
if (singleInputGate != null) {
// Run asynchronously because it might be blocking
getRpcService().execute(
() -> {
try {
singleInputGate.updateInputChannel(partitionInfo.getInputChannelDeploymentDescriptor());
} catch (IOException | InterruptedException e) {
log.error("Could not update input data location for task {}. Trying to fail task.", task.getTaskInfo().getTaskName(), e);
try {
task.failExternally(e);
} catch (RuntimeException re) {
// TODO: Check whether we need this or make exception in failExtenally checked
log.error("Failed canceling task with execution ID {} after task update failure.", executionAttemptID, re);
}
}
});
} else {
return FutureUtils.completedExceptionally(
new PartitionException("No reader with ID " + intermediateResultPartitionID +
" for task " + executionAttemptID + " was found."));
}
}
return CompletableFuture.completedFuture(Acknowledge.get());
} else {
log.debug("Discard update for input partitions of task {}. Task is no longer running.", executionAttemptID);
return CompletableFuture.completedFuture(Acknowledge.get());
}
} }
|
public class class_name {
@Override
public CompletableFuture<Acknowledge> updatePartitions(
final ExecutionAttemptID executionAttemptID,
Iterable<PartitionInfo> partitionInfos,
Time timeout) {
final Task task = taskSlotTable.getTask(executionAttemptID);
if (task != null) {
for (final PartitionInfo partitionInfo: partitionInfos) {
IntermediateDataSetID intermediateResultPartitionID = partitionInfo.getIntermediateDataSetID();
final SingleInputGate singleInputGate = task.getInputGateById(intermediateResultPartitionID);
if (singleInputGate != null) {
// Run asynchronously because it might be blocking
getRpcService().execute(
() -> {
try {
singleInputGate.updateInputChannel(partitionInfo.getInputChannelDeploymentDescriptor()); // depends on control dependency: [try], data = [none]
} catch (IOException | InterruptedException e) {
log.error("Could not update input data location for task {}. Trying to fail task.", task.getTaskInfo().getTaskName(), e);
try {
task.failExternally(e); // depends on control dependency: [try], data = [none]
} catch (RuntimeException re) {
// TODO: Check whether we need this or make exception in failExtenally checked
log.error("Failed canceling task with execution ID {} after task update failure.", executionAttemptID, re);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
});
} else {
return FutureUtils.completedExceptionally(
new PartitionException("No reader with ID " + intermediateResultPartitionID +
" for task " + executionAttemptID + " was found.")); // depends on control dependency: [if], data = [none]
}
}
return CompletableFuture.completedFuture(Acknowledge.get()); // depends on control dependency: [if], data = [none]
} else {
log.debug("Discard update for input partitions of task {}. Task is no longer running.", executionAttemptID); // depends on control dependency: [if], data = [none]
return CompletableFuture.completedFuture(Acknowledge.get()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void outputString(final HttpServletResponse response, final Object obj) {
try {
response.setContentType("text/javascript");
response.setCharacterEncoding("utf-8");
disableCache(response);
response.getWriter().write(obj.toString());
response.getWriter().flush();
response.getWriter().close();
} catch (IOException e) {
}
} }
|
public class class_name {
public static void outputString(final HttpServletResponse response, final Object obj) {
try {
response.setContentType("text/javascript"); // depends on control dependency: [try], data = [none]
response.setCharacterEncoding("utf-8"); // depends on control dependency: [try], data = [none]
disableCache(response); // depends on control dependency: [try], data = [none]
response.getWriter().write(obj.toString()); // depends on control dependency: [try], data = [none]
response.getWriter().flush(); // depends on control dependency: [try], data = [none]
response.getWriter().close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Double[] exportImaginary()
{
Double[] ad = new Double[indexSet.size()];
int i = 0;
for (IndexMN index: indexSet) {
if (imaginary.containsKey(index)) {
ad[i] = imaginary.get(index);
} else {
ad[i] = 0.0;
}
i++;
}
return ad;
} }
|
public class class_name {
public Double[] exportImaginary()
{
Double[] ad = new Double[indexSet.size()];
int i = 0;
for (IndexMN index: indexSet) {
if (imaginary.containsKey(index)) {
ad[i] = imaginary.get(index); // depends on control dependency: [if], data = [none]
} else {
ad[i] = 0.0; // depends on control dependency: [if], data = [none]
}
i++; // depends on control dependency: [for], data = [none]
}
return ad;
} }
|
public class class_name {
public AlphabeticIndex<V> clearRecords() {
if (inputList != null && !inputList.isEmpty()) {
inputList.clear();
buckets = null;
}
return this;
} }
|
public class class_name {
public AlphabeticIndex<V> clearRecords() {
if (inputList != null && !inputList.isEmpty()) {
inputList.clear(); // depends on control dependency: [if], data = [none]
buckets = null; // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public String getValidationDescription() {
final JvmOperation feature = getOperation();
String message = null;
if (!getDeclaredTypeParameters().isEmpty()) {
message = MessageFormat.format(Messages.CastOperatorLinkingCandidate_0,
getFeatureTypeParametersAsString(true),
feature.getSimpleName(),
getFeatureParameterTypesAsString(),
feature.getDeclaringType().getSimpleName());
} else {
message = MessageFormat.format(Messages.CastOperatorLinkingCandidate_1,
feature.getSimpleName(),
getFeatureParameterTypesAsString(),
feature.getDeclaringType().getSimpleName());
}
return message;
} }
|
public class class_name {
public String getValidationDescription() {
final JvmOperation feature = getOperation();
String message = null;
if (!getDeclaredTypeParameters().isEmpty()) {
message = MessageFormat.format(Messages.CastOperatorLinkingCandidate_0,
getFeatureTypeParametersAsString(true),
feature.getSimpleName(),
getFeatureParameterTypesAsString(),
feature.getDeclaringType().getSimpleName()); // depends on control dependency: [if], data = [none]
} else {
message = MessageFormat.format(Messages.CastOperatorLinkingCandidate_1,
feature.getSimpleName(),
getFeatureParameterTypesAsString(),
feature.getDeclaringType().getSimpleName()); // depends on control dependency: [if], data = [none]
}
return message;
} }
|
public class class_name {
public String getMenuLink(Record recMenu)
{
String strRecordClass = recMenu.getClass().getName();
String strLink = HtmlConstants.SERVLET_LINK;
strLink = Utility.addURLParam(strLink, DBParams.RECORD, strRecordClass);
strLink = Utility.addURLParam(strLink, DBParams.COMMAND, MenuConstants.FORM);
if ((recMenu.getEditMode() == Constants.EDIT_IN_PROGRESS) || (recMenu.getEditMode() == Constants.EDIT_CURRENT))
{
try {
String strBookmark = recMenu.getHandle(DBConstants.OBJECT_ID_HANDLE).toString();
strLink = Utility.addURLParam(strLink, DBConstants.STRING_OBJECT_ID_HANDLE, strBookmark);
} catch (DBException ex) {
ex.printStackTrace();
}
}
return strLink;
} }
|
public class class_name {
public String getMenuLink(Record recMenu)
{
String strRecordClass = recMenu.getClass().getName();
String strLink = HtmlConstants.SERVLET_LINK;
strLink = Utility.addURLParam(strLink, DBParams.RECORD, strRecordClass);
strLink = Utility.addURLParam(strLink, DBParams.COMMAND, MenuConstants.FORM);
if ((recMenu.getEditMode() == Constants.EDIT_IN_PROGRESS) || (recMenu.getEditMode() == Constants.EDIT_CURRENT))
{
try {
String strBookmark = recMenu.getHandle(DBConstants.OBJECT_ID_HANDLE).toString();
strLink = Utility.addURLParam(strLink, DBConstants.STRING_OBJECT_ID_HANDLE, strBookmark); // depends on control dependency: [try], data = [none]
} catch (DBException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
}
return strLink;
} }
|
public class class_name {
public void revokeService(Class serviceClass, BeanContextServiceProvider serviceProvider, boolean revokeCurrentServicesNow) {
// todo: for multithreaded usage this block needs to be synchronized
if (!_serviceProviders.containsKey(serviceClass)) {
return;
}
// propagate to any children implementing BeanContextServices
Iterator i = iterator();
while (i.hasNext()) {
Object o = i.next();
if (o instanceof BeanContextServices) {
((BeanContextServices) o).revokeService(serviceClass, serviceProvider, revokeCurrentServicesNow);
}
}
BeanContextServiceRevokedEvent bcsre =
new BeanContextServiceRevokedEvent((BeanContextServices)getPeer(), serviceClass, revokeCurrentServicesNow);
fireServiceRevokedEvent(bcsre);
// fire revoked event to requestor listeners, if the service is delegated the owner of the
// service should fire these events.
ServiceProvider sp = _serviceProviders.get(serviceClass);
if (!sp.isDelegated()) {
sp.revoke(bcsre);
}
if (revokeCurrentServicesNow || !sp.hasRequestors()) {
_serviceProviders.remove(serviceClass);
}
// end synchronized
} }
|
public class class_name {
public void revokeService(Class serviceClass, BeanContextServiceProvider serviceProvider, boolean revokeCurrentServicesNow) {
// todo: for multithreaded usage this block needs to be synchronized
if (!_serviceProviders.containsKey(serviceClass)) {
return; // depends on control dependency: [if], data = [none]
}
// propagate to any children implementing BeanContextServices
Iterator i = iterator();
while (i.hasNext()) {
Object o = i.next();
if (o instanceof BeanContextServices) {
((BeanContextServices) o).revokeService(serviceClass, serviceProvider, revokeCurrentServicesNow); // depends on control dependency: [if], data = [none]
}
}
BeanContextServiceRevokedEvent bcsre =
new BeanContextServiceRevokedEvent((BeanContextServices)getPeer(), serviceClass, revokeCurrentServicesNow);
fireServiceRevokedEvent(bcsre);
// fire revoked event to requestor listeners, if the service is delegated the owner of the
// service should fire these events.
ServiceProvider sp = _serviceProviders.get(serviceClass);
if (!sp.isDelegated()) {
sp.revoke(bcsre); // depends on control dependency: [if], data = [none]
}
if (revokeCurrentServicesNow || !sp.hasRequestors()) {
_serviceProviders.remove(serviceClass); // depends on control dependency: [if], data = [none]
}
// end synchronized
} }
|
public class class_name {
@Override
public void onFatalError(Throwable exception) {
LOG.error("Fatal error occurred while executing the TaskManager. Shutting it down...", exception);
if (ExceptionUtils.isJvmFatalOrOutOfMemoryError(exception)) {
terminateJVM();
} else {
closeAsync();
FutureUtils.orTimeout(terminationFuture, FATAL_ERROR_SHUTDOWN_TIMEOUT_MS, TimeUnit.MILLISECONDS);
terminationFuture.whenComplete(
(Void ignored, Throwable throwable) -> {
terminateJVM();
});
}
} }
|
public class class_name {
@Override
public void onFatalError(Throwable exception) {
LOG.error("Fatal error occurred while executing the TaskManager. Shutting it down...", exception);
if (ExceptionUtils.isJvmFatalOrOutOfMemoryError(exception)) {
terminateJVM(); // depends on control dependency: [if], data = [none]
} else {
closeAsync(); // depends on control dependency: [if], data = [none]
FutureUtils.orTimeout(terminationFuture, FATAL_ERROR_SHUTDOWN_TIMEOUT_MS, TimeUnit.MILLISECONDS); // depends on control dependency: [if], data = [none]
terminationFuture.whenComplete(
(Void ignored, Throwable throwable) -> {
terminateJVM(); // depends on control dependency: [if], data = [none]
});
}
} }
|
public class class_name {
public String unescapeJavaScript(final Object target) {
if (target == null) {
return null;
}
return StringUtils.unescapeJavaScript(target);
} }
|
public class class_name {
public String unescapeJavaScript(final Object target) {
if (target == null) {
return null; // depends on control dependency: [if], data = [none]
}
return StringUtils.unescapeJavaScript(target);
} }
|
public class class_name {
private List<Float> interpolateUpwards(float min, int steps) {
List<Float> result = new ArrayList<Float>();
for (int i = 0; i < steps; i++) {
result.add(new Float(min + 1 + i));
}
return result;
} }
|
public class class_name {
private List<Float> interpolateUpwards(float min, int steps) {
List<Float> result = new ArrayList<Float>();
for (int i = 0; i < steps; i++) {
result.add(new Float(min + 1 + i));
// depends on control dependency: [for], data = [i]
}
return result;
} }
|
public class class_name {
public final void mHexLiteral() throws RecognitionException {
try {
int _type = HexLiteral;
int _channel = DEFAULT_TOKEN_CHANNEL;
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1302:12: ( '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1302:14: '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )?
{
match('0');
if ( input.LA(1)=='X'||input.LA(1)=='x' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1302:28: ( HexDigit )+
int cnt1=0;
loop1:
while (true) {
int alt1=2;
int LA1_0 = input.LA(1);
if ( ((LA1_0 >= '0' && LA1_0 <= '9')||(LA1_0 >= 'A' && LA1_0 <= 'F')||(LA1_0 >= 'a' && LA1_0 <= 'f')) ) {
alt1=1;
}
switch (alt1) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
{
if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||(input.LA(1) >= 'A' && input.LA(1) <= 'F')||(input.LA(1) >= 'a' && input.LA(1) <= 'f') ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
default :
if ( cnt1 >= 1 ) break loop1;
EarlyExitException eee = new EarlyExitException(1, input);
throw eee;
}
cnt1++;
}
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1302:38: ( IntegerTypeSuffix )?
int alt2=2;
int LA2_0 = input.LA(1);
if ( (LA2_0=='L'||LA2_0=='l') ) {
alt2=1;
}
switch (alt2) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
{
if ( input.LA(1)=='L'||input.LA(1)=='l' ) {
input.consume();
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse);
throw mse;
}
}
break;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
} }
|
public class class_name {
public final void mHexLiteral() throws RecognitionException {
try {
int _type = HexLiteral;
int _channel = DEFAULT_TOKEN_CHANNEL;
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1302:12: ( '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )? )
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1302:14: '0' ( 'x' | 'X' ) ( HexDigit )+ ( IntegerTypeSuffix )?
{
match('0');
if ( input.LA(1)=='X'||input.LA(1)=='x' ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1302:28: ( HexDigit )+
int cnt1=0;
loop1:
while (true) {
int alt1=2;
int LA1_0 = input.LA(1);
if ( ((LA1_0 >= '0' && LA1_0 <= '9')||(LA1_0 >= 'A' && LA1_0 <= 'F')||(LA1_0 >= 'a' && LA1_0 <= 'f')) ) {
alt1=1; // depends on control dependency: [if], data = [none]
}
switch (alt1) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
{
if ( (input.LA(1) >= '0' && input.LA(1) <= '9')||(input.LA(1) >= 'A' && input.LA(1) <= 'F')||(input.LA(1) >= 'a' && input.LA(1) <= 'f') ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
}
break;
default :
if ( cnt1 >= 1 ) break loop1;
EarlyExitException eee = new EarlyExitException(1, input);
throw eee;
}
cnt1++; // depends on control dependency: [while], data = [none]
}
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:1302:38: ( IntegerTypeSuffix )?
int alt2=2;
int LA2_0 = input.LA(1);
if ( (LA2_0=='L'||LA2_0=='l') ) {
alt2=1; // depends on control dependency: [if], data = [none]
}
switch (alt2) {
case 1 :
// src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:
{
if ( input.LA(1)=='L'||input.LA(1)=='l' ) {
input.consume(); // depends on control dependency: [if], data = [none]
}
else {
MismatchedSetException mse = new MismatchedSetException(null,input);
recover(mse); // depends on control dependency: [if], data = [none]
throw mse;
}
}
break;
}
}
state.type = _type;
state.channel = _channel;
}
finally {
// do for sure before leaving
}
} }
|
public class class_name {
public String escapeLikeExpression(String likeExpression) {
String normalizeLikeExpression = likeExpression;
if (likeExpression != null && !likeExpression.isEmpty()) {
normalizeLikeExpression = normalizeLikeExpression.replace(ESCAPE_CHAR, DOUBLE_ESCAPE_CHAR);
for (String charToEscape : currentSpecialCharsSet) {
normalizeLikeExpression = normalizeLikeExpression.replace(charToEscape, ESCAPE_CHAR + charToEscape);
}
}
return normalizeLikeExpression;
} }
|
public class class_name {
public String escapeLikeExpression(String likeExpression) {
String normalizeLikeExpression = likeExpression;
if (likeExpression != null && !likeExpression.isEmpty()) {
normalizeLikeExpression = normalizeLikeExpression.replace(ESCAPE_CHAR, DOUBLE_ESCAPE_CHAR); // depends on control dependency: [if], data = [none]
for (String charToEscape : currentSpecialCharsSet) {
normalizeLikeExpression = normalizeLikeExpression.replace(charToEscape, ESCAPE_CHAR + charToEscape); // depends on control dependency: [for], data = [charToEscape]
}
}
return normalizeLikeExpression;
} }
|
public class class_name {
private final void step3() {
if (k == 0) {
return;
}
switch (b[k - 1]) {
case 'a':
if (endWith("ational")) {
r("ate");
break;
}
if (endWith("tional")) {
r("tion");
break;
}
break;
case 'c':
if (endWith("enci")) {
r("ence");
break;
}
if (endWith("anci")) {
r("ance");
break;
}
break;
case 'e':
if (endWith("izer")) {
r("ize");
break;
}
break;
case 'l':
if (endWith("bli")) {
r("ble");
break;
}
if (endWith("alli")) {
r("al");
break;
}
if (endWith("entli")) {
r("ent");
break;
}
if (endWith("eli")) {
r("e");
break;
}
if (endWith("ousli")) {
r("ous");
break;
}
break;
case 'o':
if (endWith("ization")) {
r("ize");
break;
}
if (endWith("ation")) {
r("ate");
break;
}
if (endWith("ator")) {
r("ate");
break;
}
break;
case 's':
if (endWith("alism")) {
r("al");
break;
}
if (endWith("iveness")) {
r("ive");
break;
}
if (endWith("fulness")) {
r("ful");
break;
}
if (endWith("ousness")) {
r("ous");
break;
}
break;
case 't':
if (endWith("aliti")) {
r("al");
break;
}
if (endWith("iviti")) {
r("ive");
break;
}
if (endWith("biliti")) {
r("ble");
break;
}
break;
case 'g':
if (endWith("logi")) {
r("log");
break;
}
}
} }
|
public class class_name {
private final void step3() {
if (k == 0) {
return; // depends on control dependency: [if], data = [none]
}
switch (b[k - 1]) {
case 'a':
if (endWith("ational")) {
r("ate"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("tional")) {
r("tion"); // depends on control dependency: [if], data = [none]
break;
}
break;
case 'c':
if (endWith("enci")) {
r("ence"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("anci")) {
r("ance"); // depends on control dependency: [if], data = [none]
break;
}
break;
case 'e':
if (endWith("izer")) {
r("ize"); // depends on control dependency: [if], data = [none]
break;
}
break;
case 'l':
if (endWith("bli")) {
r("ble"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("alli")) {
r("al"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("entli")) {
r("ent"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("eli")) {
r("e"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("ousli")) {
r("ous"); // depends on control dependency: [if], data = [none]
break;
}
break;
case 'o':
if (endWith("ization")) {
r("ize"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("ation")) {
r("ate"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("ator")) {
r("ate"); // depends on control dependency: [if], data = [none]
break;
}
break;
case 's':
if (endWith("alism")) {
r("al"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("iveness")) {
r("ive"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("fulness")) {
r("ful"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("ousness")) {
r("ous"); // depends on control dependency: [if], data = [none]
break;
}
break;
case 't':
if (endWith("aliti")) {
r("al"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("iviti")) {
r("ive"); // depends on control dependency: [if], data = [none]
break;
}
if (endWith("biliti")) {
r("ble"); // depends on control dependency: [if], data = [none]
break;
}
break;
case 'g':
if (endWith("logi")) {
r("log"); // depends on control dependency: [if], data = [none]
break;
}
}
} }
|
public class class_name {
public final void addObject(Object object) {
if (object instanceof Iterable) {
// Iterable
for (Object o : (Iterable<?>) object) {
objects.add(o);
}
} else if (object.getClass().isArray()) {
// Array
for (Object o : (Object[]) object) {
objects.add(o);
}
} else {
// Single object
objects.add(object);
}
} }
|
public class class_name {
public final void addObject(Object object) {
if (object instanceof Iterable) {
// Iterable
for (Object o : (Iterable<?>) object) {
objects.add(o); // depends on control dependency: [for], data = [o]
}
} else if (object.getClass().isArray()) {
// Array
for (Object o : (Object[]) object) {
objects.add(o); // depends on control dependency: [for], data = [o]
}
} else {
// Single object
objects.add(object); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@SuppressWarnings({"unused", "WeakerAccess"})
public void pushEvent(String eventName, Map<String, Object> eventActions) {
if (eventName == null || eventName.equals(""))
return;
ValidationResult validationResult = validator.isRestrictedEventName(eventName);
// Check for a restricted event name
if (validationResult.getErrorCode()>0) {
pushValidationResult(validationResult);
return;
}
if (eventActions == null) {
eventActions = new HashMap<>();
}
JSONObject event = new JSONObject();
try {
// Validate
ValidationResult vr = validator.cleanEventName(eventName);
// Check for an error
if (vr.getErrorCode() != 0)
event.put(Constants.ERROR_KEY, getErrorObject(vr));
eventName = vr.getObject().toString();
JSONObject actions = new JSONObject();
for (String key : eventActions.keySet()) {
Object value = eventActions.get(key);
vr = validator.cleanObjectKey(key);
key = vr.getObject().toString();
// Check for an error
if (vr.getErrorCode() != 0)
event.put(Constants.ERROR_KEY, getErrorObject(vr));
try {
vr = validator.cleanObjectValue(value, Validator.ValidationContext.Event);
} catch (IllegalArgumentException e) {
// The object was neither a String, Boolean, or any number primitives
ValidationResult error = new ValidationResult();
error.setErrorCode(512);
final String err = "For event \"" + eventName + "\": Property value for property " + key + " wasn't a primitive (" + value + ")";
error.setErrorDesc(err);
getConfigLogger().debug(getAccountId(), err);
pushValidationResult(error);
// Skip this record
continue;
}
value = vr.getObject();
// Check for an error
if (vr.getErrorCode() != 0)
event.put(Constants.ERROR_KEY, getErrorObject(vr));
actions.put(key, value);
}
event.put("evtName", eventName);
event.put("evtData", actions);
queueEvent(context, event, Constants.RAISED_EVENT);
} catch (Throwable t) {
// We won't get here
}
} }
|
public class class_name {
@SuppressWarnings({"unused", "WeakerAccess"})
public void pushEvent(String eventName, Map<String, Object> eventActions) {
if (eventName == null || eventName.equals(""))
return;
ValidationResult validationResult = validator.isRestrictedEventName(eventName);
// Check for a restricted event name
if (validationResult.getErrorCode()>0) {
pushValidationResult(validationResult); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (eventActions == null) {
eventActions = new HashMap<>(); // depends on control dependency: [if], data = [none]
}
JSONObject event = new JSONObject();
try {
// Validate
ValidationResult vr = validator.cleanEventName(eventName);
// Check for an error
if (vr.getErrorCode() != 0)
event.put(Constants.ERROR_KEY, getErrorObject(vr));
eventName = vr.getObject().toString();
JSONObject actions = new JSONObject();
for (String key : eventActions.keySet()) {
Object value = eventActions.get(key);
vr = validator.cleanObjectKey(key); // depends on control dependency: [for], data = [key]
key = vr.getObject().toString(); // depends on control dependency: [for], data = [key]
// Check for an error
if (vr.getErrorCode() != 0)
event.put(Constants.ERROR_KEY, getErrorObject(vr));
try {
vr = validator.cleanObjectValue(value, Validator.ValidationContext.Event); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
// The object was neither a String, Boolean, or any number primitives
ValidationResult error = new ValidationResult();
error.setErrorCode(512);
final String err = "For event \"" + eventName + "\": Property value for property " + key + " wasn't a primitive (" + value + ")";
error.setErrorDesc(err);
getConfigLogger().debug(getAccountId(), err);
pushValidationResult(error);
// Skip this record
continue;
}
value = vr.getObject();
// Check for an error
if (vr.getErrorCode() != 0)
event.put(Constants.ERROR_KEY, getErrorObject(vr));
actions.put(key, value);
}
event.put("evtName", eventName);
event.put("evtData", actions);
queueEvent(context, event, Constants.RAISED_EVENT);
} catch (Throwable t) {
// We won't get here
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(AssociateSkillGroupWithRoomRequest associateSkillGroupWithRoomRequest, ProtocolMarshaller protocolMarshaller) {
if (associateSkillGroupWithRoomRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(associateSkillGroupWithRoomRequest.getSkillGroupArn(), SKILLGROUPARN_BINDING);
protocolMarshaller.marshall(associateSkillGroupWithRoomRequest.getRoomArn(), ROOMARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(AssociateSkillGroupWithRoomRequest associateSkillGroupWithRoomRequest, ProtocolMarshaller protocolMarshaller) {
if (associateSkillGroupWithRoomRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(associateSkillGroupWithRoomRequest.getSkillGroupArn(), SKILLGROUPARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(associateSkillGroupWithRoomRequest.getRoomArn(), ROOMARN_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 Integer[] getAdjustedCycle(int cycleNumber) {
Integer[] cycles;
try {
cycles = ADJUSTED_CYCLE_YEARS.get(Integer.valueOf(cycleNumber));
} catch (ArrayIndexOutOfBoundsException e) {
cycles = null;
}
if (cycles == null) {
cycles = DEFAULT_CYCLE_YEARS;
}
return cycles;
} }
|
public class class_name {
private static Integer[] getAdjustedCycle(int cycleNumber) {
Integer[] cycles;
try {
cycles = ADJUSTED_CYCLE_YEARS.get(Integer.valueOf(cycleNumber)); // depends on control dependency: [try], data = [none]
} catch (ArrayIndexOutOfBoundsException e) {
cycles = null;
} // depends on control dependency: [catch], data = [none]
if (cycles == null) {
cycles = DEFAULT_CYCLE_YEARS; // depends on control dependency: [if], data = [none]
}
return cycles;
} }
|
public class class_name {
public static String getName(String s, String separator) {
if (s.length() == 1) { // handle common case
return getName(s.charAt(0));
}
int cp;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i += Character.charCount(cp)) {
cp = s.codePointAt(i);
if (i != 0) sb.append(separator);
sb.append(UCharacter.getName(cp));
}
return sb.toString();
} }
|
public class class_name {
public static String getName(String s, String separator) {
if (s.length() == 1) { // handle common case
return getName(s.charAt(0)); // depends on control dependency: [if], data = [none]
}
int cp;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i += Character.charCount(cp)) {
cp = s.codePointAt(i); // depends on control dependency: [for], data = [i]
if (i != 0) sb.append(separator);
sb.append(UCharacter.getName(cp)); // depends on control dependency: [for], data = [none]
}
return sb.toString();
} }
|
public class class_name {
private final static Class convertToJavaClass(String name,
ClassLoader cl)
throws ClassNotFoundException
{
int arraySize = 0;
while (name.endsWith("[]"))
{
name = name.substring(0, name.length() - 2);
arraySize++;
}
// Check for a primitive type
Class c = (Class) PRIMITIVE_NAME_TYPE_MAP.get(name);
if (c == null)
{
// No primitive, try to load it from the given ClassLoader
try
{
c = cl.loadClass(name);
}
catch (ClassNotFoundException cnfe)
{
throw new ClassNotFoundException("Parameter class not found: " +
name);
}
}
// if we have an array get the array class
if (arraySize > 0)
{
int[] dims = new int[arraySize];
for (int i = 0; i < arraySize; i++)
{
dims[i] = 1;
}
c = Array.newInstance(c, dims).getClass();
}
return c;
} }
|
public class class_name {
private final static Class convertToJavaClass(String name,
ClassLoader cl)
throws ClassNotFoundException
{
int arraySize = 0;
while (name.endsWith("[]"))
{
name = name.substring(0, name.length() - 2);
arraySize++;
}
// Check for a primitive type
Class c = (Class) PRIMITIVE_NAME_TYPE_MAP.get(name);
if (c == null)
{
// No primitive, try to load it from the given ClassLoader
try
{
c = cl.loadClass(name); // depends on control dependency: [try], data = [none]
}
catch (ClassNotFoundException cnfe)
{
throw new ClassNotFoundException("Parameter class not found: " +
name);
} // depends on control dependency: [catch], data = [none]
}
// if we have an array get the array class
if (arraySize > 0)
{
int[] dims = new int[arraySize];
for (int i = 0; i < arraySize; i++)
{
dims[i] = 1; // depends on control dependency: [for], data = [i]
}
c = Array.newInstance(c, dims).getClass();
}
return c;
} }
|
public class class_name {
public void setInsights(java.util.Collection<Insight> insights) {
if (insights == null) {
this.insights = null;
return;
}
this.insights = new java.util.ArrayList<Insight>(insights);
} }
|
public class class_name {
public void setInsights(java.util.Collection<Insight> insights) {
if (insights == null) {
this.insights = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.insights = new java.util.ArrayList<Insight>(insights);
} }
|
public class class_name {
public static String decode(String file, String ref) {
StringBuffer buf = new StringBuffer();
StringTokenizer tokenizer = new StringTokenizer(file, "/", true); //$NON-NLS-1$
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
if (token.equals("/")) { //$NON-NLS-1$
buf.append(token);
} else {
buf.append(decodeSegment(token));
}
}
if (ref != null) {
buf.append('#');
buf.append(decodeSegment(ref));
}
return buf.toString();
} }
|
public class class_name {
public static String decode(String file, String ref) {
StringBuffer buf = new StringBuffer();
StringTokenizer tokenizer = new StringTokenizer(file, "/", true); //$NON-NLS-1$
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
if (token.equals("/")) { //$NON-NLS-1$
buf.append(token); // depends on control dependency: [if], data = [none]
} else {
buf.append(decodeSegment(token)); // depends on control dependency: [if], data = [none]
}
}
if (ref != null) {
buf.append('#'); // depends on control dependency: [if], data = [none]
buf.append(decodeSegment(ref)); // depends on control dependency: [if], data = [(ref]
}
return buf.toString();
} }
|
public class class_name {
private void calculateRows()
{
//create the sorted list of points
GridPoint points[] = new GridPoint[areas.size() * 2];
int pi = 0;
for (Area area : areas)
{
points[pi] = new GridPoint(area.getY1(), area, true);
points[pi+1] = new GridPoint(area.getY2() + 1, area, false);
pi += 2;
//Y2+1 ensures that the end of one box will be on the same point
//as the start of the following box
}
Arrays.sort(points);
//calculate the number of rows
int cnt = 0;
int last = abspos.getY1();
for (int i = 0; i < points.length; i++)
if (!theSame(points[i].value, last))
{
last = points[i].value;
cnt++;
}
if (!theSame(last, abspos.getY2()))
cnt++; //last row finishes the whole area
height = cnt;
//calculate the row heights and the layout
rows = new int[height];
cnt = 0;
last = abspos.getY1();
for (int i = 0; i < points.length; i++)
{
if (!theSame(points[i].value, last))
{
rows[cnt] = points[i].value - last;
last = points[i].value;
cnt++;
}
if (points[i].begin)
{
target.getPosition(points[i].area).setY1(cnt);
//points[i].node.getArea().setY1(parent.getArea().getY1() + getRowOfs(cnt));
}
else
{
Rectangular pos = target.getPosition(points[i].area);
pos.setY2(cnt-1);
if (pos.getY2() < pos.getY1())
pos.setY2(pos.getY1());
//points[i].node.getArea().setY2(parent.getArea().getY1() + getRowOfs(pos.getY2()+1));
}
}
if (!theSame(last, abspos.getY2()))
rows[cnt] = abspos.getY2() - last;
} }
|
public class class_name {
private void calculateRows()
{
//create the sorted list of points
GridPoint points[] = new GridPoint[areas.size() * 2];
int pi = 0;
for (Area area : areas)
{
points[pi] = new GridPoint(area.getY1(), area, true); // depends on control dependency: [for], data = [area]
points[pi+1] = new GridPoint(area.getY2() + 1, area, false); // depends on control dependency: [for], data = [area]
pi += 2; // depends on control dependency: [for], data = [none]
//Y2+1 ensures that the end of one box will be on the same point
//as the start of the following box
}
Arrays.sort(points);
//calculate the number of rows
int cnt = 0;
int last = abspos.getY1();
for (int i = 0; i < points.length; i++)
if (!theSame(points[i].value, last))
{
last = points[i].value; // depends on control dependency: [if], data = [none]
cnt++; // depends on control dependency: [if], data = [none]
}
if (!theSame(last, abspos.getY2()))
cnt++; //last row finishes the whole area
height = cnt;
//calculate the row heights and the layout
rows = new int[height];
cnt = 0;
last = abspos.getY1();
for (int i = 0; i < points.length; i++)
{
if (!theSame(points[i].value, last))
{
rows[cnt] = points[i].value - last; // depends on control dependency: [if], data = [none]
last = points[i].value; // depends on control dependency: [if], data = [none]
cnt++; // depends on control dependency: [if], data = [none]
}
if (points[i].begin)
{
target.getPosition(points[i].area).setY1(cnt); // depends on control dependency: [if], data = [none]
//points[i].node.getArea().setY1(parent.getArea().getY1() + getRowOfs(cnt));
}
else
{
Rectangular pos = target.getPosition(points[i].area);
pos.setY2(cnt-1); // depends on control dependency: [if], data = [none]
if (pos.getY2() < pos.getY1())
pos.setY2(pos.getY1());
//points[i].node.getArea().setY2(parent.getArea().getY1() + getRowOfs(pos.getY2()+1));
}
}
if (!theSame(last, abspos.getY2()))
rows[cnt] = abspos.getY2() - last;
} }
|
public class class_name {
public static boolean toBooleanValue(Object o, boolean defaultValue) {
if (o instanceof Boolean) return ((Boolean) o).booleanValue();
else if (o instanceof Double) return toBooleanValue(((Double) o).doubleValue());
else if (o instanceof Number) return toBooleanValue(((Number) o).doubleValue());
else if (o instanceof String) {
Boolean b = toBoolean(o.toString(), null);
if (b != null) return b;
}
// else if(o instanceof Clob) return toBooleanValueEL(toStringEL(o));
else if (o instanceof Castable) {
return ((Castable) o).castToBoolean(Caster.toBoolean(defaultValue)).booleanValue();
}
else if (o == null) return toBooleanValue("", defaultValue);
else if (o instanceof ObjectWrap) return toBooleanValue(((ObjectWrap) o).getEmbededObject(toBoolean(defaultValue)), defaultValue);
return defaultValue;
} }
|
public class class_name {
public static boolean toBooleanValue(Object o, boolean defaultValue) {
if (o instanceof Boolean) return ((Boolean) o).booleanValue();
else if (o instanceof Double) return toBooleanValue(((Double) o).doubleValue());
else if (o instanceof Number) return toBooleanValue(((Number) o).doubleValue());
else if (o instanceof String) {
Boolean b = toBoolean(o.toString(), null);
if (b != null) return b;
}
// else if(o instanceof Clob) return toBooleanValueEL(toStringEL(o));
else if (o instanceof Castable) {
return ((Castable) o).castToBoolean(Caster.toBoolean(defaultValue)).booleanValue(); // depends on control dependency: [if], data = [none]
}
else if (o == null) return toBooleanValue("", defaultValue);
else if (o instanceof ObjectWrap) return toBooleanValue(((ObjectWrap) o).getEmbededObject(toBoolean(defaultValue)), defaultValue);
return defaultValue;
} }
|
public class class_name {
public MimeType getPreferredAccept(Set<MimeType> supportedTypes) {
// Starts from the highest.
for (AcceptHeaderEntry clientSupported : entries) {
for (MimeType serverSupported : supportedTypes) {
if (isSameOrSubtype(serverSupported, clientSupported.mediaType)) {
return serverSupported;
}
}
}
return null;
} }
|
public class class_name {
public MimeType getPreferredAccept(Set<MimeType> supportedTypes) {
// Starts from the highest.
for (AcceptHeaderEntry clientSupported : entries) {
for (MimeType serverSupported : supportedTypes) {
if (isSameOrSubtype(serverSupported, clientSupported.mediaType)) {
return serverSupported; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
public OSchemaHelper oProperty(String propertyName, OType type)
{
checkOClass();
lastProperty = lastClass.getProperty(propertyName);
if(lastProperty==null)
{
lastProperty = lastClass.createProperty(propertyName, type);
}
else
{
if(!type.equals(lastProperty.getType()))
{
lastProperty.setType(type);
}
}
return this;
} }
|
public class class_name {
public OSchemaHelper oProperty(String propertyName, OType type)
{
checkOClass();
lastProperty = lastClass.getProperty(propertyName);
if(lastProperty==null)
{
lastProperty = lastClass.createProperty(propertyName, type); // depends on control dependency: [if], data = [none]
}
else
{
if(!type.equals(lastProperty.getType()))
{
lastProperty.setType(type); // depends on control dependency: [if], data = [none]
}
}
return this;
} }
|
public class class_name {
@Override
public FeatureDao getFeatureDao(String tableName) {
GeometryColumnsDao dao = getGeometryColumnsDao();
List<GeometryColumns> geometryColumnsList;
try {
geometryColumnsList = dao.queryForEq(
GeometryColumns.COLUMN_TABLE_NAME, tableName);
} catch (SQLException e) {
throw new GeoPackageException("Failed to retrieve "
+ FeatureDao.class.getSimpleName() + " for table name: "
+ tableName + ". Exception retrieving "
+ GeometryColumns.class.getSimpleName() + ".", e);
}
if (geometryColumnsList.isEmpty()) {
throw new GeoPackageException(
"No Feature Table exists for table name: " + tableName);
} else if (geometryColumnsList.size() > 1) {
// This shouldn't happen with the table name unique constraint on
// geometry columns
throw new GeoPackageException("Unexpected state. More than one "
+ GeometryColumns.class.getSimpleName()
+ " matched for table name: " + tableName + ", count: "
+ geometryColumnsList.size());
}
return getFeatureDao(geometryColumnsList.get(0));
} }
|
public class class_name {
@Override
public FeatureDao getFeatureDao(String tableName) {
GeometryColumnsDao dao = getGeometryColumnsDao();
List<GeometryColumns> geometryColumnsList;
try {
geometryColumnsList = dao.queryForEq(
GeometryColumns.COLUMN_TABLE_NAME, tableName); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new GeoPackageException("Failed to retrieve "
+ FeatureDao.class.getSimpleName() + " for table name: "
+ tableName + ". Exception retrieving "
+ GeometryColumns.class.getSimpleName() + ".", e);
} // depends on control dependency: [catch], data = [none]
if (geometryColumnsList.isEmpty()) {
throw new GeoPackageException(
"No Feature Table exists for table name: " + tableName);
} else if (geometryColumnsList.size() > 1) {
// This shouldn't happen with the table name unique constraint on
// geometry columns
throw new GeoPackageException("Unexpected state. More than one "
+ GeometryColumns.class.getSimpleName()
+ " matched for table name: " + tableName + ", count: "
+ geometryColumnsList.size());
}
return getFeatureDao(geometryColumnsList.get(0));
} }
|
public class class_name {
protected void readFilterConfigParameters(final FilterConfig filterConfig, final Object target, final String... parameters) {
for (String parameter : parameters) {
String value = filterConfig.getInitParameter(parameter);
if (value != null) {
BeanUtil.declared.setProperty(target, parameter, value);
}
}
} }
|
public class class_name {
protected void readFilterConfigParameters(final FilterConfig filterConfig, final Object target, final String... parameters) {
for (String parameter : parameters) {
String value = filterConfig.getInitParameter(parameter);
if (value != null) {
BeanUtil.declared.setProperty(target, parameter, value); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public EClass getIfcAirTerminalType() {
if (ifcAirTerminalTypeEClass == null) {
ifcAirTerminalTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(8);
}
return ifcAirTerminalTypeEClass;
} }
|
public class class_name {
public EClass getIfcAirTerminalType() {
if (ifcAirTerminalTypeEClass == null) {
ifcAirTerminalTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(8);
// depends on control dependency: [if], data = [none]
}
return ifcAirTerminalTypeEClass;
} }
|
public class class_name {
public void marshall(GetCostForecastRequest getCostForecastRequest, ProtocolMarshaller protocolMarshaller) {
if (getCostForecastRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getCostForecastRequest.getTimePeriod(), TIMEPERIOD_BINDING);
protocolMarshaller.marshall(getCostForecastRequest.getMetric(), METRIC_BINDING);
protocolMarshaller.marshall(getCostForecastRequest.getGranularity(), GRANULARITY_BINDING);
protocolMarshaller.marshall(getCostForecastRequest.getFilter(), FILTER_BINDING);
protocolMarshaller.marshall(getCostForecastRequest.getPredictionIntervalLevel(), PREDICTIONINTERVALLEVEL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(GetCostForecastRequest getCostForecastRequest, ProtocolMarshaller protocolMarshaller) {
if (getCostForecastRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getCostForecastRequest.getTimePeriod(), TIMEPERIOD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getCostForecastRequest.getMetric(), METRIC_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getCostForecastRequest.getGranularity(), GRANULARITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getCostForecastRequest.getFilter(), FILTER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getCostForecastRequest.getPredictionIntervalLevel(), PREDICTIONINTERVALLEVEL_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected String[] getPaths (String pkgPath, String key)
{
String bundle = _loader.getBundle(pkgPath);
Preconditions.checkNotNull(bundle,
"Unable to find the bundle name for a package [package=%s, key=%s]", pkgPath, key);
String[] names = _loader.getPaths(pkgPath, key);
Preconditions.checkNotNull(names, "No such sound [package=%s, key=%s]", pkgPath, key);
String[] paths = new String[names.length];
for (int ii = 0; ii < paths.length; ii++) {
paths[ii] = bundle + ":" + names[ii];
}
return paths;
} }
|
public class class_name {
protected String[] getPaths (String pkgPath, String key)
{
String bundle = _loader.getBundle(pkgPath);
Preconditions.checkNotNull(bundle,
"Unable to find the bundle name for a package [package=%s, key=%s]", pkgPath, key);
String[] names = _loader.getPaths(pkgPath, key);
Preconditions.checkNotNull(names, "No such sound [package=%s, key=%s]", pkgPath, key);
String[] paths = new String[names.length];
for (int ii = 0; ii < paths.length; ii++) {
paths[ii] = bundle + ":" + names[ii]; // depends on control dependency: [for], data = [ii]
}
return paths;
} }
|
public class class_name {
private List<SiteNode> getChildren(SiteNode siteNode) {
int childCount = siteNode.getChildCount();
if (childCount == 0) {
return Collections.emptyList();
}
List<SiteNode> children = new ArrayList<>(childCount);
for (int i = 0; i < childCount; i++) {
children.add((SiteNode) siteNode.getChildAt(i));
}
return children;
} }
|
public class class_name {
private List<SiteNode> getChildren(SiteNode siteNode) {
int childCount = siteNode.getChildCount();
if (childCount == 0) {
return Collections.emptyList();
// depends on control dependency: [if], data = [none]
}
List<SiteNode> children = new ArrayList<>(childCount);
for (int i = 0; i < childCount; i++) {
children.add((SiteNode) siteNode.getChildAt(i));
// depends on control dependency: [for], data = [i]
}
return children;
} }
|
public class class_name {
public StringIndex getNameIndex() {
try {
if (nameIndex == null) {
FileSystemResource res = new FileSystemResource(context.getFileSystem(), RES_NAME_INDEX);
if (res.exists()) {
nameIndex = super.getNameIndex();
} else {
// create db nameindex
nameIndex = createDbNameIndex();
}
}
return nameIndex;
} catch (Exception e) {
IllegalStateException exception =
new IllegalStateException("Unable to create nsIndex");
exception.initCause(e);
throw exception;
}
} }
|
public class class_name {
public StringIndex getNameIndex() {
try {
if (nameIndex == null) {
FileSystemResource res = new FileSystemResource(context.getFileSystem(), RES_NAME_INDEX);
if (res.exists()) {
nameIndex = super.getNameIndex(); // depends on control dependency: [if], data = [none]
} else {
// create db nameindex
nameIndex = createDbNameIndex(); // depends on control dependency: [if], data = [none]
}
}
return nameIndex; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
IllegalStateException exception =
new IllegalStateException("Unable to create nsIndex");
exception.initCause(e);
throw exception;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static <R> Mono<R> zipDelayError(Function<? super Object[], ? extends R>
combinator, Mono<?>... monos) {
if (monos.length == 0) {
return empty();
}
if (monos.length == 1) {
return monos[0].map(d -> combinator.apply(new Object[]{d}));
}
return onAssembly(new MonoZip<>(true, combinator, monos));
} }
|
public class class_name {
public static <R> Mono<R> zipDelayError(Function<? super Object[], ? extends R>
combinator, Mono<?>... monos) {
if (monos.length == 0) {
return empty(); // depends on control dependency: [if], data = [none]
}
if (monos.length == 1) {
return monos[0].map(d -> combinator.apply(new Object[]{d})); // depends on control dependency: [if], data = [none]
}
return onAssembly(new MonoZip<>(true, combinator, monos));
} }
|
public class class_name {
public AnnotatedTypeBuilder<X> addToMethodParameter(Method method, int position, Annotation annotation) {
if (!methods.containsKey(method)) {
methods.put(method, new AnnotationBuilder());
}
if (methodParameters.get(method) == null) {
methodParameters.put(method, new HashMap<Integer, AnnotationBuilder>());
}
if (methodParameters.get(method).get(position) == null) {
methodParameters.get(method).put(position, new AnnotationBuilder());
}
methodParameters.get(method).get(position).add(annotation);
return this;
} }
|
public class class_name {
public AnnotatedTypeBuilder<X> addToMethodParameter(Method method, int position, Annotation annotation) {
if (!methods.containsKey(method)) {
methods.put(method, new AnnotationBuilder()); // depends on control dependency: [if], data = [none]
}
if (methodParameters.get(method) == null) {
methodParameters.put(method, new HashMap<Integer, AnnotationBuilder>()); // depends on control dependency: [if], data = [none]
}
if (methodParameters.get(method).get(position) == null) {
methodParameters.get(method).put(position, new AnnotationBuilder()); // depends on control dependency: [if], data = [none]
}
methodParameters.get(method).get(position).add(annotation);
return this;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
protected <C extends Compound> Sequence<C> reverseSequence(Sequence<C> sequence) {
if(getStrand() != Strand.NEGATIVE) {
return sequence;
}
Sequence<C> reversed = new ReversedSequenceView<C>(sequence);
// "safe" operation as we have tried to check this
if(canComplement(sequence)) {
Sequence<ComplementCompound> casted = (Sequence<ComplementCompound>) reversed;
ComplementSequenceView<ComplementCompound> complement =
new ComplementSequenceView<ComplementCompound>(casted);
return (Sequence<C>)complement;
}
return reversed;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
protected <C extends Compound> Sequence<C> reverseSequence(Sequence<C> sequence) {
if(getStrand() != Strand.NEGATIVE) {
return sequence; // depends on control dependency: [if], data = [none]
}
Sequence<C> reversed = new ReversedSequenceView<C>(sequence);
// "safe" operation as we have tried to check this
if(canComplement(sequence)) {
Sequence<ComplementCompound> casted = (Sequence<ComplementCompound>) reversed;
ComplementSequenceView<ComplementCompound> complement =
new ComplementSequenceView<ComplementCompound>(casted);
return (Sequence<C>)complement; // depends on control dependency: [if], data = [none]
}
return reversed;
} }
|
public class class_name {
@SuppressWarnings("TryWithIdenticalCatches")
private static Map<View, FormValidator.FieldInfo> findFieldsToValidate(Object target) {
final Field[] fields = target.getClass().getDeclaredFields();
if (fields == null || fields.length == 0) {
return Collections.emptyMap();
}
final WeakHashMap<View, FormValidator.FieldInfo> infoMap = new WeakHashMap<>(fields.length);
for (Field field : fields) {
final List<FormValidator.ValidationInfo> infos = new ArrayList<>();
final Annotation[] annotations = field.getDeclaredAnnotations();
if (annotations.length > 0) {
if (! View.class.isAssignableFrom(field.getType())) {
// next field
continue;
}
final View view;
try {
field.setAccessible(true);
view = (View) field.get(target);
} catch (IllegalAccessException e) {
throw new FormsValidationException(e);
}
if (view == null) {
continue;
}
for (Annotation annotation : annotations) {
final IValidator validator;
try {
validator = ValidatorFactory.getValidator(annotation);
} catch (IllegalAccessException e) {
throw new FormsValidationException(e);
} catch (InstantiationException e) {
throw new FormsValidationException(e);
}
if (validator != null) {
FormValidator.ValidationInfo info = new FormValidator.ValidationInfo(annotation, validator);
infos.add(info);
}
}
final Condition conditionAnnotation = field.getAnnotation(Condition.class);
if (infos.size() > 0) {
Collections.sort(infos, new Comparator<FormValidator.ValidationInfo>() {
@Override
public int compare(FormValidator.ValidationInfo lhs, FormValidator.ValidationInfo rhs) {
return lhs.order < rhs.order ? -1 : (lhs.order == rhs.order ? 0 : 1);
}
});
}
final FormValidator.FieldInfo fieldInfo = new FormValidator.FieldInfo(conditionAnnotation, infos);
infoMap.put(view, fieldInfo);
}
}
return infoMap;
} }
|
public class class_name {
@SuppressWarnings("TryWithIdenticalCatches")
private static Map<View, FormValidator.FieldInfo> findFieldsToValidate(Object target) {
final Field[] fields = target.getClass().getDeclaredFields();
if (fields == null || fields.length == 0) {
return Collections.emptyMap(); // depends on control dependency: [if], data = [none]
}
final WeakHashMap<View, FormValidator.FieldInfo> infoMap = new WeakHashMap<>(fields.length);
for (Field field : fields) {
final List<FormValidator.ValidationInfo> infos = new ArrayList<>();
final Annotation[] annotations = field.getDeclaredAnnotations();
if (annotations.length > 0) {
if (! View.class.isAssignableFrom(field.getType())) {
// next field
continue;
}
final View view;
try {
field.setAccessible(true); // depends on control dependency: [try], data = [none]
view = (View) field.get(target); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException e) {
throw new FormsValidationException(e);
} // depends on control dependency: [catch], data = [none]
if (view == null) {
continue;
}
for (Annotation annotation : annotations) {
final IValidator validator;
try {
validator = ValidatorFactory.getValidator(annotation); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException e) {
throw new FormsValidationException(e);
} catch (InstantiationException e) { // depends on control dependency: [catch], data = [none]
throw new FormsValidationException(e);
} // depends on control dependency: [catch], data = [none]
if (validator != null) {
FormValidator.ValidationInfo info = new FormValidator.ValidationInfo(annotation, validator);
infos.add(info); // depends on control dependency: [if], data = [none]
}
}
final Condition conditionAnnotation = field.getAnnotation(Condition.class);
if (infos.size() > 0) {
Collections.sort(infos, new Comparator<FormValidator.ValidationInfo>() {
@Override
public int compare(FormValidator.ValidationInfo lhs, FormValidator.ValidationInfo rhs) {
return lhs.order < rhs.order ? -1 : (lhs.order == rhs.order ? 0 : 1);
}
}); // depends on control dependency: [if], data = [none]
}
final FormValidator.FieldInfo fieldInfo = new FormValidator.FieldInfo(conditionAnnotation, infos);
infoMap.put(view, fieldInfo); // depends on control dependency: [if], data = [none]
}
}
return infoMap;
} }
|
public class class_name {
public static String buildSubscript(Iterable<Object> subscripts) {
StringBuilder sb = new StringBuilder();
for (Object subscript : subscripts) {
String value = toString(subscript);
if (value.isEmpty()) {
throw new RuntimeException("Null subscript not allowed.");
}
if (sb.length() > 0) {
sb.append(",");
}
if (StringUtils.isNumeric(value)) {
sb.append(value);
} else {
sb.append(QT);
sb.append(value.replaceAll(QT, QT2));
sb.append(QT);
}
}
return sb.toString();
} }
|
public class class_name {
public static String buildSubscript(Iterable<Object> subscripts) {
StringBuilder sb = new StringBuilder();
for (Object subscript : subscripts) {
String value = toString(subscript);
if (value.isEmpty()) {
throw new RuntimeException("Null subscript not allowed.");
}
if (sb.length() > 0) {
sb.append(","); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isNumeric(value)) {
sb.append(value); // depends on control dependency: [if], data = [none]
} else {
sb.append(QT); // depends on control dependency: [if], data = [none]
sb.append(value.replaceAll(QT, QT2)); // depends on control dependency: [if], data = [none]
sb.append(QT); // depends on control dependency: [if], data = [none]
}
}
return sb.toString();
} }
|
public class class_name {
private void socketClosedHandler() {
// If the book-keeping has already been completed earlier, then
// we should just bail.
if (getReadyState() == ReadyState.CLOSED) {
return;
}
// TODO: Determine whether channels need to be cleaned up
if (this.channels.size() != 0) {
// Iterate over the channels and close them.
for (int i = 1; i <= this.channels.size(); i++) { // 1-based
AmqpChannel channel = this.channels.get(i);
AmqpFrame f = new AmqpFrame();
// Close the channel and ensure that the CLOSE event is
// fired on the registered ChannelListener objects.
f.setMethodName("closeChannel");
f.setChannelId((short) i);
channel.channelClosedHandler(this, "", f, "closeChannel");
}
}
// Mark the readyState as CLOSED.
readyState = ReadyState.CLOSED;
// Fire the CLOSE event on the ConnectionListener(s) registered on
// the AmqpClient object.
fireOnClosed(new ConnectionEvent(this, Kind.CLOSE));
} }
|
public class class_name {
private void socketClosedHandler() {
// If the book-keeping has already been completed earlier, then
// we should just bail.
if (getReadyState() == ReadyState.CLOSED) {
return; // depends on control dependency: [if], data = [none]
}
// TODO: Determine whether channels need to be cleaned up
if (this.channels.size() != 0) {
// Iterate over the channels and close them.
for (int i = 1; i <= this.channels.size(); i++) { // 1-based
AmqpChannel channel = this.channels.get(i);
AmqpFrame f = new AmqpFrame();
// Close the channel and ensure that the CLOSE event is
// fired on the registered ChannelListener objects.
f.setMethodName("closeChannel"); // depends on control dependency: [for], data = [none]
f.setChannelId((short) i); // depends on control dependency: [for], data = [i]
channel.channelClosedHandler(this, "", f, "closeChannel"); // depends on control dependency: [for], data = [none]
}
}
// Mark the readyState as CLOSED.
readyState = ReadyState.CLOSED;
// Fire the CLOSE event on the ConnectionListener(s) registered on
// the AmqpClient object.
fireOnClosed(new ConnectionEvent(this, Kind.CLOSE));
} }
|
public class class_name {
public OqlBuilder<T> orderBy(final List<Order> orders) {
if (null != orders) {
if (isNotEmpty(statement)) { throw new RuntimeException("cannot add order by to a exists statement."); }
this.orders.addAll(orders);
}
return this;
} }
|
public class class_name {
public OqlBuilder<T> orderBy(final List<Order> orders) {
if (null != orders) {
if (isNotEmpty(statement)) { throw new RuntimeException("cannot add order by to a exists statement."); }
this.orders.addAll(orders); // depends on control dependency: [if], data = [orders)]
}
return this;
} }
|
public class class_name {
public int run(String argv[]) throws Exception {
if (argv.length < 1) {
printUsage();
return -1;
}
AvatarShellCommand cmd = AvatarShellCommand.parseCommand(argv);
if (cmd == null) {
printUsage();
return -1;
}
int exitCode = 0;
if (conf.get(FSConstants.DFS_FEDERATION_NAMESERVICES) != null
&& (!cmd.isServiceCommand) && (!cmd.isAddressCommand)) {
printServiceErrorMessage("AvatarShell", conf);
return -1;
}
String serviceName = null;
if (cmd.isServiceCommand) {
serviceName = cmd.serviceArgs[0];
}
// commands without -{zero|one} prefix
if (cmd.isWaitTxIdCommand) {
AvatarZooKeeperClient zk = new AvatarZooKeeperClient(conf, null);
try {
processServiceName(serviceName, true);
waitForLastTxIdNode(zk, originalConf);
} catch (Exception e) {
exitCode = -1;
printError(e);
} finally {
zk.shutdown();
}
if (exitCode == 0) {
LOG.info("Primary shutdown was successful!");
}
return exitCode;
}
if (cmd.isFailoverCommand || cmd.isPrepfailoverCommand) {
boolean prep = cmd.isPrepfailoverCommand;
try {
processServiceName(serviceName, true);
exitCode = failover(serviceName, prep);
} catch (Exception e) {
exitCode = -1;
printError(e);
}
String prefix = prep ? "Prep" : "";
if (exitCode == 0) {
LOG.info(prefix + "Failover was successful!");
if (prep) {
System.out
.println("WARNING: Standby is in pre-failover state! If the failover "
+ "is not performed, the standby needs to be restarted to "
+ "continue checkpointing.");
}
} else {
LOG.error(prefix + "Failover failed!");
if (prep) {
System.out
.println("WARNING: Standby is in bad state! Restart the standby node!");
}
}
return exitCode;
}
/////////////////////// direct commands (-zero -one -address)
String address = cmd.isAddressCommand ? cmd.addressArgs[0] : null;
String instance = cmd.isZeroCommand ? StartupOption.NODEZERO.getName()
: (cmd.isOneCommand ? StartupOption.NODEONE.getName() : null);
if (!processServiceName(serviceName, false)) {
return -1;
}
// remove 0/1 suffix
if (instance != null) {
if ((conf = AvatarZKShell.updateConf(instance, originalConf)) == null) {
printUsage();
return -1;
}
}
initAvatarRPC(address);
try {
if (cmd.isShowAvatarCommand) {
exitCode = showAvatar();
} else if (cmd.isSetAvatarCommand) {
exitCode = setAvatar("primary", contains(cmd.setAvatarArgs, "force"), serviceName, instance);
} else if (cmd.isIsInitializedCommand) {
exitCode = isInitialized();
} else if (cmd.isMetasaveCommand) {
exitCode = metasave(cmd.metasageArgs[0]);
} else if (cmd.isSaveNamespaceCommand) {
exitCode = saveNamespace(cmd.getSaveNamespaceArgs());
} else if (cmd.isShutdownAvatarCommand) {
shutdownAvatar(serviceName);
} else if (cmd.isSafemodeCommand) {
processSafeMode(cmd.safemodeArgs[0]);
} else {
exitCode = -1;
System.err.println("Unknown command");
printUsage();
}
} catch (IllegalArgumentException arge) {
exitCode = -1;
arge.printStackTrace();
printError(arge);
printUsage();
} catch (RemoteException e) {
//
// This is a error returned by avatarnode server. Print
// out the first line of the error mesage, ignore the stack trace.
exitCode = -1;
try {
String[] content;
content = e.getLocalizedMessage().split("\n");
System.err.println(content[0]);
} catch (Exception ex) {
System.err.println(ex.getLocalizedMessage());
}
} catch (IOException e) {
//
// IO exception encountered locally.
//
exitCode = -1;
printError(e);
} catch (Throwable re) {
exitCode = -1;
printError(re);
} finally {
}
if (exitCode == 0) {
LOG.info("Command was successful!");
}
return exitCode;
} }
|
public class class_name {
public int run(String argv[]) throws Exception {
if (argv.length < 1) {
printUsage();
return -1;
}
AvatarShellCommand cmd = AvatarShellCommand.parseCommand(argv);
if (cmd == null) {
printUsage();
return -1;
}
int exitCode = 0;
if (conf.get(FSConstants.DFS_FEDERATION_NAMESERVICES) != null
&& (!cmd.isServiceCommand) && (!cmd.isAddressCommand)) {
printServiceErrorMessage("AvatarShell", conf);
return -1;
}
String serviceName = null;
if (cmd.isServiceCommand) {
serviceName = cmd.serviceArgs[0];
}
// commands without -{zero|one} prefix
if (cmd.isWaitTxIdCommand) {
AvatarZooKeeperClient zk = new AvatarZooKeeperClient(conf, null);
try {
processServiceName(serviceName, true); // depends on control dependency: [try], data = [none]
waitForLastTxIdNode(zk, originalConf); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
exitCode = -1;
printError(e);
} finally { // depends on control dependency: [catch], data = [none]
zk.shutdown();
}
if (exitCode == 0) {
LOG.info("Primary shutdown was successful!"); // depends on control dependency: [if], data = [none]
}
return exitCode;
}
if (cmd.isFailoverCommand || cmd.isPrepfailoverCommand) {
boolean prep = cmd.isPrepfailoverCommand;
try {
processServiceName(serviceName, true); // depends on control dependency: [try], data = [none]
exitCode = failover(serviceName, prep); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
exitCode = -1;
printError(e);
} // depends on control dependency: [catch], data = [none]
String prefix = prep ? "Prep" : "";
if (exitCode == 0) {
LOG.info(prefix + "Failover was successful!"); // depends on control dependency: [if], data = [none]
if (prep) {
System.out
.println("WARNING: Standby is in pre-failover state! If the failover "
+ "is not performed, the standby needs to be restarted to "
+ "continue checkpointing."); // depends on control dependency: [if], data = [none]
}
} else {
LOG.error(prefix + "Failover failed!"); // depends on control dependency: [if], data = [none]
if (prep) {
System.out
.println("WARNING: Standby is in bad state! Restart the standby node!"); // depends on control dependency: [if], data = [none]
}
}
return exitCode;
}
/////////////////////// direct commands (-zero -one -address)
String address = cmd.isAddressCommand ? cmd.addressArgs[0] : null;
String instance = cmd.isZeroCommand ? StartupOption.NODEZERO.getName()
: (cmd.isOneCommand ? StartupOption.NODEONE.getName() : null);
if (!processServiceName(serviceName, false)) {
return -1;
}
// remove 0/1 suffix
if (instance != null) {
if ((conf = AvatarZKShell.updateConf(instance, originalConf)) == null) {
printUsage();
return -1;
}
}
initAvatarRPC(address);
try {
if (cmd.isShowAvatarCommand) {
exitCode = showAvatar();
} else if (cmd.isSetAvatarCommand) {
exitCode = setAvatar("primary", contains(cmd.setAvatarArgs, "force"), serviceName, instance);
} else if (cmd.isIsInitializedCommand) {
exitCode = isInitialized();
} else if (cmd.isMetasaveCommand) {
exitCode = metasave(cmd.metasageArgs[0]);
} else if (cmd.isSaveNamespaceCommand) {
exitCode = saveNamespace(cmd.getSaveNamespaceArgs());
} else if (cmd.isShutdownAvatarCommand) {
shutdownAvatar(serviceName);
} else if (cmd.isSafemodeCommand) {
processSafeMode(cmd.safemodeArgs[0]);
} else {
exitCode = -1;
System.err.println("Unknown command");
printUsage();
}
} catch (IllegalArgumentException arge) {
exitCode = -1;
arge.printStackTrace();
printError(arge);
printUsage();
} catch (RemoteException e) {
//
// This is a error returned by avatarnode server. Print
// out the first line of the error mesage, ignore the stack trace.
exitCode = -1;
try {
String[] content;
content = e.getLocalizedMessage().split("\n");
System.err.println(content[0]);
} catch (Exception ex) {
System.err.println(ex.getLocalizedMessage());
}
} catch (IOException e) {
//
// IO exception encountered locally.
//
exitCode = -1;
printError(e);
} catch (Throwable re) {
exitCode = -1;
printError(re);
} finally {
}
if (exitCode == 0) {
LOG.info("Command was successful!");
}
return exitCode;
} }
|
public class class_name {
public static String convertSessionIdBytesToSessionId(byte[] pBytes, int sessionIdLength) {
// int numBits = pBytes.length * 8;
char[] chars = new char[sessionIdLength];
int byteNum = 0;
int bitNum = 0;
int pos = 0;
while (byteNum < pBytes.length && pos < sessionIdLength) {
int val = 0;
// Get from the byte
if (bitNum < 3) {
val = (pBytes[byteNum] >> (2 - bitNum)) & 0x3f;
}
// Get from this byte and the next
else {
val = pBytes[byteNum] << (6 - (8 - bitNum));
if (byteNum + 1 < pBytes.length) {
// LIDB2775.25 zOS int secondVal = pBytes[byteNum + 1] >> 8
// - (6 - (8 - bitNum)); /* @WS17270A */
int secondVal = (pBytes[byteNum + 1] & 0x000000ff) >> 8 - (6 - (8 - bitNum)); /*
* cmdzos
*
* @
* WS17270A
* and
*
* @
* MD16963C
*/
secondVal &= sSecondByteMasks[6 - (8 - bitNum)];
val |= secondVal;
}
val &= 0x3f;
}
// Assign the character
chars[pos++] = sBitChars[val];
// Increment to the next character
bitNum += 6;
if (bitNum >= 8) {
byteNum++;
bitNum -= 8;
}
}
return new String(chars);
} }
|
public class class_name {
public static String convertSessionIdBytesToSessionId(byte[] pBytes, int sessionIdLength) {
// int numBits = pBytes.length * 8;
char[] chars = new char[sessionIdLength];
int byteNum = 0;
int bitNum = 0;
int pos = 0;
while (byteNum < pBytes.length && pos < sessionIdLength) {
int val = 0;
// Get from the byte
if (bitNum < 3) {
val = (pBytes[byteNum] >> (2 - bitNum)) & 0x3f; // depends on control dependency: [if], data = [none]
}
// Get from this byte and the next
else {
val = pBytes[byteNum] << (6 - (8 - bitNum)); // depends on control dependency: [if], data = [none]
if (byteNum + 1 < pBytes.length) {
// LIDB2775.25 zOS int secondVal = pBytes[byteNum + 1] >> 8
// - (6 - (8 - bitNum)); /* @WS17270A */
int secondVal = (pBytes[byteNum + 1] & 0x000000ff) >> 8 - (6 - (8 - bitNum)); /*
* cmdzos
*
* @
* WS17270A
* and
*
* @
* MD16963C
*/
secondVal &= sSecondByteMasks[6 - (8 - bitNum)]; // depends on control dependency: [if], data = [none]
val |= secondVal; // depends on control dependency: [if], data = [none]
}
val &= 0x3f; // depends on control dependency: [if], data = [none]
}
// Assign the character
chars[pos++] = sBitChars[val]; // depends on control dependency: [while], data = [none]
// Increment to the next character
bitNum += 6; // depends on control dependency: [while], data = [none]
if (bitNum >= 8) {
byteNum++; // depends on control dependency: [if], data = [none]
bitNum -= 8; // depends on control dependency: [if], data = [none]
}
}
return new String(chars);
} }
|
public class class_name {
public void marshall(AutoScalingPolicyDescription autoScalingPolicyDescription, ProtocolMarshaller protocolMarshaller) {
if (autoScalingPolicyDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(autoScalingPolicyDescription.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(autoScalingPolicyDescription.getConstraints(), CONSTRAINTS_BINDING);
protocolMarshaller.marshall(autoScalingPolicyDescription.getRules(), RULES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(AutoScalingPolicyDescription autoScalingPolicyDescription, ProtocolMarshaller protocolMarshaller) {
if (autoScalingPolicyDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(autoScalingPolicyDescription.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(autoScalingPolicyDescription.getConstraints(), CONSTRAINTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(autoScalingPolicyDescription.getRules(), RULES_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 NoteAbstract getHighestNoteBewteen(MusicElement elmtBegin,
MusicElement elmtEnd) throws IllegalArgumentException {
NoteAbstract highestNote = null;
int highestNoteHeight = Note.REST;
if (elmtBegin instanceof NoteAbstract) {
if (!((elmtBegin instanceof Note) && ((Note) elmtBegin).isRest())) {
highestNote = (NoteAbstract) elmtBegin;
highestNoteHeight = (highestNote instanceof MultiNote) ? ((MultiNote) elmtBegin)
.getHighestNote().getMidiLikeHeight()
: ((Note) highestNote).getMidiLikeHeight();
}
}
int idxBegin = indexOf(elmtBegin);
int idxEnd = indexOf(elmtEnd);
if (idxBegin == -1)
throw new IllegalArgumentException("Note " + elmtBegin
+ " hasn't been found in tune");
if (idxEnd == -1)
throw new IllegalArgumentException("Note " + elmtEnd
+ " hasn't been found in tune");
if (idxBegin > idxEnd)
throw new IllegalArgumentException("Note " + elmtBegin
+ " is located after " + elmtEnd + " in the score");
MusicElement currentScoreEl;
int currentNoteHeight;
for (int i = idxBegin + 1; i <= idxEnd; i++) {
currentScoreEl = (MusicElement) elementAt(i);
if (currentScoreEl instanceof NoteAbstract) {
currentNoteHeight = (currentScoreEl instanceof MultiNote) ? ((MultiNote) currentScoreEl)
.getHighestNote().getMidiLikeHeight()
: ((Note) currentScoreEl).getMidiLikeHeight();
if ((currentNoteHeight != Note.REST)
&& ((highestNoteHeight == Note.REST) || (currentNoteHeight > highestNoteHeight))) {
highestNoteHeight = currentNoteHeight;
highestNote = (NoteAbstract) currentScoreEl;
}
}
}
return highestNote;
} }
|
public class class_name {
public NoteAbstract getHighestNoteBewteen(MusicElement elmtBegin,
MusicElement elmtEnd) throws IllegalArgumentException {
NoteAbstract highestNote = null;
int highestNoteHeight = Note.REST;
if (elmtBegin instanceof NoteAbstract) {
if (!((elmtBegin instanceof Note) && ((Note) elmtBegin).isRest())) {
highestNote = (NoteAbstract) elmtBegin;
// depends on control dependency: [if], data = [none]
highestNoteHeight = (highestNote instanceof MultiNote) ? ((MultiNote) elmtBegin)
.getHighestNote().getMidiLikeHeight()
: ((Note) highestNote).getMidiLikeHeight();
// depends on control dependency: [if], data = [none]
}
}
int idxBegin = indexOf(elmtBegin);
int idxEnd = indexOf(elmtEnd);
if (idxBegin == -1)
throw new IllegalArgumentException("Note " + elmtBegin
+ " hasn't been found in tune");
if (idxEnd == -1)
throw new IllegalArgumentException("Note " + elmtEnd
+ " hasn't been found in tune");
if (idxBegin > idxEnd)
throw new IllegalArgumentException("Note " + elmtBegin
+ " is located after " + elmtEnd + " in the score");
MusicElement currentScoreEl;
int currentNoteHeight;
for (int i = idxBegin + 1; i <= idxEnd; i++) {
currentScoreEl = (MusicElement) elementAt(i);
if (currentScoreEl instanceof NoteAbstract) {
currentNoteHeight = (currentScoreEl instanceof MultiNote) ? ((MultiNote) currentScoreEl)
.getHighestNote().getMidiLikeHeight()
: ((Note) currentScoreEl).getMidiLikeHeight();
if ((currentNoteHeight != Note.REST)
&& ((highestNoteHeight == Note.REST) || (currentNoteHeight > highestNoteHeight))) {
highestNoteHeight = currentNoteHeight;
// depends on control dependency: [if], data = [none]
highestNote = (NoteAbstract) currentScoreEl;
// depends on control dependency: [if], data = [none]
}
}
}
return highestNote;
} }
|
public class class_name {
public PointExpression<Point> pointOnSurface() {
if (pointOnSurface == null) {
pointOnSurface = GeometryExpressions.pointOperation(SpatialOps.POINT_ON_SURFACE, mixin);
}
return pointOnSurface;
} }
|
public class class_name {
public PointExpression<Point> pointOnSurface() {
if (pointOnSurface == null) {
pointOnSurface = GeometryExpressions.pointOperation(SpatialOps.POINT_ON_SURFACE, mixin); // depends on control dependency: [if], data = [none]
}
return pointOnSurface;
} }
|
public class class_name {
@Nullable
static <T> T removeFirstMatching(Iterable<T> removeFrom, Predicate<? super T> predicate) {
checkNotNull(predicate);
Iterator<T> iterator = removeFrom.iterator();
while (iterator.hasNext()) {
T next = iterator.next();
if (predicate.apply(next)) {
iterator.remove();
return next;
}
}
return null;
} }
|
public class class_name {
@Nullable
static <T> T removeFirstMatching(Iterable<T> removeFrom, Predicate<? super T> predicate) {
checkNotNull(predicate);
Iterator<T> iterator = removeFrom.iterator();
while (iterator.hasNext()) {
T next = iterator.next();
if (predicate.apply(next)) {
iterator.remove(); // depends on control dependency: [if], data = [none]
return next; // depends on control dependency: [if], data = [none]
}
}
return null;
} }
|
public class class_name {
private String limitString(int rowIndex){
if(params.length != 2){
throw new IllegalArgumentException("Wrong number of Parameters for limit string expression");
}
final RecordList.Record currentRecord = recordList.getRecords().get(rowIndex);
final String field = currentRecord.getValueByFieldName(params[0]);
int limit = Integer.parseInt(params[1]);
if (field.isEmpty() || field.length() < limit){
return field;
}
String result = field.substring(0, limit) + "...";
return result;
} }
|
public class class_name {
private String limitString(int rowIndex){
if(params.length != 2){
throw new IllegalArgumentException("Wrong number of Parameters for limit string expression");
}
final RecordList.Record currentRecord = recordList.getRecords().get(rowIndex);
final String field = currentRecord.getValueByFieldName(params[0]);
int limit = Integer.parseInt(params[1]);
if (field.isEmpty() || field.length() < limit){
return field; // depends on control dependency: [if], data = [none]
}
String result = field.substring(0, limit) + "...";
return result;
} }
|
public class class_name {
public void setChecks(java.util.Collection<TrustedAdvisorCheckDescription> checks) {
if (checks == null) {
this.checks = null;
return;
}
this.checks = new com.amazonaws.internal.SdkInternalList<TrustedAdvisorCheckDescription>(checks);
} }
|
public class class_name {
public void setChecks(java.util.Collection<TrustedAdvisorCheckDescription> checks) {
if (checks == null) {
this.checks = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.checks = new com.amazonaws.internal.SdkInternalList<TrustedAdvisorCheckDescription>(checks);
} }
|
public class class_name {
public static double root(double eps, int maxIterations, double a, double b, Function1D f)
{
double x1 = a;
double x2 = b;
double fx1 = f.f(x1);
double fx2 = f.f(x2);
double halfEps = eps*0.5;
if(fx1* fx2 >= 0)
throw new ArithmeticException("The given interval does not appear to bracket the root");
double dif = 1;//Measure the change interface values
while( abs(x1-x2) > eps && maxIterations-->0)
{
double x3 = (x1+x2)*0.5;
double fx3 = f.f(x3);
double x4 = x3+(x3-x1)*signum(fx1-fx2)*fx3/sqrt(fx3*fx3-fx1*fx2);
double fx4 = f.f(x4);
if(fx3 * fx4 < 0)
{
x1 = x3;
fx1 = fx3;
x2 = x4;
fx2 = fx4;
}
else if(fx1 * fx4 < 0)
{
dif = abs(x4 - x2);
if(dif <= halfEps)//WE are no longer updating, return the value
return x4;
x2 = x4;
fx2 = fx4;
}
else
{
dif = abs(x4 - x1);
if(dif <= halfEps)//WE are no longer updating, return the value
return x4;
x1 = x4;
fx1 = fx4;
}
}
return x2;
} }
|
public class class_name {
public static double root(double eps, int maxIterations, double a, double b, Function1D f)
{
double x1 = a;
double x2 = b;
double fx1 = f.f(x1);
double fx2 = f.f(x2);
double halfEps = eps*0.5;
if(fx1* fx2 >= 0)
throw new ArithmeticException("The given interval does not appear to bracket the root");
double dif = 1;//Measure the change interface values
while( abs(x1-x2) > eps && maxIterations-->0)
{
double x3 = (x1+x2)*0.5;
double fx3 = f.f(x3);
double x4 = x3+(x3-x1)*signum(fx1-fx2)*fx3/sqrt(fx3*fx3-fx1*fx2);
double fx4 = f.f(x4);
if(fx3 * fx4 < 0)
{
x1 = x3; // depends on control dependency: [if], data = [none]
fx1 = fx3; // depends on control dependency: [if], data = [none]
x2 = x4; // depends on control dependency: [if], data = [none]
fx2 = fx4; // depends on control dependency: [if], data = [none]
}
else if(fx1 * fx4 < 0)
{
dif = abs(x4 - x2); // depends on control dependency: [if], data = [none]
if(dif <= halfEps)//WE are no longer updating, return the value
return x4;
x2 = x4; // depends on control dependency: [if], data = [none]
fx2 = fx4; // depends on control dependency: [if], data = [none]
}
else
{
dif = abs(x4 - x1); // depends on control dependency: [if], data = [none]
if(dif <= halfEps)//WE are no longer updating, return the value
return x4;
x1 = x4; // depends on control dependency: [if], data = [none]
fx1 = fx4; // depends on control dependency: [if], data = [none]
}
}
return x2;
} }
|
public class class_name {
public DBObject getObject(TableDefinition tableDef, String objID) {
checkServiceState();
String storeName = objectsStoreName(tableDef);
Tenant tenant = Tenant.getTenant(tableDef);
Iterator<DColumn> colIter = DBService.instance(tenant).getAllColumns(storeName, objID).iterator();
if (!colIter.hasNext()) {
return null;
}
DBObject dbObj = createObject(tableDef, objID, colIter);
addShardedLinkValues(tableDef, dbObj);
return dbObj;
} }
|
public class class_name {
public DBObject getObject(TableDefinition tableDef, String objID) {
checkServiceState();
String storeName = objectsStoreName(tableDef);
Tenant tenant = Tenant.getTenant(tableDef);
Iterator<DColumn> colIter = DBService.instance(tenant).getAllColumns(storeName, objID).iterator();
if (!colIter.hasNext()) {
return null;
// depends on control dependency: [if], data = [none]
}
DBObject dbObj = createObject(tableDef, objID, colIter);
addShardedLinkValues(tableDef, dbObj);
return dbObj;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T> Optional<T> invoke(Object target) {
Object resolvedTarget = resolveTarget(target);
Method method = getMethod();
try {
return Optional.ofNullable((T) method.invoke(resolvedTarget, getArguments()));
}
catch (IllegalAccessException | InvocationTargetException e) {
throw new MethodInvocationException(String.format("Failed to invoke method [%1$s] on target object [%2$s]",
method.getName(), resolvedTarget), e);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T> Optional<T> invoke(Object target) {
Object resolvedTarget = resolveTarget(target);
Method method = getMethod();
try {
return Optional.ofNullable((T) method.invoke(resolvedTarget, getArguments())); // depends on control dependency: [try], data = [none]
}
catch (IllegalAccessException | InvocationTargetException e) {
throw new MethodInvocationException(String.format("Failed to invoke method [%1$s] on target object [%2$s]",
method.getName(), resolvedTarget), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private static int merging3_2(int[] buffer, int x) {
int cnt1;
int cnt2;
int cnt = 0;
for (int i = x; i < x + 48; i += 6) {
cnt1 = buffer[i + 1];
cnt2 = buffer[i + 3];
final int w = buffer[i + 5];
cnt1 = cnt1 - ((cnt1 >>> 1) & 0x55555555) + (w & 0x55555555);
cnt2 = cnt2 - ((cnt2 >>> 1) & 0x55555555) + ((w >>> 1) & 0x55555555);
cnt1 = (cnt1 & 0x33333333) + ((cnt1 >>> 2) & 0x33333333);
cnt1 += (cnt2 & 0x33333333) + ((cnt2 >>> 2) & 0x33333333);
cnt += (cnt1 & 0x0F0F0F0F) + ((cnt1 >>> 4) & 0x0F0F0F0F);
}
cnt = (cnt & 0x00FF00FF) + ((cnt >>> 8) & 0x00FF00FF);
cnt += cnt >>> 16;
return cnt & 0x00000FFFF;
} }
|
public class class_name {
private static int merging3_2(int[] buffer, int x) {
int cnt1;
int cnt2;
int cnt = 0;
for (int i = x; i < x + 48; i += 6) {
cnt1 = buffer[i + 1];
// depends on control dependency: [for], data = [i]
cnt2 = buffer[i + 3];
// depends on control dependency: [for], data = [i]
final int w = buffer[i + 5];
cnt1 = cnt1 - ((cnt1 >>> 1) & 0x55555555) + (w & 0x55555555);
// depends on control dependency: [for], data = [none]
cnt2 = cnt2 - ((cnt2 >>> 1) & 0x55555555) + ((w >>> 1) & 0x55555555);
// depends on control dependency: [for], data = [none]
cnt1 = (cnt1 & 0x33333333) + ((cnt1 >>> 2) & 0x33333333);
// depends on control dependency: [for], data = [none]
cnt1 += (cnt2 & 0x33333333) + ((cnt2 >>> 2) & 0x33333333);
// depends on control dependency: [for], data = [none]
cnt += (cnt1 & 0x0F0F0F0F) + ((cnt1 >>> 4) & 0x0F0F0F0F);
// depends on control dependency: [for], data = [none]
}
cnt = (cnt & 0x00FF00FF) + ((cnt >>> 8) & 0x00FF00FF);
cnt += cnt >>> 16;
return cnt & 0x00000FFFF;
} }
|
public class class_name {
@Override
public CommerceAccountUserRel fetchByCommerceAccountId_Last(
long commerceAccountId,
OrderByComparator<CommerceAccountUserRel> orderByComparator) {
int count = countByCommerceAccountId(commerceAccountId);
if (count == 0) {
return null;
}
List<CommerceAccountUserRel> list = findByCommerceAccountId(commerceAccountId,
count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} }
|
public class class_name {
@Override
public CommerceAccountUserRel fetchByCommerceAccountId_Last(
long commerceAccountId,
OrderByComparator<CommerceAccountUserRel> orderByComparator) {
int count = countByCommerceAccountId(commerceAccountId);
if (count == 0) {
return null; // depends on control dependency: [if], data = [none]
}
List<CommerceAccountUserRel> list = findByCommerceAccountId(commerceAccountId,
count - 1, count, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
@SuppressWarnings("CompareToUsesNonFinalVariable")
@Override
public int compareTo(IntSet o)
{
// empty set cases
if (this.isEmpty() && o.isEmpty()) {
return 0;
}
if (this.isEmpty()) {
return -1;
}
if (o.isEmpty()) {
return 1;
}
final ConciseSet other = convert(o);
// the word at the end must be the same
int res = Integer.compare(this.last, other.last);
if (res != 0) {
return res;
}
// scan words from MSB to LSB
int thisIndex = this.lastWordIndex;
int otherIndex = other.lastWordIndex;
int thisWord = this.words[thisIndex];
int otherWord = other.words[otherIndex];
while (thisIndex >= 0 && otherIndex >= 0) {
if (!isLiteral(thisWord)) {
if (!isLiteral(otherWord)) {
// compare two sequences
// note that they are made up of at least two blocks, and we
// start comparing from the end, that is at blocks with no
// (un)set bits
if (isZeroSequence(thisWord)) {
if (isOneSequence(otherWord)) {
// zeros < ones
return -1;
}
// compare two sequences of zeros
res = Integer.compare(getSequenceCount(otherWord), getSequenceCount(thisWord));
if (res != 0) {
return res;
}
} else {
if (isZeroSequence(otherWord)) {
// ones > zeros
return 1;
}
// compare two sequences of ones
res = Integer.compare(getSequenceCount(thisWord), getSequenceCount(otherWord));
if (res != 0) {
return res;
}
}
// if the sequences are the same (both zeros or both ones)
// and have the same length, compare the first blocks in the
// next loop since such blocks might contain (un)set bits
thisWord = getLiteral(thisWord);
otherWord = getLiteral(otherWord);
} else {
// zeros < literal --> -1
// ones > literal --> +1
// note that the sequence is made up of at least two blocks,
// and we start comparing from the end, that is at a block
// with no (un)set bits
if (isZeroSequence(thisWord)) {
if (otherWord != ConciseSetUtils.ALL_ZEROS_LITERAL) {
return -1;
}
} else {
if (otherWord != ConciseSetUtils.ALL_ONES_LITERAL) {
return 1;
}
}
if (getSequenceCount(thisWord) == 1) {
thisWord = getLiteral(thisWord);
} else {
thisWord--;
}
if (--otherIndex >= 0) {
otherWord = other.words[otherIndex];
}
}
} else if (!isLiteral(otherWord)) {
// literal > zeros --> +1
// literal < ones --> -1
// note that the sequence is made up of at least two blocks,
// and we start comparing from the end, that is at a block
// with no (un)set bits
if (isZeroSequence(otherWord)) {
if (thisWord != ConciseSetUtils.ALL_ZEROS_LITERAL) {
return 1;
}
} else {
if (thisWord != ConciseSetUtils.ALL_ONES_LITERAL) {
return -1;
}
}
if (--thisIndex >= 0) {
thisWord = this.words[thisIndex];
}
if (getSequenceCount(otherWord) == 1) {
otherWord = getLiteral(otherWord);
} else {
otherWord--;
}
} else {
// equals compare(getLiteralBits(thisWord), getLiteralBits(otherWord))
res = Integer.compare(thisWord, otherWord);
if (res != 0) {
return res;
}
if (--thisIndex >= 0) {
thisWord = this.words[thisIndex];
}
if (--otherIndex >= 0) {
otherWord = other.words[otherIndex];
}
}
}
return thisIndex >= 0 ? 1 : (otherIndex >= 0 ? -1 : 0);
} }
|
public class class_name {
@SuppressWarnings("CompareToUsesNonFinalVariable")
@Override
public int compareTo(IntSet o)
{
// empty set cases
if (this.isEmpty() && o.isEmpty()) {
return 0;
// depends on control dependency: [if], data = [none]
}
if (this.isEmpty()) {
return -1;
// depends on control dependency: [if], data = [none]
}
if (o.isEmpty()) {
return 1;
// depends on control dependency: [if], data = [none]
}
final ConciseSet other = convert(o);
// the word at the end must be the same
int res = Integer.compare(this.last, other.last);
if (res != 0) {
return res;
// depends on control dependency: [if], data = [none]
}
// scan words from MSB to LSB
int thisIndex = this.lastWordIndex;
int otherIndex = other.lastWordIndex;
int thisWord = this.words[thisIndex];
int otherWord = other.words[otherIndex];
while (thisIndex >= 0 && otherIndex >= 0) {
if (!isLiteral(thisWord)) {
if (!isLiteral(otherWord)) {
// compare two sequences
// note that they are made up of at least two blocks, and we
// start comparing from the end, that is at blocks with no
// (un)set bits
if (isZeroSequence(thisWord)) {
if (isOneSequence(otherWord)) {
// zeros < ones
return -1;
// depends on control dependency: [if], data = [none]
}
// compare two sequences of zeros
res = Integer.compare(getSequenceCount(otherWord), getSequenceCount(thisWord));
// depends on control dependency: [if], data = [none]
if (res != 0) {
return res;
// depends on control dependency: [if], data = [none]
}
} else {
if (isZeroSequence(otherWord)) {
// ones > zeros
return 1;
// depends on control dependency: [if], data = [none]
}
// compare two sequences of ones
res = Integer.compare(getSequenceCount(thisWord), getSequenceCount(otherWord));
// depends on control dependency: [if], data = [none]
if (res != 0) {
return res;
// depends on control dependency: [if], data = [none]
}
}
// if the sequences are the same (both zeros or both ones)
// and have the same length, compare the first blocks in the
// next loop since such blocks might contain (un)set bits
thisWord = getLiteral(thisWord);
// depends on control dependency: [if], data = [none]
otherWord = getLiteral(otherWord);
// depends on control dependency: [if], data = [none]
} else {
// zeros < literal --> -1
// ones > literal --> +1
// note that the sequence is made up of at least two blocks,
// and we start comparing from the end, that is at a block
// with no (un)set bits
if (isZeroSequence(thisWord)) {
if (otherWord != ConciseSetUtils.ALL_ZEROS_LITERAL) {
return -1;
// depends on control dependency: [if], data = [none]
}
} else {
if (otherWord != ConciseSetUtils.ALL_ONES_LITERAL) {
return 1;
// depends on control dependency: [if], data = [none]
}
}
if (getSequenceCount(thisWord) == 1) {
thisWord = getLiteral(thisWord);
// depends on control dependency: [if], data = [none]
} else {
thisWord--;
// depends on control dependency: [if], data = [none]
}
if (--otherIndex >= 0) {
otherWord = other.words[otherIndex];
// depends on control dependency: [if], data = [none]
}
}
} else if (!isLiteral(otherWord)) {
// literal > zeros --> +1
// literal < ones --> -1
// note that the sequence is made up of at least two blocks,
// and we start comparing from the end, that is at a block
// with no (un)set bits
if (isZeroSequence(otherWord)) {
if (thisWord != ConciseSetUtils.ALL_ZEROS_LITERAL) {
return 1;
// depends on control dependency: [if], data = [none]
}
} else {
if (thisWord != ConciseSetUtils.ALL_ONES_LITERAL) {
return -1;
// depends on control dependency: [if], data = [none]
}
}
if (--thisIndex >= 0) {
thisWord = this.words[thisIndex];
// depends on control dependency: [if], data = [none]
}
if (getSequenceCount(otherWord) == 1) {
otherWord = getLiteral(otherWord);
// depends on control dependency: [if], data = [none]
} else {
otherWord--;
// depends on control dependency: [if], data = [none]
}
} else {
// equals compare(getLiteralBits(thisWord), getLiteralBits(otherWord))
res = Integer.compare(thisWord, otherWord);
// depends on control dependency: [if], data = [none]
if (res != 0) {
return res;
// depends on control dependency: [if], data = [none]
}
if (--thisIndex >= 0) {
thisWord = this.words[thisIndex];
// depends on control dependency: [if], data = [none]
}
if (--otherIndex >= 0) {
otherWord = other.words[otherIndex];
// depends on control dependency: [if], data = [none]
}
}
}
return thisIndex >= 0 ? 1 : (otherIndex >= 0 ? -1 : 0);
} }
|
public class class_name {
protected void writeClassInfo(ClassInfo info) {
Node currentNode = this.currentNode;
Element tmp = doc.createElementNS(XML_URI, "class");
currentNode.appendChild(tmp);
this.currentNode = tmp;
addAccessFlags(info);
if (info.getName() != null)
tmp.setAttribute( "name",
info.getName());
if (info.getSignature() != null)
tmp.setAttribute( "signature",
info.getSignature());
if (info.getSupername() != null)
tmp.setAttribute( "superclass",
info.getSupername());
String[] interfaces = info.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
Element iface = doc.createElementNS(XML_URI, "implements");
tmp.appendChild(iface);
iface.setAttribute( "name",
interfaces[i]);
}
this.currentNode = currentNode;
} }
|
public class class_name {
protected void writeClassInfo(ClassInfo info) {
Node currentNode = this.currentNode;
Element tmp = doc.createElementNS(XML_URI, "class");
currentNode.appendChild(tmp);
this.currentNode = tmp;
addAccessFlags(info);
if (info.getName() != null)
tmp.setAttribute( "name",
info.getName());
if (info.getSignature() != null)
tmp.setAttribute( "signature",
info.getSignature());
if (info.getSupername() != null)
tmp.setAttribute( "superclass",
info.getSupername());
String[] interfaces = info.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
Element iface = doc.createElementNS(XML_URI, "implements");
tmp.appendChild(iface); // depends on control dependency: [for], data = [none]
iface.setAttribute( "name",
interfaces[i]); // depends on control dependency: [for], data = [none]
}
this.currentNode = currentNode;
} }
|
public class class_name {
public static List<? extends IResource> chain(IResource resource)
{
List<IResource> chain = new ArrayList<IResource>();
while (true)
{
chain.add(resource);
if (!resource.hasParent())
break;
resource = resource.getParent();
}
return chain;
} }
|
public class class_name {
public static List<? extends IResource> chain(IResource resource)
{
List<IResource> chain = new ArrayList<IResource>();
while (true)
{
chain.add(resource); // depends on control dependency: [while], data = [none]
if (!resource.hasParent())
break;
resource = resource.getParent(); // depends on control dependency: [while], data = [none]
}
return chain;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override
public <E> int batchInsert(final Class<E> entityType, final Stream<E> entities,
final InsertsCondition<? super E> condition) {
@SuppressWarnings("rawtypes")
EntityHandler handler = this.getEntityHandler();
if (!handler.getEntityType().isAssignableFrom(entityType)) {
throw new IllegalArgumentException("Entity type not supported");
}
try {
TableMetadata metadata = handler.getMetadata(this.transactionManager, entityType);
SqlContext context = handler.createBatchInsertContext(this, metadata, entityType);
context.setSqlKind(SqlKind.BATCH_INSERT);
// IDアノテーションが付与されたカラム情報を取得する
MappingColumn[] idColumns = MappingUtils.getIdMappingColumns(entityType);
setGeneratedKeyColumns(context, idColumns, metadata);
int count = 0;
List<E> entityList = new ArrayList<>();
for (Iterator<E> iterator = entities.iterator(); iterator.hasNext();) {
E entity = iterator.next();
if (!entityType.isInstance(entity)) {
throw new IllegalArgumentException("Entity types do not match");
}
entityList.add(entity);
handler.setInsertParams(context, entity);
context.addBatch();
if (condition.test(context, context.batchCount(), entity)) {
count += Arrays.stream(doBatchInsert(context, handler, entityList, idColumns)).sum();
entityList.clear();
}
}
return count + (context.batchCount() != 0
? Arrays.stream(doBatchInsert(context, handler, entityList, idColumns)).sum()
: 0);
} catch (SQLException e) {
throw new EntitySqlRuntimeException(SqlKind.BATCH_INSERT, e);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
@Override
public <E> int batchInsert(final Class<E> entityType, final Stream<E> entities,
final InsertsCondition<? super E> condition) {
@SuppressWarnings("rawtypes")
EntityHandler handler = this.getEntityHandler();
if (!handler.getEntityType().isAssignableFrom(entityType)) {
throw new IllegalArgumentException("Entity type not supported");
}
try {
TableMetadata metadata = handler.getMetadata(this.transactionManager, entityType);
SqlContext context = handler.createBatchInsertContext(this, metadata, entityType);
context.setSqlKind(SqlKind.BATCH_INSERT); // depends on control dependency: [try], data = [none]
// IDアノテーションが付与されたカラム情報を取得する
MappingColumn[] idColumns = MappingUtils.getIdMappingColumns(entityType);
setGeneratedKeyColumns(context, idColumns, metadata); // depends on control dependency: [try], data = [none]
int count = 0;
List<E> entityList = new ArrayList<>();
for (Iterator<E> iterator = entities.iterator(); iterator.hasNext();) {
E entity = iterator.next();
if (!entityType.isInstance(entity)) {
throw new IllegalArgumentException("Entity types do not match");
}
entityList.add(entity); // depends on control dependency: [for], data = [none]
handler.setInsertParams(context, entity); // depends on control dependency: [for], data = [none]
context.addBatch(); // depends on control dependency: [for], data = [none]
if (condition.test(context, context.batchCount(), entity)) {
count += Arrays.stream(doBatchInsert(context, handler, entityList, idColumns)).sum(); // depends on control dependency: [if], data = [none]
entityList.clear(); // depends on control dependency: [if], data = [none]
}
}
return count + (context.batchCount() != 0
? Arrays.stream(doBatchInsert(context, handler, entityList, idColumns)).sum()
: 0); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new EntitySqlRuntimeException(SqlKind.BATCH_INSERT, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> listFromComputeNodeWithServiceResponseAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions) {
return listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null;
if (fileListFromComputeNodeOptions != null) {
fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions();
fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId());
fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId());
fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate());
}
return Observable.just(page).concatWith(listFromComputeNodeNextWithServiceResponseAsync(nextPageLink, fileListFromComputeNodeNextOptions));
}
});
} }
|
public class class_name {
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> listFromComputeNodeWithServiceResponseAsync(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions) {
return listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions)
.concatMap(new Func1<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>, Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders>> call(ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null;
if (fileListFromComputeNodeOptions != null) {
fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions(); // depends on control dependency: [if], data = [none]
fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId()); // depends on control dependency: [if], data = [(fileListFromComputeNodeOptions]
fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId()); // depends on control dependency: [if], data = [(fileListFromComputeNodeOptions]
fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate()); // depends on control dependency: [if], data = [(fileListFromComputeNodeOptions]
}
return Observable.just(page).concatWith(listFromComputeNodeNextWithServiceResponseAsync(nextPageLink, fileListFromComputeNodeNextOptions));
}
});
} }
|
public class class_name {
public static final void shift(Structure structure, Atom a ){
AtomIterator iter = new AtomIterator(structure) ;
while (iter.hasNext() ) {
Atom atom = null ;
atom = iter.next() ;
Atom natom = add(atom,a);
double x = natom.getX();
double y = natom.getY() ;
double z = natom.getZ();
atom.setX(x);
atom.setY(y);
atom.setZ(z);
}
} }
|
public class class_name {
public static final void shift(Structure structure, Atom a ){
AtomIterator iter = new AtomIterator(structure) ;
while (iter.hasNext() ) {
Atom atom = null ;
atom = iter.next() ; // depends on control dependency: [while], data = [none]
Atom natom = add(atom,a);
double x = natom.getX();
double y = natom.getY() ;
double z = natom.getZ();
atom.setX(x); // depends on control dependency: [while], data = [none]
atom.setY(y); // depends on control dependency: [while], data = [none]
atom.setZ(z); // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
public void setDataPoints(java.util.Collection<DataPoint> dataPoints) {
if (dataPoints == null) {
this.dataPoints = null;
return;
}
this.dataPoints = new java.util.ArrayList<DataPoint>(dataPoints);
} }
|
public class class_name {
public void setDataPoints(java.util.Collection<DataPoint> dataPoints) {
if (dataPoints == null) {
this.dataPoints = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.dataPoints = new java.util.ArrayList<DataPoint>(dataPoints);
} }
|
public class class_name {
public String getName()
{
if ( name == null )
{
name = MessageFormat.format( "{0}-{1}{2}.{3}", new Object[]{ artifactId, getTimestampVersion(),
( classifier == null ? "" : "-" + classifier ), type } );
}
return name;
} }
|
public class class_name {
public String getName()
{
if ( name == null )
{
name = MessageFormat.format( "{0}-{1}{2}.{3}", new Object[]{ artifactId, getTimestampVersion(),
( classifier == null ? "" : "-" + classifier ), type } ); // depends on control dependency: [if], data = [none]
}
return name;
} }
|
public class class_name {
public ServiceCall<LanguageModel> createLanguageModel(CreateLanguageModelOptions createLanguageModelOptions) {
Validator.notNull(createLanguageModelOptions, "createLanguageModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "createLanguageModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("name", createLanguageModelOptions.name());
contentJson.addProperty("base_model_name", createLanguageModelOptions.baseModelName());
if (createLanguageModelOptions.dialect() != null) {
contentJson.addProperty("dialect", createLanguageModelOptions.dialect());
}
if (createLanguageModelOptions.description() != null) {
contentJson.addProperty("description", createLanguageModelOptions.description());
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LanguageModel.class));
} }
|
public class class_name {
public ServiceCall<LanguageModel> createLanguageModel(CreateLanguageModelOptions createLanguageModelOptions) {
Validator.notNull(createLanguageModelOptions, "createLanguageModelOptions cannot be null");
String[] pathSegments = { "v1/customizations" };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "createLanguageModel");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header]
}
builder.header("Accept", "application/json");
final JsonObject contentJson = new JsonObject();
contentJson.addProperty("name", createLanguageModelOptions.name());
contentJson.addProperty("base_model_name", createLanguageModelOptions.baseModelName());
if (createLanguageModelOptions.dialect() != null) {
contentJson.addProperty("dialect", createLanguageModelOptions.dialect()); // depends on control dependency: [if], data = [none]
}
if (createLanguageModelOptions.description() != null) {
contentJson.addProperty("description", createLanguageModelOptions.description()); // depends on control dependency: [if], data = [none]
}
builder.bodyJson(contentJson);
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LanguageModel.class));
} }
|
public class class_name {
public Vector mlsd(String path)
throws ServerException, ClientException, IOException {
ByteArrayDataSink sink = new ByteArrayDataSink();
mlsd(path, sink);
ByteArrayOutputStream received = sink.getData();
// transfer done. Data is in received stream.
// convert it to a vector.
BufferedReader reader =
new BufferedReader(new StringReader(received.toString()));
Vector fileList = new Vector();
MlsxEntry entry = null;
String line = null;
while ((line = reader.readLine()) != null) {
if (logger.isDebugEnabled()) {
logger.debug("line ->" + line);
}
try {
entry = new MlsxEntry(line);
} catch (FTPException e) {
ClientException ce =
new ClientException(
ClientException.UNSPECIFIED,
"Could not create MlsxEntry");
ce.setRootCause(e);
throw ce;
}
fileList.addElement(entry);
}
return fileList;
} }
|
public class class_name {
public Vector mlsd(String path)
throws ServerException, ClientException, IOException {
ByteArrayDataSink sink = new ByteArrayDataSink();
mlsd(path, sink);
ByteArrayOutputStream received = sink.getData();
// transfer done. Data is in received stream.
// convert it to a vector.
BufferedReader reader =
new BufferedReader(new StringReader(received.toString()));
Vector fileList = new Vector();
MlsxEntry entry = null;
String line = null;
while ((line = reader.readLine()) != null) {
if (logger.isDebugEnabled()) {
logger.debug("line ->" + line); // depends on control dependency: [if], data = [none]
}
try {
entry = new MlsxEntry(line); // depends on control dependency: [try], data = [none]
} catch (FTPException e) {
ClientException ce =
new ClientException(
ClientException.UNSPECIFIED,
"Could not create MlsxEntry");
ce.setRootCause(e);
throw ce;
} // depends on control dependency: [catch], data = [none]
fileList.addElement(entry);
}
return fileList;
} }
|
public class class_name {
public static boolean classAllowed(String className) {
for (String name: BLACK_LIST) {
if (className.startsWith(name)) {
return false;
}
}
return true;
} }
|
public class class_name {
public static boolean classAllowed(String className) {
for (String name: BLACK_LIST) {
if (className.startsWith(name)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
synchronized Spanner getSpanner(String projectId, Credentials credentials, String host) {
SpannerKey key = SpannerKey.of(host, projectId, credentials);
Spanner spanner = spanners.get(key);
if (spanner == null) {
spanner = createSpanner(key);
spanners.put(key, spanner);
}
return spanner;
} }
|
public class class_name {
synchronized Spanner getSpanner(String projectId, Credentials credentials, String host) {
SpannerKey key = SpannerKey.of(host, projectId, credentials);
Spanner spanner = spanners.get(key);
if (spanner == null) {
spanner = createSpanner(key);
// depends on control dependency: [if], data = [none]
spanners.put(key, spanner);
// depends on control dependency: [if], data = [none]
}
return spanner;
} }
|
public class class_name {
final Mappings mappingsOf(final Class<?> clazz) {
if (!mappings.containsKey(clazz)) {
mappings.putIfAbsent(clazz, new Mappings(clazz));
}
return mappings.get(clazz);
} }
|
public class class_name {
final Mappings mappingsOf(final Class<?> clazz) {
if (!mappings.containsKey(clazz)) {
mappings.putIfAbsent(clazz, new Mappings(clazz)); // depends on control dependency: [if], data = [none]
}
return mappings.get(clazz);
} }
|
public class class_name {
@Override
public boolean modelExampleClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
List<InnerClass> innerClasses = topLevelClass.getInnerClasses();
for (int i = 0; i < innerClasses.size(); i++) {
InnerClass innerClass = innerClasses.get(i);
if ("Criteria".equals(innerClass.getType().getShortName())) {
// 工厂方法
addFactoryMethodToCriteria(topLevelClass, innerClass, introspectedTable);
// andIf
if (this.enableAndIf) {
addAndIfMethodToCriteria(topLevelClass, innerClass, introspectedTable);
}
// when
addWhenToCriteria(topLevelClass, innerClass, introspectedTable);
} else if ("GeneratedCriteria".equals(innerClass.getType().getShortName())) {
// column 方法
if (this.enableColumnOperate) {
addColumnMethodToCriteria(topLevelClass, innerClass, introspectedTable);
}
}
}
List<Method> methods = topLevelClass.getMethods();
for (Method method : methods) {
if (!"createCriteriaInternal".equals(method.getName())) {
continue;
} else {
method.getBodyLines().set(0, "Criteria criteria = new Criteria(this);");
logger.debug("itfsw(Example增强插件):" + topLevelClass.getType().getShortName() + "修改createCriteriaInternal方法,修改构造Criteria时传入Example对象");
}
}
// orderBy方法
this.addOrderByMethodToExample(topLevelClass, introspectedTable);
// createCriteria 静态方法
this.addStaticCreateCriteriaMethodToExample(topLevelClass, introspectedTable);
// when
addWhenToExample(topLevelClass, introspectedTable);
return true;
} }
|
public class class_name {
@Override
public boolean modelExampleClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
List<InnerClass> innerClasses = topLevelClass.getInnerClasses();
for (int i = 0; i < innerClasses.size(); i++) {
InnerClass innerClass = innerClasses.get(i);
if ("Criteria".equals(innerClass.getType().getShortName())) {
// 工厂方法
addFactoryMethodToCriteria(topLevelClass, innerClass, introspectedTable); // depends on control dependency: [if], data = [none]
// andIf
if (this.enableAndIf) {
addAndIfMethodToCriteria(topLevelClass, innerClass, introspectedTable); // depends on control dependency: [if], data = [none]
}
// when
addWhenToCriteria(topLevelClass, innerClass, introspectedTable); // depends on control dependency: [if], data = [none]
} else if ("GeneratedCriteria".equals(innerClass.getType().getShortName())) {
// column 方法
if (this.enableColumnOperate) {
addColumnMethodToCriteria(topLevelClass, innerClass, introspectedTable); // depends on control dependency: [if], data = [none]
}
}
}
List<Method> methods = topLevelClass.getMethods();
for (Method method : methods) {
if (!"createCriteriaInternal".equals(method.getName())) {
continue;
} else {
method.getBodyLines().set(0, "Criteria criteria = new Criteria(this);"); // depends on control dependency: [if], data = [none]
logger.debug("itfsw(Example增强插件):" + topLevelClass.getType().getShortName() + "修改createCriteriaInternal方法,修改构造Criteria时传入Example对象"); // depends on control dependency: [if], data = [none]
}
}
// orderBy方法
this.addOrderByMethodToExample(topLevelClass, introspectedTable);
// createCriteria 静态方法
this.addStaticCreateCriteriaMethodToExample(topLevelClass, introspectedTable);
// when
addWhenToExample(topLevelClass, introspectedTable);
return true;
} }
|
public class class_name {
public void setComposite(Composite comp) {
if (comp instanceof AlphaComposite) {
AlphaComposite composite = (AlphaComposite) comp;
if (composite.getRule() == 3) {
alpha = composite.getAlpha();
this.composite = composite;
if (realPaint != null && (realPaint instanceof Color)) {
Color c = (Color) realPaint;
paint = new Color(c.getRed(), c.getGreen(), c.getBlue(),
(int) (c.getAlpha() * alpha));
}
return;
}
}
this.composite = comp;
alpha = 1.0F;
} }
|
public class class_name {
public void setComposite(Composite comp) {
if (comp instanceof AlphaComposite) {
AlphaComposite composite = (AlphaComposite) comp;
if (composite.getRule() == 3) {
alpha = composite.getAlpha(); // depends on control dependency: [if], data = [none]
this.composite = composite; // depends on control dependency: [if], data = [none]
if (realPaint != null && (realPaint instanceof Color)) {
Color c = (Color) realPaint;
paint = new Color(c.getRed(), c.getGreen(), c.getBlue(),
(int) (c.getAlpha() * alpha)); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
}
this.composite = comp;
alpha = 1.0F;
} }
|
public class class_name {
public void marshall(CreateFileSystemFromBackupRequest createFileSystemFromBackupRequest, ProtocolMarshaller protocolMarshaller) {
if (createFileSystemFromBackupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createFileSystemFromBackupRequest.getBackupId(), BACKUPID_BINDING);
protocolMarshaller.marshall(createFileSystemFromBackupRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING);
protocolMarshaller.marshall(createFileSystemFromBackupRequest.getSubnetIds(), SUBNETIDS_BINDING);
protocolMarshaller.marshall(createFileSystemFromBackupRequest.getSecurityGroupIds(), SECURITYGROUPIDS_BINDING);
protocolMarshaller.marshall(createFileSystemFromBackupRequest.getTags(), TAGS_BINDING);
protocolMarshaller.marshall(createFileSystemFromBackupRequest.getWindowsConfiguration(), WINDOWSCONFIGURATION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CreateFileSystemFromBackupRequest createFileSystemFromBackupRequest, ProtocolMarshaller protocolMarshaller) {
if (createFileSystemFromBackupRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createFileSystemFromBackupRequest.getBackupId(), BACKUPID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createFileSystemFromBackupRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createFileSystemFromBackupRequest.getSubnetIds(), SUBNETIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createFileSystemFromBackupRequest.getSecurityGroupIds(), SECURITYGROUPIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createFileSystemFromBackupRequest.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createFileSystemFromBackupRequest.getWindowsConfiguration(), WINDOWSCONFIGURATION_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 List<CmsUser> getUsersFromFile() {
String separator = null;
List values = null;
FileReader fileReader;
BufferedReader bufferedReader;
List<CmsUser> users = null;
boolean keepPasswordIfPossible = m_importPasswords.getValue().booleanValue();
try {
bufferedReader = new BufferedReader(
new InputStreamReader(new ByteArrayInputStream(m_importFileStream.toByteArray())));
String line;
boolean headline = true;
while ((line = bufferedReader.readLine()) != null) {
if (users == null) {
users = new ArrayList<CmsUser>();
}
if (separator == null) {
separator = CmsXsltUtil.getPreferredDelimiter(line);
}
List lineValues = CmsStringUtil.splitAsList(line, separator);
if (headline) {
values = new ArrayList();
Iterator itLineValues = lineValues.iterator();
while (itLineValues.hasNext()) {
values.add(itLineValues.next());
}
headline = false;
} else if (values != null) {
CmsUser curUser = new CmsUser();
try {
for (int i = 0; i < values.size(); i++) {
String curValue = (String)values.get(i);
try {
Method method = CmsUser.class.getMethod(
"set" + curValue.substring(0, 1).toUpperCase() + curValue.substring(1),
new Class[] {String.class});
String value = "";
if ((lineValues.size() > i) && (lineValues.get(i) != null)) {
value = (String)lineValues.get(i);
}
if (curValue.equals("password")) {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(value) | !keepPasswordIfPossible) {
value = m_password.getValue();
}
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value) && !value.equals("null")) {
method.invoke(curUser, new Object[] {value});
}
} catch (NoSuchMethodException ne) {
if (!CmsStringUtil.isEmptyOrWhitespaceOnly((String)lineValues.get(i))) {
curUser.setAdditionalInfo(curValue, lineValues.get(i));
}
} catch (IllegalAccessException le) {
//
} catch (InvocationTargetException te) {
//
}
}
} catch (CmsRuntimeException e) {
//
}
users.add(curUser);
}
}
bufferedReader.close();
} catch (IOException e) {
//noop
}
return users;
} }
|
public class class_name {
protected List<CmsUser> getUsersFromFile() {
String separator = null;
List values = null;
FileReader fileReader;
BufferedReader bufferedReader;
List<CmsUser> users = null;
boolean keepPasswordIfPossible = m_importPasswords.getValue().booleanValue();
try {
bufferedReader = new BufferedReader(
new InputStreamReader(new ByteArrayInputStream(m_importFileStream.toByteArray()))); // depends on control dependency: [try], data = [none]
String line;
boolean headline = true;
while ((line = bufferedReader.readLine()) != null) {
if (users == null) {
users = new ArrayList<CmsUser>(); // depends on control dependency: [if], data = [none]
}
if (separator == null) {
separator = CmsXsltUtil.getPreferredDelimiter(line); // depends on control dependency: [if], data = [none]
}
List lineValues = CmsStringUtil.splitAsList(line, separator);
if (headline) {
values = new ArrayList(); // depends on control dependency: [if], data = [none]
Iterator itLineValues = lineValues.iterator();
while (itLineValues.hasNext()) {
values.add(itLineValues.next()); // depends on control dependency: [while], data = [none]
}
headline = false; // depends on control dependency: [if], data = [none]
} else if (values != null) {
CmsUser curUser = new CmsUser();
try {
for (int i = 0; i < values.size(); i++) {
String curValue = (String)values.get(i);
try {
Method method = CmsUser.class.getMethod(
"set" + curValue.substring(0, 1).toUpperCase() + curValue.substring(1),
new Class[] {String.class});
String value = "";
if ((lineValues.size() > i) && (lineValues.get(i) != null)) {
value = (String)lineValues.get(i); // depends on control dependency: [if], data = [none]
}
if (curValue.equals("password")) {
if (CmsStringUtil.isEmptyOrWhitespaceOnly(value) | !keepPasswordIfPossible) {
value = m_password.getValue(); // depends on control dependency: [if], data = [none]
}
}
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(value) && !value.equals("null")) {
method.invoke(curUser, new Object[] {value}); // depends on control dependency: [if], data = [none]
}
} catch (NoSuchMethodException ne) {
if (!CmsStringUtil.isEmptyOrWhitespaceOnly((String)lineValues.get(i))) {
curUser.setAdditionalInfo(curValue, lineValues.get(i)); // depends on control dependency: [if], data = [none]
}
} catch (IllegalAccessException le) { // depends on control dependency: [catch], data = [none]
//
} catch (InvocationTargetException te) { // depends on control dependency: [catch], data = [none]
//
} // depends on control dependency: [catch], data = [none]
}
} catch (CmsRuntimeException e) {
//
} // depends on control dependency: [catch], data = [none]
users.add(curUser); // depends on control dependency: [if], data = [none]
}
}
bufferedReader.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
//noop
} // depends on control dependency: [catch], data = [none]
return users;
} }
|
public class class_name {
public static void restoreSignal(int[] residual, int dataLen, int order, int[] data, int startAt) {
int idataLen = (int) dataLen;
switch (order) {
case 0 :
for (int i = 0; i < idataLen; i++) {
data[i + startAt] = residual[i];
}
break;
case 1 :
for (int i = 0; i < idataLen; i++) {
data[i + startAt] = residual[i] + data[i + startAt - 1];
}
break;
case 2 :
for (int i = 0; i < idataLen; i++) {
/* == residual[i] + 2*data[i-1] - data[i-2] */
data[i + startAt] = residual[i] + (data[i + startAt - 1] << 1) - data[i + startAt - 2];
}
break;
case 3 :
for (int i = 0; i < idataLen; i++) {
/* residual[i] + 3*data[i-1] - 3*data[i-2]) + data[i-3] */
data[i + startAt] = residual[i] + (((data[i + startAt - 1] - data[i + startAt - 2]) << 1) + (data[i + startAt - 1] - data[i + startAt - 2])) + data[i + startAt - 3];
}
break;
case 4 :
for (int i = 0; i < idataLen; i++) {
/* == residual[i] + 4*data[i-1] - 6*data[i-2] + 4*data[i-3] - data[i-4] */
data[i + startAt] = residual[i] + ((data[i + startAt - 1] + data[i + startAt - 3]) << 2) - ((data[i + startAt - 2] << 2) + (data[i + startAt - 2] << 1)) - data[i + startAt - 4];
}
break;
default :
}
} }
|
public class class_name {
public static void restoreSignal(int[] residual, int dataLen, int order, int[] data, int startAt) {
int idataLen = (int) dataLen;
switch (order) {
case 0 :
for (int i = 0; i < idataLen; i++) {
data[i + startAt] = residual[i]; // depends on control dependency: [for], data = [i]
}
break;
case 1 :
for (int i = 0; i < idataLen; i++) {
data[i + startAt] = residual[i] + data[i + startAt - 1]; // depends on control dependency: [for], data = [i]
}
break;
case 2 :
for (int i = 0; i < idataLen; i++) {
/* == residual[i] + 2*data[i-1] - data[i-2] */
data[i + startAt] = residual[i] + (data[i + startAt - 1] << 1) - data[i + startAt - 2]; // depends on control dependency: [for], data = [i]
}
break;
case 3 :
for (int i = 0; i < idataLen; i++) {
/* residual[i] + 3*data[i-1] - 3*data[i-2]) + data[i-3] */
data[i + startAt] = residual[i] + (((data[i + startAt - 1] - data[i + startAt - 2]) << 1) + (data[i + startAt - 1] - data[i + startAt - 2])) + data[i + startAt - 3]; // depends on control dependency: [for], data = [i]
}
break;
case 4 :
for (int i = 0; i < idataLen; i++) {
/* == residual[i] + 4*data[i-1] - 6*data[i-2] + 4*data[i-3] - data[i-4] */
data[i + startAt] = residual[i] + ((data[i + startAt - 1] + data[i + startAt - 3]) << 2) - ((data[i + startAt - 2] << 2) + (data[i + startAt - 2] << 1)) - data[i + startAt - 4]; // depends on control dependency: [for], data = [i]
}
break;
default :
}
} }
|
public class class_name {
@Deprecated
protected List<GenPackage> loadReferencedGenModels(ResourceSet rs) {
List<GenPackage> result = Lists.newArrayList();
if (getReferencedGenModels() != null) {
for (String uri : getReferencedGenModels().split(",")) {
try {
Resource resource = rs.getResource(URI.createURI(uri.trim()), true);
GenModel genmodel = (GenModel) resource.getContents().get(0);
EList<GenPackage> genPackages = genmodel.getGenPackages();
for (GenPackage genPackage : genPackages) {
genPackage.getEcorePackage().getEClassifiers();
result.add(genPackage);
}
} catch (Exception e) {
log.error("Couldn't find genmodel for uri '" + uri + "'");
throw new WrappedException(e);
}
}
}
return result;
} }
|
public class class_name {
@Deprecated
protected List<GenPackage> loadReferencedGenModels(ResourceSet rs) {
List<GenPackage> result = Lists.newArrayList();
if (getReferencedGenModels() != null) {
for (String uri : getReferencedGenModels().split(",")) {
try {
Resource resource = rs.getResource(URI.createURI(uri.trim()), true);
GenModel genmodel = (GenModel) resource.getContents().get(0);
EList<GenPackage> genPackages = genmodel.getGenPackages();
for (GenPackage genPackage : genPackages) {
genPackage.getEcorePackage().getEClassifiers(); // depends on control dependency: [for], data = [genPackage]
result.add(genPackage); // depends on control dependency: [for], data = [genPackage]
}
} catch (Exception e) {
log.error("Couldn't find genmodel for uri '" + uri + "'");
throw new WrappedException(e);
} // depends on control dependency: [catch], data = [none]
}
}
return result;
} }
|
public class class_name {
protected boolean isNoException(String token,
AnalyzedTokenReadings[] tokens, int i, int j,
boolean precSpace,
boolean follSpace, UnsyncStack<SymbolLocator> symbolStack) {
String tokenStr = tokens[i].getToken();
if (i >= 2) {
String prevPrevToken = tokens[i - 2].getToken();
String prevToken = tokens[i - 1].getToken();
// Smiley ":-)" and ":-("
if (prevPrevToken.equals(":") && prevToken.equals("-") && (tokenStr.equals(")") || tokenStr.equals("("))) {
return false;
}
// Smiley ";-)" and ";-("
if (prevPrevToken.equals(";") && prevToken.equals("-") && (tokenStr.equals(")") || tokenStr.equals("("))) {
return false;
}
}
if (i >= 1) {
String prevToken = tokens[i - 1].getToken();
// Smiley ":)" and ":("
if (prevToken.equals(":") && !tokens[i].isWhitespaceBefore() && (tokenStr.equals(")") || tokenStr.equals("("))) {
return false;
}
// Smiley ";)" and ";("
if (prevToken.equals(";") && !tokens[i].isWhitespaceBefore() && (tokenStr.equals(")") || tokenStr.equals("("))) {
return false;
}
}
return true;
} }
|
public class class_name {
protected boolean isNoException(String token,
AnalyzedTokenReadings[] tokens, int i, int j,
boolean precSpace,
boolean follSpace, UnsyncStack<SymbolLocator> symbolStack) {
String tokenStr = tokens[i].getToken();
if (i >= 2) {
String prevPrevToken = tokens[i - 2].getToken();
String prevToken = tokens[i - 1].getToken();
// Smiley ":-)" and ":-("
if (prevPrevToken.equals(":") && prevToken.equals("-") && (tokenStr.equals(")") || tokenStr.equals("("))) {
return false; // depends on control dependency: [if], data = [none]
}
// Smiley ";-)" and ";-("
if (prevPrevToken.equals(";") && prevToken.equals("-") && (tokenStr.equals(")") || tokenStr.equals("("))) {
return false; // depends on control dependency: [if], data = [none]
}
}
if (i >= 1) {
String prevToken = tokens[i - 1].getToken();
// Smiley ":)" and ":("
if (prevToken.equals(":") && !tokens[i].isWhitespaceBefore() && (tokenStr.equals(")") || tokenStr.equals("("))) {
return false; // depends on control dependency: [if], data = [none]
}
// Smiley ";)" and ";("
if (prevToken.equals(";") && !tokens[i].isWhitespaceBefore() && (tokenStr.equals(")") || tokenStr.equals("("))) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.