Package jmt.engine.math.parser

Examples of jmt.engine.math.parser.Parser$Element


        assertEquals("Invalid local name", LOCAL_NAME, node.getName());
    }

    @Override
    protected Element getReturnValue(MethodParameter returnType) {
        return new Element(LOCAL_NAME, NAMESPACE_URI);
    }
View Full Code Here


            @Override
            protected Element invokeInternal(Element requestElement) throws Exception {
                assertNotNull("No requestElement passed", requestElement);
                assertEquals("Invalid request element", REQUEST_ELEMENT, requestElement.getName());
                assertEquals("Invalid request element", NAMESPACE_URI, requestElement.getNamespaceURI());
                return new Element(RESPONSE_ELEMENT, Namespace.getNamespace("tns", NAMESPACE_URI));
            }
        };
    }
View Full Code Here

        return supports(returnType);
    }

    @Override
    protected Source createResponsePayload(MethodParameter returnType, Object returnValue) {
        Element returnedElement = (Element) returnValue;
        return new JDOMSource(returnedElement);
    }
View Full Code Here

        this.alwaysTransform = alwaysTransform;
    }

    @Override
    public final Source invoke(Source request) throws Exception {
        Element requestElement = getDocumentElement(request);
        Element responseElement = invokeInternal(requestElement);
        return responseElement != null ? new JDOMSource(responseElement) : null;
    }
View Full Code Here

        } else if(variable.contentEquals("LastChange")){
          
            SAXBuilder sxb = new SAXBuilder();
            try {
                Document document = sxb.build(new InputSource(new StringReader(value)));
                Element root = document.getRootElement();
                List<Element> children = root.getChildren();
                Iterator<Element> iterator = children.iterator();
                while (iterator.hasNext()) { //for each instanceID
                    Element current = iterator.next();
                    List<Element> childList = current.getChildren();
                    Iterator<Element> iterChild = childList.iterator();
                    Element child;
                    while (iterChild.hasNext()) {
                        child = iterChild.next();
                        String attributeValue = child.getAttributeValue("val");
//                        if (child.getName().equalsIgnoreCase("Volume")) {
//                            if (child.getAttributeValue("channel").equalsIgnoreCase("Master")) {
//                                volume = attributeValue;
//                            }
//                        } else if (child.getName().equalsIgnoreCase("Mute")) {
//                            muteState = Boolean.valueOf(attributeValue);
//                        } else if (child.getName().equalsIgnoreCase("PresetName")) {
//                            currentPreset = attributeValue;
//                        } else if (child.getName().equalsIgnoreCase("CurrentTrackDuration")) {
//                            trackDuration = attributeValue;
//                        } else if (child.getName().equalsIgnoreCase("AVTransportURI")) {
//                            String[] split = attributeValue.split("/");
//                            title = split[split.length - 1];
/*                        } else*/ if (child.getName().equalsIgnoreCase("TransportState")) {
                            if (attributeValue.contentEquals("STOPPED")) {
                                update.offer("device" + UDN + "/value/" + "renderer_stop.png");
                            } else if (attributeValue.contentEquals("PAUSED_PLAYBACK")) {
                                update.offer("device" + UDN + "/value/" + "renderer_pause.png");
                            } else if (attributeValue.contentEquals("PLAYING")) {
View Full Code Here

        this(new DefaultJDOMFactory());
    }

    @Override
    protected Object createNode(final String name) {
        final Element element = documentFactory.element(encodeNode(name));
        final Element parent = top();
        if (parent != null) {
            parent.addContent(element);
        }
        return element;
    }
View Full Code Here

     * Creates a config XML element for this class.
     */
    @Override
    public Element getAsElement()
    {
        Element keyEl = new Element(Element_Key);
        keyEl.setAttribute(Attr_Special, this.key.toString());
        keyEl.setAttribute("length", String.valueOf(this.keyWidth));
        return keyEl;
    }
View Full Code Here

    protected void loadData(Element data)
    {
        if (data == null)
            throw new IllegalArgumentException("cannot load data, data ist null");

        Element li = data.getChild(Element_LanguageInfo);
        name = li.getAttributeValue(Attr_Name);
        nativeName = li.getAttributeValue(Attr_Name);
        fontName = li.getAttributeValue(Attr_Font);
        fixedWidthFontName = li.getAttributeValue(Attr_FixedWidthFont);
        localeString.add(li.getAttributeValue(Attr_LocaleString));
        Element countriesEl = li.getChild(ELEMENT_COUNTRIES);
        if (countriesEl != null)
        {
            List<Element> countries = countriesEl.getChildren(ELEMENT_COUNTRY);
            String[] locSplit = localeString.get(0).split("-");
            if (countries != null && !countries.isEmpty() && locSplit != null && locSplit.length >= 1)
                for (Element country : countries)
                    localeString.add(locSplit[0] + "-" + country.getAttributeValue(ATTR_CODE));
        }
        org = new LinkedList<String>();
        trans = new LinkedList<String>();

        // check the translated keys
        Element transKeys = li.getChild(Show);
        if (transKeys != null)
            for (Element l : transKeys.getChildren(in))
            {
                org.add(l.getAttribute("org").getValue());
                trans.add(l.getAttribute("translate").getValue());
            }
View Full Code Here

        return localeString;
    }

    public Element getAsElement()
    {
        Element root = new Element("KeyboardConfiguration");
        Element li = new Element(Element_LanguageInfo);
        root.addContent(li);
        li.setAttribute(Attr_Name, name);
        li.setAttribute(Attr_NativeName, nativeName);
        li.setAttribute(Attr_Font, fontName);
        li.setAttribute(Attr_FixedWidthFont, fixedWidthFontName);
        li.setAttribute(Attr_LocaleString, localeString.isEmpty() ? "international" : localeString.get(0));
        if (localeString.size() > 1)
        {
            Element countries = new Element(ELEMENT_COUNTRIES);
            for (int i = 1; i < localeString.size(); i++)
            {
                String[] split = localeString.get(i).split("-");
                if (split != null && split.length == 2)
                {
                    Element country = new Element(ELEMENT_COUNTRY);
                    country.setAttribute(ATTR_CODE, split[1]);
                    countries.addContent(country);
                }
            }
            if (countries.getChildren().isEmpty())
                li.addContent(countries);
        }
        Element keyboard;

        // backwards Translation key
        if (org.size() > 0)
        {
            Element et = new Element(Show);
            li.setContent(et);
            for (int f = 0; f < org.size(); f++)
            {
                Element ett = new Element(in);
                et.addContent(ett);
                ett.setAttribute(new org.jdom2.Attribute("org", org.get(f)));
                ett.setAttribute(new org.jdom2.Attribute("translate", trans.get(f)));
            }
        }

        if (imeList.size() > 0)
            for (int f = 0; f < imeList.size(); f++)
            {
                Element et = new Element(IME);
                et.setAttribute(new org.jdom2.Attribute(IME, imeList.get(f)));
                li.addContent(et);
            }

        for (int i = 0; i < size(); i++)
        {
            keyboard = new Element(Element_Keyboard);
            li.addContent(keyboard);

            for (LinkedList<KeyboardKey> list : this.get(i))
            {
                Element line = new Element(Element_Line);
                keyboard.addContent(line);
                for (KeyboardKey kk : list)
                    line.addContent(kk.getAsElement());
            }
        }

        return root;
    }
View Full Code Here

            insertString(textField, keyboard, getContent(keyboard.getModifier()));
    }

    public Element getAsElement()
    {
        Element key = new Element(Element_Key);
        if (normalKey != null)
            key.setAttribute(Attr_Normal, normalKey);
        if (shiftKey != null)
            key.setAttribute(Attr_Shift, shiftKey);
        if (altKey != null)
            key.setAttribute(Attr_Alt, altKey);
        if (altshiftKey != null)
            key.setAttribute(Attr_AltGr, altshiftKey);
        return key;
    }
View Full Code Here

TOP

Related Classes of jmt.engine.math.parser.Parser$Element

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.