Search in sources :

Example 1 with HashedMap

use of php.runtime.common.collections.map.HashedMap in project jphp by jphp-compiler.

the class DocGenerator method generate.

public void generate(File targetDirectory, String language) {
    if (!targetDirectory.exists())
        if (!targetDirectory.mkdirs())
            throw new IllegalStateException("Cannot create target directory");
    SphinxTemplate sphinxTemplate = new SphinxTemplate(language, languages.get(language));
    List<ApiDocument> documents = new ArrayList<ApiDocument>();
    for (File file : files) {
        ApiDocument document = new ApiDocument(parseFile(file), sphinxTemplate);
        documents.add(document);
    }
    Map<String, ClassDescription> classMap = new HashedMap<String, ClassDescription>();
    for (ApiDocument document : documents) {
        classMap.putAll(document.getClasses());
    }
    for (ClassDescription el : classMap.values()) {
        if (el.getExtends() != null) {
            ClassDescription parent = classMap.get(el.getExtends().toLowerCase());
            if (parent != null) {
                parent.addChildClass(el);
            }
        }
    }
    for (ApiDocument document : documents) {
        document.generate(targetDirectory, language, classMap);
    }
}
Also used : ArrayList(java.util.ArrayList) SphinxTemplate(org.develnext.jphp.genapi.template.SphinxTemplate) ClassDescription(org.develnext.jphp.genapi.description.ClassDescription) HashedMap(php.runtime.common.collections.map.HashedMap) File(java.io.File)

Example 2 with HashedMap

use of php.runtime.common.collections.map.HashedMap in project jphp by jphp-compiler.

the class Closure method getOrCreateStatic.

public Memory getOrCreateStatic(String name, Memory initValue) {
    if (statics == null)
        statics = new HashedMap<String, ReferenceMemory>();
    ReferenceMemory result = statics.get(name);
    if (result == null) {
        result = new ReferenceMemory(initValue);
        statics.put(name, result);
    }
    return result;
}
Also used : ReferenceMemory(php.runtime.memory.ReferenceMemory) HashedMap(php.runtime.common.collections.map.HashedMap)

Aggregations

HashedMap (php.runtime.common.collections.map.HashedMap)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 ClassDescription (org.develnext.jphp.genapi.description.ClassDescription)1 SphinxTemplate (org.develnext.jphp.genapi.template.SphinxTemplate)1 ReferenceMemory (php.runtime.memory.ReferenceMemory)1