mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 19:36:41 +00:00
Cleanup unused code.
This commit is contained in:
@ -1,33 +0,0 @@
|
||||
package com.boydti.fawe.beta.implementation.chunk;
|
||||
|
||||
import com.boydti.fawe.beta.IQueueChunk;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
|
||||
/**
|
||||
* Used by {@link ReferenceChunk} to allow the chunk to be garbage collected. - When the object is
|
||||
* finalized, add it to the queue
|
||||
*/
|
||||
public class FinalizedChunk<T extends IQueueChunk> extends DelegateChunk<T> {
|
||||
|
||||
private final IQueueExtent queueExtent;
|
||||
|
||||
public FinalizedChunk(T parent, IQueueExtent queueExtent) {
|
||||
super(parent);
|
||||
this.queueExtent = queueExtent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit the chunk to the queue
|
||||
*
|
||||
* @throws Throwable
|
||||
*/
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
if (getParent() != null) {
|
||||
// TODO apply safely
|
||||
// apply();
|
||||
setParent(null);
|
||||
}
|
||||
super.finalize();
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
package com.boydti.fawe.beta.implementation.chunk;
|
||||
|
||||
import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IDelegateChunk;
|
||||
import com.boydti.fawe.beta.IQueueChunk;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import java.lang.ref.Reference;
|
||||
|
||||
/**
|
||||
* An {@link IChunk} may be wrapped by a ReferenceChunk if there is low memory. This class stores a
|
||||
* reference for garbage collection purposes. If it cleaned by garbage collection, the {@link
|
||||
* FinalizedChunk} logic is run.
|
||||
*/
|
||||
public abstract class ReferenceChunk implements IDelegateChunk {
|
||||
|
||||
private final Reference<FinalizedChunk> reference;
|
||||
|
||||
public ReferenceChunk(IQueueChunk parent, IQueueExtent queueExtent) {
|
||||
this.reference = toReference(new FinalizedChunk(parent, queueExtent));
|
||||
}
|
||||
|
||||
protected abstract Reference<FinalizedChunk> toReference(FinalizedChunk parent);
|
||||
|
||||
@Override
|
||||
public IQueueChunk getParent() {
|
||||
final FinalizedChunk finalized = reference.get();
|
||||
return finalized != null ? finalized.getParent() : null;
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package com.boydti.fawe.beta.implementation.chunk;
|
||||
|
||||
import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IQueueChunk;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.SoftReference;
|
||||
|
||||
/**
|
||||
* Soft reference implementation of {@link ReferenceChunk}
|
||||
*/
|
||||
public class SoftChunk extends ReferenceChunk {
|
||||
|
||||
public SoftChunk(IQueueChunk parent, IQueueExtent queueExtent) {
|
||||
super(parent, queueExtent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Reference<FinalizedChunk> toReference(FinalizedChunk parent) {
|
||||
return new SoftReference<>(parent);
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package com.boydti.fawe.beta.implementation.chunk;
|
||||
|
||||
import com.boydti.fawe.beta.IChunk;
|
||||
import com.boydti.fawe.beta.IQueueChunk;
|
||||
import com.boydti.fawe.beta.IQueueExtent;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
/**
|
||||
* A {@link ReferenceChunk} using {@link WeakReference} to hold the chunk.
|
||||
*/
|
||||
public class WeakChunk extends ReferenceChunk {
|
||||
|
||||
public WeakChunk(IQueueChunk parent, IQueueExtent queueExtent) {
|
||||
super(parent, queueExtent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Reference<FinalizedChunk> toReference(FinalizedChunk parent) {
|
||||
return new WeakReference<>(parent);
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ import com.boydti.fawe.beta.implementation.filter.block.FilterBlock;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.function.mask.ABlockMask;
|
||||
import com.sk89q.worldedit.util.Countable;
|
||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -94,10 +95,10 @@ public class DistrFilter extends ForkedFilter<DistrFilter> {
|
||||
for (Countable c : getDistribution()) {
|
||||
final String name = c.getID().toString();
|
||||
final String str = String.format("%-7s (%.3f%%) %s",
|
||||
String.valueOf(c.getAmount()),
|
||||
c.getAmount(),
|
||||
c.getAmount() / (double) size * 100,
|
||||
name);
|
||||
actor.print(str);
|
||||
actor.printInfo(TextComponent.of(str));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ import com.boydti.fawe.beta.IQueueExtent;
|
||||
import com.boydti.fawe.beta.implementation.blocks.CharSetBlocks;
|
||||
import com.boydti.fawe.beta.implementation.chunk.ChunkHolder;
|
||||
import com.boydti.fawe.beta.implementation.chunk.NullChunk;
|
||||
import com.boydti.fawe.beta.implementation.chunk.ReferenceChunk;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.CharFilterBlock;
|
||||
import com.boydti.fawe.beta.implementation.filter.block.ChunkFilterBlock;
|
||||
import com.boydti.fawe.beta.implementation.processors.EmptyBatchProcessor;
|
||||
@ -210,9 +209,6 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
|
||||
return NullChunk.INSTANCE;
|
||||
}
|
||||
IQueueChunk chunk = chunks.get(pair);
|
||||
if (chunk instanceof ReferenceChunk) {
|
||||
chunk = ((ReferenceChunk) chunk).getParent();
|
||||
}
|
||||
if (chunk != null) {
|
||||
lastPair = pair;
|
||||
lastChunk = chunk;
|
||||
|
Reference in New Issue
Block a user