<commit_before>/*
 * Copyright (c) 2014. Massachusetts Institute of Technology
 * Released under the BSD 2-Clause License
 * http://opensource.org/licenses/BSD-2-Clause
 */

package bits.math3d;

import java.util.NoSuchElementException;


/**
 * 3-dimensional vector.
 *
 * Extending {@code Vec2} might seem kind of weird, but I tested allocation time and it was
 * slower by about 2%. I was using arrays before, which are nice and general purpose, but
 * require an extra 4 bytes of memory, are slower to createGeom, and require runtime rangeOf checks.
 *
 * @author <NAME>
 */
public class Vec4 extends Vec3 {

    public float w;

    public Vec4() {}


    public Vec4( float x, float y, float z, float w ) {
        this.x = x;
        this.y = y;
        this.z = z;
        this.w = w;
    }


    public Vec4( Vec4 copy ) {
        this.x = copy.x;
        this.y = copy.y;
        this.z = copy.z;
        this.w = copy.w;
    }



//    public Vec4( float... xyzw ) {
//        x = xyzw[0];
//        y = xyzw[1];
//        z = xyzw[2];
//        w = xyzw[3];
//    }
//
//
//    public Vec4( double... xyzw ) {
//        x = (float)xyzw[0];
//        y = (float)xyzw[1];
//        z = (float)xyzw[2];
//        w = (float)xyzw[3];
//    }



    public float el( int d ) {
        switch( d ) {
        case 0: return x;
        case 1: return y;
        case 2: return z;
        case 3: return w;
        default:
            throw new NoSuchElementException();
        }
    }


    public void el( int d, float v ) {
        switch( d ) {
        case 0: x = v; return;
        case 1: y = v; return;
        case 2: z = v; return;
        case 3: w = v; return;
        default:
            throw new NoSuchElementException();
        }
    }<commit_msg>Minor cleanup.<commit_after>/*
 * Copyright (c) 2014. Massachusetts Institute of Technology
 * Released under the BSD 2-Clause License
 * http://opensource.org/licenses/BSD-2-Clause
 */

package bits.math3d;

import java.util.NoSuchElementException;


/**
 * 3-dimensional vector.
 *
 * Extending {@code Vec2} might seem kind of weird, but I tested allocation time and it was
 * slower by about 2%. I was using arrays before, which are nice and general purpose, but
 * require an extra 4 bytes of memory, are slower to createGeom, and require runtime rangeOf checks.
 *
 * @author <NAME>
 */
public class Vec4 extends Vec3 {

    public float w;


    public Vec4() {}


    public Vec4( float x, float y, float z, float w ) {
        this.x = x;
        this.y = y;
        this.z = z;
        this.w = w;
    }


    public Vec4( Vec4 copy ) {
        this.x = copy.x;
        this.y = copy.y;
        this.z = copy.z;
        this.w = copy.w;
    }



    public float el( int d ) {
        switch( d ) {
        case 0: return x;
        case 1: return y;
        case 2: return z;
        case 3: return w;
        default:
            throw new NoSuchElementException();
        }
    }


    public void el( int d, float v ) {
        switch( d ) {
        case 0: x = v; return;
        case 1: y = v; return;
        case 2: z = v; return;
        case 3: w = v; return;
        default:
            throw new NoSuchElementException();
        }
    }
{'fraction_non_alphanumeric': 0.11795665634674922, 'fraction_numerical': 0.018575851393188854, 'mean_word_length': 1.7174095878889823, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4105828', 'n_tokens_mistral': 1087, 'n_tokens_neox': 1028, 'n_words': 367}