Examples of ModelBuilder


Examples of com.badlogic.gdx.graphics.g3d.utils.ModelBuilder

      backgroundColor = new GradientColorValue();
      Color color = Color.valueOf("878787");
      backgroundColor.setColors(new float[] { color.r, color.g, color.b});

      models = new Array<Model>();
      ModelBuilder builder = new ModelBuilder();
      Model   xyzModel = builder.createXYZCoordinates(10, new Material(), Usage.Position|Usage.ColorPacked),
        planeModel = builder.createLineGrid(10, 10, 1, 1, new Material(ColorAttribute.createDiffuse(Color.WHITE)), Usage.Position);
      models.add(xyzModel);
      models.add(planeModel);
      xyzInstance = new ModelInstance(xyzModel);
      xzPlaneInstance = new ModelInstance(planeModel);
      xyPlaneInstance = new ModelInstance(planeModel);
View Full Code Here

Examples of com.thoughtworks.qdox.model.ModelBuilder

            }
        }

        // Create a new builder and mimic the behaviour of the parser.
        // We're getting all the information we need via reflection instead.
        ModelBuilder binaryBuilder =
                new ModelBuilder(classLibrary, docletTagFactory);

        // Set the package name and class name
        if (packageName == null) {
            binaryBuilder.addPackage(getPackageName(name));
        } else {
            binaryBuilder.addPackage(packageName);
        }

        ClassDef classDef = new ClassDef();
        classDef.name = getClassName(name);

        // Set the extended class and interfaces.
        Class[] interfaces = clazz.getInterfaces();
        if (clazz.isInterface()) {
            // It's an interface
            classDef.type = ClassDef.INTERFACE;
            for (int i = 0; i < interfaces.length; i++) {
                Class anInterface = interfaces[i];
                classDef.extendz.add(anInterface.getName());
            }
        } else {
            // It's a class
            for (int i = 0; i < interfaces.length; i++) {
                Class anInterface = interfaces[i];
                classDef.implementz.add(anInterface.getName());
            }
            Class superclass = clazz.getSuperclass();
            if (superclass != null) {
                classDef.extendz.add(superclass.getName());
            }
        }

        addModifiers(classDef.modifiers, clazz.getModifiers());

        binaryBuilder.beginClass(classDef);

        // add the constructors
        //
        // This also adds the default constructor if any which is different
        // to the source code as that does not create a default constructor
        // if no constructor exists.
        Constructor[] constructors = clazz.getDeclaredConstructors();
        for (int i = 0; i < constructors.length; i++) {
            addMethodOrConstructor(constructors[i], binaryBuilder);
        }

        // add the methods
        Method[] methods = clazz.getDeclaredMethods();
        for (int i = 0; i < methods.length; i++) {
            addMethodOrConstructor(methods[i], binaryBuilder);
        }

        Field[] fields = clazz.getDeclaredFields();
        for (int i = 0; i < fields.length; i++) {
            addField(fields[i], binaryBuilder);
        }

        binaryBuilder.endClass();
        JavaSource binarySource = binaryBuilder.getSource();
        // There is always only one class in a "binary" source.
        JavaClass result = binarySource.getClasses()[0];
        return result;
    }
View Full Code Here

Examples of com.thoughtworks.qdox.model.ModelBuilder

    public JavaSource addSource(Reader reader) {
        return addSource(reader, "UNKNOWN SOURCE");
    }

    public JavaSource addSource(Reader reader, String sourceInfo) {
        ModelBuilder builder = new ModelBuilder(classLibrary, docletTagFactory);
        Lexer lexer = new JFlexLexer(reader);
        Parser parser = new Parser(lexer, builder);
        parser.setDebugLexer(debugLexer);
        parser.setDebugParser(debugParser);
        try {
            parser.parse();
        } catch (ParseException e) {
            e.setSourceInfo(sourceInfo);
            throw e;
        }
        JavaSource source = builder.getSource();
        sources.add(source);
        addClasses(source);
        return source;
    }
View Full Code Here

Examples of com.thoughtworks.qdox.model.ModelBuilder

        }
        return result;
    }

    private JavaClass createUnknownClass(String name) {
        ModelBuilder unknownBuilder = new ModelBuilder(classLibrary, docletTagFactory);
        ClassDef classDef = new ClassDef();
        classDef.name = name;
        unknownBuilder.beginClass(classDef);
        unknownBuilder.endClass();
        JavaSource unknownSource = unknownBuilder.getSource();
        JavaClass result = unknownSource.getClasses()[0];
        return result;
    }
View Full Code Here

Examples of com.thoughtworks.qdox.model.ModelBuilder

        if (clazz == null) {
            return null;
        } else {
            // Create a new builder and mimic the behaviour of the parser.
            // We're getting all the information we need via reflection instead.
            ModelBuilder binaryBuilder = new ModelBuilder(classLibrary, docletTagFactory);

            // Set the package name and class name
            String packageName = getPackageName(name);
            binaryBuilder.addPackage(packageName);

            ClassDef classDef = new ClassDef();
            classDef.name = getClassName(name);

            // Set the extended class and interfaces.
            Class[] interfaces = clazz.getInterfaces();
            if (clazz.isInterface()) {
                // It's an interface
                classDef.type = ClassDef.INTERFACE;
                for (int i = 0; i < interfaces.length; i++) {
                    Class anInterface = interfaces[i];
                    classDef.extendz.add(anInterface.getName());
                }
            } else {
                // It's a class
                for (int i = 0; i < interfaces.length; i++) {
                    Class anInterface = interfaces[i];
                    classDef.implementz.add(anInterface.getName());
                }
                Class superclass = clazz.getSuperclass();
                if (superclass != null) {
                    classDef.extendz.add(superclass.getName());
                }
            }

            addModifiers(classDef.modifiers, clazz.getModifiers());

            binaryBuilder.beginClass(classDef);

            // add the constructors
            Constructor[] constructors = clazz.getConstructors();
            for (int i = 0; i < constructors.length; i++) {
                addMethodOrConstructor(constructors[i], binaryBuilder);
            }

            // add the methods
            Method[] methods = clazz.getMethods();
            for (int i = 0; i < methods.length; i++) {
                // Ignore methods defined in superclasses
                if (methods[i].getDeclaringClass() == clazz) {
                    addMethodOrConstructor(methods[i], binaryBuilder);
                }
            }

            Field[] fields = clazz.getFields();
            for (int i = 0; i < fields.length; i++) {
                if (fields[i].getDeclaringClass() == clazz) {
                    addField(fields[i], binaryBuilder);
                }
            }

            binaryBuilder.endClass();
            JavaSource binarySource = binaryBuilder.getSource();
            // There is always only one class in a "binary" source.
            JavaClass result = binarySource.getClasses()[0];
            return result;
        }
    }
View Full Code Here

Examples of com.thoughtworks.qdox.model.ModelBuilder

        }
        return null;
    }

    protected JavaClass createUnknownClass(String name) {
        ModelBuilder unknownBuilder = new ModelBuilder(context, docletTagFactory, new HashMap());
        ClassDef classDef = new ClassDef();
        classDef.name = name;
        unknownBuilder.beginClass(classDef);
        unknownBuilder.endClass();
        JavaSource unknownSource = unknownBuilder.getSource();
        JavaClass result = unknownSource.getClasses()[0];
        return result;
    }
View Full Code Here

Examples of com.thoughtworks.qdox.model.ModelBuilder

            return null;
        } else {
            try {
        // Create a new builder and mimic the behaviour of the parser.
        // We're getting all the information we need via reflection instead.
        ModelBuilder binaryBuilder = new ModelBuilder(context, docletTagFactory, new HashMap());

        // Set the package name and class name
        String packageName = getPackageName(name);
        binaryBuilder.addPackage(new PackageDef(packageName));

        ClassDef classDef = new ClassDef();
        classDef.name = getClassName(name);

        // Set the extended class and interfaces.
        Class[] interfaces = clazz.getInterfaces();
        if (clazz.isInterface()) {
            // It's an interface
            classDef.type = ClassDef.INTERFACE;
            for (int i = 0; i < interfaces.length; i++) {
                Class anInterface = interfaces[i];
                classDef.extendz.add(new TypeDef(anInterface.getName()));
            }
        } else {
            // It's a class
            for (int i = 0; i < interfaces.length; i++) {
                Class anInterface = interfaces[i];
                classDef.implementz.add(new TypeDef(anInterface.getName()));
            }
            Class superclass = clazz.getSuperclass();
            if (superclass != null) {
                classDef.extendz.add(new TypeDef(superclass.getName()));
            }
        }

        addModifiers(classDef.modifiers, clazz.getModifiers());

        binaryBuilder.beginClass(classDef);

        // add the constructors
        //
        // This also adds the default constructor if any which is different
        // to the source code as that does not create a default constructor
        // if no constructor exists.
        Constructor[] constructors = clazz.getDeclaredConstructors();
        for (int i = 0; i < constructors.length; i++) {
            addMethodOrConstructor(constructors[i], binaryBuilder);
        }

        // add the methods
        Method[] methods = clazz.getDeclaredMethods();
        for (int i = 0; i < methods.length; i++) {
            addMethodOrConstructor(methods[i], binaryBuilder);
        }

        Field[] fields = clazz.getDeclaredFields();
        for (int i = 0; i < fields.length; i++) {
            addField(fields[i], binaryBuilder);
        }

        binaryBuilder.endClass();
        JavaSource binarySource = binaryBuilder.getSource();
        // There is always only one class in a "binary" source.
        JavaClass result = binarySource.getClasses()[0];
        return result;
      } catch (NoClassDefFoundError e) {
        return null;
View Full Code Here

Examples of com.thoughtworks.qdox.model.ModelBuilder

    public JavaSource addSource(Reader reader) {
        return addSource(reader, "UNKNOWN SOURCE");
    }

    public JavaSource addSource(Reader reader, String sourceInfo) {
        ModelBuilder builder = new ModelBuilder(context, docletTagFactory, null);
        Lexer lexer = new JFlexLexer(reader);
        Parser parser = new Parser(lexer, builder);
        parser.setDebugLexer(debugLexer);
        parser.setDebugParser(debugParser);
        try {
            parser.parse();
        } catch (ParseException e) {
            e.setSourceInfo(sourceInfo);
            errorHandler.handle(e);
        }
        JavaSource source = builder.getSource();
        sources.add(source);
        addClasses(source);

        JavaPackage pkg = context.getPackageByName( source.getPackageName() );
        if (!packages.contains(pkg)) {
View Full Code Here

Examples of hex.ModelBuilder

    if (null != m.model_builders) {
      this.model_builders = new IcedHashMap<>();

      int i = 0;
      for (Map.Entry<String, ModelBuilder> entry: m.model_builders.entrySet()) {
        ModelBuilder model_builder = entry.getValue();
        String algo = entry.getKey();
        this.model_builders.put(algo, model_builder.schema().fillFromImpl(entry.getValue()));
      }
    }
    return this;
  }
View Full Code Here

Examples of hex.ModelBuilder

        Type[] handler_type_parms = ((ParameterizedType)(clz.getGenericSuperclass())).getActualTypeArguments();
        // [0] is the Model type; [1] is the Model.Parameters type; [2] is the Model.Output type.
        Class<? extends Model.Parameters> pclz = (Class<? extends Model.Parameters>)handler_type_parms[1];

        ModelBuilder modelbuilder = clz.getDeclaredConstructor(new Class[] { (Class)handler_type_parms[1] }).newInstance(pclz.newInstance());
        m.model_builders.put(algo, modelbuilder);
      }
      catch (Exception e) {
        throw H2O.fail("Exception when trying to instantiate ModelBuilder for: " + entry.getKey() + ": " + e);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.