Package org.openquark.cal.compiler

Examples of org.openquark.cal.compiler.CALDocComment$Segment


    }

    public void testLayoutRUN() throws Pack200Exception {
        AttributeLayout layout = new AttributeLayout("RUN",
                AttributeLayout.CONTEXT_CLASS, "RUN", 1);
        Segment segment = new TestSegment();
        assertNull(layout.getValue(0, segment.getConstantPool()));
        assertEquals("Zero", ((CPUTF8)layout.getValue(1, segment.getConstantPool())).underlyingString());
        assertEquals("One", ((CPUTF8)layout.getValue(2, segment.getConstantPool())).underlyingString());
    }
View Full Code Here


    }

    public void testLayoutRS() throws Pack200Exception {
        AttributeLayout layout = new AttributeLayout("RS",
                AttributeLayout.CONTEXT_CLASS, "RS", 1);
        Segment segment = new TestSegment();
        assertNull(layout.getValue(-1, segment.getConstantPool()));
        assertEquals("Eins", ((CPUTF8)layout.getValue(0, segment.getConstantPool())).underlyingString());
        assertEquals("Zwei", ((CPUTF8)layout.getValue(1, segment.getConstantPool())).underlyingString());
    }
View Full Code Here

    }

    public void testLayoutRSN() throws Pack200Exception {
        AttributeLayout layout = new AttributeLayout("RSN",
                AttributeLayout.CONTEXT_CLASS, "RSN", 1);
        Segment segment = new TestSegment();
        assertNull(layout.getValue(0, segment.getConstantPool()));
        assertEquals("Eins", ((CPUTF8)layout.getValue(1, segment.getConstantPool())).underlyingString());
        assertEquals("Zwei", ((CPUTF8)layout.getValue(2, segment.getConstantPool())).underlyingString());
    }
View Full Code Here

        pool
                .add(new CPUTF8("OtherThing",
                        ClassConstantPool.DOMAIN_NORMALASCIIZ, 1));
        CPUTF8 u1 = new CPUTF8("thing", ClassConstantPool.DOMAIN_NORMALASCIIZ, 2);
        pool.add(u1);
        pool.resolve(new Segment());
        assertTrue(pool.indexOf(u1) > 0);
    }
View Full Code Here

    public void testIndex() {
        pool.add(new CPUTF8("OtherThing", 1));
        CPUTF8 u1 = new CPUTF8("thing", 2);
        pool.add(u1);
        pool.resolve(new Segment());
        assertTrue(pool.indexOf(u1) > 0);
    }
View Full Code Here

    public void testJustResources() throws Exception {
        in = Segment.class
                .getResourceAsStream("/org/apache/harmony/pack200/tests/JustResources.pack");
        file = File.createTempFile("just", "resources.jar");
        out = new JarOutputStream(new FileOutputStream(file));
        Segment segment = new Segment();
        segment.unpack(in, out);
    }
View Full Code Here

    public void testInterfaceOnly() throws Exception {
        in = Segment.class
                .getResourceAsStream("/org/apache/harmony/pack200/tests/InterfaceOnly.pack");
        file = File.createTempFile("Interface", "Only.jar");
        out = new JarOutputStream(new FileOutputStream(file));
        Segment segment = new Segment();
        segment.unpack(in, out);
    }
View Full Code Here

    public void testHelloWorld() throws Exception {
        in = Segment.class
                .getResourceAsStream("/org/apache/harmony/pack200/tests/HelloWorld.pack");
        file = File.createTempFile("hello", "world.jar");
        out = new JarOutputStream(new FileOutputStream(file));
        Segment segment = new Segment();
        segment.unpack(in, out);
        out.close();
        out = null;
        JarFile jarFile = new JarFile(file);
        file.deleteOnExit();
View Full Code Here

       
        } else if (metadata.getLongDescription() != null) {
            text.append("<br>").append(wrapTextToHTMLLines(metadata.getLongDescription(), parent));           
        } else {
            // If there is neither a short nor a long description, display the CALDoc description instead.
            CALDocComment caldoc = gem.getGemEntity().getFunctionalAgent().getCALDocComment();
            if (caldoc != null) {
                String caldocDesc = NavHtmlFactory.getHtmlForCALDocSummaryWithNoHyperlinks(caldoc, locale, true);
                if (caldocDesc.length() > 0) {
                    text.append(caldocDesc);
                } else {
View Full Code Here

            text.append("<br>");
            text.append(wrapTextToHTMLLines(metadata.getLongDescription(), parent));
            text.append("<br>");
        } else {
            // If there is neither a short nor a long description, display the CALDoc description instead.
            CALDocComment caldoc = scopedEntity.getCALDocComment();
            if (caldoc != null) {
                String caldocDesc = getHTMLForBoundedToolTipText(
                    NavHtmlFactory.getHtmlForCALDocSummaryWithNoHyperlinks(caldoc, locale, true), TOOLTIP_MAX_WIDTH, 0, true, parent);
               
                if (caldocDesc.length() > 0) {
                    text.append(caldocDesc);
                } else {
                    text.append("<br>");
                }
            } else {
                text.append("<br>");
            }
        }

        if (metadata instanceof FunctionalAgentMetadata) {

            FunctionalAgent envEntity = (FunctionalAgent)scopedEntity;
            PolymorphicVarContext polymorphicVarContext = PolymorphicVarContext.make();
            TypeExpr[] typePieces = envEntity.getTypeExpr().getTypePieces();

            CALDocComment caldoc = envEntity.getCALDocComment();

            // Add the result type.           
            text.append("<br>");
            text.append("<b>");
            text.append(GemCutter.getResourceString("ToolTipHelper_Returns"));
            text.append("</b>");
            text.append("<br>");
            String returnValueIndicator = "<i>" + GemCutter.getResourceString("ToolTipHelper_ReturnValueIndicator") + "</i>";
            String returnType = typePieces[typePieces.length - 1].toString(polymorphicVarContext, namingPolicy);
            String returnValueMetadata;
            if (metadata instanceof FunctionMetadata) {
                returnValueMetadata = ((FunctionMetadata)metadata).getReturnValueDescription();
            } else if (metadata instanceof ClassMethodMetadata) {
                returnValueMetadata = ((ClassMethodMetadata)metadata).getReturnValueDescription();
            } else {
                returnValueMetadata = null;
            }
            CALDocComment.TextBlock returnValueCALDoc;
            if (caldoc != null) {
                returnValueCALDoc = caldoc.getReturnBlock();
            } else {
                returnValueCALDoc = null;
            }
            buildTypeSignatureAndDescription(parent, text, returnValueIndicator, returnType, returnValueMetadata, returnValueCALDoc, true);
   
            // Add the argument descriptions
            NavAddressHelper.isMetadataValid(envEntity, (FunctionalAgentMetadata) metadata);
            ArgumentMetadata[] arguments = ((FunctionalAgentMetadata) metadata).getArguments();
            NavAddressHelper.adjustArgumentNames(envEntity, arguments);

            if (arguments.length > 0) {
                text.append("<br>");               
                text.append("<b>");
                text.append(GemCutter.getResourceString("ToolTipHelper_Arguments"));
                text.append("</b>");
   
                // Process the tagged blocks in the CALDoc to extract the @arg blocks.
                text.append("<br>");
                for (int i = 0; i < arguments.length; i++) {
                    String displayName = arguments[i].getDisplayName();
                    String type = typePieces[i].toString(polymorphicVarContext, namingPolicy);
                    String descriptionFromMetadata = arguments[i].getShortDescription();
                    CALDocComment.TextBlock descriptionFromCALDoc;
                    if (caldoc != null && i < caldoc.getNArgBlocks()) {
                        descriptionFromCALDoc = caldoc.getNthArgBlock(i).getTextBlock();
                    } else {
                        descriptionFromCALDoc = null;
                    }
                   
                    boolean shouldEmitLineBreakSuffix = i < arguments.length - 1;
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.CALDocComment$Segment

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.