rename SingleFullDataAccessor -> SingleColumnFullDataAccessor

This commit is contained in:
James Seibel
2023-04-23 14:51:13 -05:00
parent e1c0299368
commit 9ea5aba0ab
11 changed files with 47 additions and 47 deletions
@@ -7,7 +7,7 @@ import com.seibel.lod.api.objects.data.DhApiTerrainDataPoint;
import com.seibel.lod.api.interfaces.data.IDhApiTerrainDataRepo;
import com.seibel.lod.api.objects.math.DhApiVec3i;
import com.seibel.lod.core.api.internal.SharedApi;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleColumnFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.sources.IFullDataSource;
import com.seibel.lod.core.util.FullDataPointUtil;
import com.seibel.lod.core.dataObjects.fullData.FullDataPointIdMap;
@@ -209,7 +209,7 @@ public class DhApiTerrainDataRepo implements IDhApiTerrainDataRepo
{
// attempt to get the LOD data from the data source
FullDataPointIdMap mapping = dataSource.getMapping();
SingleFullDataAccessor dataColumn = dataSource.tryGet(relativePos.x, relativePos.z);
SingleColumnFullDataAccessor dataColumn = dataSource.tryGet(relativePos.x, relativePos.z);
if (dataColumn != null)
{
int dataColumnIndexCount = dataColumn.getSingleLength();
@@ -1,6 +1,6 @@
package com.seibel.lod.core.dataObjects.fullData;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleColumnFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.sources.CompleteFullDataSource;
import com.seibel.lod.core.dataObjects.fullData.sources.IFullDataSource;
import com.seibel.lod.core.file.fullDatafile.IFullDataSourceProvider;
@@ -101,7 +101,7 @@ public class FullDataDownSampler {
for (int ox = 0; ox < overlappedTrgDataSize; ox++) {
for (int oz = 0; oz < overlappedTrgDataSize; oz++) {
SingleFullDataAccessor column = target.get(ox + offsetX, oz + offsetZ);
SingleColumnFullDataAccessor column = target.get(ox + offsetX, oz + offsetZ);
column.downsampleFrom(source.subView(srcDataPerTrgData, ox * srcDataPerTrgData, oz * srcDataPerTrgData));
}
}
@@ -124,7 +124,7 @@ public class FullDataArrayAccessor implements IFullDataAccessor
{
for (int zOffset = 0; zOffset < this.width; zOffset++)
{
SingleFullDataAccessor column = this.get(xOffset, zOffset);
SingleColumnFullDataAccessor column = this.get(xOffset, zOffset);
column.downsampleFrom(fullDataAccessor.subView(dataPointsPerWidthUnit, xOffset * dataPointsPerWidthUnit, zOffset * dataPointsPerWidthUnit));
}
}
@@ -140,9 +140,9 @@ public class FullDataArrayAccessor implements IFullDataAccessor
public FullDataPointIdMap getMapping() { return this.mapping; }
@Override
public SingleFullDataAccessor get(int index) { return this.get(index / this.width, index % this.width); }
public SingleColumnFullDataAccessor get(int index) { return this.get(index / this.width, index % this.width); }
@Override
public SingleFullDataAccessor get(int relativeX, int relativeZ) { return new SingleFullDataAccessor(this.mapping, this.dataArrays, relativeX * this.width + relativeZ + this.offset); }
public SingleColumnFullDataAccessor get(int relativeX, int relativeZ) { return new SingleColumnFullDataAccessor(this.mapping, this.dataArrays, relativeX * this.width + relativeZ + this.offset); }
@Override
public int width() { return this.width; }
@@ -19,8 +19,8 @@ public interface IFullDataAccessor
FullDataPointIdMap getMapping();
/** generally used for iterating through the whole data set */
SingleFullDataAccessor get(int index);
SingleFullDataAccessor get(int relativeX, int relativeZ);
SingleColumnFullDataAccessor get(int index);
SingleColumnFullDataAccessor get(int relativeX, int relativeZ);
/** measured in full data points */
int width();
@@ -35,9 +35,9 @@ public interface IFullDataAccessor
/** Returns an iterator that goes over each data column */
default Iterator<SingleFullDataAccessor> iterator()
default Iterator<SingleColumnFullDataAccessor> iterator()
{
return new Iterator<SingleFullDataAccessor>()
return new Iterator<SingleColumnFullDataAccessor>()
{
private int index = 0;
private final int size = width() * width();
@@ -46,7 +46,7 @@ public interface IFullDataAccessor
public boolean hasNext() { return this.index < this.size; }
@Override
public SingleFullDataAccessor next()
public SingleColumnFullDataAccessor next()
{
LodUtil.assertTrue(this.hasNext(), "No more data to iterate!");
return get(this.index++);
@@ -8,7 +8,7 @@ import com.seibel.lod.core.util.FullDataPointUtil;
*
* @see FullDataPointUtil
*/
public class SingleFullDataAccessor implements IFullDataAccessor
public class SingleColumnFullDataAccessor implements IFullDataAccessor
{
/**
* A flattened 2D array (for the X and Z directions) containing an array for the Y direction.
@@ -16,13 +16,13 @@ public class SingleFullDataAccessor implements IFullDataAccessor
* @see FullDataArrayAccessor#dataArrays
*/
private final long[][] dataArrays;
/** indicates what index of the {@link SingleFullDataAccessor#dataArrays} is used by this accessor */
/** indicates what index of the {@link SingleColumnFullDataAccessor#dataArrays} is used by this accessor */
private final int dataArrayIndex;
private final FullDataPointIdMap mapping;
public SingleFullDataAccessor(FullDataPointIdMap mapping, long[][] dataArrays, int dataArrayIndex)
public SingleColumnFullDataAccessor(FullDataPointIdMap mapping, long[][] dataArrays, int dataArrayIndex)
{
this.dataArrays = dataArrays;
this.dataArrayIndex = dataArrayIndex;
@@ -37,7 +37,7 @@ public class SingleFullDataAccessor implements IFullDataAccessor
public FullDataPointIdMap getMapping() { return this.mapping; }
@Override
public SingleFullDataAccessor get(int index)
public SingleColumnFullDataAccessor get(int index)
{
if (index != 0)
{
@@ -48,7 +48,7 @@ public class SingleFullDataAccessor implements IFullDataAccessor
}
@Override
public SingleFullDataAccessor get(int relativeX, int relativeZ)
public SingleColumnFullDataAccessor get(int relativeX, int relativeZ)
{
if (relativeX != 0 || relativeZ != 0)
{
@@ -77,14 +77,14 @@ public class SingleFullDataAccessor implements IFullDataAccessor
{
if (width != 1 || xOffset != 1 || zOffset != 1)
{
throw new IllegalArgumentException("Getting invalid range of subView from SingleFullDataAccessor!");
throw new IllegalArgumentException("Getting invalid range of subView from SingleColumnFullDataAccessor!");
}
return this;
}
/** WARNING: This may potentially share the underlying array objects! */
public void shadowCopyTo(SingleFullDataAccessor target)
public void shadowCopyTo(SingleColumnFullDataAccessor target)
{
if (target.mapping.equals(this.mapping))
{
@@ -105,7 +105,7 @@ public class SingleFullDataAccessor implements IFullDataAccessor
}
/** Copies both ID data and mapping data. */
public void deepCopyTo(SingleFullDataAccessor target)
public void deepCopyTo(SingleColumnFullDataAccessor target)
{
if (target.mapping.equals(this.mapping))
{
@@ -131,7 +131,7 @@ public class SingleFullDataAccessor implements IFullDataAccessor
public void downsampleFrom(IFullDataAccessor source)
{
//TODO: average the data instead of just picking the first column
SingleFullDataAccessor firstColumn = source.get(0);
SingleColumnFullDataAccessor firstColumn = source.get(0);
firstColumn.deepCopyTo(this);
}
@@ -4,7 +4,7 @@ import com.seibel.lod.api.enums.worldGeneration.EDhApiWorldGenerationStep;
import com.seibel.lod.core.dataObjects.fullData.FullDataPointIdMap;
import com.seibel.lod.core.dataObjects.fullData.accessor.ChunkSizedFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.FullDataArrayAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleColumnFullDataAccessor;
import com.seibel.lod.core.level.IDhLevel;
import com.seibel.lod.core.pos.DhBlockPos2D;
import com.seibel.lod.core.pos.DhLodPos;
@@ -65,7 +65,7 @@ public class CompleteFullDataSource extends FullDataArrayAccessor implements IFu
public EDhApiWorldGenerationStep getWorldGenStep() { return EDhApiWorldGenerationStep.EMPTY; }
@Override
public SingleFullDataAccessor tryGet(int relativeX, int relativeZ) { return this.get(relativeX, relativeZ); }
public SingleColumnFullDataAccessor tryGet(int relativeX, int relativeZ) { return this.get(relativeX, relativeZ); }
@Override
public void update(ChunkSizedFullDataAccessor chunkDataView)
@@ -86,7 +86,7 @@ public class CompleteFullDataSource extends FullDataArrayAccessor implements IFu
{
for (int z = 0; z < LodUtil.CHUNK_WIDTH; z++)
{
SingleFullDataAccessor column = this.get(x + blockOffset.x, z + blockOffset.z);
SingleColumnFullDataAccessor column = this.get(x + blockOffset.x, z + blockOffset.z);
LodUtil.assertTrue(column.doesColumnExist());
}
}
@@ -108,7 +108,7 @@ public class CompleteFullDataSource extends FullDataArrayAccessor implements IFu
{
for (int zOffset = 0; zOffset < fullSize; zOffset++)
{
SingleFullDataAccessor column = this.get(xOffset + offsetX, zOffset + offsetZ);
SingleColumnFullDataAccessor column = this.get(xOffset + offsetX, zOffset + offsetZ);
column.downsampleFrom(chunkDataView.subView(dataPerFull, xOffset * dataPerFull, zOffset * dataPerFull));
}
}
@@ -255,7 +255,7 @@ public class CompleteFullDataSource extends FullDataArrayAccessor implements IFu
{
for (int z = 0; z < this.width; z++)
{
SingleFullDataAccessor column = this.get(x, z);
SingleColumnFullDataAccessor column = this.get(x, z);
if (!column.doesColumnExist())
continue;
@@ -332,7 +332,7 @@ public class CompleteFullDataSource extends FullDataArrayAccessor implements IFu
{
for (int zOffset = 0; zOffset < count; zOffset++)
{
SingleFullDataAccessor column = this.get(xOffset + dataOffsetX, zOffset + dataOffsetZ);
SingleColumnFullDataAccessor column = this.get(xOffset + dataOffsetX, zOffset + dataOffsetZ);
column.downsampleFrom(subData.subView(dataPerCount, xOffset * dataPerCount, zOffset * dataPerCount));
}
}
@@ -4,7 +4,7 @@ import com.seibel.lod.api.enums.worldGeneration.EDhApiWorldGenerationStep;
import com.seibel.lod.core.dataObjects.fullData.FullDataPointIdMap;
import com.seibel.lod.core.dataObjects.fullData.accessor.ChunkSizedFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.IFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleColumnFullDataAccessor;
import com.seibel.lod.core.dataObjects.render.ColumnRenderSource;
import com.seibel.lod.core.file.fullDatafile.FullDataMetaFile;
import com.seibel.lod.core.level.IDhLevel;
@@ -76,7 +76,7 @@ public interface IFullDataSource
* Attempts to get the data column for the given relative x and z position.
* @return null if the data doesn't exist
*/
public abstract SingleFullDataAccessor tryGet(int relativeX, int relativeZ);
public abstract SingleColumnFullDataAccessor tryGet(int relativeX, int relativeZ);
public abstract FullDataPointIdMap getMapping();
@@ -4,7 +4,7 @@ import com.seibel.lod.api.enums.worldGeneration.EDhApiWorldGenerationStep;
import com.seibel.lod.core.dataObjects.fullData.FullDataPointIdMap;
import com.seibel.lod.core.dataObjects.fullData.accessor.ChunkSizedFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.FullDataArrayAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleColumnFullDataAccessor;
import com.seibel.lod.core.file.fullDatafile.FullDataMetaFile;
import com.seibel.lod.core.level.IDhLevel;
import com.seibel.lod.core.pos.DhLodPos;
@@ -137,7 +137,7 @@ public class SparseFullDataSource implements IIncompleteFullDataSource
{
for (int zOffset = 0; zOffset < count; zOffset++)
{
SingleFullDataAccessor column = newArray.get(xOffset, zOffset);
SingleColumnFullDataAccessor column = newArray.get(xOffset, zOffset);
column.downsampleFrom(chunkDataView.subView(dataPerCount, xOffset * dataPerCount, zOffset * dataPerCount));
}
}
@@ -286,7 +286,7 @@ public class SparseFullDataSource implements IIncompleteFullDataSource
{
for (int z = 0; z < array.width(); z++)
{
SingleFullDataAccessor column = array.get(x, z);
SingleColumnFullDataAccessor column = array.get(x, z);
LodUtil.assertTrue(column.getMapping() == this.mapping); // the mappings must be exactly equal!
if (column.doesColumnExist())
@@ -512,7 +512,7 @@ public class SparseFullDataSource implements IIncompleteFullDataSource
return fullDataSource;
}
public SingleFullDataAccessor tryGet(int relativeX, int relativeZ)
public SingleColumnFullDataAccessor tryGet(int relativeX, int relativeZ)
{
LodUtil.assertTrue(relativeX >=0 && relativeX <SECTION_SIZE && relativeZ >=0 && relativeZ <SECTION_SIZE);
int chunkX = relativeX / this.dataPerChunk;
@@ -4,7 +4,7 @@ import com.seibel.lod.api.enums.worldGeneration.EDhApiWorldGenerationStep;
import com.seibel.lod.core.dataObjects.fullData.FullDataPointIdMap;
import com.seibel.lod.core.dataObjects.fullData.accessor.ChunkSizedFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.FullDataArrayAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleColumnFullDataAccessor;
import com.seibel.lod.core.file.fullDatafile.FullDataMetaFile;
import com.seibel.lod.core.level.IDhLevel;
import com.seibel.lod.core.logging.DhLoggerBuilder;
@@ -295,7 +295,7 @@ public class SpottyFullDataSource extends FullDataArrayAccessor implements IInco
{
for (int zOffset = 0; zOffset < dataSpan; zOffset++)
{
SingleFullDataAccessor column = sparseSource.tryGet(
SingleColumnFullDataAccessor column = sparseSource.tryGet(
xOffset * chunksPerData * sparseSource.dataPerChunk,
zOffset * chunksPerData * sparseSource.dataPerChunk);
@@ -321,7 +321,7 @@ public class SpottyFullDataSource extends FullDataArrayAccessor implements IInco
int offsetX = dataLodPos.x - thisLodPos.x;
int offsetZ = dataLodPos.z - thisLodPos.z;
SingleFullDataAccessor column = sparseSource.tryGet(0, 0);
SingleColumnFullDataAccessor column = sparseSource.tryGet(0, 0);
if (column != null)
{
column.deepCopyTo(this.get(offsetX, offsetZ));
@@ -395,7 +395,7 @@ public class SpottyFullDataSource extends FullDataArrayAccessor implements IInco
//
@Override
public SingleFullDataAccessor tryGet(int relativeX, int relativeZ) { return this.isColumnNotEmpty.get(relativeX * SECTION_SIZE + relativeZ) ? this.get(relativeX, relativeZ) : null; }
public SingleColumnFullDataAccessor tryGet(int relativeX, int relativeZ) { return this.isColumnNotEmpty.get(relativeX * SECTION_SIZE + relativeZ) ? this.get(relativeX, relativeZ) : null; }
@@ -1,7 +1,7 @@
package com.seibel.lod.core.dataObjects.transformers;
import com.seibel.lod.core.dataObjects.fullData.FullDataPointIdMap;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleColumnFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.sources.CompleteFullDataSource;
import com.seibel.lod.core.dataObjects.fullData.sources.IIncompleteFullDataSource;
import com.seibel.lod.core.util.RenderDataPointUtil;
@@ -75,7 +75,7 @@ public class FullToColumnTransformer
throwIfThreadInterrupted();
ColumnArrayView columnArrayView = columnSource.getVerticalDataPointView(x, z);
SingleFullDataAccessor fullArrayView = fullDataSource.get(x, z);
SingleColumnFullDataAccessor fullArrayView = fullDataSource.get(x, z);
convertColumnData(level, baseX + x, baseZ + z, columnArrayView, fullArrayView, 1);
if (fullArrayView.doesColumnExist())
@@ -96,7 +96,7 @@ public class FullToColumnTransformer
// for (int x = 0; x < pos.getWidth(dataDetail).value; x++) {
// for (int z = 0; z < pos.getWidth(dataDetail).value; z++) {
// ColumnArrayView columnArrayView = columnSource.getVerticalDataView(x, z);
// SingleFullDataAccessor fullArrayView = data.get(x, z);
// SingleColumnFullDataAccessor fullArrayView = data.get(x, z);
// convertColumnData(level, columnArrayView, fullArrayView);
// }
// }
@@ -136,7 +136,7 @@ public class FullToColumnTransformer
{
throwIfThreadInterrupted();
SingleFullDataAccessor fullArrayView = data.tryGet(x, z);
SingleColumnFullDataAccessor fullArrayView = data.tryGet(x, z);
if (fullArrayView == null)
{
continue;
@@ -188,7 +188,7 @@ public class FullToColumnTransformer
throwIfThreadInterrupted();
ColumnArrayView columnArrayView = render.getVerticalDataPointView(renderOffsetX + x, renderOffsetZ + z);
SingleFullDataAccessor fullArrayView = chunkDataView.get(x, z);
SingleColumnFullDataAccessor fullArrayView = chunkDataView.get(x, z);
convertColumnData(level, blockX + perRenderWidth * (renderOffsetX + x),
blockZ + perRenderWidth * (renderOffsetZ + z),
columnArrayView, fullArrayView, 2);
@@ -226,7 +226,7 @@ public class FullToColumnTransformer
ColumnArrayView columnArrayView = tempQuadView.get(ox, oz);
SingleFullDataAccessor fullArrayView = chunkDataView.get(x * dataPerRender + ox, z * dataPerRender + oz);
SingleColumnFullDataAccessor fullArrayView = chunkDataView.get(x * dataPerRender + ox, z * dataPerRender + oz);
convertColumnData(level, blockX + perRenderWidth * (renderOffsetX + x) + perDataWidth * ox,
blockZ + perRenderWidth * (renderOffsetZ + z) + perDataWidth * oz,
columnArrayView, fullArrayView, 2);
@@ -240,7 +240,7 @@ public class FullToColumnTransformer
}
}
private static void convertColumnData(IDhClientLevel level, int blockX, int blockZ, ColumnArrayView columnArrayView, SingleFullDataAccessor fullArrayView, int genMode)
private static void convertColumnData(IDhClientLevel level, int blockX, int blockZ, ColumnArrayView columnArrayView, SingleColumnFullDataAccessor fullArrayView, int genMode)
{
if (!fullArrayView.doesColumnExist())
{
@@ -265,7 +265,7 @@ public class FullToColumnTransformer
}
}
private static void iterateAndConvert(IDhClientLevel level, int blockX, int blockZ, int genMode, ColumnArrayView column, SingleFullDataAccessor data)
private static void iterateAndConvert(IDhClientLevel level, int blockX, int blockZ, int genMode, ColumnArrayView column, SingleColumnFullDataAccessor data)
{
FullDataPointIdMap mapping = data.getMapping();
boolean isVoid = true;
@@ -1,7 +1,7 @@
package com.seibel.lod.core.file.subDimMatching;
import com.seibel.lod.core.config.Config;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.accessor.SingleColumnFullDataAccessor;
import com.seibel.lod.core.dataObjects.fullData.sources.IFullDataSource;
import com.seibel.lod.core.dataObjects.fullData.accessor.ChunkSizedFullDataAccessor;
import com.seibel.lod.core.util.FullDataPointUtil;
@@ -233,7 +233,7 @@ public class SubDimensionLevelMatcher implements AutoCloseable
{
for (int z = 0; z < LodUtil.CHUNK_WIDTH; z++)
{
SingleFullDataAccessor singleDataColumn = lodDataSource.tryGet(x, z);
SingleColumnFullDataAccessor singleDataColumn = lodDataSource.tryGet(x, z);
if (singleDataColumn != null)
{
long[] rawSingleColumn = singleDataColumn.getRaw();