All Downloads are FREE. Search and download functionalities are using the official Maven repository.

one.empty3.library1.tree.Class Maven / Gradle / Ivy

Go to download

3D rendering engine. Plus modelling. Expected glsl textures 3d and 2d rendering3D primitives, and a lot of scenes' samples to test.+ Game Jogl reworked, Calculator (numbers and vectors). Java code parser implementation starts (<=1.2)

The newest version!
/*
 *
 *  * Copyright (c) 2024. Manuel Daniel Dahmen
 *  *
 *  *
 *  *    Copyright 2024 Manuel Daniel Dahmen
 *  *
 *  *    Licensed under the Apache License, Version 2.0 (the "License");
 *  *    you may not use this file except in compliance with the License.
 *  *    You may obtain a copy of the License at
 *  *
 *  *        http://www.apache.org/licenses/LICENSE-2.0
 *  *
 *  *    Unless required by applicable law or agreed to in writing, software
 *  *    distributed under the License is distributed on an "AS IS" BASIS,
 *  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  *    See the License for the specific language governing permissions and
 *  *    limitations under the License.
 *
 *
 */

package one.empty3.library1.tree;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;

public class Class {
    private String name;
    private List variableList = new ArrayList<>();
    private List methodList = new ArrayList<>();
    private String accessModifier;
    private boolean mFinal;
    private String packageName;

    public Class() {

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List getVariableList() {
        return variableList;
    }

    public void setVariableList(List variableList) {
        this.variableList = variableList;
    }

    public List getMethodList() {
        return methodList;
    }

    public void setMethodList(List methodList) {
        this.methodList = methodList;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Class aClass = (Class) o;

        if (!Objects.equals(variableList, aClass.variableList))
            return false;
        return Objects.equals(methodList, aClass.methodList);
    }

    @Override
    public int hashCode() {
        int result = variableList != null ? variableList.hashCode() : 0;
        result = 31 * result + (methodList != null ? methodList.hashCode() : 0);
        return result;
    }

    public void setAccessModifier(String searched) {
        this.accessModifier = searched;
    }

    public void setFinal(boolean b) {
        this.mFinal = b;
    }

    public void setPackageName(String packageName) {
        this.packageName = packageName;
    }

    @Override
    public String toString() {
        String[] variableListStr = new String[]{""};
        variableList.forEach(new Consumer() {
            @Override
            public void accept(Variable variable) {
                variableListStr[0] += variable.toString();
            }
        });

        String[] methodListStr = new String[]{""};
        methodList.forEach(new Consumer() {
            @Override
            public void accept(Method method) {
                methodListStr[0] += method.toString();
            }
        });
        String string = "Class{" +
                "name='" + name + '\'' +
                ", variableList=[" + variableListStr[0] +
                "], methodList=[" + methodListStr[0] +
                "], accessModifier='" + accessModifier + '\'' +
                ", mFinal=" + mFinal +
                ", packageName='" + packageName + '\'' +
                '}';

        return string;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        Class clone = new Class();
        clone.setFinal(getFinal());
        clone.setVariableList(getVariableList());
        clone.setMethodList(getMethodList());
        clone.setAccessModifier(getAccessModifier());
        clone.setMethodList((List) ((ArrayList) this.getMethodList()).clone());
        clone.setVariableList((List) ((ArrayList) this.getVariableList()).clone());
        return clone;
    }

    private String getAccessModifier() {
        return accessModifier;
    }

    public boolean getFinal() {
        return mFinal;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy