<repo_name>stefanociccalotti/linear-problems<file_sep>/src/vectorSpace/euclidean/EuclideanVector.java
package vectorSpace.euclidean;

import vectorSpace.Vector;

public class EuclideanVector implements Vector{
    private int components[];
    private int dimension;

    public EuclideanVector() {}

    public EuclideanVector(int dimension) {
        this.components = new int[dimension];
        this.dimension = dimension;
    }

    public EuclideanVector(int[] components) {
        this.components = components;
        this.dimension = components.length;
    }

    public int[] getComponents() {
        return this.components;
    }
    public int getAxisComponent(int axis) {
        return this.components[axis];
    }
    public int getDimension() {
        return this.dimension;
    }
    public void setComponents(int[] components) {
        this.components = components;
    }
    public void setAxisComponent(int axis, int component) {
        this.components[axis] = component;
    }

    public void copyVector(Vector v) {
        int[] components = new int[v.getDimension()];
        int[] tempComponents = v.getComponents();

        for(int i = 0; i < components.length; i++) {
            components[i] = tempComponents[i];
        }
        this.components = components;
    }

    public String toString() {
        String s = "(";
        int i;

        for(i = 0; i < components.length-1; i++) {
            s+=components[i]+", ";
        }
        s+=components[i]+")\n";

        return s;
    }
}
<file_sep>/src/LinearCombination.java
import vectorSpace.*;
import vectorSpace.euclidean.*;

public class LinearCombination {
    public static void main(String[] args) {

        //wtf

        Vector[] base = new EuclideanVector[]{  new EuclideanVector(new int[]{0, 0, 1}),
                                                new EuclideanVector(new int[]{0, 1, 0}),
                                                new EuclideanVector(new int[]{1, 0, 0}) 
                                            };
        Space space = new EuclideanSpaceCanonicalBase(base);

        Vector v1 = new EuclideanVector(new int[]{1, 2, 3});
        Vector v2 = new EuclideanVector(new int[]{1, 6, 2});

        space.associateVector(v1);
        space.associateVector(v2);



        Vector v3 = new EuclideanVector();

        v3.copyVector(v1);
        
        EuclideanSpaceCanonicalBase.scaleEuclideanVector(v3, 2);

        EuclideanSpaceCanonicalBase.addEuclideanVectors(v3, v2);

        space.associateVector(v3);

        space.printSpaceAndVectors();

    }
}
