本文整理汇总了Java中nu.xom.Elements.get方法的典型用法代码示例。如果您正苦于以下问题:Java Elements.get方法的具体用法?Java Elements.get怎么用?Java Elements.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nu.xom.Elements
的用法示例。
在下文中一共展示了Elements.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllNotes
import nu.xom.Elements; //导入方法依赖的package包/类
public Collection getAllNotes() {
Vector v = new Vector();
Elements yrs = _root.getChildElements("year");
for (int yi = 0; yi < yrs.size(); yi++) {
Year y = new Year(yrs.get(yi));
Vector ms = y.getMonths();
for (int mi = 0; mi < ms.size(); mi++) {
Month m = (Month) ms.get(mi);
Vector ds = m.getDays();
for (int di = 0; di < ds.size(); di++) {
Day d = (Day) ds.get(di);
Vector ns = d.getNotes();
for(int ni = 0; ni < ns.size(); ni++) {
NoteElement n = (NoteElement) ns.get(ni);
v.add(new NoteImpl(n.getElement(), _project));
}
}
}
}
return v;
}
示例2: getMarkedNotes
import nu.xom.Elements; //导入方法依赖的package包/类
/**
* @see net.sf.memoranda.NoteList#getMarkedNotes()
*/
public Collection getMarkedNotes() {
Vector v = new Vector();
Elements yrs = _root.getChildElements("year");
for (int yi = 0; yi < yrs.size(); yi++) {
Year y = new Year(yrs.get(yi));
Vector ms = y.getMonths();
for (int mi = 0; mi < ms.size(); mi++) {
Month m = (Month) ms.get(mi);
Vector ds = m.getDays();
for (int di = 0; di < ds.size(); di++) {
Day d = (Day) ds.get(di);
Vector ns = d.getNotes();
for(int ni = 0; ni < ns.size(); ni++) {
NoteElement ne = (NoteElement) ns.get(ni);
Note n = new NoteImpl(ne.getElement(), _project);
if (n.isMarked()) v.add(n);
}
}
}
}
return v;
}
示例3: getYear
import nu.xom.Elements; //导入方法依赖的package包/类
public Element getYear(CalendarDate date) {
System.out.println("mad it in");
if (_root == null) {
System.out.println("the root was null");
//_root = new Element("eventslist");
}
Element year = null;
Elements years = _root.getChildElements("year");
System.out.println("years size: " + years.size() + " ");
if (years.size() == 0) {
return null;
}
else {
for (int i = 0; i < years.size(); i++) {
if (Integer.parseInt(years.get(i).getAttributeValue("year").toString()) == date.getYear()) {
year = years.get(i);
break;
}
}
}
return year;
}
示例4: getCommand
import nu.xom.Elements; //导入方法依赖的package包/类
public String[] getCommand(String appId, String fPath) {
Elements apps = _root.getChildElements("app");
//fPath = fPath.replaceAll("\\\\", "\\\\\\\\");
for (int i = 0; i < apps.size(); i++)
if (apps.get(i).getAttribute("id").getValue().equals(appId)) {
Element app = apps.get(i);
String command = app.getAttribute("command").getValue();
String exec = app.getAttribute("findPath").getValue() + "/" + app.getAttribute("exec").getValue();
StringTokenizer st = new StringTokenizer(command);
String[] cmdarray = new String[st.countTokens()+1];
cmdarray[0] = exec;
for (int j = 1; st.hasMoreTokens(); j++) {
String tk = st.nextToken();
if (tk.equals("$1"))
cmdarray[j] = fPath;
else
cmdarray[j] = tk;
}
return cmdarray;
}
return null;
}
示例5: getActualLocForProject
import nu.xom.Elements; //导入方法依赖的package包/类
public static int getActualLocForProject(String targetid, Element rootElement) {
Elements projectElements = rootElement.getChildElements(PSP.ELEMENT_NAME);
Element projectElement = null;
Element locElement = null;
int value = 0;
if (projectElements != null) {
for (int i = 0; i < projectElements.size(); i++) {
String projectid = projectElements.get(i).getAttributeValue(PSP.ID_ATTRIBUTE);
if (projectid.equals(targetid)) {
projectElement = projectElements.get(i);
locElement = projectElement.getFirstChildElement(ELEMENT_NAME);
try {
value = Integer.valueOf(locElement.getValue());
}
catch (Exception ex) {
// do nothing here
}
}
}
}
return value;
}
示例6: testGetTagsNumber
import nu.xom.Elements; //导入方法依赖的package包/类
@Test
public void testGetTagsNumber() {
Elements prjs = projects.getRootElement().getChildElements("project");
int number=0;
for (int i = 0; i < prjs.size(); i++) {
number+=prjs.get(i).getFirstChildElement("tags").getChildCount();
Project ptest= new ProjectImpl(prjs.get(i));
assertTrue(ptest.getTitle() instanceof String);
assertTrue(ptest instanceof Project);
}
assertTrue(number > 0);
assertFalse(number < 0);
}
示例7: getYear
import nu.xom.Elements; //导入方法依赖的package包/类
private Year getYear(int y) {
Elements yrs = _root.getChildElements("year");
String yy = new Integer(y).toString();
for (int i = 0; i < yrs.size(); i++)
if (yrs.get(i).getAttribute("year").getValue().equals(yy))
return new Year(yrs.get(i));
//return createYear(y);
return null;
}
示例8: getMonth
import nu.xom.Elements; //导入方法依赖的package包/类
public Month getMonth(int m) {
Elements ms = yearElement.getChildElements("month");
String mm = new Integer(m).toString();
for (int i = 0; i < ms.size(); i++)
if (ms.get(i).getAttribute("month").getValue().equals(mm))
return new Month(ms.get(i));
//return createMonth(m);
return null;
}
示例9: convertToTaskObjects
import nu.xom.Elements; //导入方法依赖的package包/类
private Collection convertToTaskObjects(Elements tasks) {
Vector v = new Vector();
for (int i = 0; i < tasks.size(); i++) {
Task t = new TaskImpl(tasks.get(i), _tl);
v.add(t);
}
return v;
}
示例10: removeSticker
import nu.xom.Elements; //导入方法依赖的package包/类
public static void removeSticker(String stickerId) {
Elements els = _root.getChildElements("sticker");
for (int i = 0; i < els.size(); i++) {
Element se = els.get(i);
if (se.getAttribute("id").getValue().equals(stickerId)) {
_root.removeChild(se);
break;
}
}
}
示例11: getBrowserExec
import nu.xom.Elements; //导入方法依赖的package包/类
/**
* Gets child elements of "browser" from XML file. If no elements,
* returns null. Else returns file path of browser executable.
* @return String filepath
*/
public String getBrowserExec() {
Elements els = _root.getChildElements("browser"); //Read only traversal
if (els.size() < 1) return null;
Element el = els.get(0);
return (el.getAttribute("path").getValue());
}
示例12: buildElements
import nu.xom.Elements; //导入方法依赖的package包/类
private void buildElements(Element parent) {
Elements els = parent.getChildElements("task");
for (int i = 0; i < els.size(); i++) {
Element el = els.get(i);
elements.put(el.getAttribute("id").getValue(), el);
buildElements(el);
}
}
示例13: getProject
import nu.xom.Elements; //导入方法依赖的package包/类
public static Project getProject(String id) {
Elements prjs = _root.getChildElements("project");
for (int i = 0; i < prjs.size(); i++) {
String pid = ((Element) prjs.get(i)).getAttribute("id").getValue();
if (pid.equals(id)) {
return new ProjectImpl((Element) prjs.get(i));
}
}
return null;
}
示例14: getDay
import nu.xom.Elements; //导入方法依赖的package包/类
public Day getDay(int d) {
if (mElement == null)
return null;
Elements ds = mElement.getChildElements("day");
String dd = new Integer(d).toString();
for (int i = 0; i < ds.size(); i++)
if (ds.get(i).getAttribute("day").getValue().equals(dd))
return new Day(ds.get(i));
return null;
}
示例15: getActiveProjectsNumber
import nu.xom.Elements; //导入方法依赖的package包/类
public static int getActiveProjectsNumber() {
Elements prjs = _root.getChildElements("project");
int count = 0;
for (int i = 0; i < prjs.size(); i++) {
Project prj = new ProjectImpl((Element) prjs.get(i));
if (prj.getStatus() == Project.ACTIVE){
count++;
}
}
return count;
}