當前位置: 首頁>>代碼示例>>Java>>正文


Java Element類代碼示例

本文整理匯總了Java中nu.xom.Element的典型用法代碼示例。如果您正苦於以下問題:Java Element類的具體用法?Java Element怎麽用?Java Element使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Element類屬於nu.xom包,在下文中一共展示了Element類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getCommand

import nu.xom.Element; //導入依賴的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;
}
 
開發者ID:ser316asu,項目名稱:SER316-Munich,代碼行數:23,代碼來源:AppList.java

示例2: extraer

import nu.xom.Element; //導入依賴的package包/類
public Element extraer(){
        if(!this.Vacia()){
                Element m = a[1].getElement();  
                a[1] = a[n];
                --n;
                int j = 1;
                while(2*j<=n)
                {
                        int k=2*j;
                        if(k+1<=n && a[k+1].getPriority() < a[k].getPriority())
                                k=k+1;  
                        if(a[j].getPriority() < a[k].getPriority())
                                break;
                        Pair t = a[j]; 
                        a[j] = a[k];
                        a[k] = t;  
                        j = k;
                }
                return m;
        }
        else 
                return null;
}
 
開發者ID:ser316asu,項目名稱:SER316-Munich,代碼行數:24,代碼來源:PriorityQueue.java

示例3: getTaskElement

import nu.xom.Element; //導入依賴的package包/類
private Element getTaskElement(String id) {
             
/*Nodes nodes = XQueryUtil.xquery(_doc, "//task[@id='" + id + "']");
      if (nodes.size() > 0) {
          Element el = (Element) nodes.get(0);
          return el;            
      }
      else {
          Util.debug("Task " + id + " cannot be found in project " + _project.getTitle());
          return null;
      } */
Element el = (Element)elements.get(id);
if (el == null) {
	Util.debug("Task " + id + " cannot be found in project " + _project.getTitle());
}
return el;
  }
 
開發者ID:ser316asu,項目名稱:Wilmersdorf_SER316,代碼行數:18,代碼來源:CommitListImpl.java

示例4: createDay

import nu.xom.Element; //導入依賴的package包/類
private Day createDay(int d) {
	Element el = new Element("day");
	el.addAttribute(new Attribute("day", new Integer(d).toString()));
	el.addAttribute(
		new Attribute(
			"date",
			new CalendarDate(
				d,
				getValue(),
				new Integer(
					((Element) mElement.getParent())
						.getAttribute("year")
						.getValue())
					.intValue())
				.toString()));

	mElement.appendChild(el);
	return new Day(el);
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:20,代碼來源:EventsManager.java

示例5: hasParentTask

import nu.xom.Element; //導入依賴的package包/類
public boolean hasParentTask(String id) {
	Element t = getTaskElement(id);
	
	Node parentNode = t.getParent();
	if (parentNode instanceof Element) {
	    Element parent = (Element) parentNode;
    	if (parent.getLocalName().equalsIgnoreCase("task")) {
    	    return true;
    	}
    	else {
    	    return false;
    	}
	}
	else {
	    return false;
	}
}
 
開發者ID:ser316asu,項目名稱:Dahlem_SER316,代碼行數:18,代碼來源:TaskListImpl.java

示例6: createEvent

import nu.xom.Element; //導入依賴的package包/類
public static Event createEvent(
	CalendarDate date,
	int hh,
	int mm,
	String text) {
	Element el = new Element("event");
	el.addAttribute(new Attribute("id", Util.generateId()));
	el.addAttribute(new Attribute("hour", String.valueOf(hh)));
	el.addAttribute(new Attribute("min", String.valueOf(mm)));
	el.appendChild(text);
	Day d = getDay(date);
	if (d == null)
		d = createDay(date);
	d.getElement().appendChild(el);
	return new EventImpl(el);
}
 
開發者ID:ser316asu,項目名稱:Dahlem_SER316,代碼行數:17,代碼來源:EventsManager.java

示例7: createEvent

import nu.xom.Element; //導入依賴的package包/類
public static Event createEvent(
	CalendarDate date,
	int hh,
	int mm,
	String text) {
	Element el = new Element("event");
	el.addAttribute(new Attribute("id", Util.generateId()));
	el.addAttribute(new Attribute("hour", String.valueOf(hh)));
	el.addAttribute(new Attribute("min", String.valueOf(mm)));
	el.appendChild(text);
	Day d = getDay(date);
	if (d == null)
		d = createDay(date);
	d.getElement().appendChild(el);
	Event newEvent = new EventImpl(el);
	
	try {
		EventIndexer.addEvent(newEvent);
	}
	catch (Exception e) {
		throw new RuntimeException ("cannot index event", e);
	}
	
	return newEvent;
}
 
開發者ID:ser316asu,項目名稱:Reinickendorf_SER316,代碼行數:26,代碼來源:EventsManager.java

示例8: getAllSubTasks

import nu.xom.Element; //導入依賴的package包/類
/**
 * All methods to obtain list of tasks are consolidated under getAllSubTasks and getActiveSubTasks.
 * If a root task is required, just send a null taskId
 */
public Collection getAllSubTasks(String taskId) {
	if ((taskId == null) || (taskId.length() == 0)) {
		return getAllRootTasks();
	}
	else {
        Element task = getTaskElement(taskId);
        if (task == null)
            return new Vector();
        Elements subTasks = task.getChildElements("task");
        return convertToTaskObjects(subTasks);    	    		
	}
}
 
開發者ID:ser316asu,項目名稱:Dahlem_SER316,代碼行數:17,代碼來源:TaskListImpl.java

示例9: createEvent

import nu.xom.Element; //導入依賴的package包/類
private static Event createEvent(int hh, int mm, String text, Calendar start, Calendar end) {
	Element el = new Element("event");
	el.addAttribute(new Attribute("startDate", start.toString()));
	el.addAttribute(new Attribute("endDate", end.toString()));
	el.addAttribute(new Attribute("id", Util.generateId()));
	el.addAttribute(new Attribute("hour", String.valueOf(hh)));
	el.addAttribute(new Attribute("min", String.valueOf(mm)));
	el.appendChild(text);
	return new EventImpl(el);
}
 
開發者ID:ser316asu,項目名稱:SER316-Ingolstadt,代碼行數:11,代碼來源:testEvent.java

示例10: createSticker

import nu.xom.Element; //導入依賴的package包/類
public static void createSticker(String text, int prior) {
	Element el = new Element("sticker");
	el.addAttribute(new Attribute("id", Util.generateId()));
	el.addAttribute(new Attribute("priority", prior+""));
	el.appendChild(text);
	_root.appendChild(el);
}
 
開發者ID:ser316asu,項目名稱:SER316-Ingolstadt,代碼行數:8,代碼來源:EventsManager.java

示例11: getCommandLine

import nu.xom.Element; //導入依賴的package包/類
public String getCommandLine(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 pt = app.getAttribute("command").getValue();
            if (fPath.indexOf(' ') >= 0)
               fPath = '"' + fPath + '"'; 
            pt = pt.replaceAll("\\$1", fPath);
            return app.getAttribute("findPath").getValue() + "/" + app.getAttribute("exec").getValue()+" "+pt;
        }
    return null;
}
 
開發者ID:ser316asu,項目名稱:Reinickendorf_SER316,代碼行數:15,代碼來源:AppList.java

示例12: getEvent

import nu.xom.Element; //導入依賴的package包/類
public static Event getEvent(CalendarDate date, int hh, int mm) {
	Day d = getDay(date);
	if (d == null)
		return null;
	Elements els = d.getElement().getChildElements("event");
	for (int i = 0; i < els.size(); i++) {
		Element el = els.get(i);
		if ((new Integer(el.getAttribute("hour").getValue()).intValue()
			== hh)
			&& (new Integer(el.getAttribute("min").getValue()).intValue()
				== mm))
			return new EventImpl(el);
	}
	return null;
}
 
開發者ID:ser316asu,項目名稱:Dahlem_SER316,代碼行數:16,代碼來源:EventsManager.java

示例13: getStickers

import nu.xom.Element; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public static Map getStickers() {
	Map m = new HashMap();
	Elements els = _root.getChildElements("sticker");
	for (int i = 0; i < els.size(); i++) {
		Element se = els.get(i);
		m.put(se.getAttribute("id").getValue(), se);
	}
	return m;
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:11,代碼來源:EventsManager.java

示例14: getRepeatableEvents

import nu.xom.Element; //導入依賴的package包/類
public static Collection getRepeatableEvents() {
	Vector v = new Vector();
	Element rep = _root.getFirstChildElement("repeatable");
	if (rep == null)
		return v;
	Elements els = rep.getChildElements("event");
	for (int i = 0; i < els.size(); i++)
		v.add(new EventImpl(els.get(i)));
	return v;
}
 
開發者ID:ser316asu,項目名稱:Neukoelln_SER316,代碼行數:11,代碼來源:EventsManager.java

示例15: sortStickers

import nu.xom.Element; //導入依賴的package包/類
private static PriorityQueue sortStickers(){
    Map stickers = EventsManager.getStickers();
    PriorityQueue pQ = new PriorityQueue(stickers.size());
	for (Iterator i = stickers.keySet().iterator(); i.hasNext();) {
    	String id = (String)i.next();
    	Element el = (Element)stickers.get(id);
    	int j=2;
    	j=Integer.parseInt(el.getAttributeValue("priority"));
    	pQ.insertar(new Pair(el,j));
	}
	return pQ;
}
 
開發者ID:ser316asu,項目名稱:SER316-Munich,代碼行數:13,代碼來源:AgendaGenerator.java


注:本文中的nu.xom.Element類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。