package io.github.vmzakharov.ecdataframe.dataframe;
import io.github.vmzakharov.ecdataframe.dsl.value.Value;
public interface DfColumnComputed
extends DfColumn
{
@Override
default boolean isStored() { return false; }
String getExpressionAsString();
@Override
default void setObject(int rowIndex, Object anObject)
{
throw new RuntimeException("Cannot set a value on computed column '" + this.getName() + "'");
}
@Override
default void addEmptyValue()
{
}
@Override
default void addValue(Value value)
{
this.throwUnmodifiableColumnException();
}
@Override
default void addObject(Object newObject)
{
if (newObject != null)
{
this.throwUnmodifiableColumnException();
}
}
@Override
default void incrementFrom(int targetRowIndex, DfColumn sourceColumn, int sourceRowIndex)
{
throw new RuntimeException("Cannot increment a value of computed column '" + this.getName() + "'");
}
default void throwUnmodifiableColumnException()
{
throw new UnsupportedOperationException("Cannot modify computed column '" + this.getName() + "'");
}
}