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

io.github.vmzakharov.ecdataframe.dataframe.DfObjectColumn Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
package io.github.vmzakharov.ecdataframe.dataframe;

import io.github.vmzakharov.ecdataframe.dsl.value.Value;
import org.eclipse.collections.api.block.function.Function2;
import org.eclipse.collections.api.list.ImmutableList;

public interface DfObjectColumn
extends DfColumn
{
    ImmutableList toList();

    T getTypedObject(int rowIndex);

    Value objectToValue(T anObject);

    @Override
    default Object getObject(int rowIndex)
    {
        return this.getTypedObject(rowIndex);
    }

    default  IV injectIntoBreakOnNulls(
            IV injectedValue,
            Function2 function
    )
    {
        IV result = injectedValue;

        for (int i = 0; i < this.getSize(); i++)
        {
            T current =  this.getTypedObject(i);
            if (current == null)
            {
                return null;
            }

            result = function.apply(result, current);

            if (result == null)
            {
                return null;
            }
        }

        return result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy