Package factories

Source Code of factories.Sizes$Get3D

package factories;

import graphics.common.Size;
import graphics.common.Size2D;
import graphics.common.Size3D;
import utils.GlobalData;

public class Sizes {

    private static final int MAX_RECYCLED = 2000;

    private static SizeGet[] getters;

    public Sizes() {
        getters = new SizeGet[] { new Get2D(), new Get3D() };
    }

    public static Size get( double width, double height, double depth ) {
        return getters[ GlobalData.GRAPHICS_DIMENSIONS.getValue() ].get( width, height, depth );
    }

    public static Size get( double width, double height ) {
        return getters[ GlobalData.GRAPHICS_DIMENSIONS.getValue() ].get( width, height, 0 );
    }

    private interface SizeGet {
        public Size get( double width, double height, double depth );
    }

    private class Get2D implements SizeGet {
        @Override
        public Size get( double width, double height, double depth ) {
                return new Size2D( width, height );
        }
    }

    private class Get3D implements SizeGet {
        @Override
        public Size get( double width, double height, double depth ) {
                return new Size3D( width, height, depth );
        }
    }
}
TOP

Related Classes of factories.Sizes$Get3D

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.