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

io.github.vmzakharov.ecdataframe.dsl.value.VectorValue Maven / Gradle / Ivy

There is a newer version: 1.2.0
Show newest version
package io.github.vmzakharov.ecdataframe.dsl.value;

import io.github.vmzakharov.ecdataframe.dsl.UnaryOp;
import org.eclipse.collections.api.list.ListIterable;
import org.eclipse.collections.impl.factory.Lists;

public record VectorValue(ListIterable elements)
implements Value
{
    public static final VectorValue EMPTY = new VectorValue(Lists.immutable.empty());

    @Override
    public String asStringLiteral()
    {
        return this.elements.makeString(Value::asStringLiteral, "(", ", ", ")");
    }

    @Override
    public ValueType getType()
    {
        return ValueType.VECTOR;
    }

    public ListIterable getElements()
    {
        return this.elements;
    }

    public int size()
    {
        return this.elements.size();
    }

    public Value get(int index)
    {
        return this.elements.get(index);
    }

    @Override
    public Value apply(UnaryOp operation)
    {
        return operation.applyVector(this.elements);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy