class Light {

    String name;
    float r, g, b;
    boolean on;
	
    void onLight() {
        on = true;
        System.out.println(name + " is turned on.");
    }
    
    void offLight() {
        on = false;
        System.out.println(name + " is turned off.");
    }	

    void onOrOff () {
        if ( on == true ) 
            System.out.println(name + " is on.");
        else System.out.println(name + " is off.");
    }
          
    // 名前をセットする.
    void setName(String newName) {
    	name = newName;
    }
    
    // 照明の色をセットする.
    void setColor(float red, float green, float blue) {
        r = red; g = green; b = blue;
    }
}

class DirectionalLight extends Light {
    float xRay, yRay, zRay; // 光線の向きを表すベクトル
    
    // 光線の方向の取り出し
    float[] getDirection() {
        float direct[] = new float[3];
        direct[0] = xRay; direct[1] = yRay; direct[2] = zRay;
        return direct; 
    }
    
    // 光線の方向の変更
    void changeDirection(float xDirect, float yDirect, float zDirect) {
        xRay = xDirect; yRay = yDirect; zRay = zDirect;
    } 
}

class PointLight extends Light {
    // 点光源の座標
    float x, y, z;
    
    // 位置座標の取り出し
    float[] getPosition() {
        float pos[] = new float[3];
        pos[0] = x; pos[1] = y; pos[2] = z;
        return pos;
    }
    
    // 位置座標の変更
    void changePosition( float xNew, float yNew, float zNew ) {
        x = xNew; y = yNew; z = zNew;
    } 
}    

class SpotLight extends PointLight {
    // 光線の最も強い方向
    float xRayMax, yRayMax, zRayMax;
     
    // 光線の最も強い方向の取り出し
    float[] getDirection() {
        float direct[] = new float[3];
        direct[0] = xRayMax; direct[1] = yRayMax; direct[2] = zRayMax;
        return direct;
    }
    
    // 光線の最も強い方向の変更
    void changeDirection(float xDirect, float yDirect, float zDirect) {
        xRayMax = xDirect; yRayMax = yDirect; zRayMax = zDirect;
    }     
}

class LightTest1 {
    public static void main(String args[]) {
        // DirectionalLightクラスのインスタンス化
        DirectionalLight dLight = new DirectionalLight(); 
        dLight.setName("directinalLight0"); // 名前の設定
        dLight.setColor(1.0f, 1.0f, 1.0f); // 白色光(単精度浮動小数点)
        dLight.onLight();
        
        // PointLightクラスのインスタンス化
        PointLight pLight = new PointLight();
        pLight.setName("pointLight0"); // 名前の設定
        pLight.setColor(1.0f, 0.0f, 0.0f); // 赤色光(単精度浮動小数点)
        pLight.onLight();
        
        // SpotLightクラスのインスタンス化
        SpotLight sLight = new SpotLight();
        sLight.setName("spotLight0"); // 名前の設定
        sLight.setColor(0.0f, 1.0f, 0.0f); // 緑色光(単精度浮動小数点)
        sLight.onLight(); 
    
        sLight.onOrOff(); // オン・オフを尋ねる.
    
        sLight.offLight(); // 点灯
        sLight.onOrOff(); // オン・オフを尋ねる.
        
        // スポットライトの光線の最も強い方向の変更
        sLight.changeDirection(0.0f, 0.0f, -1.0f);
        // 光線の最も強い方向の取り出し
        float ray[] = new float[3];
        ray = sLight.getDirection();
        System.out.println("Max Light Direction of "+sLight.name+
                           " is ("+ray[0]+","+ray[1]+","+ray[2]+").");
 
     }
}        
