Java 类org.dom4j.tree.FlyweightAttribute 实例源码

项目:cernunnos    文件:AttributeNodePhrase.java   
public Object evaluate(TaskRequest req, TaskResponse res) {

        String s = (String) tuple.evaluate(req, res);

        int index = s.indexOf("=");
        switch (index) {
            case -1:
                String msg = "The TUPLE expression must contain an equals ('=') " +
                "character.  The specified expression is invalid:  " + s;
                throw new IllegalArgumentException(msg);
            default:
                // All is well...
                String name = s.substring(0, index);
                String value = s.substring(index + 1);
                return new FlyweightAttribute(name, value);
        }

    }
项目:Text2Process    文件:Frame.java   
/**
 * This method can be used to export the frame definition of this frame into
 * an XML-format that can be embedded in SalsaTigerXML-files.
 * 
 * @return An XML element containing the name and frame elements of this
 *         frame.
 * @since 0.4.1
 */
public Element exportToSalsaTiger() {
    Namespace ns = new Namespace("fd",
            "http://www.clt-st.de/framenet/frame-database");

    Element elem = new DefaultElement("frame", ns);

    elem.add(new FlyweightAttribute("name", getName(), ns));

    for (FrameElement fe : frameElements()) {
        Element fee = new DefaultElement("element", ns);
        fee.add(new FlyweightAttribute("name", fe.getName(), ns));
        fee.add(new FlyweightAttribute("optional", String.valueOf(!fe
                .isCore()), ns));

        elem.add(fee);
    }

    return elem;

}