9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-22 08:39:14 +00:00
This commit is contained in:
cyberpwn
2022-01-12 01:47:38 -05:00
parent 8c00499e76
commit 2dde426df6
463 changed files with 11845 additions and 10159 deletions

View File

@@ -301,8 +301,7 @@ public class Iris extends VolmitPlugin implements Listener {
@SuppressWarnings("deprecation")
public static void later(NastyRunnable object) {
try
{
try {
Bukkit.getScheduler().scheduleAsyncDelayedTask(instance, () ->
{
try {
@@ -312,10 +311,7 @@ public class Iris extends VolmitPlugin implements Listener {
Iris.reportError(e);
}
}, RNG.r.i(100, 1200));
}
catch(IllegalPluginAccessException ignored)
{
} catch(IllegalPluginAccessException ignored) {
}
}
@@ -476,13 +472,11 @@ public class Iris extends VolmitPlugin implements Listener {
postShutdown.add(r);
}
public static void panic()
{
public static void panic() {
EnginePanic.panic();
}
public static void addPanic(String s, String v)
{
public static void addPanic(String s, String v) {
EnginePanic.add(s, v);
}

View File

@@ -19,29 +19,21 @@
package com.volmit.iris.core.commands;
import com.volmit.iris.Iris;
import com.volmit.iris.core.edit.BlockSignal;
import com.volmit.iris.core.loader.IrisRegistrant;
import com.volmit.iris.core.nms.INMS;
import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.util.data.B;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisCave;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisJigsawPiece;
import com.volmit.iris.engine.object.IrisJigsawPool;
import com.volmit.iris.engine.object.IrisJigsawStructure;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.util.decree.DecreeExecutor;
import com.volmit.iris.util.decree.DecreeOrigin;
import com.volmit.iris.util.decree.annotations.Decree;
import com.volmit.iris.util.decree.annotations.Param;
import com.volmit.iris.util.format.C;
import com.volmit.iris.util.matter.MatterMarker;
import com.volmit.iris.util.scheduling.J;
import org.bukkit.Chunk;
import org.bukkit.FluidCollisionMode;
import org.bukkit.Material;
import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData;
import java.awt.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.awt.Desktop;
@Decree(name = "edit", origin = DecreeOrigin.PLAYER, studio = true, description = "Edit something")
@@ -64,10 +56,11 @@ public class CommandEdit implements DecreeExecutor {
}
@Decree(description = "Edit the biome you specified", aliases = {"b"}, origin = DecreeOrigin.PLAYER)
public void biome(@Param(contextual = false, description = "The biome to edit") IrisBiome biome) {
if (noStudio()) {return;}
if(noStudio()) {
return;
}
try {
if(biome == null || biome.getLoadFile() == null) {
sender().sendMessage(C.GOLD + "Cannot find the file; Perhaps it was not loaded directly from a file?");
@@ -83,7 +76,9 @@ public class CommandEdit implements DecreeExecutor {
@Decree(description = "Edit the region you specified", aliases = {"r"}, origin = DecreeOrigin.PLAYER)
public void region(@Param(contextual = false, description = "The region to edit") IrisRegion region) {
if (noStudio()) {return;}
if(noStudio()) {
return;
}
try {
if(region == null || region.getLoadFile() == null) {
sender().sendMessage(C.GOLD + "Cannot find the file; Perhaps it was not loaded directly from a file?");
@@ -99,7 +94,9 @@ public class CommandEdit implements DecreeExecutor {
@Decree(description = "Edit the dimension you specified", aliases = {"d"}, origin = DecreeOrigin.PLAYER)
public void dimension(@Param(contextual = false, description = "The dimension to edit") IrisDimension dimension) {
if (noStudio()) {return;}
if(noStudio()) {
return;
}
try {
if(dimension == null || dimension.getLoadFile() == null) {
sender().sendMessage(C.GOLD + "Cannot find the file; Perhaps it was not loaded directly from a file?");
@@ -115,7 +112,9 @@ public class CommandEdit implements DecreeExecutor {
@Decree(description = "Edit the cave file you specified", aliases = {"c"}, origin = DecreeOrigin.PLAYER)
public void cave(@Param(contextual = false, description = "The cave to edit") IrisCave cave) {
if (noStudio()) {return;}
if(noStudio()) {
return;
}
try {
if(cave == null || cave.getLoadFile() == null) {
sender().sendMessage(C.GOLD + "Cannot find the file; Perhaps it was not loaded directly from a file?");
@@ -131,7 +130,9 @@ public class CommandEdit implements DecreeExecutor {
@Decree(description = "Edit the structure file you specified", aliases = {"jigsawstructure", "structure"}, origin = DecreeOrigin.PLAYER)
public void jigsaw(@Param(contextual = false, description = "The jigsaw structure to edit") IrisJigsawStructure jigsaw) {
if (noStudio()) {return;}
if(noStudio()) {
return;
}
try {
if(jigsaw == null || jigsaw.getLoadFile() == null) {
sender().sendMessage(C.GOLD + "Cannot find the file; Perhaps it was not loaded directly from a file?");
@@ -147,7 +148,9 @@ public class CommandEdit implements DecreeExecutor {
@Decree(description = "Edit the pool file you specified", aliases = {"jigsawpool", "pool"}, origin = DecreeOrigin.PLAYER)
public void jigsawPool(@Param(contextual = false, description = "The jigsaw pool to edit") IrisJigsawPool pool) {
if (noStudio()) {return;}
if(noStudio()) {
return;
}
try {
if(pool == null || pool.getLoadFile() == null) {
sender().sendMessage(C.GOLD + "Cannot find the file; Perhaps it was not loaded directly from a file?");
@@ -163,7 +166,9 @@ public class CommandEdit implements DecreeExecutor {
@Decree(description = "Edit the jigsaw piece file you specified", aliases = {"jigsawpiece", "piece"}, origin = DecreeOrigin.PLAYER)
public void jigsawPiece(@Param(contextual = false, description = "The jigsaw piece to edit") IrisJigsawPiece piece) {
if (noStudio()) {return;}
if(noStudio()) {
return;
}
try {
if(piece == null || piece.getLoadFile() == null) {
sender().sendMessage(C.GOLD + "Cannot find the file; Perhaps it was not loaded directly from a file?");

View File

@@ -23,7 +23,6 @@ import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.gui.NoiseExplorerGUI;
import com.volmit.iris.core.gui.VisionGUI;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.loader.IrisRegistrant;
import com.volmit.iris.core.project.IrisProject;
import com.volmit.iris.core.service.ConversionSVC;
import com.volmit.iris.core.service.StudioSVC;
@@ -82,7 +81,6 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.util.BlockVector;
import org.bukkit.util.Vector;
import java.awt.Desktop;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -102,6 +100,7 @@ public class CommandStudio implements DecreeExecutor {
public static String hrf(Duration duration) {
return duration.toString().substring(2).replaceAll("(\\d[HMS])(?!$)", "$1 ").toLowerCase();
}
private CommandFind find;
private CommandEdit edit;
@@ -301,7 +300,6 @@ public class CommandStudio implements DecreeExecutor {
}
@Decree(description = "Execute a script", aliases = "run", origin = DecreeOrigin.PLAYER)
public void execute(
@Param(description = "The script to run")

View File

@@ -50,8 +50,10 @@ public class MythicMobsLink {
/**
* Spawn a mythic mob at this location
*
* @param mob The mob
* @param location The location
* @param mob
* The mob
* @param location
* The location
* @return The mob, or null if it can't be spawned
*/
public @Nullable

View File

@@ -21,7 +21,6 @@ package com.volmit.iris.core.loader;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.engine.object.IrisImage;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KSet;
import com.volmit.iris.util.data.KCache;

View File

@@ -41,7 +41,6 @@ import java.io.File;
import java.util.Locale;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicReferenceArray;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Stream;

View File

@@ -35,16 +35,14 @@ import com.volmit.iris.util.nbt.mca.palette.MCAPaletteAccess;
import com.volmit.iris.util.nbt.mca.palette.MCAPalettedContainer;
import com.volmit.iris.util.nbt.mca.palette.MCAWrappedPalettedContainer;
import com.volmit.iris.util.nbt.tag.CompoundTag;
import com.volmit.iris.util.scheduling.Queue;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess;
import net.minecraft.nbt.NbtIo;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import org.bukkit.Bukkit;
@@ -53,11 +51,9 @@ import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_18_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_18_R1.CraftServer;
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_18_R1.generator.CustomChunkGenerator;
import org.bukkit.entity.Entity;
import org.bukkit.generator.ChunkGenerator;
import org.jetbrains.annotations.NotNull;
@@ -68,7 +64,6 @@ import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
@@ -149,8 +144,7 @@ public class NMSBinding18_1 implements INMSBinding {
return true;
}
private RegistryAccess registry()
{
private RegistryAccess registry() {
return registryAccess.aquire(() -> (RegistryAccess) getFor(RegistryAccess.class, ((CraftServer) Bukkit.getServer()).getHandle().getServer()));
}
@@ -377,20 +371,16 @@ public class NMSBinding18_1 implements INMSBinding {
private static Object getFor(Class<?> type, Object source) {
Object o = fieldFor(type, source);
if(o != null)
{
if(o != null) {
return o;
}
return invokeFor(type, source);
}
private static Object invokeFor(Class<?> returns, Object in)
{
for(Method i : in.getClass().getMethods())
{
if(i.getReturnType().equals(returns))
{
private static Object invokeFor(Class<?> returns, Object in) {
for(Method i : in.getClass().getMethods()) {
if(i.getReturnType().equals(returns)) {
i.setAccessible(true);
try {
Iris.info("[NMS] Found " + returns.getSimpleName() + " in " + in.getClass().getSimpleName() + "." + i.getName() + "()");
@@ -404,12 +394,9 @@ public class NMSBinding18_1 implements INMSBinding {
return null;
}
private static Object fieldFor(Class<?> returns, Object in)
{
for(Field i : in.getClass().getFields())
{
if(i.getType().equals(returns))
{
private static Object fieldFor(Class<?> returns, Object in) {
for(Field i : in.getClass().getFields()) {
if(i.getType().equals(returns)) {
i.setAccessible(true);
try {
Iris.info("[NMS] Found " + returns.getSimpleName() + " in " + in.getClass().getSimpleName() + "." + i.getName());

View File

@@ -54,7 +54,8 @@ public class IrisPack {
* Create an iris pack backed by a data folder
* the data folder is assumed to be in the Iris/packs/NAME folder
*
* @param name the name
* @param name
* the name
*/
public IrisPack(String name) {
this(packsPack(name));
@@ -63,7 +64,8 @@ public class IrisPack {
/**
* Create an iris pack backed by a data folder
*
* @param folder the folder of the pack. Must be a directory
* @param folder
* the folder of the pack. Must be a directory
*/
public IrisPack(File folder) {
this.folder = folder;
@@ -82,10 +84,13 @@ public class IrisPack {
/**
* Create a new pack from the input url
*
* @param sender the sender
* @param url the url, or name, or really anything see IrisPackRepository.from(String)
* @param sender
* the sender
* @param url
* the url, or name, or really anything see IrisPackRepository.from(String)
* @return the iris pack
* @throws IrisException fails
* @throws IrisException
* fails
*/
public static Future<IrisPack> from(VolmitSender sender, String url) throws IrisException {
IrisPackRepository repo = IrisPackRepository.from(url);
@@ -103,10 +108,13 @@ public class IrisPack {
/**
* Create a pack from a repo
*
* @param sender the sender
* @param repo the repo
* @param sender
* the sender
* @param repo
* the repo
* @return the pack
* @throws MalformedURLException shit happens
* @throws MalformedURLException
* shit happens
*/
public static Future<IrisPack> from(VolmitSender sender, IrisPackRepository repo) throws MalformedURLException {
CompletableFuture<IrisPack> pack = new CompletableFuture<>();
@@ -119,9 +127,11 @@ public class IrisPack {
/**
* Create a blank pack with a given name
*
* @param name the name of the pack
* @param name
* the name of the pack
* @return the pack
* @throws IrisException if the pack already exists or another error
* @throws IrisException
* if the pack already exists or another error
*/
public static IrisPack blank(String name) throws IrisException {
File f = packsPack(name);
@@ -149,7 +159,8 @@ public class IrisPack {
/**
* Get a packs pack folder for a name. Such that overworld would resolve as Iris/packs/overworld
*
* @param name the name
* @param name
* the name
* @return the file path
*/
public static File packsPack(String name) {
@@ -232,7 +243,8 @@ public class IrisPack {
/**
* Install this pack into a world
*
* @param world the world to install into (world/iris/pack)
* @param world
* the world to install into (world/iris/pack)
* @return the installed pack
*/
public IrisPack install(World world) throws IrisException {
@@ -242,7 +254,8 @@ public class IrisPack {
/**
* Install this pack into a world
*
* @param world the world to install into (world/iris/pack)
* @param world
* the world to install into (world/iris/pack)
* @return the installed pack
*/
public IrisPack install(IrisWorld world) throws IrisException {
@@ -252,7 +265,8 @@ public class IrisPack {
/**
* Install this pack into a world
*
* @param folder the folder to install this pack into
* @param folder
* the folder to install this pack into
* @return the installed pack
*/
public IrisPack install(File folder) throws IrisException {
@@ -275,7 +289,8 @@ public class IrisPack {
* Create a new pack using this pack as a template. The new pack will be renamed & have a renamed dimension
* to match it.
*
* @param newName the new pack name
* @param newName
* the new pack name
* @return the new IrisPack
*/
public IrisPack install(String newName) throws IrisException {
@@ -330,7 +345,8 @@ public class IrisPack {
/**
* Find all files in this pack with the given extension
*
* @param fileExtension the extension
* @param fileExtension
* the extension
* @return the list of files
*/
public KList<File> collectFiles(String fileExtension) {

View File

@@ -51,8 +51,7 @@ public class IrisPackRepository {
private String tag = "";
/**
* @param g
* @return
*
*/
public static IrisPackRepository from(String g) {
// https://github.com/IrisDimensions/overworld

View File

@@ -43,8 +43,10 @@ public interface PregeneratorMethod {
/**
* Return true if regions can be generated
*
* @param x the x region
* @param z the z region
* @param x
* the x region
* @param z
* the z region
* @return true if they can be
*/
boolean supportsRegions(int x, int z, PregenListener listener);
@@ -52,8 +54,10 @@ public interface PregeneratorMethod {
/**
* Return the name of the method being used
*
* @param x the x region
* @param z the z region
* @param x
* the x region
* @param z
* the z region
* @return the name
*/
String getMethod(int x, int z);
@@ -62,18 +66,22 @@ public interface PregeneratorMethod {
* Called to generate a region. Execute sync, if multicore internally, wait
* for the task to complete
*
* @param x the x
* @param z the z
* @param listener signal chunks generating & generated. Parallel capable.
* @param x
* the x
* @param z
* the z
* @param listener
* signal chunks generating & generated. Parallel capable.
*/
void generateRegion(int x, int z, PregenListener listener);
/**
* Called to generate a chunk. You can go async so long as save will wait on the threads to finish
*
* @param x the x
* @param z the z
* @param listener
* @param x
* the x
* @param z
* the z
*/
void generateChunk(int x, int z, PregenListener listener);

View File

@@ -19,9 +19,7 @@
package com.volmit.iris.core.service;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.project.IrisProject;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.util.board.BoardManager;
@@ -87,8 +85,7 @@ public class BoardSVC implements IrisService, BoardProvider {
}
public void tick() {
if(!Iris.service(StudioSVC.class).isProjectOpen())
{
if(!Iris.service(StudioSVC.class).isProjectOpen()) {
return;
}

View File

@@ -65,7 +65,8 @@ public class ObjectSVC implements IrisService {
/**
* Reverts all the block changes provided, 200 blocks per tick
*
* @param blocks The blocks to remove
* @param blocks
* The blocks to remove
*/
private void revert(Map<Block, BlockData> blocks) {
int amount = 0;

View File

@@ -79,7 +79,8 @@ public class TreeSVC implements IrisService {
* <br>4. Check biome, region and dimension for overrides for that sapling type -> Found -> use</br>
* <br>5. Exit if none are found, cancel event if one or more are.</br>
*
* @param event Checks the given event for sapling overrides
* @param event
* Checks the given event for sapling overrides
*/
@EventHandler(priority = EventPriority.HIGHEST)
public void on(StructureGrowEvent event) {
@@ -238,12 +239,17 @@ public class TreeSVC implements IrisService {
}
/**
* Finds a single object placement (which may contain more than one object) for the requirements species, location & size
* Finds a single object placement (which may contain more than one object) for the requirements species, location &
* size
*
* @param worldAccess The world to access (check for biome, region, dimension, etc)
* @param location The location of the growth event (For biome/region finding)
* @param type The bukkit TreeType to match
* @param size The size of the sapling area
* @param worldAccess
* The world to access (check for biome, region, dimension, etc)
* @param location
* The location of the growth event (For biome/region finding)
* @param type
* The bukkit TreeType to match
* @param size
* The size of the sapling area
* @return An object placement which contains the matched tree, or null if none were found / it's disabled.
*/
private IrisObjectPlacement getObjectPlacement(PlatformChunkGenerator worldAccess, Location location, TreeType type, IrisTreeSize size) {
@@ -268,9 +274,12 @@ public class TreeSVC implements IrisService {
/**
* Filters out mismatches and returns matches
*
* @param objects The object placements to check
* @param size The size of the sapling area to filter with
* @param type The type of the tree to filter with
* @param objects
* The object placements to check
* @param size
* The size of the sapling area to filter with
* @param type
* The type of the tree to filter with
* @return A list of objectPlacements that matched. May be empty.
*/
private KList<IrisObjectPlacement> matchObjectPlacements(KList<IrisObjectPlacement> objects, IrisTreeSize size, TreeType type) {
@@ -289,9 +298,12 @@ public class TreeSVC implements IrisService {
/**
* Get the Cuboid of sapling sizes at a location & blockData predicate
*
* @param at this location
* @param valid with this blockData predicate
* @param world the world to check in
* @param at
* this location
* @param valid
* with this blockData predicate
* @param world
* the world to check in
* @return A cuboid containing only saplings
*/
public Cuboid getSaplings(Location at, Predicate<BlockData> valid, World world) {
@@ -343,10 +355,14 @@ public class TreeSVC implements IrisService {
/**
* Grows the blockPosition list by means of checking neighbours in
*
* @param world the world to check in
* @param center the location of this position
* @param valid validation on blockData to check block with
* @param l list of block positions to add new neighbors too
* @param world
* the world to check in
* @param center
* the location of this position
* @param valid
* validation on blockData to check block with
* @param l
* list of block positions to add new neighbors too
*/
private void grow(World world, BlockPosition center, Predicate<BlockData> valid, KList<BlockPosition> l) {
// Make sure size is less than 50, the block to check isn't already in, and make sure the blockData still matches

View File

@@ -64,7 +64,8 @@ public class WandSVC implements IrisService {
/**
* Creates an Iris Object from the 2 coordinates selected with a wand
*
* @param wand The wand itemstack
* @param wand
* The wand itemstack
* @return The new object
*/
public static IrisObject createSchematic(ItemStack wand) {
@@ -97,7 +98,8 @@ public class WandSVC implements IrisService {
/**
* Creates an Iris Object from the 2 coordinates selected with a wand
*
* @param wand The wand itemstack
* @param wand
* The wand itemstack
* @return The new object
*/
public static Matter createMatterSchem(Player p, ItemStack wand) {
@@ -120,7 +122,8 @@ public class WandSVC implements IrisService {
/**
* Converts a user friendly location string to an actual Location
*
* @param s The string
* @param s
* The string
* @return The location
*/
public static Location stringToLocation(String s) {
@@ -137,7 +140,8 @@ public class WandSVC implements IrisService {
/**
* Get a user friendly string of a location
*
* @param loc The location
* @param loc
* The location
* @return The string
*/
public static String locationToString(Location loc) {
@@ -178,7 +182,8 @@ public class WandSVC implements IrisService {
/**
* Finds an existing wand in a users inventory
*
* @param inventory The inventory to search
* @param inventory
* The inventory to search
* @return The slot number the wand is in. Or -1 if none are found
*/
public static int findWand(Inventory inventory) {
@@ -202,8 +207,10 @@ public class WandSVC implements IrisService {
/**
* Creates an Iris wand. The locations should be the currently selected locations, or null
*
* @param a Location A
* @param b Location B
* @param a
* Location A
* @param b
* Location B
* @return A new wand
*/
public static ItemStack createWand(Location a, Location b) {
@@ -222,7 +229,8 @@ public class WandSVC implements IrisService {
/**
* Get a pair of locations that are selected in an Iris wand
*
* @param is The wand item
* @param is
* The wand item
* @return An array with the 2 locations
*/
public static Location[] getCuboid(ItemStack is) {
@@ -233,7 +241,8 @@ public class WandSVC implements IrisService {
/**
* Is a player holding an Iris wand
*
* @param p The player
* @param p
* The player
* @return True if they are
*/
public static boolean isHoldingWand(Player p) {
@@ -244,7 +253,8 @@ public class WandSVC implements IrisService {
/**
* Is the itemstack passed an Iris wand
*
* @param is The itemstack
* @param is
* The itemstack
* @return True if it is
*/
public static boolean isWand(ItemStack is) {
@@ -291,8 +301,10 @@ public class WandSVC implements IrisService {
/**
* Draw the outline of a selected region
*
* @param d The cuboid
* @param p The player to show it to
* @param d
* The cuboid
* @param p
* The player to show it to
*/
public void draw(Cuboid d, Player p) {
draw(new Location[] {d.getLowerNE(), d.getUpperSW()}, p);
@@ -301,8 +313,10 @@ public class WandSVC implements IrisService {
/**
* Draw the outline of a selected region
*
* @param d A pair of locations
* @param p The player to show them to
* @param d
* A pair of locations
* @param p
* The player to show them to
*/
public void draw(Location[] d, Player p) {
Vector gx = Vector.getRandom().subtract(Vector.getRandom()).normalize().clone().multiply(0.65);
@@ -406,7 +420,8 @@ public class WandSVC implements IrisService {
/**
* Is the player holding Dust?
*
* @param p The player
* @param p
* The player
* @return True if they are
*/
public boolean isHoldingDust(Player p) {
@@ -417,7 +432,8 @@ public class WandSVC implements IrisService {
/**
* Is the itemstack passed Iris dust?
*
* @param is The itemstack
* @param is
* The itemstack
* @return True if it is
*/
public boolean isDust(ItemStack is) {
@@ -427,9 +443,12 @@ public class WandSVC implements IrisService {
/**
* Update the location on an Iris wand
*
* @param left True for first location, false for second
* @param a The location
* @param item The wand
* @param left
* True for first location, false for second
* @param a
* The location
* @param item
* The wand
* @return The updated wand
*/
public ItemStack update(boolean left, Location a, ItemStack item) {

View File

@@ -88,7 +88,8 @@ public class IrisCreator {
* Create the IrisAccess (contains the world)
*
* @return the IrisAccess
* @throws IrisException shit happens
* @throws IrisException
* shit happens
*/
public World create() throws IrisException {
if(Bukkit.isPrimaryThread()) {

View File

@@ -51,7 +51,8 @@ public class IrisToolbelt {
* - GithubUsername/repository
* - GithubUsername/repository/branch
*
* @param dimension the dimension id such as overworld or flat
* @param dimension
* the dimension id such as overworld or flat
* @return the IrisDimension or null
*/
public static IrisDimension getDimension(String dimension) {
@@ -80,7 +81,8 @@ public class IrisToolbelt {
/**
* Checks if the given world is an Iris World (same as access(world) != null)
*
* @param world the world
* @param world
* the world
* @return true if it is an Iris Access world
*/
public static boolean isIrisWorld(World world) {
@@ -103,7 +105,8 @@ public class IrisToolbelt {
/**
* Get the Iris generator for the given world
*
* @param world the given world
* @param world
* the given world
* @return the IrisAccess or null if it's not an Iris World
*/
public static PlatformChunkGenerator access(World world) {
@@ -117,8 +120,10 @@ public class IrisToolbelt {
/**
* Start a pregenerator task
*
* @param task the scheduled task
* @param method the method to execute the task
* @param task
* the scheduled task
* @param method
* the method to execute the task
* @return the pregenerator job (already started)
*/
public static PregeneratorJob pregenerate(PregenTask task, PregeneratorMethod method, Engine engine) {
@@ -129,8 +134,10 @@ public class IrisToolbelt {
* Start a pregenerator task. If the supplied generator is headless, headless mode is used,
* otherwise Hybrid mode is used.
*
* @param task the scheduled task
* @param gen the Iris Generator
* @param task
* the scheduled task
* @param gen
* the Iris Generator
* @return the pregenerator job (already started)
*/
public static PregeneratorJob pregenerate(PregenTask task, PlatformChunkGenerator gen) {
@@ -146,8 +153,10 @@ public class IrisToolbelt {
* Start a pregenerator task. If the supplied generator is headless, headless mode is used,
* otherwise Hybrid mode is used.
*
* @param task the scheduled task
* @param world the World
* @param task
* the scheduled task
* @param world
* the World
* @return the pregenerator job (already started)
*/
public static PregeneratorJob pregenerate(PregenTask task, World world) {
@@ -162,7 +171,8 @@ public class IrisToolbelt {
* Evacuate all players from the world into literally any other world.
* If there are no other worlds, kick them! Not the best but what's mine is mine sometimes...
*
* @param world the world to evac
* @param world
* the world to evac
*/
public static boolean evacuate(World world) {
for(World i : Bukkit.getWorlds()) {
@@ -182,8 +192,10 @@ public class IrisToolbelt {
/**
* Evacuate all players from the world
*
* @param world the world to leave
* @param m the message
* @param world
* the world to leave
* @param m
* the message
* @return true if it was evacuated.
*/
public static boolean evacuate(World world, String m) {

View File

@@ -25,29 +25,23 @@ public class EnginePanic {
private static final KMap<String, String> stuff = new KMap<>();
private static KMap<String, String> last = new KMap<>();
public static void add(String key, String value)
{
public static void add(String key, String value) {
stuff.put(key, value);
}
public static void saveLast()
{
public static void saveLast() {
last = stuff.copy();
}
public static void lastPanic()
{
for(String i : last.keySet())
{
public static void lastPanic() {
for(String i : last.keySet()) {
Iris.error("Last Panic " + i + ": " + stuff.get(i));
}
}
public static void panic()
{
public static void panic() {
lastPanic();
for(String i : stuff.keySet())
{
for(String i : stuff.keySet()) {
Iris.error("Engine Panic " + i + ": " + stuff.get(i));
}
}

View File

@@ -35,7 +35,13 @@ import com.volmit.iris.engine.framework.EngineWorldManager;
import com.volmit.iris.engine.framework.SeedManager;
import com.volmit.iris.engine.framework.WrongEngineBroException;
import com.volmit.iris.engine.mantle.EngineMantle;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisBiomePaletteLayer;
import com.volmit.iris.engine.object.IrisDecorator;
import com.volmit.iris.engine.object.IrisEngineData;
import com.volmit.iris.engine.object.IrisJigsawStructure;
import com.volmit.iris.engine.object.IrisObjectPlacement;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.scripting.EngineExecutionEnvironment;
import com.volmit.iris.util.atomics.AtomicRollingSequence;
import com.volmit.iris.util.collection.KMap;
@@ -488,6 +494,7 @@ public class IrisEngine implements Engine {
return getData().getRegionLoader().load(getDimension().getFocusRegion());
}
@Override
public void fail(String error, Throwable e) {
failing = true;

View File

@@ -21,7 +21,6 @@ package com.volmit.iris.engine.actuator;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.framework.EngineAssignedActuator;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.documentation.BlockCoordinates;
@@ -71,10 +70,14 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
/**
* This is calling 1/16th of a chunk x/z slice. It is a plane from sky to bedrock 1 thick in the x direction.
*
* @param x the chunk x in blocks
* @param z the chunk z in blocks
* @param xf the current x slice
* @param h the blockdata
* @param x
* the chunk x in blocks
* @param z
* the chunk z in blocks
* @param xf
* the current x slice
* @param h
* the blockdata
*/
@BlockCoordinates
public void terrainSliver(int x, int z, int xf, Hunk<BlockData> h) {

View File

@@ -49,8 +49,10 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
/**
* Get biome at x, z within chunk being generated
*
* @param x - 0-15
* @param z - 0-15
* @param x
* - 0-15
* @param z
* - 0-15
* @return Biome value
* @deprecated biomes are now 3-dimensional
*/
@@ -61,9 +63,12 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
/**
* Get biome at x, z within chunk being generated
*
* @param x - 0-15
* @param y - 0-255
* @param z - 0-15
* @param x
* - 0-15
* @param y
* - 0-255
* @param z
* - 0-15
* @return Biome value
*/
Biome getBiome(int x, int y, int z);
@@ -71,9 +76,12 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
/**
* Set biome at x, z within chunk being generated
*
* @param x - 0-15
* @param z - 0-15
* @param bio - Biome value
* @param x
* - 0-15
* @param z
* - 0-15
* @param bio
* - Biome value
* @deprecated biomes are now 3-dimensional
*/
@Deprecated
@@ -82,10 +90,14 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
/**
* Set biome at x, z within chunk being generated
*
* @param x - 0-15
* @param y - 0-255
* @param z - 0-15
* @param bio - Biome value
* @param x
* - 0-15
* @param y
* - 0-255
* @param z
* - 0-15
* @param bio
* - Biome value
*/
void setBiome(int x, int y, int z, Biome bio);
@@ -103,11 +115,15 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
* <p>
* Setting blocks outside the chunk's bounds does nothing.
*
* @param x the x location in the chunk from 0-15 inclusive
* @param y the y location in the chunk from 0 (inclusive) - maxHeight
* @param x
* the x location in the chunk from 0-15 inclusive
* @param y
* the y location in the chunk from 0 (inclusive) - maxHeight
* (exclusive)
* @param z the z location in the chunk from 0-15 inclusive
* @param blockData the type to set the block to
* @param z
* the z location in the chunk from 0-15 inclusive
* @param blockData
* the type to set the block to
*/
void setBlock(int x, int y, int z, BlockData blockData);
@@ -116,10 +132,13 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
* <p>
* Getting blocks outside the chunk's bounds returns air.
*
* @param x the x location in the chunk from 0-15 inclusive
* @param y the y location in the chunk from 0 (inclusive) - maxHeight
* @param x
* the x location in the chunk from 0-15 inclusive
* @param y
* the y location in the chunk from 0 (inclusive) - maxHeight
* (exclusive)
* @param z the z location in the chunk from 0-15 inclusive
* @param z
* the z location in the chunk from 0-15 inclusive
* @return the data of the block or the BlockData for air if x, y or z are
* outside the chunk's bounds
*/

View File

@@ -145,7 +145,7 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
@BlockCoordinates
default void generate(int x, int z, TerrainChunk tc, boolean multicore) throws WrongEngineBroException {
generate(x, z, Hunk.view((ChunkGenerator.ChunkData) tc), Hunk.view((ChunkGenerator.BiomeGrid) tc, tc.getMinHeight(), tc.getMaxHeight()), multicore);
generate(x, z, Hunk.view(tc), Hunk.view(tc, tc.getMinHeight(), tc.getMaxHeight()), multicore);
}
@BlockCoordinates

View File

@@ -56,7 +56,7 @@ public class PregeneratedData {
});
if(postMod.get()) {
return () -> Hunk.view((ChunkGenerator.ChunkData) tc).insertSoftly(0, 0, 0, post, (b) -> b == null || B.isAirOrFluid(b));
return () -> Hunk.view(tc).insertSoftly(0, 0, 0, post, (b) -> b == null || B.isAirOrFluid(b));
}
return () -> {

View File

@@ -210,13 +210,20 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set a sphere into the mantle
*
* @param cx the center x
* @param cy the center y
* @param cz the center z
* @param radius the radius of this sphere
* @param fill should it be filled? or just the outer shell?
* @param data the data to set
* @param <T> the type of data to apply to the mantle
* @param cx
* the center x
* @param cy
* the center y
* @param cz
* the center z
* @param radius
* the radius of this sphere
* @param fill
* should it be filled? or just the outer shell?
* @param data
* the data to set
* @param <T>
* the type of data to apply to the mantle
*/
public <T> void setSphere(int cx, int cy, int cz, double radius, boolean fill, T data) {
setElipsoid(cx, cy, cz, radius, radius, radius, fill, data);
@@ -229,15 +236,24 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set an elipsoid into the mantle
*
* @param cx the center x
* @param cy the center y
* @param cz the center z
* @param rx the x radius
* @param ry the y radius
* @param rz the z radius
* @param fill should it be filled or just the outer shell?
* @param data the data to set
* @param <T> the type of data to apply to the mantle
* @param cx
* the center x
* @param cy
* the center y
* @param cz
* the center z
* @param rx
* the x radius
* @param ry
* the y radius
* @param rz
* the z radius
* @param fill
* should it be filled or just the outer shell?
* @param data
* the data to set
* @param <T>
* the type of data to apply to the mantle
*/
public <T> void setElipsoidFunction(int cx, int cy, int cz, double rx, double ry, double rz, boolean fill, Function3<Integer, Integer, Integer, T> data) {
rx += 0.5;
@@ -299,14 +315,22 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set a cuboid of data in the mantle
*
* @param x1 the min x
* @param y1 the min y
* @param z1 the min z
* @param x2 the max x
* @param y2 the max y
* @param z2 the max z
* @param data the data to set
* @param <T> the type of data to apply to the mantle
* @param x1
* the min x
* @param y1
* the min y
* @param z1
* the min z
* @param x2
* the max x
* @param y2
* the max y
* @param z2
* the max z
* @param data
* the data to set
* @param <T>
* the type of data to apply to the mantle
*/
public <T> void setCuboid(int x1, int y1, int z1, int x2, int y2, int z2, T data) {
int j, k;
@@ -323,13 +347,20 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set a pyramid of data in the mantle
*
* @param cx the center x
* @param cy the base y
* @param cz the center z
* @param data the data to set
* @param size the size of the pyramid (width of base & height)
* @param filled should it be filled or hollow
* @param <T> the type of data to apply to the mantle
* @param cx
* the center x
* @param cy
* the base y
* @param cz
* the center z
* @param data
* the data to set
* @param size
* the size of the pyramid (width of base & height)
* @param filled
* should it be filled or hollow
* @param <T>
* the type of data to apply to the mantle
*/
@SuppressWarnings("ConstantConditions")
public <T> void setPyramid(int cx, int cy, int cz, T data, int size, boolean filled) {
@@ -353,12 +384,18 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set a 3d line
*
* @param a the first point
* @param b the second point
* @param radius the radius
* @param filled hollow or filled?
* @param data the data
* @param <T> the type of data to apply to the mantle
* @param a
* the first point
* @param b
* the second point
* @param radius
* the radius
* @param filled
* hollow or filled?
* @param data
* the data
* @param <T>
* the type of data to apply to the mantle
*/
public <T> void setLine(IrisPosition a, IrisPosition b, double radius, boolean filled, T data) {
setLine(ImmutableList.of(a, b), radius, filled, data);
@@ -371,11 +408,16 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set lines for points
*
* @param vectors the points
* @param radius the radius
* @param filled hollow or filled?
* @param data the data to set
* @param <T> the type of data to apply to the mantle
* @param vectors
* the points
* @param radius
* the radius
* @param filled
* hollow or filled?
* @param data
* the data to set
* @param <T>
* the type of data to apply to the mantle
*/
public <T> void setLineConsumer(List<IrisPosition> vectors, double radius, boolean filled, Function3<Integer, Integer, Integer, T> data) {
Set<IrisPosition> vset = new KSet<>();
@@ -441,13 +483,20 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set a cylinder in the mantle
*
* @param cx the center x
* @param cy the base y
* @param cz the center z
* @param data the data to set
* @param radius the radius
* @param height the height of the cyl
* @param filled filled or not
* @param cx
* the center x
* @param cy
* the base y
* @param cz
* the center z
* @param data
* the data to set
* @param radius
* the radius
* @param height
* the height of the cyl
* @param filled
* filled or not
*/
public <T> void setCylinder(int cx, int cy, int cz, T data, double radius, int height, boolean filled) {
setCylinder(cx, cy, cz, data, radius, radius, height, filled);
@@ -456,14 +505,22 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set a cylinder in the mantle
*
* @param cx the center x
* @param cy the base y
* @param cz the center z
* @param data the data to set
* @param radiusX the x radius
* @param radiusZ the z radius
* @param height the height of this cyl
* @param filled filled or hollow?
* @param cx
* the center x
* @param cy
* the base y
* @param cz
* the center z
* @param data
* the data to set
* @param radiusX
* the x radius
* @param radiusZ
* the z radius
* @param height
* the height of this cyl
* @param filled
* filled or hollow?
*/
public <T> void setCylinder(int cx, int cy, int cz, T data, double radiusX, double radiusZ, int height, boolean filled) {
int affected = 0;
@@ -524,13 +581,9 @@ public class MantleWriter implements IObjectPlacer {
}
public <T> void set(IrisPosition pos, T data) {
try
{
try {
setData(pos.getX(), pos.getY(), pos.getZ(), data);
}
catch(Throwable e)
{
} catch(Throwable e) {
Iris.error("No set? " + data.toString() + " for " + pos.toString());
}
}

View File

@@ -18,19 +18,11 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.EnginePanic;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.reflect.V;
import com.volmit.iris.util.scheduling.J;
import com.volmit.iris.util.stream.ProceduralStream;
import com.volmit.iris.util.stream.arithmetic.FittedStream;
import com.volmit.iris.util.stream.interpolation.Interpolated;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.*;
import java.util.List;
public interface IRare {
static <T extends IRare> ProceduralStream<T> stream(ProceduralStream<Double> noise, List<T> possibilities) {

View File

@@ -22,7 +22,6 @@ import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.loader.IrisRegistrant;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.MaxNumber;

View File

@@ -174,7 +174,8 @@ public enum IrisDirection {
* Get the directional value from the given byte from common directional blocks
* (MUST BE BETWEEN 0 and 5 INCLUSIVE)
*
* @param b the byte
* @param b
* the byte
* @return the direction or null if the byte is outside of the inclusive range
* 0-5
*/

View File

@@ -29,14 +29,11 @@ import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.noise.CNG;
import com.volmit.iris.util.noise.ExpressionNoise;
import com.volmit.iris.util.noise.ImageNoise;
import com.volmit.iris.util.stream.ProceduralStream;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.List;
@Snippet("style")
@Accessors(chain = true)
@NoArgsConstructor
@@ -96,17 +93,13 @@ public class IrisGeneratorStyle {
cng.fractureWith(fracture.create(rng.nextParallelRNG(2934), data), fracture.getMultiplier());
}
if(cellularFrequency > 0)
{
if(cellularFrequency > 0) {
return cng.cellularize(rng.nextParallelRNG(884466), cellularFrequency).scale(1D / cellularZoom).bake();
}
return cng;
}
}
else if(getImageMap() != null)
{
} else if(getImageMap() != null) {
CNG cng = new CNG(rng, new ImageNoise(data, getImageMap()), 1D, 1).bake().scale(1D / zoom).pow(exponent).bake();
cng.setTrueFracturing(axialFracturing);
@@ -114,8 +107,7 @@ public class IrisGeneratorStyle {
cng.fractureWith(fracture.create(rng.nextParallelRNG(2934), data), fracture.getMultiplier());
}
if(cellularFrequency > 0)
{
if(cellularFrequency > 0) {
return cng.cellularize(rng.nextParallelRNG(884466), cellularFrequency).scale(1D / cellularZoom).bake();
}
@@ -129,8 +121,7 @@ public class IrisGeneratorStyle {
cng.fractureWith(fracture.create(rng.nextParallelRNG(2934), data), fracture.getMultiplier());
}
if(cellularFrequency > 0)
{
if(cellularFrequency > 0) {
return cng.cellularize(rng.nextParallelRNG(884466), cellularFrequency).scale(1D / cellularZoom).bake();
}

View File

@@ -30,34 +30,28 @@ import java.io.File;
import java.io.IOException;
public class IrisImage extends IrisRegistrant {
private BufferedImage image;
private final BufferedImage image;
public int getWidth()
{
public int getWidth() {
return image.getWidth();
}
public int getHeight()
{
public int getHeight() {
return image.getHeight();
}
public int getRawValue(int x, int z)
{
if(x >= getWidth() || z >= getHeight() || x < 0 || z < 0)
{
public int getRawValue(int x, int z) {
if(x >= getWidth() || z >= getHeight() || x < 0 || z < 0) {
return 0;
}
return image.getRGB(x, z);
}
public double getValue(IrisImageChannel channel, int x, int z)
{
public double getValue(IrisImageChannel channel, int x, int z) {
int color = getRawValue(x, z);
switch(channel)
{
switch(channel) {
case RED -> {
return ((color >> 16) & 0xFF) / 255D;
}
@@ -105,13 +99,11 @@ public class IrisImage extends IrisRegistrant {
return color;
}
public IrisImage()
{
public IrisImage() {
this(new BufferedImage(4, 4, BufferedImage.TYPE_INT_RGB));
}
public IrisImage(BufferedImage image)
{
public IrisImage(BufferedImage image) {
this.image = image;
}
@@ -136,10 +128,8 @@ public class IrisImage extends IrisRegistrant {
try {
File at = new File(getLoadFile().getParentFile(), "debug-see-" + getLoadFile().getName());
BufferedImage b = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_RGB);
for(int i = 0; i < getWidth(); i++)
{
for(int j = 0; j < getHeight(); j++)
{
for(int i = 0; i < getWidth(); i++) {
for(int j = 0; j < getHeight(); j++) {
b.setRGB(i, j, Color.getHSBColor(0, 0, (float) getValue(channel, i, j)).getRGB());
}
}

View File

@@ -20,21 +20,13 @@ package com.volmit.iris.engine.object;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.project.SchemaBuilder;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.mantle.MantleWriter;
import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.MaxNumber;
import com.volmit.iris.engine.object.annotations.MinNumber;
import com.volmit.iris.engine.object.annotations.RegistryListResource;
import com.volmit.iris.engine.object.annotations.Snippet;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.documentation.BlockCoordinates;
import com.volmit.iris.util.interpolation.InterpolationMethod;
import com.volmit.iris.util.interpolation.IrisInterpolation;
import com.volmit.iris.util.math.RNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -72,19 +64,16 @@ public class IrisImageMap {
private transient AtomicCache<IrisImage> imageCache = new AtomicCache<IrisImage>();
public double getNoise(IrisData data, int x, int z)
{
public double getNoise(IrisData data, int x, int z) {
IrisImage i = imageCache.aquire(() -> data.getImageLoader().load(image));
if(i == null)
{
if(i == null) {
Iris.error("NULL IMAGE FOR " + image);
}
return IrisInterpolation.getNoise(interpolationMethod, x, z, coordinateScale, (xx, zz) -> rawNoise(i, xx, zz));
}
private double rawNoise(IrisImage i, double x, double z)
{
private double rawNoise(IrisImage i, double x, double z) {
x /= coordinateScale;
z /= coordinateScale;
x = isCentered() ? x + ((i.getWidth() / 2D) * coordinateScale) : x;

View File

@@ -685,7 +685,7 @@ public class IrisObject extends IrisRegistrant {
boolean a = !blocks.containsKey(new BlockVector(i.clone().add(new BlockVector(0, 1, 0))));
boolean fff = !blocks.containsKey(new BlockVector(i.clone().add(new BlockVector(0, 2, 0))));
if ((marker.isEmptyAbove() && a && fff) || !marker.isEmptyAbove()) {
if(!marker.isEmptyAbove() || (a && fff)) {
markers.put(i, j.getMarker());
max--;
}

View File

@@ -243,8 +243,10 @@ public class IrisObjectPlacement {
/**
* Gets the loot table that should be used for the block
*
* @param data The block data of the block
* @param dataManager Iris Data Manager
* @param data
* The block data of the block
* @param dataManager
* Iris Data Manager
* @return The loot table it should use.
*/
public IrisLootTable getTable(BlockData data, IrisData dataManager) {

View File

@@ -20,11 +20,9 @@ package com.volmit.iris.engine.object;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.noise.CNG;
import jdk.jfr.Description;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

View File

@@ -44,7 +44,8 @@ public enum IrisSurface {
/**
* Check if this Iris surface matches the blockstate provided
*
* @param state The blockstate
* @param state
* The blockstate
* @return True if it matches
*/
public boolean matches(Block state) {

View File

@@ -45,7 +45,8 @@ public class IrisTreeSize {
/**
* Does the size match
*
* @param size the size to check match
* @param size
* the size to check match
* @return true if it matches (fits within width and depth)
*/
public boolean doesMatch(IrisTreeSize size) {

View File

@@ -138,8 +138,8 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
loadLock.acquire();
IrisBiomeStorage st = new IrisBiomeStorage();
TerrainChunk tc = TerrainChunk.createUnsafe(world, st);
Hunk<BlockData> blocks = Hunk.view((ChunkData) tc);
Hunk<Biome> biomes = Hunk.view((BiomeGrid) tc, tc.getMinHeight(), tc.getMaxHeight());
Hunk<BlockData> blocks = Hunk.view(tc);
Hunk<Biome> biomes = Hunk.view(tc, tc.getMinHeight(), tc.getMaxHeight());
this.world.bind(world);
getEngine().generate(x << 4, z << 4, blocks, biomes, true);
Iris.debug("Regenerated " + x + " " + z);
@@ -283,8 +283,8 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
if(studioGenerator != null) {
studioGenerator.generateChunk(getEngine(), tc, x, z);
} else {
Hunk<BlockData> blocks = Hunk.view((ChunkData) tc);
Hunk<Biome> biomes = Hunk.view((BiomeGrid) tc, tc.getMinHeight(), tc.getMaxHeight());
Hunk<BlockData> blocks = Hunk.view(tc);
Hunk<Biome> biomes = Hunk.view(tc, tc.getMinHeight(), tc.getMaxHeight());
getEngine().generate(x << 4, z << 4, blocks, biomes, true);
}

View File

@@ -86,7 +86,7 @@ public class HeadlessGenerator implements PlatformChunkGenerator {
INMS.get().getTrueBiomeBaseId(biomeBase)))
.build();
getEngine().generate(x << 4, z << 4,
Hunk.view((ChunkGenerator.ChunkData) tc), Hunk.view((ChunkGenerator.BiomeGrid) tc, tc.getMinHeight(), tc.getMaxHeight()),
Hunk.view(tc), Hunk.view(tc, tc.getMinHeight(), tc.getMaxHeight()),
false);
chunk.cleanupPalettesAndBlockStates();
} catch(Throwable e) {

View File

@@ -40,7 +40,8 @@ public class AtomicAverage {
/**
* Create an average holder
*
* @param size the size of entries to keep
* @param size
* the size of entries to keep
*/
public AtomicAverage(int size) {
values = new AtomicDoubleArray(size);
@@ -55,7 +56,8 @@ public class AtomicAverage {
/**
* Put a value into the average (rolls over if full)
*
* @param i the value
* @param i
* the value
*/
public void put(double i) {

View File

@@ -24,8 +24,10 @@ import java.io.Serializable;
/**
* A Biset
*
* @param <A> the first object type
* @param <B> the second object type
* @param <A>
* the first object type
* @param <B>
* the second object type
* @author cyberpwn
*/
@SuppressWarnings("hiding")
@@ -37,8 +39,10 @@ public class GBiset<A, B> implements Serializable {
/**
* Create a new Biset
*
* @param a the first object
* @param b the second object
* @param a
* the first object
* @param b
* the second object
*/
public GBiset(A a, B b) {
this.a = a;
@@ -57,7 +61,8 @@ public class GBiset<A, B> implements Serializable {
/**
* Set the first object
*
* @param a the first object A
* @param a
* the first object A
*/
public void setA(A a) {
this.a = a;

View File

@@ -24,15 +24,18 @@ import java.util.List;
/**
* Adapts a list of objects into a list of other objects
*
* @param <FROM> the from object in lists (the item INSIDE the list)
* @param <TO> the to object in lists (the item INSIDE the list)
* @param <FROM>
* the from object in lists (the item INSIDE the list)
* @param <TO>
* the to object in lists (the item INSIDE the list)
* @author cyberpwn
*/
public abstract class GListAdapter<FROM, TO> {
/**
* Adapts a list of FROM to a list of TO
*
* @param from the from list
* @param from
* the from list
* @return the to list
*/
public List<TO> adapt(List<FROM> from) {
@@ -52,7 +55,8 @@ public abstract class GListAdapter<FROM, TO> {
/**
* Adapts a list object FROM to TO for use with the adapt method
*
* @param from the from object
* @param from
* the from object
* @return the to object
*/
public abstract TO onAdapt(FROM from);

View File

@@ -119,8 +119,10 @@ public class KList<T> extends ArrayList<T> implements List<T> {
* returned map. You must specify each key for each value in this list. In the
* function, returning null will not add the keyval pair.
*
* @param <K> the inferred key type
* @param f the function
* @param <K>
* the inferred key type
* @param f
* the function
* @return the new map
*/
public <K> KMap<K, T> asValues(Function<T, K> f) {
@@ -134,8 +136,10 @@ public class KList<T> extends ArrayList<T> implements List<T> {
* returned map. You must specify each value for each key in this list. In the
* function, returning null will not add the keyval pair.
*
* @param <V> the inferred value type
* @param f the function
* @param <V>
* the inferred value type
* @param f
* the function
* @return the new map
*/
public <V> KMap<T, V> asKeys(Function<T, V> f) {
@@ -147,7 +151,8 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Cut this list into targetCount sublists
*
* @param targetCount the target count of sublists
* @param targetCount
* the target count of sublists
* @return the list of sublists
*/
public KList<KList<T>> divide(int targetCount) {
@@ -158,7 +163,8 @@ public class KList<T> extends ArrayList<T> implements List<T> {
* Split this list into a list of sublists with roughly targetSize elements of T
* per sublist
*
* @param targetSize the target size
* @param targetSize
* the target size
* @return the list of sublists
*/
public KList<KList<T>> split(int targetSize) {
@@ -186,7 +192,8 @@ public class KList<T> extends ArrayList<T> implements List<T> {
* Rewrite this list by checking each value and changing the value (or not).
* Return null to remove the element in the function
*
* @param t the function
* @param t
* the function
* @return the same list (not a copy)
*/
public KList<T> rewrite(Function<T, T> t) {
@@ -262,7 +269,8 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Tostring with a seperator for each item in the list
*
* @param split the seperator
* @param split
* the seperator
* @return the string representing this object
*/
public String toString(String split) {
@@ -295,9 +303,12 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Add the contents of the given list (v) into this list using a converter
*
* @param <V> the type of the forign list
* @param v the forign (given) list
* @param converter the converter that converts the forign type into this list type
* @param <V>
* the type of the forign list
* @param v
* the forign (given) list
* @param converter
* the converter that converts the forign type into this list type
* @return this list (builder)
*/
public <V> KList<T> addFrom(List<V> v, Function<V, T> converter) {
@@ -308,10 +319,6 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Convert this list into another list type. Such as GList<Integer> to
* GList<String>. list.convert((i) -> "" + i);
*
* @param <V>
* @param converter
* @return
*/
public <V> KList<V> convert(Function<T, V> converter) {
KList<V> v = new KList<V>();
@@ -332,7 +339,8 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Adds T to the list, ignores if null
*
* @param t the value to add
* @param t
* the value to add
* @return the same list
*/
public KList<T> addNonNull(T t) {
@@ -347,8 +355,10 @@ public class KList<T> extends ArrayList<T> implements List<T> {
* Swaps the values of index a and b. For example "hello", "world", "!" swap(1,
* 2) would change the list to "hello", "!", "world"
*
* @param a the first index
* @param b the second index
* @param a
* the first index
* @param b
* the second index
* @return the same list (builder), not a copy
*/
public KList<T> swapIndexes(int a, int b) {
@@ -364,7 +374,8 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Remove a number of elements from the list
*
* @param t the elements
* @param t
* the elements
* @return this list
*/
@SuppressWarnings("unchecked")
@@ -379,7 +390,8 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Add another glist's contents to this one (addall builder)
*
* @param t the list
* @param t
* the list
* @return the same list
*/
public KList<T> add(KList<T> t) {
@@ -390,7 +402,8 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Add a number of values to this list
*
* @param t the list
* @param t
* the list
* @return this list
*/
@SuppressWarnings("unchecked")
@@ -405,7 +418,8 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Check if this list has an index at the given index
*
* @param index the given index
* @param index
* the given index
* @return true if size > index
*/
public boolean hasIndex(int index) {

View File

@@ -56,9 +56,12 @@ public class KMap<K, V> extends ConcurrentHashMap<K, V> {
* Puts a value into a map-value-list based on the key such that if GMap<K,
* GList<S>> where V is GList<S>
*
* @param <S> the list type in the value type
* @param k the key to look for
* @param vs the values to put into the list of the given key
* @param <S>
* the list type in the value type
* @param k
* the key to look for
* @param vs
* the values to put into the list of the given key
* @return the same list (builder)
*/
@SuppressWarnings("unchecked")
@@ -143,7 +146,8 @@ public class KMap<K, V> extends ConcurrentHashMap<K, V> {
/**
* Put another map's values into this map
*
* @param m the map to insert
* @param m
* the map to insert
* @return this map (builder)
*/
public KMap<K, V> put(Map<K, V> m) {
@@ -163,7 +167,8 @@ public class KMap<K, V> extends ConcurrentHashMap<K, V> {
/**
* Loop through each keyvalue set (copy of it) with the map parameter
*
* @param f the function
* @param f
* the function
* @return the same gmap
*/
public KMap<K, V> rewrite(Consumer3<K, V, KMap<K, V>> f) {
@@ -179,7 +184,8 @@ public class KMap<K, V> extends ConcurrentHashMap<K, V> {
/**
* Loop through each keyvalue set (copy of it)
*
* @param f the function
* @param f
* the function
* @return the same gmap
*/
public KMap<K, V> each(Consumer2<K, V> f) {
@@ -308,9 +314,10 @@ public class KMap<K, V> extends ConcurrentHashMap<K, V> {
/**
* Still works as it normally should except it returns itself (builder)
*
* @param key the key
* @param value the value (single only supported)
* @return
* @param key
* the key
* @param value
* the value (single only supported)
*/
public KMap<K, V> qput(K key, V value) {
super.put(key, value);
@@ -321,8 +328,10 @@ public class KMap<K, V> extends ConcurrentHashMap<K, V> {
* Works just like put, except it wont put anything unless the key and value are
* nonnull
*
* @param key the nonnull key
* @param value the nonnull value
* @param key
* the nonnull key
* @param value
* the nonnull value
* @return the same map
*/
public KMap<K, V> putNonNull(K key, V value) {

View File

@@ -21,8 +21,10 @@ package com.volmit.iris.util.collection;
/**
* Represents a keypair
*
* @param <K> the key type
* @param <V> the value type
* @param <K>
* the key type
* @param <V>
* the value type
* @author cyberpwn
*/
@SuppressWarnings("hiding")
@@ -33,8 +35,10 @@ public class KeyPair<K, V> {
/**
* Create a keypair
*
* @param k the key
* @param v the value
* @param k
* the key
* @param v
* the value
*/
public KeyPair(K k, V v) {
this.k = k;

View File

@@ -38,7 +38,6 @@ import org.bukkit.block.data.type.PointedDripstone;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
import java.util.function.Supplier;
import java.util.stream.Collectors;

View File

@@ -49,8 +49,10 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* Construct a Cuboid given two Location objects which represent any two corners
* of the Cuboid.
*
* @param l1 one of the corners
* @param l2 the other corner
* @param l1
* one of the corners
* @param l2
* the other corner
*/
public Cuboid(Location l1, Location l2) {
if(!l1.getWorld().equals(l2.getWorld())) {
@@ -69,7 +71,8 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Construct a one-block Cuboid at the given Location of the Cuboid.
*
* @param l1 location of the Cuboid
* @param l1
* location of the Cuboid
*/
public Cuboid(Location l1) {
this(l1, l1);
@@ -78,7 +81,8 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Copy constructor.
*
* @param other the Cuboid to copy
* @param other
* the Cuboid to copy
*/
public Cuboid(Cuboid other) {
this(other.getWorld().getName(), other.x1, other.y1, other.z1, other.x2, other.y2, other.z2);
@@ -87,13 +91,20 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Construct a Cuboid in the given World and xyz co-ordinates
*
* @param world the Cuboid's world
* @param x1 X co-ordinate of corner 1
* @param y1 Y co-ordinate of corner 1
* @param z1 Z co-ordinate of corner 1
* @param x2 X co-ordinate of corner 2
* @param y2 Y co-ordinate of corner 2
* @param z2 Z co-ordinate of corner 2
* @param world
* the Cuboid's world
* @param x1
* X co-ordinate of corner 1
* @param y1
* Y co-ordinate of corner 1
* @param z1
* Z co-ordinate of corner 1
* @param x2
* X co-ordinate of corner 2
* @param y2
* Y co-ordinate of corner 2
* @param z2
* Z co-ordinate of corner 2
*/
public Cuboid(World world, int x1, int y1, int z1, int x2, int y2, int z2) {
this.worldName = world.getName();
@@ -108,13 +119,20 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Construct a Cuboid in the given world name and xyz co-ordinates.
*
* @param worldName the Cuboid's world name
* @param x1 X co-ordinate of corner 1
* @param y1 Y co-ordinate of corner 1
* @param z1 Z co-ordinate of corner 1
* @param x2 X co-ordinate of corner 2
* @param y2 Y co-ordinate of corner 2
* @param z2 Z co-ordinate of corner 2
* @param worldName
* the Cuboid's world name
* @param x1
* X co-ordinate of corner 1
* @param y1
* Y co-ordinate of corner 1
* @param z1
* Z co-ordinate of corner 1
* @param x2
* X co-ordinate of corner 2
* @param y2
* Y co-ordinate of corner 2
* @param z2
* Z co-ordinate of corner 2
*/
private Cuboid(String worldName, int x1, int y1, int z1, int x2, int y2, int z2) {
this.worldName = worldName;
@@ -153,8 +171,10 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Set the locations
*
* @param l1 a
* @param l2 b
* @param l1
* a
* @param l2
* b
*/
public void set(Location l1, Location l2) {
x1 = Math.min(l1.getBlockX(), l2.getBlockX());
@@ -218,7 +238,8 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* Get the Cuboid's world.
*
* @return the World object representing this Cuboid's world
* @throws IllegalStateException if the world is not loaded
* @throws IllegalStateException
* if the world is not loaded
*/
public World getWorld() {
World world = Bukkit.getWorld(worldName);
@@ -342,8 +363,10 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* amounts will shrink the Cuboid in the given direction. Shrinking a cuboid's
* face past the opposite face is not an error and will return a valid Cuboid.
*
* @param dir the direction in which to expand
* @param amount the number of blocks by which to expand
* @param dir
* the direction in which to expand
* @param amount
* the number of blocks by which to expand
* @return a new Cuboid expanded by the given direction and amount
*/
public Cuboid expand(CuboidDirection dir, int amount) {
@@ -371,8 +394,10 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Shift the Cuboid in the given direction by the given amount.
*
* @param dir the direction in which to shift
* @param amount the number of blocks by which to shift
* @param dir
* the direction in which to shift
* @param amount
* the number of blocks by which to shift
* @return a new Cuboid shifted by the given direction and amount
*/
public Cuboid shift(CuboidDirection dir, int amount) {
@@ -382,9 +407,11 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Outset (grow) the Cuboid in the given direction by the given amount.
*
* @param dir the direction in which to outset (must be Horizontal, Vertical, or
* @param dir
* the direction in which to outset (must be Horizontal, Vertical, or
* Both)
* @param amount the number of blocks by which to outset
* @param amount
* the number of blocks by which to outset
* @return a new Cuboid outset by the given direction and amount
*/
public Cuboid outset(CuboidDirection dir, int amount) {
@@ -401,9 +428,11 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* Inset (shrink) the Cuboid in the given direction by the given amount.
* Equivalent to calling outset() with a negative amount.
*
* @param dir the direction in which to inset (must be Horizontal, Vertical, or
* @param dir
* the direction in which to inset (must be Horizontal, Vertical, or
* Both)
* @param amount the number of blocks by which to inset
* @param amount
* the number of blocks by which to inset
* @return a new Cuboid inset by the given direction and amount
*/
public Cuboid inset(CuboidDirection dir, int amount) {
@@ -413,9 +442,12 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Return true if the point at (x,y,z) is contained within this Cuboid.
*
* @param x the X co-ordinate
* @param y the Y co-ordinate
* @param z the Z co-ordinate
* @param x
* the X co-ordinate
* @param y
* the Y co-ordinate
* @param z
* the Z co-ordinate
* @return true if the given point is within this Cuboid, false otherwise
*/
public boolean contains(int x, int y, int z) {
@@ -425,7 +457,8 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Check if the given Block is contained within this Cuboid.
*
* @param b the Block to check for
* @param b
* the Block to check for
* @return true if the Block is within this Cuboid, false otherwise
*/
public boolean contains(Block b) {
@@ -435,7 +468,8 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Check if the given Location is contained within this Cuboid.
*
* @param l the Location to check for
* @param l
* the Location to check for
* @return true if the Location is within this Cuboid, false otherwise
*/
public boolean contains(Location l) {
@@ -484,7 +518,8 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* no exterior empty space. E.g. a direction of Down will push the top face
* downwards as much as possible.
*
* @param dir the direction in which to contract
* @param dir
* the direction in which to contract
* @return a new Cuboid contracted in the given direction
*/
public Cuboid contract(CuboidDirection dir) {
@@ -534,7 +569,8 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* Get the Cuboid representing the face of this Cuboid. The resulting Cuboid
* will be one block thick in the axis perpendicular to the requested face.
*
* @param dir which face of the Cuboid to get
* @param dir
* which face of the Cuboid to get
* @return the Cuboid representing this Cuboid's requested face
*/
public Cuboid getFace(CuboidDirection dir) {
@@ -552,7 +588,8 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Check if the Cuboid contains only blocks of the given type
*
* @param material the material to check for
* @param material
* the material to check for
* @return true if this Cuboid contains only blocks of the given type
*/
public boolean containsOnly(Material material) {
@@ -567,7 +604,8 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Get the Cuboid big enough to hold both this Cuboid and the given one.
*
* @param other the other Cuboid to include
* @param other
* the other Cuboid to include
* @return a new Cuboid large enough to hold this Cuboid and the given Cuboid
*/
public Cuboid getBoundingCuboid(Cuboid other) {
@@ -588,9 +626,12 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Get a block relative to the lower NE point of the Cuboid.
*
* @param x the X co-ordinate
* @param y the Y co-ordinate
* @param z the Z co-ordinate
* @param x
* the X co-ordinate
* @param y
* the Y co-ordinate
* @param z
* the Z co-ordinate
* @return the block at the given position
*/
public Block getRelativeBlock(int x, int y, int z) {
@@ -602,10 +643,14 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* This version of getRelativeBlock() should be used if being called many times,
* to avoid excessive calls to getWorld().
*
* @param w the World
* @param x the X co-ordinate
* @param y the Y co-ordinate
* @param z the Z co-ordinate
* @param w
* the World
* @param x
* the X co-ordinate
* @param y
* the Y co-ordinate
* @param z
* the Z co-ordinate
* @return the block at the given position
*/
public Block getRelativeBlock(World w, int x, int y, int z) {

View File

@@ -18,12 +18,9 @@
package com.volmit.iris.util.data;
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
/**

View File

@@ -31,9 +31,12 @@ public class Dimension {
/**
* Make a dimension
*
* @param width width of this (X)
* @param height the height (Y)
* @param depth the depth (Z)
* @param width
* width of this (X)
* @param height
* the height (Y)
* @param depth
* the depth (Z)
*/
public Dimension(int width, int height, int depth) {
this.width = width;
@@ -44,8 +47,10 @@ public class Dimension {
/**
* Make a dimension
*
* @param width width of this (X)
* @param height the height (Y)
* @param width
* width of this (X)
* @param height
* the height (Y)
*/
public Dimension(int width, int height) {
this.width = width;

View File

@@ -36,8 +36,10 @@ public class MaterialBlock {
/**
* Create a materialblock
*
* @param material the material
* @param data the data
* @param material
* the material
* @param data
* the data
*/
public MaterialBlock(Material material, Byte data) {
this.material = material;

View File

@@ -44,9 +44,12 @@ public final class Varint {
* encode signed values. If values are known to be nonnegative,
* {@link #writeUnsignedVarLong(long, DataOutput)} should be used.
*
* @param value value to encode
* @param out to writeNodeData bytes to
* @throws IOException if {@link DataOutput} throws {@link IOException}
* @param value
* value to encode
* @param out
* to writeNodeData bytes to
* @throws IOException
* if {@link DataOutput} throws {@link IOException}
*/
public static void writeSignedVarLong(long value, DataOutput out) throws IOException {
// Great trick from http://code.google.com/apis/protocolbuffers/docs/encoding.html#types
@@ -60,9 +63,12 @@ public final class Varint {
* If values can be negative, use {@link #writeSignedVarLong(long, DataOutput)}
* instead. This method treats negative input as like a large unsigned value.
*
* @param value value to encode
* @param out to writeNodeData bytes to
* @throws IOException if {@link DataOutput} throws {@link IOException}
* @param value
* value to encode
* @param out
* to writeNodeData bytes to
* @throws IOException
* if {@link DataOutput} throws {@link IOException}
*/
public static void writeUnsignedVarLong(long value, DataOutput out) throws IOException {
while((value & 0xFFFFFFFFFFFFFF80L) != 0L) {
@@ -118,10 +124,13 @@ public final class Varint {
}
/**
* @param in to read bytes from
* @param in
* to read bytes from
* @return decode value
* @throws IOException if {@link DataInput} throws {@link IOException}
* @throws IllegalArgumentException if variable-length value does not terminate
* @throws IOException
* if {@link DataInput} throws {@link IOException}
* @throws IllegalArgumentException
* if variable-length value does not terminate
* after 9 bytes have been read
* @see #writeSignedVarLong(long, DataOutput)
*/
@@ -136,10 +145,13 @@ public final class Varint {
}
/**
* @param in to read bytes from
* @param in
* to read bytes from
* @return decode value
* @throws IOException if {@link DataInput} throws {@link IOException}
* @throws IllegalArgumentException if variable-length value does not terminate
* @throws IOException
* if {@link DataInput} throws {@link IOException}
* @throws IllegalArgumentException
* if variable-length value does not terminate
* after 9 bytes have been read
* @see #writeUnsignedVarLong(long, DataOutput)
*/
@@ -158,9 +170,11 @@ public final class Varint {
}
/**
* @throws IllegalArgumentException if variable-length value does not terminate
* @throws IllegalArgumentException
* if variable-length value does not terminate
* after 5 bytes have been read
* @throws IOException if {@link DataInput} throws {@link IOException}
* @throws IOException
* if {@link DataInput} throws {@link IOException}
* @see #readSignedVarLong(DataInput)
*/
public static int readSignedVarInt(DataInput in) throws IOException {
@@ -174,9 +188,11 @@ public final class Varint {
}
/**
* @throws IllegalArgumentException if variable-length value does not terminate
* @throws IllegalArgumentException
* if variable-length value does not terminate
* after 5 bytes have been read
* @throws IOException if {@link DataInput} throws {@link IOException}
* @throws IOException
* if {@link DataInput} throws {@link IOException}
* @see #readUnsignedVarLong(DataInput)
*/
public static int readUnsignedVarInt(DataInput in) throws IOException {

View File

@@ -31,7 +31,8 @@ public enum DecreeOrigin {
/**
* Check if the origin is valid for a sender
*
* @param sender The sender to check
* @param sender
* The sender to check
* @return True if valid for origin
*/
public boolean validFor(VolmitSender sender) {

View File

@@ -38,7 +38,8 @@ public interface DecreeParameterHandler<T> {
/**
* Converting the type back to a string (inverse of the {@link #parse(String) parse} method)
*
* @param t The input of the designated type to convert to a String
* @param t
* The input of the designated type to convert to a String
* @return The resulting string
*/
String toString(T t);
@@ -46,7 +47,8 @@ public interface DecreeParameterHandler<T> {
/**
* Forces conversion to the designated type before converting to a string using {@link #toString(T t)}
*
* @param t The object to convert to string (that should be of this type)
* @param t
* The object to convert to string (that should be of this type)
* @return The resulting string.
*/
default String toStringForce(Object t) {
@@ -56,9 +58,11 @@ public interface DecreeParameterHandler<T> {
/**
* Should parse a String into the designated type
*
* @param in The string to parse
* @param in
* The string to parse
* @return The value extracted from the string, of the designated type
* @throws DecreeParsingException Thrown when the parsing fails (ex: "oop" translated to an integer throws this)
* @throws DecreeParsingException
* Thrown when the parsing fails (ex: "oop" translated to an integer throws this)
*/
default T parse(String in) throws DecreeParsingException {
return parse(in, false);
@@ -67,17 +71,21 @@ public interface DecreeParameterHandler<T> {
/**
* Should parse a String into the designated type. You can force it to not throw a whichexception
*
* @param in The string to parse
* @param force force an option instead of throwing decreewhich
* @param in
* The string to parse
* @param force
* force an option instead of throwing decreewhich
* @return The value extracted from the string, of the designated type
* @throws DecreeParsingException Thrown when the parsing fails (ex: "oop" translated to an integer throws this)
* @throws DecreeParsingException
* Thrown when the parsing fails (ex: "oop" translated to an integer throws this)
*/
T parse(String in, boolean force) throws DecreeParsingException;
/**
* Returns whether a certain type is supported by this handler<br>
*
* @param type The type to check
* @param type
* The type to check
* @return True if supported, false if not
*/
boolean supports(Class<?> type);
@@ -85,7 +93,8 @@ public interface DecreeParameterHandler<T> {
/**
* The possible entries for the inputted string (support for autocomplete on partial entries)
*
* @param input The inputted string to check against
* @param input
* The inputted string to check against
* @return A {@link KList} of possibilities
*/
default KList<T> getPossibilities(String input) {

View File

@@ -113,7 +113,8 @@ public interface DecreeSystem extends CommandExecutor, TabCompleter {
/**
* Get the handler for the specified type
*
* @param type The type to handle
* @param type
* The type to handle
* @return The corresponding {@link DecreeParameterHandler}, or null
*/
static DecreeParameterHandler<?> getHandler(Class<?> type) {
@@ -128,8 +129,6 @@ public interface DecreeSystem extends CommandExecutor, TabCompleter {
/**
* The root class to start command searching from
*
* @return
*/
VirtualDecreeCommand getRoot();

View File

@@ -63,7 +63,8 @@ public @interface Decree {
DecreeOrigin origin() default DecreeOrigin.BOTH;
/**
* The aliases of this parameter (instead of just the {@link #name() name} (if specified) or Method Name (name of method))<br>
* The aliases of this parameter (instead of just the {@link #name() name} (if specified) or Method Name (name of
* method))<br>
* Can be initialized as just a string (ex. "alias") or as an array (ex. {"alias1", "alias2"})<br>
* If someone uses /plugin foo and you specify alias="f" here, /plugin f will do the exact same.
*/

View File

@@ -53,7 +53,8 @@ public @interface Param {
String defaultValue() default "";
/**
* The aliases of this parameter (instead of just the {@link #name() name} (if specified) or Method Name (name of method))<br>
* The aliases of this parameter (instead of just the {@link #name() name} (if specified) or Method Name (name of
* method))<br>
* Can be initialized as just a string (ex. "alias") or as an array (ex. {"alias1", "alias2"})<br>
* If someone uses /plugin foo bar=baz and you specify alias="b" here, /plugin foo b=baz will do the exact same.
*/

View File

@@ -21,8 +21,6 @@ package com.volmit.iris.util.decree.handlers;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.object.IrisCave;
import com.volmit.iris.engine.object.IrisJigsawPiece;
import com.volmit.iris.engine.object.IrisJigsawPool;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.decree.DecreeParameterHandler;
@@ -65,7 +63,8 @@ public class CaveHandler implements DecreeParameterHandler<IrisCave> {
if(options.isEmpty()) {
throw new DecreeParsingException("Unable to find Cave \"" + in + "\"");
}try {
}
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch(Throwable e) {
throw new DecreeParsingException("Unable to filter which Cave\"" + in + "\"");

View File

@@ -60,7 +60,8 @@ public class DimensionHandler implements DecreeParameterHandler<IrisDimension> {
if(options.isEmpty()) {
throw new DecreeParsingException("Unable to find Dimension \"" + in + "\"");
} try {
}
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch(Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");

View File

@@ -58,7 +58,8 @@ public class EntityHandler implements DecreeParameterHandler<IrisEntity> {
/**
* Converting the type back to a string (inverse of the {@link #parse(String) parse} method)
*
* @param entity The input of the designated type to convert to a String
* @param entity
* The input of the designated type to convert to a String
* @return The resulting string
*/
@Override
@@ -69,9 +70,11 @@ public class EntityHandler implements DecreeParameterHandler<IrisEntity> {
/**
* Should parse a String into the designated type
*
* @param in The string to parse
* @param in
* The string to parse
* @return The value extracted from the string, of the designated type
* @throws DecreeParsingException Thrown when the parsing fails (ex: "oop" translated to an integer throws this)
* @throws DecreeParsingException
* Thrown when the parsing fails (ex: "oop" translated to an integer throws this)
*/
@Override
public IrisEntity parse(String in, boolean force) throws DecreeParsingException {
@@ -79,7 +82,8 @@ public class EntityHandler implements DecreeParameterHandler<IrisEntity> {
if(options.isEmpty()) {
throw new DecreeParsingException("Unable to find Entity \"" + in + "\"");
} try {
}
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch(Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
@@ -89,7 +93,8 @@ public class EntityHandler implements DecreeParameterHandler<IrisEntity> {
/**
* Returns whether a certain type is supported by this handler<br>
*
* @param type The type to check
* @param type
* The type to check
* @return True if supported, false if not
*/
@Override

View File

@@ -60,7 +60,8 @@ public class GeneratorHandler implements DecreeParameterHandler<IrisGenerator> {
if(options.isEmpty()) {
throw new DecreeParsingException("Unable to find Generator \"" + in + "\"");
} try {
}
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch(Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");

View File

@@ -63,7 +63,8 @@ public class JigsawPieceHandler implements DecreeParameterHandler<IrisJigsawPiec
if(options.isEmpty()) {
throw new DecreeParsingException("Unable to find Jigsaw Piece \"" + in + "\"");
}try {
}
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch(Throwable e) {
throw new DecreeParsingException("Unable to filter which Jigsaw Piece \"" + in + "\"");

View File

@@ -20,7 +20,6 @@ package com.volmit.iris.util.decree.handlers;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.object.IrisJigsawPiece;
import com.volmit.iris.engine.object.IrisJigsawPool;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
@@ -64,7 +63,8 @@ public class JigsawPoolHandler implements DecreeParameterHandler<IrisJigsawPool>
if(options.isEmpty()) {
throw new DecreeParsingException("Unable to find Jigsaw Pool \"" + in + "\"");
}try {
}
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch(Throwable e) {
throw new DecreeParsingException("Unable to filter which Jigsaw Pool \"" + in + "\"");

View File

@@ -63,7 +63,8 @@ public class JigsawStructureHandler implements DecreeParameterHandler<IrisJigsaw
if(options.isEmpty()) {
throw new DecreeParsingException("Unable to find Jigsaw Structure \"" + in + "\"");
} try {
}
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch(Throwable e) {
throw new DecreeParsingException("Unable to filter which Jigsaw Structure \"" + in + "\"");

View File

@@ -44,7 +44,8 @@ public class PlayerHandler implements DecreeParameterHandler<Player> {
if(options.isEmpty()) {
throw new DecreeParsingException("Unable to find Player \"" + in + "\"");
} try {
}
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch(Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");

View File

@@ -63,7 +63,8 @@ public class RegionHandler implements DecreeParameterHandler<IrisRegion> {
if(options.isEmpty()) {
throw new DecreeParsingException("Unable to find Region \"" + in + "\"");
} try {
}
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch(Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");

View File

@@ -60,7 +60,8 @@ public class ScriptHandler implements DecreeParameterHandler<IrisScript> {
if(options.isEmpty()) {
throw new DecreeParsingException("Unable to find Script \"" + in + "\"");
} try {
}
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch(Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");

View File

@@ -49,7 +49,8 @@ public class WorldHandler implements DecreeParameterHandler<World> {
if(options.isEmpty()) {
throw new DecreeParsingException("Unable to find World \"" + in + "\"");
} try {
}
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch(Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");

View File

@@ -54,7 +54,8 @@ public class ObjectHandler implements DecreeParameterHandler<String> {
if(options.isEmpty()) {
throw new DecreeParsingException("Unable to find Object \"" + in + "\"");
} try {
}
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch(Throwable e) {
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");

View File

@@ -20,7 +20,6 @@ package com.volmit.iris.util.decree.virtual;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.service.CommandSVC;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.collection.KSet;
@@ -28,7 +27,6 @@ import com.volmit.iris.util.decree.DecreeContext;
import com.volmit.iris.util.decree.DecreeContextHandler;
import com.volmit.iris.util.decree.DecreeNode;
import com.volmit.iris.util.decree.DecreeParameter;
import com.volmit.iris.util.decree.DecreeParameterHandler;
import com.volmit.iris.util.decree.annotations.Decree;
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
import com.volmit.iris.util.format.C;
@@ -38,17 +36,11 @@ import com.volmit.iris.util.plugin.VolmitSender;
import com.volmit.iris.util.scheduling.ChronoLatch;
import com.volmit.iris.util.scheduling.J;
import lombok.Data;
import org.bukkit.Sound;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Objects;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
@Data
@@ -289,8 +281,11 @@ public class VirtualDecreeCommand {
/**
* Maps the input a player typed to the parameters of this command
* @param sender The sender
* @param in The input
*
* @param sender
* The sender
* @param in
* The input
* @return A map of all the parameter names and their values
*/
private KMap<String, Object> map(VolmitSender sender, KList<String> in) {

View File

@@ -426,7 +426,8 @@ public enum C {
/**
* Gets the color represented by the specified color code
*
* @param code Code to check
* @param code
* Code to check
* @return Associative {@link org.bukkit.ChatColor} with the given code, or null
* if it doesn't exist
*/
@@ -443,7 +444,8 @@ public enum C {
/**
* Gets the color represented by the specified color code
*
* @param code Code to check
* @param code
* Code to check
* @return Associative {@link org.bukkit.ChatColor} with the given code, or null
* if it doesn't exist
*/
@@ -462,7 +464,8 @@ public enum C {
/**
* Strips the given message of all color codes
*
* @param input String to strip of color
* @param input
* String to strip of color
* @return A copy of the input string, without any coloring
*/
public static String stripColor(final String input) {
@@ -476,7 +479,8 @@ public enum C {
/**
* DyeColor to ChatColor
*
* @param dclr the dye color
* @param dclr
* the dye color
* @return the color
*/
public static C dyeToChat(DyeColor dclr) {
@@ -576,8 +580,10 @@ public enum C {
* alternate color code character will only be replaced if it is immediately
* followed by 0-9, A-F, a-f, K-O, k-o, R or r.
*
* @param altColorChar The alternate color code character to replace. Ex: {@literal &}
* @param textToTranslate Text containing the alternate color code character.
* @param altColorChar
* The alternate color code character to replace. Ex: {@literal &}
* @param textToTranslate
* Text containing the alternate color code character.
* @return Text containing the ChatColor.COLOR_CODE color code character.
*/
public static String translateAlternateColorCodes(char altColorChar, String textToTranslate) {
@@ -612,7 +618,8 @@ public enum C {
/**
* Gets the ChatColors used at the end of the given input string.
*
* @param input Input string to retrieve the colors from.
* @param input
* Input string to retrieve the colors from.
* @return Any remaining ChatColors to pass onto the next line.
*/
public static String getLastColors(String input) {

View File

@@ -73,9 +73,12 @@ public class Form {
/**
* Scroll text
*
* @param smx the text
* @param viewport the viewport length
* @param time the timeline value
* @param smx
* the text
* @param viewport
* the viewport length
* @param time
* the timeline value
*/
public static String scroll(String smx, int viewport, long time) {
String src = Form.repeat(" ", viewport) + smx + Form.repeat(" ", viewport);
@@ -90,7 +93,8 @@ public class Form {
/**
* Capitalize the first letter
*
* @param s the string
* @param s
* the string
* @return the capitalized string
*/
public static String capitalize(String s) {
@@ -112,7 +116,8 @@ public class Form {
/**
* Capitalize all words in the string
*
* @param s the string
* @param s
* the string
* @return the capitalized string
*/
public static String capitalizeWords(String s) {
@@ -128,8 +133,10 @@ public class Form {
/**
* Hard word wrap
*
* @param s the words
* @param len the length per line
* @param s
* the words
* @param len
* the length per line
* @return the wrapped string
*/
public static String wrap(String s, int len) {
@@ -139,8 +146,10 @@ public class Form {
/**
* Soft Word wrap
*
* @param s the string
* @param len the length to wrap
* @param s
* the string
* @param len
* the length to wrap
* @return the wrapped string
*/
public static String wrapWords(String s, int len) {
@@ -150,10 +159,14 @@ public class Form {
/**
* Wrap words
*
* @param s the string
* @param len the wrap length
* @param newLineSep the new line seperator
* @param soft should it be soft wrapped or hard wrapped?
* @param s
* the string
* @param len
* the wrap length
* @param newLineSep
* the new line seperator
* @param soft
* should it be soft wrapped or hard wrapped?
* @return the wrapped words
*/
public static String wrap(String s, int len, String newLineSep, boolean soft) {
@@ -163,10 +176,8 @@ public class Form {
public static String hardWrap(String s, int len) {
StringBuilder ss = new StringBuilder();
for(int i = 0; i < s.length(); i+= len)
{
if(i + len > s.length())
{
for(int i = 0; i < s.length(); i += len) {
if(i + len > s.length()) {
ss.append(s, i, s.length());
break;
}
@@ -179,10 +190,8 @@ public class Form {
public static List<String> hardWrapList(String s, int len) {
List<String> l = new ArrayList<>();
for(int i = 0; i < s.length(); i+= len)
{
if(i + len > s.length())
{
for(int i = 0; i < s.length(); i += len) {
if(i + len > s.length()) {
l.add(s.substring(i));
break;
}
@@ -197,11 +206,16 @@ public class Form {
/**
* Wrap words
*
* @param s the string
* @param len the length
* @param newLineSep the new line seperator
* @param soft soft or hard wrapping
* @param regex the regex
* @param s
* the string
* @param len
* the length
* @param newLineSep
* the new line seperator
* @param soft
* soft or hard wrapping
* @param regex
* the regex
* @return the wrapped string
*/
public static String wrap(String s, int len, String newLineSep, boolean soft, String regex) {
@@ -278,7 +292,8 @@ public class Form {
/**
* Returns a fancy duration up to Years
*
* @param duration the duration in ms
* @param duration
* the duration in ms
* @return the fancy duration
*/
public static String duration(RollingSequence rollingSequence, long duration) {
@@ -345,7 +360,8 @@ public class Form {
/**
* Fixes the minute issue with formatting
*
* @param c the calendar
* @param c
* the calendar
* @return the minute string
*/
public static String fmin(Calendar c) {
@@ -360,7 +376,8 @@ public class Form {
/**
* Get a fancy time stamp
*
* @param time the stamp in time (ago)
* @param time
* the stamp in time (ago)
* @return the fancy stamp in time (ago)
*/
public static String ago(long time) {
@@ -473,7 +490,8 @@ public class Form {
/**
* Get the suffix for a number i.e. 1st 2nd 3rd
*
* @param i the number
* @param i
* the number
* @return the suffix
*/
public static String numberSuffix(int i) {
@@ -488,8 +506,10 @@ public class Form {
* Get a high accuracy but limited range duration (accurate up to a couple
* minutes)
*
* @param ms the milliseconds (double)
* @param prec the precision (decimal format)
* @param ms
* the milliseconds (double)
* @param prec
* the precision (decimal format)
* @return the formatted string
*/
public static String duration(double ms, int prec) {
@@ -523,8 +543,10 @@ public class Form {
/**
* Get a duration from milliseconds up to days
*
* @param ms the ms
* @param prec the precision (decimal format)
* @param ms
* the ms
* @param prec
* the precision (decimal format)
* @return the formatted string
*/
public static String duration(long ms, int prec) {
@@ -554,7 +576,8 @@ public class Form {
/**
* Format a big value
*
* @param i the number
* @param i
* the number
* @return the full value in string
*/
public static String b(int i) {
@@ -564,7 +587,8 @@ public class Form {
/**
* Format a big value
*
* @param i the number
* @param i
* the number
* @return the full value in string
*/
public static String b(long i) {
@@ -574,7 +598,8 @@ public class Form {
/**
* Format a big value
*
* @param i the number
* @param i
* the number
* @return the full value in string
*/
public static String b(double i) {
@@ -584,7 +609,8 @@ public class Form {
/**
* Format a big number
*
* @param number the big number
* @param number
* the big number
* @return the value in string
*/
public static String b(BigInteger number) {
@@ -610,7 +636,8 @@ public class Form {
* Calculate a fancy string representation of a file size. Adds a suffix of B,
* KB, MB, GB, or TB
*
* @param s the size (in bytes)
* @param s
* the size (in bytes)
* @return the string
*/
public static String fileSize(long s) {
@@ -620,8 +647,10 @@ public class Form {
/**
* ":", "a", "b", "c" -> a:b:c
*
* @param splitter the splitter that goes in between
* @param strings the strings
* @param splitter
* the splitter that goes in between
* @param strings
* the strings
* @return the result
*/
public static String split(String splitter, String... strings) {
@@ -639,7 +668,8 @@ public class Form {
* Calculate a fancy string representation of a file size. Adds a suffix of B,
* KB, MB, GB, or TB
*
* @param s the size (in bytes)
* @param s
* the size (in bytes)
* @return the string
*/
public static String memSize(long s) {
@@ -653,7 +683,8 @@ public class Form {
/**
* Get the timestamp of the time t (ms since 1970)
*
* @param t the time
* @param t
* the time
* @return the stamp
*/
@SuppressWarnings("deprecation")
@@ -688,8 +719,10 @@ public class Form {
* with a special divisor. The divisor decides how much goes up in the suffix
* chain.
*
* @param s the size (in bytes)
* @param div the divisor
* @param s
* the size (in bytes)
* @param div
* the divisor
* @return the string
*/
public static String ofSize(long s, int div) {
@@ -728,9 +761,12 @@ public class Form {
* with a special divisor. The divisor decides how much goes up in the suffix
* chain.
*
* @param s the size (in bytes)
* @param div the divisor
* @param dec the decimal places
* @param s
* the size (in bytes)
* @param div
* the divisor
* @param dec
* the decimal places
* @return the string
*/
public static String ofSize(long s, int div, int dec) {
@@ -765,9 +801,12 @@ public class Form {
* with a special divisor. The divisor decides how much goes up in the suffix
* chain.
*
* @param s the size (in bytes)
* @param div the divisor
* @param dec the decimal places
* @param s
* the size (in bytes)
* @param div
* the divisor
* @param dec
* the decimal places
* @return the string
*/
public static String ofSizeMetricWeight(long s, int div, int dec) {
@@ -804,8 +843,10 @@ public class Form {
/**
* Trim a string to a length, then append ... at the end if it extends the limit
*
* @param s the string
* @param l the limit
* @param s
* the string
* @param l
* the limit
* @return the modified string
*/
public static String trim(String s, int l) {
@@ -820,7 +861,8 @@ public class Form {
* Get a class name into a configuration/filename key For example,
* PhantomController.class is converted to phantom-controller
*
* @param clazz the class
* @param clazz
* the class
* @return the string representation
*/
public static String cname(String clazz) {
@@ -844,7 +886,8 @@ public class Form {
/**
* Get a formatted representation of the memory given in megabytes
*
* @param mb the megabytes
* @param mb
* the megabytes
* @return the string representation with suffixes
*/
public static String mem(long mb) {
@@ -879,7 +922,8 @@ public class Form {
/**
* Format a long. Changes -10334 into -10,334
*
* @param i the number
* @param i
* the number
* @return the string representation of the number
*/
public static String f(long i) {
@@ -890,7 +934,8 @@ public class Form {
/**
* Format a number. Changes -10334 into -10,334
*
* @param i the number
* @param i
* the number
* @return the string representation of the number
*/
public static String f(int i) {
@@ -901,8 +946,10 @@ public class Form {
/**
* Formats a double's decimals to a limit
*
* @param i the double
* @param p the number of decimal places to use
* @param i
* the double
* @param p
* the number of decimal places to use
* @return the formated string
*/
public static String f(double i, int p) {
@@ -922,8 +969,10 @@ public class Form {
* decimal places that dont need to be placed down. 2.4343 formatted with 6
* decimals gets returned as 2.434300
*
* @param i the double
* @param p the number of decimal places to use
* @param i
* the double
* @param p
* the number of decimal places to use
* @return the formated string
*/
public static String fd(double i, int p) {
@@ -941,8 +990,10 @@ public class Form {
/**
* Formats a float's decimals to a limit
*
* @param i the float
* @param p the number of decimal places to use
* @param i
* the float
* @param p
* the number of decimal places to use
* @return the formated string
*/
public static String f(float i, int p) {
@@ -960,7 +1011,8 @@ public class Form {
/**
* Formats a double's decimals (one decimal point)
*
* @param i the double
* @param i
* the double
*/
public static String f(double i) {
return f(i, 1);
@@ -969,7 +1021,8 @@ public class Form {
/**
* Formats a float's decimals (one decimal point)
*
* @param i the float
* @param i
* the float
*/
public static String f(float i) {
return f(i, 1);
@@ -979,8 +1032,10 @@ public class Form {
* Get a percent representation of a double and decimal places (0.53) would
* return 53%
*
* @param i the double
* @param p the number of decimal points
* @param i
* the double
* @param p
* the number of decimal points
* @return a string
*/
public static String pc(double i, int p) {
@@ -991,8 +1046,10 @@ public class Form {
* Get a percent representation of a float and decimal places (0.53) would
* return 53%
*
* @param i the float
* @param p the number of decimal points
* @param i
* the float
* @param p
* the number of decimal points
* @return a string
*/
public static String pc(float i, int p) {
@@ -1003,7 +1060,8 @@ public class Form {
* Get a percent representation of a double and zero decimal places (0.53) would
* return 53%
*
* @param i the double
* @param i
* the double
* @return a string
*/
public static String pc(double i) {
@@ -1014,7 +1072,8 @@ public class Form {
* Get a percent representation of a float and zero decimal places (0.53) would
* return 53%
*
* @param i the double
* @param i
* the double
* @return a string
*/
public static String pc(float i) {
@@ -1024,9 +1083,12 @@ public class Form {
/**
* Get a percent as the percent of i out of "of" with custom decimal places
*
* @param i the percent out of
* @param of of of
* @param p the decimal places
* @param i
* the percent out of
* @param of
* of of
* @param p
* the decimal places
* @return the string
*/
public static String pc(int i, int of, int p) {
@@ -1036,8 +1098,10 @@ public class Form {
/**
* Get a percent as the percent of i out of "of"
*
* @param i the percent out of
* @param of of of
* @param i
* the percent out of
* @param of
* of of
* @return the string
*/
public static String pc(int i, int of) {
@@ -1047,9 +1111,12 @@ public class Form {
/**
* Get a percent as the percent of i out of "of" with custom decimal places
*
* @param i the percent out of
* @param of of of
* @param p the decimal places
* @param i
* the percent out of
* @param of
* of of
* @param p
* the decimal places
* @return the string
*/
public static String pc(long i, long of, int p) {
@@ -1059,8 +1126,10 @@ public class Form {
/**
* Get a percent as the percent of i out of "of"
*
* @param i the percent out of
* @param of of of
* @param i
* the percent out of
* @param of
* of of
* @return the string
*/
public static String pc(long i, long of) {
@@ -1070,7 +1139,8 @@ public class Form {
/**
* Milliseconds to seconds (double)
*
* @param ms the milliseconds
* @param ms
* the milliseconds
* @return a formatted string to milliseconds
*/
public static String msSeconds(long ms) {
@@ -1080,8 +1150,10 @@ public class Form {
/**
* Milliseconds to seconds (double) custom decimals
*
* @param ms the milliseconds
* @param p number of decimal points
* @param ms
* the milliseconds
* @param p
* number of decimal points
* @return a formatted string to milliseconds
*/
public static String msSeconds(long ms, int p) {
@@ -1100,7 +1172,8 @@ public class Form {
/**
* nanoseconds to seconds (double) custom decimals
*
* @param p number of decimal points
* @param p
* number of decimal points
* @return a formatted string to nanoseconds
*/
public static String nsMs(long ns, int p) {
@@ -1110,7 +1183,8 @@ public class Form {
/**
* nanoseconds to seconds (double) custom decimals
*
* @param p number of decimal points
* @param p
* number of decimal points
* @return a formatted string to nanoseconds
*/
public static String nsMsd(long ns, int p) {
@@ -1120,7 +1194,8 @@ public class Form {
/**
* Get roman numeral representation of the int
*
* @param num the int
* @param num
* the int
* @return the numerals
*/
public static String toRoman(int num) {
@@ -1155,7 +1230,8 @@ public class Form {
/**
* Get the number representation from roman numerals.
*
* @param number the roman number
* @param number
* the roman number
* @return the int representation
*/
public static int fromRoman(String number) {
@@ -1223,8 +1299,10 @@ public class Form {
/**
* Repeat a string
*
* @param s the string
* @param n the amount of times to repeat
* @param s
* the string
* @param n
* the amount of times to repeat
* @return the repeated string
*/
@SuppressWarnings("StringRepeatCanBeUsed")

View File

@@ -78,8 +78,10 @@ public interface Hunk<T> {
* Create a hunk view from a source hunk. This view reads and writes through to
* the source hunk. Its is not a copy.
*
* @param <T> the type
* @param src the source hunk
* @param <T>
* the type
* @param src
* the source hunk
* @return the hunk view
*/
static <T> Hunk<T> view(Hunk<T> src) {
@@ -197,9 +199,12 @@ public interface Hunk<T> {
/**
* Creates a new bounding hunk from the given hunks
*
* @param <T> the type
* @param factory the factory that creates a hunk
* @param hunks the hunks
* @param <T>
* the type
* @param factory
* the factory that creates a hunk
* @param hunks
* the hunks
* @return the new bounding hunk
*/
@SafeVarargs
@@ -291,13 +296,20 @@ public interface Hunk<T> {
/**
* Create a hunk that is optimized for specific uses
*
* @param w width
* @param h height
* @param d depth
* @param type the class type
* @param packed if the hunk is generally more than 50% full (non-null nodes)
* @param concurrent if this hunk must be thread safe
* @param <T> the type
* @param w
* width
* @param h
* height
* @param d
* depth
* @param type
* the class type
* @param packed
* if the hunk is generally more than 50% full (non-null nodes)
* @param concurrent
* if this hunk must be thread safe
* @param <T>
* the type
* @return the hunk
*/
static <T> Hunk<T> newHunk(int w, int h, int d, Class<T> type, boolean packed, boolean concurrent) {
@@ -556,8 +568,10 @@ public interface Hunk<T> {
* hunk.set(hunkX, ?, hunkZ, noise(actualBlockX, ?, actualBlockZ));<br>
* }<br>
*
* @param p the predicate
* @param c the consumer
* @param p
* the predicate
* @param c
* the consumer
* @return this
*/
default Hunk<T> iterateSurfaces2D(Predicate<T> p, Consumer8<Integer, Integer, Integer, Integer, Integer, Integer, Integer, Hunk<T>> c) {
@@ -618,9 +632,12 @@ public interface Hunk<T> {
* hunk.set(hunkX, ?, hunkZ, noise(actualBlockX, ?, actualBlockZ));<br>
* }<br>
*
* @param parallelism the ideal threads to use on this
* @param p the predicate
* @param c the consumer
* @param parallelism
* the ideal threads to use on this
* @param p
* the predicate
* @param c
* the consumer
* @return this
*/
default Hunk<T> iterateSurfaces2D(int parallelism, Predicate<T> p, Consumer8<Integer, Integer, Integer, Integer, Integer, Integer, Integer, Hunk<T>> c) {
@@ -657,7 +674,8 @@ public interface Hunk<T> {
* <p>
* hunk.set(ax, ?, az, NOISE.get(ax+hx, az+hz));
*
* @param c the consumer hunkX, hunkZ, hunkOffsetX, hunkOffsetZ.
* @param c
* the consumer hunkX, hunkZ, hunkOffsetX, hunkOffsetZ.
* @return this
*/
default Hunk<T> iterate2DTop(Consumer5<Integer, Integer, Integer, Integer, Hunk<T>> c) {
@@ -675,8 +693,10 @@ public interface Hunk<T> {
* <p>
* hunk.set(ax, ?, az, NOISE.get(ax+hx, az+hz));
*
* @param parallelism the target parallelism value or 0 to disable
* @param c the consumer hunkX, hunkZ, hunkOffsetX, hunkOffsetZ.
* @param parallelism
* the target parallelism value or 0 to disable
* @param c
* the consumer hunkX, hunkZ, hunkOffsetX, hunkOffsetZ.
* @return this
*/
default Hunk<T> iterate2DTop(int parallelism, Consumer5<Integer, Integer, Integer, Integer, Hunk<T>> c) {
@@ -1037,12 +1057,18 @@ public interface Hunk<T> {
/**
* Create a new hunk from a section of this hunk.
*
* @param x1 The min x (inclusive)
* @param y1 The min y (inclusive)
* @param z1 The min z (inclusive)
* @param x2 The max x (exclusive)
* @param y2 The max y (exclusive)
* @param z2 The max z (exclusive)
* @param x1
* The min x (inclusive)
* @param y1
* The min y (inclusive)
* @param z1
* The min z (inclusive)
* @param x2
* The max x (exclusive)
* @param y2
* The max y (exclusive)
* @param z2
* The max z (exclusive)
* @return the new hunk (x2-x1, y2-y1, z2-z1)
*/
default ArrayHunk<T> crop(int x1, int y1, int z1, int x2, int y2, int z2) {
@@ -1063,12 +1089,18 @@ public interface Hunk<T> {
* Create a new view of this same hunk from a section of this hunk.
* Modifications are routed to this hunk!
*
* @param x1 The min x (inclusive)
* @param y1 The min y (inclusive)
* @param z1 The min z (inclusive)
* @param x2 The max x (exclusive)
* @param y2 The max y (exclusive)
* @param z2 The max z (exclusive)
* @param x1
* The min x (inclusive)
* @param y1
* The min y (inclusive)
* @param z1
* The min z (inclusive)
* @param x2
* The max x (exclusive)
* @param y2
* The max y (exclusive)
* @param z2
* The max z (exclusive)
* @return the cropped view of this hunk (x2-x1, y2-y1, z2-z1)
*/
default Hunk<T> croppedView(int x1, int y1, int z1, int x2, int y2, int z2) {
@@ -1093,13 +1125,20 @@ public interface Hunk<T> {
/**
* Set a region
*
* @param x1 inclusive 1st x
* @param y1 inclusive 1st y
* @param z1 inclusive 1st z
* @param x2 inclusive 2nd x
* @param y2 inclusive 2nd y
* @param z2 inclusive 2nd z
* @param t the value to set
* @param x1
* inclusive 1st x
* @param y1
* inclusive 1st y
* @param z1
* inclusive 1st z
* @param x2
* inclusive 2nd x
* @param y2
* inclusive 2nd y
* @param z2
* inclusive 2nd z
* @param t
* the value to set
*/
default void set(int x1, int y1, int z1, int x2, int y2, int z2, T t) {
for(int i = x1; i <= x2; i++) {
@@ -1114,9 +1153,12 @@ public interface Hunk<T> {
/**
* Get the value to the closest valid position
*
* @param x the x
* @param y the y
* @param z the z
* @param x
* the x
* @param y
* the y
* @param z
* the z
* @return the value closest to the border of the hunk
*/
default T getClosest(int x, int y, int z) {
@@ -1146,7 +1188,8 @@ public interface Hunk<T> {
/**
* Get a 1 node thick hunk representing the face of this hunk
*
* @param f the face
* @param f
* the face
* @return the hunk view of this hunk
*/
default Hunk<T> viewFace(HunkFace f) {
@@ -1173,7 +1216,8 @@ public interface Hunk<T> {
/**
* Crop (copy) a 1 node thick hunk representing the face of this hunk
*
* @param f the face
* @param f
* the face
* @return the hunk copy (face) of this hunk
*/
default Hunk<T> cropFace(HunkFace f) {
@@ -1200,10 +1244,14 @@ public interface Hunk<T> {
/**
* Set a value at the given position
*
* @param x the x
* @param y the y
* @param z the z
* @param t the value
* @param x
* the x
* @param y
* the y
* @param z
* the z
* @param t
* the value
*/
default void set(int x, int y, int z, T t) {
setRaw(x, y, z, t);
@@ -1232,19 +1280,26 @@ public interface Hunk<T> {
/**
* Set a value at the given position without checking coordinate bounds
*
* @param x the x
* @param y the y
* @param z the z
* @param t the value
* @param x
* the x
* @param y
* the y
* @param z
* the z
* @param t
* the value
*/
void setRaw(int x, int y, int z, T t);
/**
* Get a value at the given position without checking coordinate bounds
*
* @param x the x
* @param y the y
* @param z the z
* @param x
* the x
* @param y
* the y
* @param z
* the z
* @return the value or null
*/
T getRaw(int x, int y, int z);
@@ -1252,9 +1307,12 @@ public interface Hunk<T> {
/**
* Get a value at the given position
*
* @param x the x
* @param y the y
* @param z the z
* @param x
* the x
* @param y
* the y
* @param z
* the z
* @return the value or null
*/
default T get(int x, int y, int z) {
@@ -1274,10 +1332,14 @@ public interface Hunk<T> {
/**
* Insert a hunk into this one with an offset the inserted hunk
*
* @param offX the offset from zero for x
* @param offY the offset from zero for y
* @param offZ the offset from zero for z
* @param hunk the hunk to insert
* @param offX
* the offset from zero for x
* @param offY
* the offset from zero for y
* @param offZ
* the offset from zero for z
* @param hunk
* the hunk to insert
*/
default void insert(int offX, int offY, int offZ, Hunk<T> hunk) {
insert(offX, offY, offZ, hunk, false);
@@ -1290,7 +1352,8 @@ public interface Hunk<T> {
/**
* Insert a hunk into this one
*
* @param hunk the hunk to insert
* @param hunk
* the hunk to insert
*/
default void insert(Hunk<T> hunk) {
insert(0, 0, 0, hunk, false);
@@ -1310,8 +1373,10 @@ public interface Hunk<T> {
/**
* Insert a hunk into this one
*
* @param hunk the hunk to insert
* @param inverted invert the inserted hunk or not
* @param hunk
* the hunk to insert
* @param inverted
* invert the inserted hunk or not
*/
default void insert(Hunk<T> hunk, boolean inverted) {
insert(0, 0, 0, hunk, inverted);
@@ -1321,11 +1386,16 @@ public interface Hunk<T> {
* Insert a hunk into this one with an offset and possibly inverting the y of
* the inserted hunk
*
* @param offX the offset from zero for x
* @param offY the offset from zero for y
* @param offZ the offset from zero for z
* @param hunk the hunk to insert
* @param invertY should the inserted hunk be inverted
* @param offX
* the offset from zero for x
* @param offY
* the offset from zero for y
* @param offZ
* the offset from zero for z
* @param hunk
* the hunk to insert
* @param invertY
* should the inserted hunk be inverted
*/
default void insert(int offX, int offY, int offZ, Hunk<T> hunk, boolean invertY) {
for(int i = offX; i < offX + hunk.getWidth(); i++) {
@@ -1338,14 +1408,20 @@ public interface Hunk<T> {
}
/**
* Insert a hunk into this one with an offset and possibly inverting the y of. Will never insert a node if its already used
* Insert a hunk into this one with an offset and possibly inverting the y of. Will never insert a node if its
* already used
* the inserted hunk
*
* @param offX the offset from zero for x
* @param offY the offset from zero for y
* @param offZ the offset from zero for z
* @param hunk the hunk to insert
* @param invertY should the inserted hunk be inverted
* @param offX
* the offset from zero for x
* @param offY
* the offset from zero for y
* @param offZ
* the offset from zero for z
* @param hunk
* the hunk to insert
* @param invertY
* should the inserted hunk be inverted
*/
default void insertSoftly(int offX, int offY, int offZ, Hunk<T> hunk, boolean invertY, Predicate<T> shouldOverwrite) {
for(int i = offX; i < offX + hunk.getWidth(); i++) {
@@ -1362,7 +1438,8 @@ public interface Hunk<T> {
/**
* Acts like fill, however if used by a mapped hunk, will simply clear it
*
* @param b the data to use for fill
* @param b
* the data to use for fill
*/
default void empty(T b) {
fill(b);
@@ -1371,9 +1448,12 @@ public interface Hunk<T> {
/**
* Take a hunk and scale it up using interpolation
*
* @param scale the scale
* @param d the interpolation method
* @param interpolated the interpolated value converter
* @param scale
* the scale
* @param d
* the interpolation method
* @param interpolated
* the interpolated value converter
* @return the new hunk
*/
default Hunk<T> interpolate3D(double scale, InterpolationMethod3D d, Interpolated<T> interpolated) {
@@ -1398,9 +1478,12 @@ public interface Hunk<T> {
* Take a hunk and scale it up using interpolation
* 2D, (using only x and z) assumes the height is 1
*
* @param scale the scale
* @param d the interpolation method
* @param interpolated the interpolated value converter
* @param scale
* the scale
* @param d
* the interpolation method
* @param interpolated
* the interpolated value converter
* @return the new hunk
*/
default Hunk<T> interpolate2D(double scale, InterpolationMethod d, Interpolated<T> interpolated) {

View File

@@ -18,7 +18,6 @@
package com.volmit.iris.util.hunk.bits;
import com.volmit.iris.Iris;
import com.volmit.iris.util.data.Varint;
import org.apache.commons.lang3.Validate;

View File

@@ -18,7 +18,6 @@
package com.volmit.iris.util.hunk.bits;
import com.volmit.iris.Iris;
import com.volmit.iris.util.data.Varint;
import java.io.ByteArrayOutputStream;
@@ -56,8 +55,7 @@ public class DataContainer<T> {
this.bits = new AtomicInteger(palette.get().bits());
}
public static String readBitString(DataInputStream din) throws IOException
{
public static String readBitString(DataInputStream din) throws IOException {
DataContainer<Character> c = new DataContainer<>(din, new Writable<Character>() {
@Override
public Character readNodeData(DataInputStream din) throws IOException {
@@ -72,8 +70,7 @@ public class DataContainer<T> {
StringBuilder sb = new StringBuilder();
for(int i = c.size()-1; i >= 0; i--)
{
for(int i = c.size() - 1; i >= 0; i--) {
sb.setCharAt(i, c.get(i));
}
@@ -93,21 +90,18 @@ public class DataContainer<T> {
}
}, s.length());
for(int i = 0; i < s.length(); i++)
{
for(int i = 0; i < s.length(); i++) {
c.set(i, s.charAt(i));
}
c.writeDos(dos);
}
public DataBits getData()
{
public DataBits getData() {
return data.get();
}
public Palette<T> getPalette()
{
public Palette<T> getPalette() {
return palette.get();
}
@@ -156,8 +150,7 @@ public class DataContainer<T> {
}
public void set(int position, T t) {
synchronized (this)
{
synchronized(this) {
int id = palette.get().id(t);
if(id == -1) {
@@ -176,8 +169,7 @@ public class DataContainer<T> {
}
public T get(int position) {
synchronized (this)
{
synchronized(this) {
int id = data.get().get(position) + 1;
if(id <= 0) {

View File

@@ -59,8 +59,7 @@ public class HashPalette<T> implements Palette<T> {
@Override
public int id(T t) {
if(t == null)
{
if(t == null) {
return 0;
}
@@ -76,8 +75,7 @@ public class HashPalette<T> implements Palette<T> {
@Override
public void iterate(Consumer2<T, Integer> c) {
for(T i : palette.keySet()) {
if(i == null)
{
if(i == null) {
continue;
}

View File

@@ -18,9 +18,7 @@
package com.volmit.iris.util.hunk.bits;
import com.volmit.iris.Iris;
import com.volmit.iris.util.function.Consumer2;
import org.bukkit.block.data.BlockData;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
@@ -67,8 +65,7 @@ public class LinearPalette<T> implements Palette<T> {
@Override
public int id(T t) {
if(t == null)
{
if(t == null) {
return 0;
}

View File

@@ -22,31 +22,23 @@ import com.volmit.iris.Iris;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KSet;
import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.io.IO;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.matter.slices.BlockMatter;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Set;
public class TecTest {
public static Set<BlockData> randomBlocks(int max)
{
public static Set<BlockData> randomBlocks(int max) {
KSet<BlockData> d = new KSet<>();
while(d.size() < max)
{
while(d.size() < max) {
Material m = Material.values()[RNG.r.i(Material.values().length - 1)];
if(m.isBlock())
{
if(m.isBlock()) {
d.add(m.createBlockData());
}
}
@@ -54,23 +46,19 @@ public class TecTest {
return d;
}
public static void go()
{
public static void go() {
}
public static boolean test(int size, int pal)
{
try
{
public static boolean test(int size, int pal) {
try {
Iris.info("Test? " + size + " " + pal);
KList<BlockData> blocks = new KList<>(randomBlocks(pal));
Iris.info("Fill " + pal + " -> " + size + " Entries");
Writable<BlockData> writer = new BlockMatter();
DataContainer<BlockData> dc = new DataContainer<>(writer, size);
for(int i = 0; i < dc.size(); i++)
{
for(int i = 0; i < dc.size(); i++) {
dc.set(i, blocks.getRandom());
}
@@ -84,13 +72,9 @@ public class TecTest {
if(Arrays.equals(dat, dat2)) {
Iris.info("MATCH");
return true;
}
else
{
for(int i = 0; i < dc.size(); i++)
{
if(!dx.get(i).equals(dc.get(i)))
{
} else {
for(int i = 0; i < dc.size(); i++) {
if(!dx.get(i).equals(dc.get(i))) {
Iris.info("FAIL Expected " + dc.get(i).getAsString(true) + " but got " + dx.get(i).getAsString(true));
return false;
}
@@ -99,10 +83,7 @@ public class TecTest {
return true;
}
}
catch(Throwable e)
{
} catch(Throwable e) {
e.printStackTrace();
return false;
}

View File

@@ -27,7 +27,6 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.IOException;
import java.util.concurrent.locks.ReentrantLock;
@SuppressWarnings({"DefaultAnnotationParam", "Lombok"})
@Data

View File

@@ -921,17 +921,28 @@ public class IrisInterpolation {
/**
* Get the interpolated 3D noise within a given cuboid size with offsets
*
* @param method the interpolation method to use
* @param xo the x offset for noise
* @param yo the y offset for noise
* @param zo the z offset for noise
* @param w the width of the result
* @param h the height of the result
* @param d the depth of the result
* @param radX the interpolation radius for the x axis
* @param radY the interpolation radius for the y axis
* @param radZ the interpolation radius for the z axis
* @param n the noise provider
* @param method
* the interpolation method to use
* @param xo
* the x offset for noise
* @param yo
* the y offset for noise
* @param zo
* the z offset for noise
* @param w
* the width of the result
* @param h
* the height of the result
* @param d
* the depth of the result
* @param radX
* the interpolation radius for the x axis
* @param radY
* the interpolation radius for the y axis
* @param radZ
* the interpolation radius for the z axis
* @param n
* the noise provider
* @return the resulting hunk of noise
*/
public static Hunk<Double> getNoise3D(InterpolationMethod3D method, int xo, int yo, int zo, int w, int h, int d, double radX, double radY, double radZ, NoiseProvider3 n) {

View File

@@ -188,10 +188,13 @@ public class IO {
* Transfers the length of the buffer amount of data from the input stream to
* the output stream
*
* @param in the input
* @param out the output
* @param in
* the input
* @param out
* the output
* @return the actual transfered amount
* @throws IOException shit happens
* @throws IOException
* shit happens
*/
public static int transfer(InputStream in, OutputStream out, byte[] buffer) throws IOException {
int r = in.read(buffer);
@@ -207,12 +210,17 @@ public class IO {
* Transfers the length of the buffer amount of data from the input stream to
* the output stream
*
* @param in the input
* @param out the output
* @param targetBuffer the buffer and size to use
* @param totalSize the total amount to transfer
* @param in
* the input
* @param out
* the output
* @param targetBuffer
* the buffer and size to use
* @param totalSize
* the total amount to transfer
* @return the actual transfered amount
* @throws IOException shit happens
* @throws IOException
* shit happens
*/
public static long transfer(InputStream in, OutputStream out, int targetBuffer, long totalSize) throws IOException {
long total = totalSize;
@@ -237,10 +245,7 @@ public class IO {
* Fully move data from a finite inputstream to an output stream using a buffer
* size of 8192. This does NOT close streams.
*
* @param in
* @param out
* @return total size transfered
* @throws IOException
*/
public static long fillTransfer(InputStream in, OutputStream out) throws IOException {
return fullTransfer(in, out, 8192);
@@ -260,11 +265,15 @@ public class IO {
* Fully move data from a finite inputstream to an output stream using a given
* buffer size. This does NOT close streams.
*
* @param in the input stream to read from
* @param out the output stream to writeNodeData to
* @param bufferSize the target buffer size
* @param in
* the input stream to read from
* @param out
* the output stream to writeNodeData to
* @param bufferSize
* the target buffer size
* @return total size transfered
* @throws IOException shit happens
* @throws IOException
* shit happens
*/
public static long fullTransfer(InputStream in, OutputStream out, int bufferSize) throws IOException {
long wrote = 0;
@@ -282,7 +291,8 @@ public class IO {
/**
* Recursive delete (deleting folders)
*
* @param f the file to delete (and subfiles if folder)
* @param f
* the file to delete (and subfiles if folder)
*/
public static void delete(File f) {
if(f == null || !f.exists()) {
@@ -433,8 +443,10 @@ public class IO {
* new file with size 0 or, if the file exists already, it is opened and closed
* without modifying it, but updating the file date and time.
*
* @param file the File to touch
* @throws IOException If an I/O problem occurs
* @param file
* the File to touch
* @throws IOException
* If an I/O problem occurs
*/
public static void touch(File file) throws IOException {
if(!file.exists()) {
@@ -452,11 +464,16 @@ public class IO {
* does not exist. If the destination file exists, then this method will
* overwrite it.
*
* @param srcFile an existing file to copy, must not be null
* @param destFile the new file, must not be null
* @throws NullPointerException if source or destination is null
* @throws IOException if source or destination is invalid
* @throws IOException if an IO error occurs during copying
* @param srcFile
* an existing file to copy, must not be null
* @param destFile
* the new file, must not be null
* @throws NullPointerException
* if source or destination is null
* @throws IOException
* if source or destination is invalid
* @throws IOException
* if an IO error occurs during copying
*/
public static void copyFile(File srcFile, File destFile) throws IOException {
copyFile(srcFile, destFile, true);
@@ -470,13 +487,19 @@ public class IO {
* does not exist. If the destination file exists, then this method will
* overwrite it.
*
* @param srcFile an existing file to copy, must not be null
* @param destFile the new file, must not be null
* @param preserveFileDate true if the file date of the copy should be the same as the
* @param srcFile
* an existing file to copy, must not be null
* @param destFile
* the new file, must not be null
* @param preserveFileDate
* true if the file date of the copy should be the same as the
* original
* @throws NullPointerException if source or destination is null
* @throws IOException if source or destination is invalid
* @throws IOException if an IO error occurs during copying
* @throws NullPointerException
* if source or destination is null
* @throws IOException
* if source or destination is invalid
* @throws IOException
* if an IO error occurs during copying
*/
public static void copyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if(srcFile == null) {
@@ -510,10 +533,14 @@ public class IO {
/**
* Internal copy file method.
*
* @param srcFile the validated source file, not null
* @param destFile the validated destination file, not null
* @param preserveFileDate whether to preserve the file date
* @throws IOException if an error occurs
* @param srcFile
* the validated source file, not null
* @param destFile
* the validated destination file, not null
* @param preserveFileDate
* whether to preserve the file date
* @throws IOException
* if an error occurs
*/
private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if(destFile.exists() && destFile.isDirectory()) {
@@ -546,7 +573,8 @@ public class IO {
* Equivalent to {@link Reader#close()}, except any exceptions will be ignored.
* This is typically used in finally blocks.
*
* @param input the Reader to close, may be null or already closed
* @param input
* the Reader to close, may be null or already closed
*/
public static void closeQuietly(Reader input) {
try {
@@ -565,7 +593,8 @@ public class IO {
* Equivalent to {@link Writer#close()}, except any exceptions will be ignored.
* This is typically used in finally blocks.
*
* @param output the Writer to close, may be null or already closed
* @param output
* the Writer to close, may be null or already closed
*/
public static void closeQuietly(Writer output) {
try {
@@ -584,7 +613,8 @@ public class IO {
* Equivalent to {@link InputStream#close()}, except any exceptions will be
* ignored. This is typically used in finally blocks.
*
* @param input the InputStream to close, may be null or already closed
* @param input
* the InputStream to close, may be null or already closed
*/
public static void closeQuietly(InputStream input) {
try {
@@ -606,7 +636,8 @@ public class IO {
* Equivalent to {@link OutputStream#close()}, except any exceptions will be
* ignored. This is typically used in finally blocks.
*
* @param output the OutputStream to close, may be null or already closed
* @param output
* the OutputStream to close, may be null or already closed
*/
public static void closeQuietly(OutputStream output) {
try {
@@ -625,10 +656,13 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param input the <code>InputStream</code> to read from
* @param input
* the <code>InputStream</code> to read from
* @return the requested byte array
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
*/
public static byte[] toByteArray(InputStream input) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
@@ -643,10 +677,13 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
*
* @param input the <code>Reader</code> to read from
* @param input
* the <code>Reader</code> to read from
* @return the requested byte array
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
*/
public static byte[] toByteArray(Reader input) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
@@ -664,11 +701,15 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
*
* @param input the <code>Reader</code> to read from
* @param encoding the encoding to use, null means platform default
* @param input
* the <code>Reader</code> to read from
* @param encoding
* the encoding to use, null means platform default
* @return the requested byte array
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static byte[] toByteArray(Reader input, String encoding) throws IOException {
@@ -686,7 +727,8 @@ public class IO {
* <p>
* This is the same as {@link String#getBytes()}.
*
* @param input the <code>String</code> to convert
* @param input
* the <code>String</code> to convert
* @return the requested byte array
* @deprecated Use {@link String#getBytes()}
*/
@@ -702,10 +744,13 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param is the <code>InputStream</code> to read from
* @param is
* the <code>InputStream</code> to read from
* @return the requested character array
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static char[] toCharArray(InputStream is) throws IOException {
@@ -724,11 +769,15 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param is the <code>InputStream</code> to read from
* @param encoding the encoding to use, null means platform default
* @param is
* the <code>InputStream</code> to read from
* @param encoding
* the encoding to use, null means platform default
* @return the requested character array
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static char[] toCharArray(InputStream is, String encoding) throws IOException {
@@ -746,10 +795,13 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
*
* @param input the <code>Reader</code> to read from
* @param input
* the <code>Reader</code> to read from
* @return the requested character array
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static char[] toCharArray(Reader input) throws IOException {
@@ -765,10 +817,13 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param input the <code>InputStream</code> to read from
* @param input
* the <code>InputStream</code> to read from
* @return the requested String
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
*/
public static String toString(InputStream input) throws IOException {
StringWriter sw = new StringWriter();
@@ -786,11 +841,15 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param input the <code>InputStream</code> to read from
* @param encoding the encoding to use, null means platform default
* @param input
* the <code>InputStream</code> to read from
* @param encoding
* the encoding to use, null means platform default
* @return the requested String
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
*/
public static String toString(InputStream input, String encoding) throws IOException {
StringWriter sw = new StringWriter();
@@ -804,10 +863,13 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
*
* @param input the <code>Reader</code> to read from
* @param input
* the <code>Reader</code> to read from
* @return the requested String
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
*/
public static String toString(Reader input) throws IOException {
StringWriter sw = new StringWriter();
@@ -819,7 +881,8 @@ public class IO {
* Get the contents of a <code>byte[]</code> as a String using the default
* character encoding of the platform.
*
* @param input the byte array to read from
* @param input
* the byte array to read from
* @return the requested String
* @deprecated Use {@link String#String(byte[])}
*/
@@ -838,11 +901,15 @@ public class IO {
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
*
* @param input the byte array to read from
* @param encoding the encoding to use, null means platform default
* @param input
* the byte array to read from
* @param encoding
* the encoding to use, null means platform default
* @return the requested String
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs (never occurs)
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs (never occurs)
* @deprecated Use {@link String#String(byte[], String)}
*/
@Deprecated
@@ -861,10 +928,13 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param input the <code>InputStream</code> to read from, not null
* @param input
* the <code>InputStream</code> to read from, not null
* @return the list of Strings, never null
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static List<String> readLines(InputStream input) throws IOException {
@@ -882,11 +952,15 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param input the <code>InputStream</code> to read from, not null
* @param encoding the encoding to use, null means platform default
* @param input
* the <code>InputStream</code> to read from, not null
* @param encoding
* the encoding to use, null means platform default
* @return the list of Strings, never null
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static List<String> readLines(InputStream input, String encoding) throws IOException {
@@ -907,10 +981,13 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
*
* @param input the <code>Reader</code> to read from, not null
* @param input
* the <code>Reader</code> to read from, not null
* @return the list of Strings, never null
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static List<String> readLines(Reader input) throws IOException {
@@ -928,7 +1005,8 @@ public class IO {
* Convert the specified string to an input stream, encoded as bytes using the
* default character encoding of the platform.
*
* @param input the string to convert
* @param input
* the string to convert
* @return an input stream
* @since Commons IO 1.1
*/
@@ -947,10 +1025,13 @@ public class IO {
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
*
* @param input the string to convert
* @param encoding the encoding to use, null means platform default
* @param input
* the string to convert
* @param encoding
* the encoding to use, null means platform default
* @return an input stream
* @throws IOException if the encoding is invalid
* @throws IOException
* if the encoding is invalid
* @since Commons IO 1.1
*/
public static InputStream toInputStream(String input, String encoding) throws IOException {
@@ -961,10 +1042,14 @@ public class IO {
/**
* Writes bytes from a <code>byte[]</code> to an <code>OutputStream</code>.
*
* @param data the byte array to writeNodeData, do not modify during output, null ignored
* @param output the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @param data
* the byte array to writeNodeData, do not modify during output, null ignored
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(byte[] data, OutputStream output) throws IOException {
@@ -979,10 +1064,14 @@ public class IO {
* <p>
* This method uses {@link String#String(byte[])}.
*
* @param data the byte array to writeNodeData, do not modify during output, null ignored
* @param output the <code>Writer</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @param data
* the byte array to writeNodeData, do not modify during output, null ignored
* @param output
* the <code>Writer</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(byte[] data, Writer output) throws IOException {
@@ -1003,11 +1092,16 @@ public class IO {
* <p>
* This method uses {@link String#String(byte[], String)}.
*
* @param data the byte array to writeNodeData, do not modify during output, null ignored
* @param output the <code>Writer</code> to writeNodeData to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @param data
* the byte array to writeNodeData, do not modify during output, null ignored
* @param output
* the <code>Writer</code> to writeNodeData to
* @param encoding
* the encoding to use, null means platform default
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(byte[] data, Writer output, String encoding) throws IOException {
@@ -1024,10 +1118,14 @@ public class IO {
* Writes chars from a <code>char[]</code> to a <code>Writer</code> using the
* default character encoding of the platform.
*
* @param data the char array to writeNodeData, do not modify during output, null ignored
* @param output the <code>Writer</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @param data
* the char array to writeNodeData, do not modify during output, null ignored
* @param output
* the <code>Writer</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(char[] data, Writer output) throws IOException {
@@ -1042,10 +1140,14 @@ public class IO {
* <p>
* This method uses {@link String#String(char[])} and {@link String#getBytes()}.
*
* @param data the char array to writeNodeData, do not modify during output, null ignored
* @param output the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @param data
* the char array to writeNodeData, do not modify during output, null ignored
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(char[] data, OutputStream output) throws IOException {
@@ -1067,11 +1169,16 @@ public class IO {
* This method uses {@link String#String(char[])} and
* {@link String#getBytes(String)}.
*
* @param data the char array to writeNodeData, do not modify during output, null ignored
* @param output the <code>OutputStream</code> to writeNodeData to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @param data
* the char array to writeNodeData, do not modify during output, null ignored
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @param encoding
* the encoding to use, null means platform default
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(char[] data, OutputStream output, String encoding) throws IOException {
@@ -1087,10 +1194,14 @@ public class IO {
/**
* Writes chars from a <code>String</code> to a <code>Writer</code>.
*
* @param data the <code>String</code> to writeNodeData, null ignored
* @param output the <code>Writer</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @param data
* the <code>String</code> to writeNodeData, null ignored
* @param output
* the <code>Writer</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(String data, Writer output) throws IOException {
@@ -1106,10 +1217,14 @@ public class IO {
* <p>
* This method uses {@link String#getBytes()}.
*
* @param data the <code>String</code> to writeNodeData, null ignored
* @param output the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @param data
* the <code>String</code> to writeNodeData, null ignored
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(String data, OutputStream output) throws IOException {
@@ -1130,11 +1245,16 @@ public class IO {
* <p>
* This method uses {@link String#getBytes(String)}.
*
* @param data the <code>String</code> to writeNodeData, null ignored
* @param output the <code>OutputStream</code> to writeNodeData to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @param data
* the <code>String</code> to writeNodeData, null ignored
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @param encoding
* the encoding to use, null means platform default
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(String data, OutputStream output, String encoding) throws IOException {
@@ -1150,10 +1270,14 @@ public class IO {
/**
* Writes chars from a <code>StringBuffer</code> to a <code>Writer</code>.
*
* @param data the <code>StringBuffer</code> to writeNodeData, null ignored
* @param output the <code>Writer</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @param data
* the <code>StringBuffer</code> to writeNodeData, null ignored
* @param output
* the <code>Writer</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(StringBuffer data, Writer output) throws IOException {
@@ -1169,10 +1293,14 @@ public class IO {
* <p>
* This method uses {@link String#getBytes()}.
*
* @param data the <code>StringBuffer</code> to writeNodeData, null ignored
* @param output the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @param data
* the <code>StringBuffer</code> to writeNodeData, null ignored
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(StringBuffer data, OutputStream output) throws IOException {
@@ -1193,11 +1321,16 @@ public class IO {
* <p>
* This method uses {@link String#getBytes(String)}.
*
* @param data the <code>StringBuffer</code> to writeNodeData, null ignored
* @param output the <code>OutputStream</code> to writeNodeData to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @param data
* the <code>StringBuffer</code> to writeNodeData, null ignored
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @param encoding
* the encoding to use, null means platform default
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(StringBuffer data, OutputStream output, String encoding) throws IOException {
@@ -1215,11 +1348,16 @@ public class IO {
* <code>OutputStream</code> line by line, using the default character encoding
* of the platform and the specified line ending.
*
* @param lines the lines to writeNodeData, null entries produce blank lines
* @param lineEnding the line separator to use, null is system default
* @param output the <code>OutputStream</code> to writeNodeData to, not null, not closed
* @throws NullPointerException if the output is null
* @throws IOException if an I/O error occurs
* @param lines
* the lines to writeNodeData, null entries produce blank lines
* @param lineEnding
* the line separator to use, null is system default
* @param output
* the <code>OutputStream</code> to writeNodeData to, not null, not closed
* @throws NullPointerException
* if the output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void writeLines(Collection<String> lines, String lineEnding, OutputStream output) throws IOException {
@@ -1246,12 +1384,18 @@ public class IO {
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
*
* @param lines the lines to writeNodeData, null entries produce blank lines
* @param lineEnding the line separator to use, null is system default
* @param output the <code>OutputStream</code> to writeNodeData to, not null, not closed
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if the output is null
* @throws IOException if an I/O error occurs
* @param lines
* the lines to writeNodeData, null entries produce blank lines
* @param lineEnding
* the line separator to use, null is system default
* @param output
* the <code>OutputStream</code> to writeNodeData to, not null, not closed
* @param encoding
* the encoding to use, null means platform default
* @throws NullPointerException
* if the output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void writeLines(Collection<String> lines, String lineEnding, OutputStream output, String encoding) throws IOException {
@@ -1281,11 +1425,16 @@ public class IO {
* Writes the <code>toString()</code> value of each item in a collection to a
* <code>Writer</code> line by line, using the specified line ending.
*
* @param lines the lines to writeNodeData, null entries produce blank lines
* @param lineEnding the line separator to use, null is system default
* @param writer the <code>Writer</code> to writeNodeData to, not null, not closed
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @param lines
* the lines to writeNodeData, null entries produce blank lines
* @param lineEnding
* the line separator to use, null is system default
* @param writer
* the <code>Writer</code> to writeNodeData to, not null, not closed
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void writeLines(Collection<String> lines, String lineEnding, Writer writer) throws IOException {
@@ -1315,12 +1464,17 @@ public class IO {
* returned as an int. For large streams use the
* <code>copyLarge(InputStream, OutputStream)</code> method.
*
* @param input the <code>InputStream</code> to read from
* @param output the <code>OutputStream</code> to writeNodeData to
* @param input
* the <code>InputStream</code> to read from
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @return the number of bytes copied
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @throws ArithmeticException if the byte count is too large
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @throws ArithmeticException
* if the byte count is too large
* @since Commons IO 1.1
*/
public static int copy(InputStream input, OutputStream output) throws IOException {
@@ -1338,11 +1492,15 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param input the <code>InputStream</code> to read from
* @param output the <code>OutputStream</code> to writeNodeData to
* @param input
* the <code>InputStream</code> to read from
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @return the number of bytes copied
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.3
*/
public static long copyLarge(InputStream input, OutputStream output) throws IOException {
@@ -1365,10 +1523,14 @@ public class IO {
* <p>
* This method uses {@link InputStreamReader}.
*
* @param input the <code>InputStream</code> to read from
* @param output the <code>Writer</code> to writeNodeData to
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @param input
* the <code>InputStream</code> to read from
* @param output
* the <code>Writer</code> to writeNodeData to
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void copy(InputStream input, Writer output) throws IOException {
@@ -1391,11 +1553,16 @@ public class IO {
* <p>
* This method uses {@link InputStreamReader}.
*
* @param input the <code>InputStream</code> to read from
* @param output the <code>Writer</code> to writeNodeData to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @param input
* the <code>InputStream</code> to read from
* @param output
* the <code>Writer</code> to writeNodeData to
* @param encoding
* the encoding to use, null means platform default
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void copy(InputStream input, Writer output, String encoding) throws IOException {
@@ -1418,12 +1585,17 @@ public class IO {
* returned as an int. For large streams use the
* <code>copyLarge(Reader, Writer)</code> method.
*
* @param input the <code>Reader</code> to read from
* @param output the <code>Writer</code> to writeNodeData to
* @param input
* the <code>Reader</code> to read from
* @param output
* the <code>Writer</code> to writeNodeData to
* @return the number of characters copied
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @throws ArithmeticException if the character count is too large
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @throws ArithmeticException
* if the character count is too large
* @since Commons IO 1.1
*/
public static int copy(Reader input, Writer output) throws IOException {
@@ -1441,11 +1613,15 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
*
* @param input the <code>Reader</code> to read from
* @param output the <code>Writer</code> to writeNodeData to
* @param input
* the <code>Reader</code> to read from
* @param output
* the <code>Writer</code> to writeNodeData to
* @return the number of characters copied
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.3
*/
public static long copyLarge(Reader input, Writer output) throws IOException {
@@ -1472,10 +1648,14 @@ public class IO {
* <p>
* This method uses {@link OutputStreamWriter}.
*
* @param input the <code>Reader</code> to read from
* @param output the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @param input
* the <code>Reader</code> to read from
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void copy(Reader input, OutputStream output) throws IOException {
@@ -1504,11 +1684,16 @@ public class IO {
* <p>
* This method uses {@link OutputStreamWriter}.
*
* @param input the <code>Reader</code> to read from
* @param output the <code>OutputStream</code> to writeNodeData to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @param input
* the <code>Reader</code> to read from
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @param encoding
* the encoding to use, null means platform default
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static void copy(Reader input, OutputStream output, String encoding) throws IOException {
@@ -1528,12 +1713,16 @@ public class IO {
* This method buffers the input internally using
* <code>BufferedInputStream</code> if they are not already buffered.
*
* @param input1 the first stream
* @param input2 the second stream
* @param input1
* the first stream
* @param input2
* the second stream
* @return true if the content of the streams are equal or they both don't
* exist, false otherwise
* @throws NullPointerException if either input is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if either input is null
* @throws IOException
* if an I/O error occurs
*/
public static boolean contentEquals(InputStream input1, InputStream input2) throws IOException {
if(!(input1 instanceof BufferedInputStream)) {
@@ -1562,12 +1751,16 @@ public class IO {
* This method buffers the input internally using <code>BufferedReader</code> if
* they are not already buffered.
*
* @param input1 the first reader
* @param input2 the second reader
* @param input1
* the first reader
* @param input2
* the second reader
* @return true if the content of the readers are equal or they both don't
* exist, false otherwise
* @throws NullPointerException if either input is null
* @throws IOException if an I/O error occurs
* @throws NullPointerException
* if either input is null
* @throws IOException
* if an I/O error occurs
* @since Commons IO 1.1
*/
public static boolean contentEquals(Reader input1, Reader input2) throws IOException {

View File

@@ -35,7 +35,8 @@ public class JarScanner {
/**
* Create a scanner
*
* @param jar the path to the jar
* @param jar
* the path to the jar
*/
public JarScanner(File jar, String superPackage) {
this.jar = jar;
@@ -46,7 +47,8 @@ public class JarScanner {
/**
* Scan the jar
*
* @throws IOException bad things happen
* @throws IOException
* bad things happen
*/
public void scan() throws IOException {
classes.clear();

View File

@@ -78,7 +78,8 @@ public class HTTP {
* It does no further checking or conversion. It does not parse dates. It
* does not do '%' transforms on URLs.
*
* @param string An HTTP header string.
* @param string
* An HTTP header string.
* @return A JSONObject containing the elements and attributes of the XML
* string.
*/
@@ -141,9 +142,11 @@ public class HTTP {
* Any other members of the JSONObject will be output as HTTP fields. The
* result will end with two CRLF pairs.
*
* @param jo A JSONObject
* @param jo
* A JSONObject
* @return An HTTP header string.
* @throws JSONException if the object does not contain enough information.
* @throws JSONException
* if the object does not contain enough information.
*/
public static String toString(JSONObject jo) throws JSONException {
Iterator<String> keys = jo.keys();

View File

@@ -31,7 +31,8 @@ public class HTTPTokener extends JSONTokener {
/**
* Construct an HTTPTokener from a string.
*
* @param string A source string.
* @param string
* A source string.
*/
public HTTPTokener(String string) {
super(string);

View File

@@ -94,8 +94,10 @@ public class JSONArray implements Iterable<Object> {
/**
* Construct a JSONArray from a JSONTokener.
*
* @param x A JSONTokener
* @throws JSONException If there is a syntax error.
* @param x
* A JSONTokener
* @throws JSONException
* If there is a syntax error.
*/
public JSONArray(JSONTokener x) throws JSONException {
this();
@@ -131,10 +133,12 @@ public class JSONArray implements Iterable<Object> {
/**
* Construct a JSONArray from a source JSON text.
*
* @param source A string that begins with <code>[</code>&nbsp;<small>(left
* @param source
* A string that begins with <code>[</code>&nbsp;<small>(left
* bracket)</small> and ends with <code>]</code> &nbsp;
* <small>(right bracket)</small>.
* @throws JSONException If there is a syntax error.
* @throws JSONException
* If there is a syntax error.
*/
public JSONArray(String source) throws JSONException {
this(new JSONTokener(source));
@@ -143,7 +147,8 @@ public class JSONArray implements Iterable<Object> {
/**
* Construct a JSONArray from a Collection.
*
* @param collection A Collection.
* @param collection
* A Collection.
*/
public JSONArray(Collection<Object> collection) {
this.myArrayList = new ArrayList<Object>();
@@ -158,7 +163,8 @@ public class JSONArray implements Iterable<Object> {
/**
* Construct a JSONArray from an array
*
* @throws JSONException If not an array.
* @throws JSONException
* If not an array.
*/
public JSONArray(Object array) throws JSONException {
this();
@@ -180,9 +186,11 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the object value associated with an index.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return An object value.
* @throws JSONException If there is no value for the index.
* @throws JSONException
* If there is no value for the index.
*/
public Object get(int index) throws JSONException {
Object object = this.opt(index);
@@ -196,9 +204,11 @@ public class JSONArray implements Iterable<Object> {
* Get the boolean value associated with an index. The string values "true"
* and "false" are converted to boolean.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return The truth.
* @throws JSONException If there is no value for the index or if the value is not
* @throws JSONException
* If there is no value for the index or if the value is not
* convertible to boolean.
*/
public boolean getBoolean(int index) throws JSONException {
@@ -214,9 +224,11 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the double value associated with an index.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
* @throws JSONException If the key is not found or if the value cannot be converted
* @throws JSONException
* If the key is not found or if the value cannot be converted
* to a number.
*/
public double getDouble(int index) throws JSONException {
@@ -232,10 +244,13 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the enum value associated with an index.
*
* @param clazz The type of enum to retrieve.
* @param index The index must be between 0 and length() - 1.
* @param clazz
* The type of enum to retrieve.
* @param index
* The index must be between 0 and length() - 1.
* @return The enum value at the index location
* @throws JSONException if the key is not found or if the value cannot be converted
* @throws JSONException
* if the key is not found or if the value cannot be converted
* to an enum.
*/
public <E extends Enum<E>> E getEnum(Class<E> clazz, int index) throws JSONException {
@@ -252,9 +267,11 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the BigDecimal value associated with an index.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
* @throws JSONException If the key is not found or if the value cannot be converted
* @throws JSONException
* If the key is not found or if the value cannot be converted
* to a BigDecimal.
*/
public BigDecimal getBigDecimal(int index) throws JSONException {
@@ -270,9 +287,11 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the BigInteger value associated with an index.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
* @throws JSONException If the key is not found or if the value cannot be converted
* @throws JSONException
* If the key is not found or if the value cannot be converted
* to a BigInteger.
*/
public BigInteger getBigInteger(int index) throws JSONException {
@@ -288,9 +307,11 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the int value associated with an index.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
* @throws JSONException If the key is not found or if the value is not a number.
* @throws JSONException
* If the key is not found or if the value is not a number.
*/
public int getInt(int index) throws JSONException {
Object object = this.get(index);
@@ -305,9 +326,11 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the JSONArray associated with an index.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return A JSONArray value.
* @throws JSONException If there is no value for the index. or if the value is not a
* @throws JSONException
* If there is no value for the index. or if the value is not a
* JSONArray
*/
public JSONArray getJSONArray(int index) throws JSONException {
@@ -321,9 +344,11 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the JSONObject associated with an index.
*
* @param index subscript
* @param index
* subscript
* @return A JSONObject value.
* @throws JSONException If there is no value for the index or if the value is not a
* @throws JSONException
* If there is no value for the index or if the value is not a
* JSONObject
*/
public JSONObject getJSONObject(int index) throws JSONException {
@@ -337,9 +362,11 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the long value associated with an index.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
* @throws JSONException If the key is not found or if the value cannot be converted
* @throws JSONException
* If the key is not found or if the value cannot be converted
* to a number.
*/
public long getLong(int index) throws JSONException {
@@ -355,9 +382,11 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the string associated with an index.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return A string value.
* @throws JSONException If there is no string value for the index.
* @throws JSONException
* If there is no string value for the index.
*/
public String getString(int index) throws JSONException {
Object object = this.get(index);
@@ -370,7 +399,8 @@ public class JSONArray implements Iterable<Object> {
/**
* Determine if the value is null.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return true if the value at the index is null, or if there is no value.
*/
public boolean isNull(int index) {
@@ -382,9 +412,11 @@ public class JSONArray implements Iterable<Object> {
* <code>separator</code> string is inserted between each element. Warning:
* This method assumes that the data structure is acyclical.
*
* @param separator A string that will be inserted between the elements.
* @param separator
* A string that will be inserted between the elements.
* @return a string.
* @throws JSONException If the array contains an invalid number.
* @throws JSONException
* If the array contains an invalid number.
*/
public String join(String separator) throws JSONException {
int len = this.length();
@@ -411,7 +443,8 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the optional object value associated with an index.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return An object value, or null if there is no object at that index.
*/
public Object opt(int index) {
@@ -423,7 +456,8 @@ public class JSONArray implements Iterable<Object> {
* if there is no value at that index, or if the value is not Boolean.TRUE
* or the String "true".
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return The truth.
*/
public boolean optBoolean(int index) {
@@ -435,8 +469,10 @@ public class JSONArray implements Iterable<Object> {
* defaultValue if there is no value at that index or if it is not a Boolean
* or the String "true" or "false" (case insensitive).
*
* @param index The index must be between 0 and length() - 1.
* @param defaultValue A boolean default.
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* A boolean default.
* @return The truth.
*/
public boolean optBoolean(int index, boolean defaultValue) {
@@ -453,7 +489,8 @@ public class JSONArray implements Iterable<Object> {
* if there is no value for the index, or if the value is not a number and
* cannot be converted to a number.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
*/
public double optDouble(int index) {
@@ -465,8 +502,10 @@ public class JSONArray implements Iterable<Object> {
* is returned if there is no value for the index, or if the value is not a
* number and cannot be converted to a number.
*
* @param index subscript
* @param defaultValue The default value.
* @param index
* subscript
* @param defaultValue
* The default value.
* @return The value.
*/
public double optDouble(int index, double defaultValue) {
@@ -483,7 +522,8 @@ public class JSONArray implements Iterable<Object> {
* there is no value for the index, or if the value is not a number and
* cannot be converted to a number.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
*/
public int optInt(int index) {
@@ -495,8 +535,10 @@ public class JSONArray implements Iterable<Object> {
* returned if there is no value for the index, or if the value is not a
* number and cannot be converted to a number.
*
* @param index The index must be between 0 and length() - 1.
* @param defaultValue The default value.
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* The default value.
* @return The value.
*/
public int optInt(int index, int defaultValue) {
@@ -511,8 +553,10 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the enum value associated with a key.
*
* @param clazz The type of enum to retrieve.
* @param index The index must be between 0 and length() - 1.
* @param clazz
* The type of enum to retrieve.
* @param index
* The index must be between 0 and length() - 1.
* @return The enum value at the index location or null if not found
*/
public <E extends Enum<E>> E optEnum(Class<E> clazz, int index) {
@@ -522,9 +566,12 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the enum value associated with a key.
*
* @param clazz The type of enum to retrieve.
* @param index The index must be between 0 and length() - 1.
* @param defaultValue The default in case the value is not found
* @param clazz
* The type of enum to retrieve.
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* The default in case the value is not found
* @return The enum value at the index location or defaultValue if the value
* is not found or cannot be assigned to clazz
*/
@@ -555,8 +602,10 @@ public class JSONArray implements Iterable<Object> {
* defaultValue is returned if there is no value for the index, or if the
* value is not a number and cannot be converted to a number.
*
* @param index The index must be between 0 and length() - 1.
* @param defaultValue The default value.
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* The default value.
* @return The value.
*/
public BigInteger optBigInteger(int index, BigInteger defaultValue) {
@@ -573,8 +622,10 @@ public class JSONArray implements Iterable<Object> {
* defaultValue is returned if there is no value for the index, or if the
* value is not a number and cannot be converted to a number.
*
* @param index The index must be between 0 and length() - 1.
* @param defaultValue The default value.
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* The default value.
* @return The value.
*/
public BigDecimal optBigDecimal(int index, BigDecimal defaultValue) {
@@ -589,7 +640,8 @@ public class JSONArray implements Iterable<Object> {
/**
* Get the optional JSONArray associated with an index.
*
* @param index subscript
* @param index
* subscript
* @return A JSONArray value, or null if the index has no value, or if the
* value is not a JSONArray.
*/
@@ -603,7 +655,8 @@ public class JSONArray implements Iterable<Object> {
* the key is not found, or null if the index has no value, or if the value
* is not a JSONObject.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return A JSONObject value.
*/
public JSONObject optJSONObject(int index) {
@@ -616,7 +669,8 @@ public class JSONArray implements Iterable<Object> {
* there is no value for the index, or if the value is not a number and
* cannot be converted to a number.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return The value.
*/
public long optLong(int index) {
@@ -628,8 +682,10 @@ public class JSONArray implements Iterable<Object> {
* returned if there is no value for the index, or if the value is not a
* number and cannot be converted to a number.
*
* @param index The index must be between 0 and length() - 1.
* @param defaultValue The default value.
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* The default value.
* @return The value.
*/
public long optLong(int index, long defaultValue) {
@@ -646,7 +702,8 @@ public class JSONArray implements Iterable<Object> {
* empty string if there is no value at that index. If the value is not a
* string and is not null, then it is coverted to a string.
*
* @param index The index must be between 0 and length() - 1.
* @param index
* The index must be between 0 and length() - 1.
* @return A String value.
*/
public String optString(int index) {
@@ -657,8 +714,10 @@ public class JSONArray implements Iterable<Object> {
* Get the optional string associated with an index. The defaultValue is
* returned if the key is not found.
*
* @param index The index must be between 0 and length() - 1.
* @param defaultValue The default value.
* @param index
* The index must be between 0 and length() - 1.
* @param defaultValue
* The default value.
* @return A String value.
*/
public String optString(int index, String defaultValue) {
@@ -669,7 +728,8 @@ public class JSONArray implements Iterable<Object> {
/**
* Append a boolean value. This increases the array's length by one.
*
* @param value A boolean value.
* @param value
* A boolean value.
* @return this.
*/
public JSONArray put(boolean value) {
@@ -681,7 +741,8 @@ public class JSONArray implements Iterable<Object> {
* Put a value in the JSONArray, where the value will be a JSONArray which
* is produced from a Collection.
*
* @param value A Collection value.
* @param value
* A Collection value.
* @return this.
*/
public JSONArray put(Collection<Object> value) {
@@ -692,9 +753,11 @@ public class JSONArray implements Iterable<Object> {
/**
* Append a double value. This increases the array's length by one.
*
* @param value A double value.
* @param value
* A double value.
* @return this.
* @throws JSONException if the value is not finite.
* @throws JSONException
* if the value is not finite.
*/
public JSONArray put(double value) throws JSONException {
Double d = Double.valueOf(value);
@@ -706,7 +769,8 @@ public class JSONArray implements Iterable<Object> {
/**
* Append an int value. This increases the array's length by one.
*
* @param value An int value.
* @param value
* An int value.
* @return this.
*/
public JSONArray put(int value) {
@@ -717,7 +781,8 @@ public class JSONArray implements Iterable<Object> {
/**
* Append an long value. This increases the array's length by one.
*
* @param value A long value.
* @param value
* A long value.
* @return this.
*/
public JSONArray put(long value) {
@@ -729,7 +794,8 @@ public class JSONArray implements Iterable<Object> {
* Put a value in the JSONArray, where the value will be a JSONObject which
* is produced from a Map.
*
* @param value A Map value.
* @param value
* A Map value.
* @return this.
*/
public JSONArray put(Map<String, Object> value) {
@@ -740,7 +806,8 @@ public class JSONArray implements Iterable<Object> {
/**
* Append an object value. This increases the array's length by one.
*
* @param value An object value. The value should be a Boolean, Double,
* @param value
* An object value. The value should be a Boolean, Double,
* Integer, JSONArray, JSONObject, Long, or String, or the
* JSONObject.NULL object.
* @return this.
@@ -755,10 +822,13 @@ public class JSONArray implements Iterable<Object> {
* than the length of the JSONArray, then null elements will be added as
* necessary to pad it out.
*
* @param index The subscript.
* @param value A boolean value.
* @param index
* The subscript.
* @param value
* A boolean value.
* @return this.
* @throws JSONException If the index is negative.
* @throws JSONException
* If the index is negative.
*/
public JSONArray put(int index, boolean value) throws JSONException {
this.put(index, value ? Boolean.TRUE : Boolean.FALSE);
@@ -769,10 +839,13 @@ public class JSONArray implements Iterable<Object> {
* Put a value in the JSONArray, where the value will be a JSONArray which
* is produced from a Collection.
*
* @param index The subscript.
* @param value A Collection value.
* @param index
* The subscript.
* @param value
* A Collection value.
* @return this.
* @throws JSONException If the index is negative or if the value is not finite.
* @throws JSONException
* If the index is negative or if the value is not finite.
*/
public JSONArray put(int index, Collection<Object> value) throws JSONException {
this.put(index, new JSONArray(value));
@@ -784,10 +857,13 @@ public class JSONArray implements Iterable<Object> {
* the JSONArray, then null elements will be added as necessary to pad it
* out.
*
* @param index The subscript.
* @param value A double value.
* @param index
* The subscript.
* @param value
* A double value.
* @return this.
* @throws JSONException If the index is negative or if the value is not finite.
* @throws JSONException
* If the index is negative or if the value is not finite.
*/
public JSONArray put(int index, double value) throws JSONException {
this.put(index, Double.valueOf(value));
@@ -799,10 +875,13 @@ public class JSONArray implements Iterable<Object> {
* the JSONArray, then null elements will be added as necessary to pad it
* out.
*
* @param index The subscript.
* @param value An int value.
* @param index
* The subscript.
* @param value
* An int value.
* @return this.
* @throws JSONException If the index is negative.
* @throws JSONException
* If the index is negative.
*/
public JSONArray put(int index, int value) throws JSONException {
this.put(index, Integer.valueOf(value));
@@ -814,10 +893,13 @@ public class JSONArray implements Iterable<Object> {
* the JSONArray, then null elements will be added as necessary to pad it
* out.
*
* @param index The subscript.
* @param value A long value.
* @param index
* The subscript.
* @param value
* A long value.
* @return this.
* @throws JSONException If the index is negative.
* @throws JSONException
* If the index is negative.
*/
public JSONArray put(int index, long value) throws JSONException {
this.put(index, Long.valueOf(value));
@@ -828,10 +910,13 @@ public class JSONArray implements Iterable<Object> {
* Put a value in the JSONArray, where the value will be a JSONObject that
* is produced from a Map.
*
* @param index The subscript.
* @param value The Map value.
* @param index
* The subscript.
* @param value
* The Map value.
* @return this.
* @throws JSONException If the index is negative or if the the value is an invalid
* @throws JSONException
* If the index is negative or if the the value is an invalid
* number.
*/
public JSONArray put(int index, Map<String, Object> value) throws JSONException {
@@ -844,12 +929,15 @@ public class JSONArray implements Iterable<Object> {
* than the length of the JSONArray, then null elements will be added as
* necessary to pad it out.
*
* @param index The subscript.
* @param value The value to put into the array. The value should be a
* @param index
* The subscript.
* @param value
* The value to put into the array. The value should be a
* Boolean, Double, Integer, JSONArray, JSONObject, Long, or
* String, or the JSONObject.NULL object.
* @return this.
* @throws JSONException If the index is negative or if the the value is an invalid
* @throws JSONException
* If the index is negative or if the the value is an invalid
* number.
*/
public JSONArray put(int index, Object value) throws JSONException {
@@ -871,7 +959,8 @@ public class JSONArray implements Iterable<Object> {
/**
* Remove an index and close the hole.
*
* @param index The index of the element to be removed.
* @param index
* The index of the element to be removed.
* @return The value that was associated with the index, or null if there
* was no value.
*/
@@ -883,7 +972,8 @@ public class JSONArray implements Iterable<Object> {
* Determine if two JSONArrays are similar. They must contain similar
* sequences.
*
* @param other The other JSONArray
* @param other
* The other JSONArray
* @return true if they are equal
*/
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
@@ -917,11 +1007,13 @@ public class JSONArray implements Iterable<Object> {
* Produce a JSONObject by combining a JSONArray of names with the values of
* this JSONArray.
*
* @param names A JSONArray containing a list of key strings. These will be
* @param names
* A JSONArray containing a list of key strings. These will be
* paired with the values.
* @return A JSONObject, or null if there are no names or if this JSONArray
* has no values.
* @throws JSONException If any of the names are null.
* @throws JSONException
* If any of the names are null.
*/
public JSONObject toJSONObject(JSONArray names) throws JSONException {
if(names == null || names.length() == 0 || this.length() == 0) {
@@ -959,12 +1051,12 @@ public class JSONArray implements Iterable<Object> {
* Make a prettyprinted JSON text of this JSONArray. Warning: This method
* assumes that the data structure is acyclical.
*
* @param indentFactor The number of spaces to add to each level of indentation.
* @param indentFactor
* The number of spaces to add to each level of indentation.
* @return a printable, displayable, transmittable representation of the
* object, beginning with <code>[</code>&nbsp;<small>(left
* bracket)</small> and ending with <code>]</code> &nbsp;
* <small>(right bracket)</small>.
* @throws JSONException
*/
public String toString(int indentFactor) throws JSONException {
StringWriter sw = new StringWriter();
@@ -980,7 +1072,6 @@ public class JSONArray implements Iterable<Object> {
* Warning: This method assumes that the data structure is acyclical.
*
* @return The writer.
* @throws JSONException
*/
public Writer write(Writer writer) throws JSONException {
return this.write(writer, 0, 0);
@@ -992,10 +1083,11 @@ public class JSONArray implements Iterable<Object> {
* <p>
* Warning: This method assumes that the data structure is acyclical.
*
* @param indentFactor The number of spaces to add to each level of indentation.
* @param indent The indention of the top level.
* @param indentFactor
* The number of spaces to add to each level of indentation.
* @param indent
* The indention of the top level.
* @return The writer.
* @throws JSONException
*/
Writer write(Writer writer, int indentFactor, int indent) throws JSONException {
try {

View File

@@ -32,7 +32,8 @@ public class JSONException extends RuntimeException {
/**
* Constructs a JSONException with an explanatory message.
*
* @param message Detail about the reason for the exception.
* @param message
* Detail about the reason for the exception.
*/
public JSONException(String message) {
super(message);
@@ -41,7 +42,8 @@ public class JSONException extends RuntimeException {
/**
* Constructs a new JSONException with the specified cause.
*
* @param cause The cause.
* @param cause
* The cause.
*/
public JSONException(Throwable cause) {
super(cause.getMessage());

View File

@@ -34,9 +34,12 @@ public class JSONML {
/**
* Parse XML values and store them in a JSONArray.
*
* @param x The XMLTokener containing the source string.
* @param arrayForm true if array form, false if object form.
* @param ja The JSONArray that is containing the current tag or null if we
* @param x
* The XMLTokener containing the source string.
* @param arrayForm
* true if array form, false if object form.
* @param ja
* The JSONArray that is containing the current tag or null if we
* are at the outermost level.
* @return A JSONArray if the value is the outermost tag, otherwise null.
*/
@@ -228,7 +231,8 @@ public class JSONML {
* JSONArrays will represent the child tags. Comments, prologs, DTDs, and
* <code>&lt;[ [ ]]></code> are ignored.
*
* @param string The source string.
* @param string
* The source string.
* @return A JSONArray containing the structured data from the XML string.
*/
public static JSONArray toJSONArray(String string) throws JSONException {
@@ -244,7 +248,8 @@ public class JSONML {
* JSONArrays will represent the child content and tags. Comments, prologs,
* DTDs, and <code>&lt;[ [ ]]></code> are ignored.
*
* @param x An XMLTokener.
* @param x
* An XMLTokener.
* @return A JSONArray containing the structured data from the XML string.
*/
public static JSONArray toJSONArray(XMLTokener x) throws JSONException {
@@ -261,7 +266,8 @@ public class JSONML {
* <p>
* Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
*
* @param x An XMLTokener of the XML source text.
* @param x
* An XMLTokener of the XML source text.
* @return A JSONObject containing the structured data from the XML string.
*/
public static JSONObject toJSONObject(XMLTokener x) throws JSONException {
@@ -278,7 +284,8 @@ public class JSONML {
* <p>
* Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code> are ignored.
*
* @param string The XML source text.
* @param string
* The XML source text.
* @return A JSONObject containing the structured data from the XML string.
*/
public static JSONObject toJSONObject(String string) throws JSONException {
@@ -288,7 +295,8 @@ public class JSONML {
/**
* Reverse the JSONML transformation, making an XML text from a JSONArray.
*
* @param ja A JSONArray.
* @param ja
* A JSONArray.
* @return An XML string.
*/
public static String toString(JSONArray ja) throws JSONException {
@@ -371,7 +379,8 @@ public class JSONML {
* then it must have a "childNodes" property containing an array of objects.
* The other properties are attributes with string values.
*
* @param jo A JSONObject.
* @param jo
* A JSONObject.
* @return An XML string.
*/
public static String toString(JSONObject jo) throws JSONException {

View File

@@ -114,10 +114,12 @@ public class JSONObject {
* strings is used to identify the keys that should be copied. Missing keys
* are ignored.
*
* @param jo A JSONObject.
* @param names An array of strings.
* @param jo
* A JSONObject.
* @param names
* An array of strings.
* @throws JSONException
* @throws JSONException If a value is a non-finite number or if a name is
* If a value is a non-finite number or if a name is
* duplicated.
*/
public JSONObject(JSONObject jo, String[] names) {
@@ -134,8 +136,10 @@ public class JSONObject {
/**
* Construct a JSONObject from a JSONTokener.
*
* @param x A JSONTokener object containing the source string.
* @throws JSONException If there is a syntax error in the source string or a
* @param x
* A JSONTokener object containing the source string.
* @throws JSONException
* If there is a syntax error in the source string or a
* duplicated key.
*/
public JSONObject(JSONTokener x) throws JSONException {
@@ -187,9 +191,9 @@ public class JSONObject {
/**
* Construct a JSONObject from a Map.
*
* @param map A map object that can be used to initialize the contents of
* @param map
* A map object that can be used to initialize the contents of
* the JSONObject.
* @throws JSONException
*/
public JSONObject(Map<String, Object> map) {
this.map = new LinkedHashMap<>();
@@ -222,7 +226,8 @@ public class JSONObject {
* <code>"Larry Fine"</code>, then the JSONObject will contain
* <code>"name": "Larry Fine"</code>.
*
* @param bean An object that has getter methods that should be used to make
* @param bean
* An object that has getter methods that should be used to make
* a JSONObject.
*/
public JSONObject(Object bean) {
@@ -237,9 +242,11 @@ public class JSONObject {
* those keys in the object. If a key is not found or not visible, then it
* will not be copied into the new JSONObject.
*
* @param object An object that has fields that should be used to make a
* @param object
* An object that has fields that should be used to make a
* JSONObject.
* @param names An array of strings, the names of the fields to be obtained
* @param names
* An array of strings, the names of the fields to be obtained
* from the object.
*/
public JSONObject(Object object, String[] names) {
@@ -259,10 +266,12 @@ public class JSONObject {
* Construct a JSONObject from a source JSON text string. This is the most
* commonly used JSONObject constructor.
*
* @param source A string beginning with <code>{</code>&nbsp;<small>(left
* @param source
* A string beginning with <code>{</code>&nbsp;<small>(left
* brace)</small> and ending with <code>}</code> &nbsp;
* <small>(right brace)</small>.
* @throws JSONException If there is a syntax error in the source string or a
* @throws JSONException
* If there is a syntax error in the source string or a
* duplicated key.
*/
public JSONObject(String source) throws JSONException {
@@ -272,9 +281,12 @@ public class JSONObject {
/**
* Construct a JSONObject from a ResourceBundle.
*
* @param baseName The ResourceBundle base name.
* @param locale The Locale to load the ResourceBundle for.
* @throws JSONException If any JSONExceptions are detected.
* @param baseName
* The ResourceBundle base name.
* @param locale
* The Locale to load the ResourceBundle for.
* @throws JSONException
* If any JSONExceptions are detected.
*/
public JSONObject(String baseName, Locale locale) throws JSONException {
this();
@@ -314,7 +326,8 @@ public class JSONObject {
* Produce a string from a double. The string "null" will be returned if the
* number is not finite.
*
* @param d A double.
* @param d
* A double.
* @return A String.
*/
public static String doubleToString(double d) {
@@ -381,9 +394,11 @@ public class JSONObject {
/**
* Produce a string from a Number.
*
* @param number A Number
* @param number
* A Number
* @return A String.
* @throws JSONException If n is a non-finite number.
* @throws JSONException
* If n is a non-finite number.
*/
public static String numberToString(Number number) throws JSONException {
if(number == null) {
@@ -411,7 +426,8 @@ public class JSONObject {
* allowing JSON text to be delivered in HTML. In JSON text, a string cannot
* contain a control character or an unescaped quote or backslash.
*
* @param string A String
* @param string
* A String
* @return A String correctly formatted for insertion in a JSON text.
*/
public static String quote(String string) {
@@ -489,7 +505,8 @@ public class JSONObject {
* Try to convert a string into a number, boolean, or null. If the string
* can't be converted, return the string.
*
* @param string A String.
* @param string
* A String.
* @return A simple JSON value.
*/
public static Object stringToValue(String string) {
@@ -540,8 +557,10 @@ public class JSONObject {
/**
* Throw an exception if the object is a NaN or infinite number.
*
* @param o The object to test.
* @throws JSONException If o is a non-finite number.
* @param o
* The object to test.
* @throws JSONException
* If o is a non-finite number.
*/
public static void testValidity(Object o) throws JSONException {
if(o != null) {
@@ -572,12 +591,14 @@ public class JSONObject {
* <p>
* Warning: This method assumes that the data structure is acyclical.
*
* @param value The value to be serialized.
* @param value
* The value to be serialized.
* @return a printable, displayable, transmittable representation of the
* object, beginning with <code>{</code>&nbsp;<small>(left
* brace)</small> and ending with <code>}</code>&nbsp;<small>(right
* brace)</small>.
* @throws JSONException If the value is or contains an invalid number.
* @throws JSONException
* If the value is or contains an invalid number.
*/
public static String valueToString(Object value) throws JSONException {
if(value == null || value.equals(null)) {
@@ -626,7 +647,8 @@ public class JSONObject {
* one of the java packages, turn it into a string. And if it doesn't, try
* to wrap it in a JSONObject. If the wrapping fails, then null is returned.
*
* @param object The object to wrap
* @param object
* The object to wrap
* @return The wrapped value
*/
public static Object wrap(Object object) {
@@ -716,10 +738,13 @@ public class JSONObject {
* will be the same as using put. But if multiple values are accumulated,
* then the result will be like append.
*
* @param key A key string.
* @param value An object to be accumulated under the key.
* @param key
* A key string.
* @param value
* An object to be accumulated under the key.
* @return this.
* @throws JSONException If the value is an invalid number or if the key is null.
* @throws JSONException
* If the value is an invalid number or if the key is null.
*/
public JSONObject accumulate(String key, Object value) throws JSONException {
testValidity(value);
@@ -740,10 +765,13 @@ public class JSONObject {
* JSONArray containing the value parameter. If the key was already
* associated with a JSONArray, then the value parameter is appended to it.
*
* @param key A key string.
* @param value An object to be accumulated under the key.
* @param key
* A key string.
* @param value
* An object to be accumulated under the key.
* @return this.
* @throws JSONException If the key is null or if the current value associated with
* @throws JSONException
* If the key is null or if the current value associated with
* the key is not a JSONArray.
*/
public JSONObject append(String key, Object value) throws JSONException {
@@ -762,9 +790,11 @@ public class JSONObject {
/**
* Get the value object associated with a key.
*
* @param key A key string.
* @param key
* A key string.
* @return The object associated with the key.
* @throws JSONException if the key is not found.
* @throws JSONException
* if the key is not found.
*/
public Object get(String key) throws JSONException {
if(key == null) {
@@ -780,10 +810,13 @@ public class JSONObject {
/**
* Get the enum value associated with a key.
*
* @param clazz The type of enum to retrieve.
* @param key A key string.
* @param clazz
* The type of enum to retrieve.
* @param key
* A key string.
* @return The enum value associated with the key
* @throws JSONException if the key is not found or if the value cannot be converted
* @throws JSONException
* if the key is not found or if the value cannot be converted
* to an enum.
*/
public <E extends Enum<E>> E getEnum(Class<E> clazz, String key) throws JSONException {
@@ -800,9 +833,11 @@ public class JSONObject {
/**
* Get the boolean value associated with a key.
*
* @param key A key string.
* @param key
* A key string.
* @return The truth.
* @throws JSONException if the value is not a Boolean or the String "true" or
* @throws JSONException
* if the value is not a Boolean or the String "true" or
* "false".
*/
public boolean getBoolean(String key) throws JSONException {
@@ -818,9 +853,11 @@ public class JSONObject {
/**
* Get the BigInteger value associated with a key.
*
* @param key A key string.
* @param key
* A key string.
* @return The numeric value.
* @throws JSONException if the key is not found or if the value cannot be converted
* @throws JSONException
* if the key is not found or if the value cannot be converted
* to BigInteger.
*/
public BigInteger getBigInteger(String key) throws JSONException {
@@ -836,9 +873,11 @@ public class JSONObject {
/**
* Get the BigDecimal value associated with a key.
*
* @param key A key string.
* @param key
* A key string.
* @return The numeric value.
* @throws JSONException if the key is not found or if the value cannot be converted
* @throws JSONException
* if the key is not found or if the value cannot be converted
* to BigDecimal.
*/
public BigDecimal getBigDecimal(String key) throws JSONException {
@@ -854,9 +893,11 @@ public class JSONObject {
/**
* Get the double value associated with a key.
*
* @param key A key string.
* @param key
* A key string.
* @return The numeric value.
* @throws JSONException if the key is not found or if the value is not a Number
* @throws JSONException
* if the key is not found or if the value is not a Number
* object and cannot be converted to a number.
*/
public double getDouble(String key) throws JSONException {
@@ -872,9 +913,11 @@ public class JSONObject {
/**
* Get the int value associated with a key.
*
* @param key A key string.
* @param key
* A key string.
* @return The integer value.
* @throws JSONException if the key is not found or if the value cannot be converted
* @throws JSONException
* if the key is not found or if the value cannot be converted
* to an integer.
*/
public int getInt(String key) throws JSONException {
@@ -890,9 +933,11 @@ public class JSONObject {
/**
* Get the JSONArray value associated with a key.
*
* @param key A key string.
* @param key
* A key string.
* @return A JSONArray which is the value.
* @throws JSONException if the key is not found or if the value is not a JSONArray.
* @throws JSONException
* if the key is not found or if the value is not a JSONArray.
*/
public JSONArray getJSONArray(String key) throws JSONException {
Object object = this.get(key);
@@ -905,9 +950,11 @@ public class JSONObject {
/**
* Get the JSONObject value associated with a key.
*
* @param key A key string.
* @param key
* A key string.
* @return A JSONObject which is the value.
* @throws JSONException if the key is not found or if the value is not a JSONObject.
* @throws JSONException
* if the key is not found or if the value is not a JSONObject.
*/
public JSONObject getJSONObject(String key) throws JSONException {
Object object = this.get(key);
@@ -920,9 +967,11 @@ public class JSONObject {
/**
* Get the long value associated with a key.
*
* @param key A key string.
* @param key
* A key string.
* @return The long value.
* @throws JSONException if the key is not found or if the value cannot be converted
* @throws JSONException
* if the key is not found or if the value cannot be converted
* to a long.
*/
public long getLong(String key) throws JSONException {
@@ -938,9 +987,11 @@ public class JSONObject {
/**
* Get the string associated with a key.
*
* @param key A key string.
* @param key
* A key string.
* @return A string which is the value.
* @throws JSONException if there is no string value for the key.
* @throws JSONException
* if there is no string value for the key.
*/
public String getString(String key) throws JSONException {
Object object = this.get(key);
@@ -953,7 +1004,8 @@ public class JSONObject {
/**
* Determine if the JSONObject contains a specific key.
*
* @param key A key string.
* @param key
* A key string.
* @return true if the key exists in the JSONObject.
*/
public boolean has(String key) {
@@ -965,9 +1017,11 @@ public class JSONObject {
* create one with a value of 1. If there is such a property, and if it is
* an Integer, Long, Double, or Float, then add one to it.
*
* @param key A key string.
* @param key
* A key string.
* @return this.
* @throws JSONException If there is already a property with this name that is not an
* @throws JSONException
* If there is already a property with this name that is not an
* Integer, Long, Double, or Float.
*/
public JSONObject increment(String key) throws JSONException {
@@ -996,7 +1050,8 @@ public class JSONObject {
* Determine if the value associated with the key is null or if there is no
* value.
*
* @param key A key string.
* @param key
* A key string.
* @return true if there is no value associated with the key or if the value
* is the JSONObject.NULL object.
*/
@@ -1050,7 +1105,8 @@ public class JSONObject {
/**
* Get an optional value associated with a key.
*
* @param key A key string.
* @param key
* A key string.
* @return An object which is the value, or null if there is no value.
*/
public Object opt(String key) {
@@ -1060,8 +1116,10 @@ public class JSONObject {
/**
* Get the enum value associated with a key.
*
* @param clazz The type of enum to retrieve.
* @param key A key string.
* @param clazz
* The type of enum to retrieve.
* @param key
* A key string.
* @return The enum value associated with the key or null if not found
*/
public <E extends Enum<E>> E optEnum(Class<E> clazz, String key) {
@@ -1071,9 +1129,12 @@ public class JSONObject {
/**
* Get the enum value associated with a key.
*
* @param clazz The type of enum to retrieve.
* @param key A key string.
* @param defaultValue The default in case the value is not found
* @param clazz
* The type of enum to retrieve.
* @param key
* A key string.
* @param defaultValue
* The default in case the value is not found
* @return The enum value associated with the key or defaultValue if the
* value is not found or cannot be assigned to clazz
*/
@@ -1103,7 +1164,8 @@ public class JSONObject {
* Get an optional boolean associated with a key. It returns false if there
* is no such key, or if the value is not Boolean.TRUE or the String "true".
*
* @param key A key string.
* @param key
* A key string.
* @return The truth.
*/
public boolean optBoolean(String key) {
@@ -1115,8 +1177,10 @@ public class JSONObject {
* defaultValue if there is no such key, or if it is not a Boolean or the
* String "true" or "false" (case insensitive).
*
* @param key A key string.
* @param defaultValue The default.
* @param key
* A key string.
* @param defaultValue
* The default.
* @return The truth.
*/
public boolean optBoolean(String key, boolean defaultValue) {
@@ -1133,7 +1197,8 @@ public class JSONObject {
* key or if its value is not a number. If the value is a string, an attempt
* will be made to evaluate it as a number.
*
* @param key A string which is the key.
* @param key
* A string which is the key.
* @return An object which is the value.
*/
public double optDouble(String key) {
@@ -1145,8 +1210,10 @@ public class JSONObject {
* there is no such key or if its value is not a number. If the value is a
* string, an attempt will be made to evaluate it as a number.
*
* @param key A key string.
* @param defaultValue The default.
* @param key
* A key string.
* @param defaultValue
* The default.
* @return An object which is the value.
*/
public BigInteger optBigInteger(String key, BigInteger defaultValue) {
@@ -1163,8 +1230,10 @@ public class JSONObject {
* there is no such key or if its value is not a number. If the value is a
* string, an attempt will be made to evaluate it as a number.
*
* @param key A key string.
* @param defaultValue The default.
* @param key
* A key string.
* @param defaultValue
* The default.
* @return An object which is the value.
*/
public BigDecimal optBigDecimal(String key, BigDecimal defaultValue) {
@@ -1181,8 +1250,10 @@ public class JSONObject {
* there is no such key or if its value is not a number. If the value is a
* string, an attempt will be made to evaluate it as a number.
*
* @param key A key string.
* @param defaultValue The default.
* @param key
* A key string.
* @param defaultValue
* The default.
* @return An object which is the value.
*/
public double optDouble(String key, double defaultValue) {
@@ -1199,7 +1270,8 @@ public class JSONObject {
* such key or if the value is not a number. If the value is a string, an
* attempt will be made to evaluate it as a number.
*
* @param key A key string.
* @param key
* A key string.
* @return An object which is the value.
*/
public int optInt(String key) {
@@ -1211,8 +1283,10 @@ public class JSONObject {
* is no such key or if the value is not a number. If the value is a string,
* an attempt will be made to evaluate it as a number.
*
* @param key A key string.
* @param defaultValue The default.
* @param key
* A key string.
* @param defaultValue
* The default.
* @return An object which is the value.
*/
public int optInt(String key, int defaultValue) {
@@ -1228,7 +1302,8 @@ public class JSONObject {
* Get an optional JSONArray associated with a key. It returns null if there
* is no such key, or if its value is not a JSONArray.
*
* @param key A key string.
* @param key
* A key string.
* @return A JSONArray which is the value.
*/
public JSONArray optJSONArray(String key) {
@@ -1240,7 +1315,8 @@ public class JSONObject {
* Get an optional JSONObject associated with a key. It returns null if
* there is no such key, or if its value is not a JSONObject.
*
* @param key A key string.
* @param key
* A key string.
* @return A JSONObject which is the value.
*/
public JSONObject optJSONObject(String key) {
@@ -1253,7 +1329,8 @@ public class JSONObject {
* such key or if the value is not a number. If the value is a string, an
* attempt will be made to evaluate it as a number.
*
* @param key A key string.
* @param key
* A key string.
* @return An object which is the value.
*/
public long optLong(String key) {
@@ -1265,8 +1342,10 @@ public class JSONObject {
* is no such key or if the value is not a number. If the value is a string,
* an attempt will be made to evaluate it as a number.
*
* @param key A key string.
* @param defaultValue The default.
* @param key
* A key string.
* @param defaultValue
* The default.
* @return An object which is the value.
*/
public long optLong(String key, long defaultValue) {
@@ -1283,7 +1362,8 @@ public class JSONObject {
* if there is no such key. If the value is not a string and is not null,
* then it is converted to a string.
*
* @param key A key string.
* @param key
* A key string.
* @return A string which is the value.
*/
public String optString(String key) {
@@ -1294,8 +1374,10 @@ public class JSONObject {
* Get an optional string associated with a key. It returns the defaultValue
* if there is no such key.
*
* @param key A key string.
* @param defaultValue The default.
* @param key
* A key string.
* @param defaultValue
* The default.
* @return A string which is the value.
*/
public String optString(String key, String defaultValue) {
@@ -1348,10 +1430,13 @@ public class JSONObject {
/**
* Put a key/boolean pair in the JSONObject.
*
* @param key A key string.
* @param value A boolean which is the value.
* @param key
* A key string.
* @param value
* A boolean which is the value.
* @return this.
* @throws JSONException If the key is null.
* @throws JSONException
* If the key is null.
*/
public JSONObject put(String key, boolean value) throws JSONException {
this.put(key, value ? Boolean.TRUE : Boolean.FALSE);
@@ -1362,10 +1447,11 @@ public class JSONObject {
* Put a key/value pair in the JSONObject, where the value will be a
* JSONArray which is produced from a Collection.
*
* @param key A key string.
* @param value A Collection value.
* @param key
* A key string.
* @param value
* A Collection value.
* @return this.
* @throws JSONException
*/
public JSONObject put(String key, Collection<Object> value) throws JSONException {
this.put(key, new JSONArray(value));
@@ -1375,10 +1461,13 @@ public class JSONObject {
/**
* Put a key/double pair in the JSONObject.
*
* @param key A key string.
* @param value A double which is the value.
* @param key
* A key string.
* @param value
* A double which is the value.
* @return this.
* @throws JSONException If the key is null or if the number is invalid.
* @throws JSONException
* If the key is null or if the number is invalid.
*/
public JSONObject put(String key, double value) throws JSONException {
this.put(key, Double.valueOf(value));
@@ -1388,10 +1477,13 @@ public class JSONObject {
/**
* Put a key/int pair in the JSONObject.
*
* @param key A key string.
* @param value An int which is the value.
* @param key
* A key string.
* @param value
* An int which is the value.
* @return this.
* @throws JSONException If the key is null.
* @throws JSONException
* If the key is null.
*/
public JSONObject put(String key, int value) throws JSONException {
this.put(key, Integer.valueOf(value));
@@ -1401,10 +1493,13 @@ public class JSONObject {
/**
* Put a key/long pair in the JSONObject.
*
* @param key A key string.
* @param value A long which is the value.
* @param key
* A key string.
* @param value
* A long which is the value.
* @return this.
* @throws JSONException If the key is null.
* @throws JSONException
* If the key is null.
*/
public JSONObject put(String key, long value) throws JSONException {
this.put(key, Long.valueOf(value));
@@ -1415,10 +1510,11 @@ public class JSONObject {
* Put a key/value pair in the JSONObject, where the value will be a
* JSONObject which is produced from a Map.
*
* @param key A key string.
* @param value A Map value.
* @param key
* A key string.
* @param value
* A Map value.
* @return this.
* @throws JSONException
*/
public JSONObject put(String key, Map<String, Object> value) throws JSONException {
this.put(key, new JSONObject(value));
@@ -1429,12 +1525,15 @@ public class JSONObject {
* Put a key/value pair in the JSONObject. If the value is null, then the
* key will be removed from the JSONObject if it is present.
*
* @param key A key string.
* @param value An object which is the value. It should be of one of these
* @param key
* A key string.
* @param value
* An object which is the value. It should be of one of these
* types: Boolean, Double, Integer, JSONArray, JSONObject, Long,
* String, or the JSONObject.NULL object.
* @return this.
* @throws JSONException If the value is non-finite number or if the key is null.
* @throws JSONException
* If the value is non-finite number or if the key is null.
*/
public JSONObject put(String key, Object value) throws JSONException {
if(key == null) {
@@ -1454,10 +1553,13 @@ public class JSONObject {
* are both non-null, and only if there is not already a member with that
* name.
*
* @param key string
* @param value object
* @param key
* string
* @param value
* object
* @return this.
* @throws JSONException if the key is a duplicate
* @throws JSONException
* if the key is a duplicate
*/
public JSONObject putOnce(String key, Object value) throws JSONException {
if(key != null && value != null) {
@@ -1473,12 +1575,15 @@ public class JSONObject {
* Put a key/value pair in the JSONObject, but only if the key and the value
* are both non-null.
*
* @param key A key string.
* @param value An object which is the value. It should be of one of these
* @param key
* A key string.
* @param value
* An object which is the value. It should be of one of these
* types: Boolean, Double, Integer, JSONArray, JSONObject, Long,
* String, or the JSONObject.NULL object.
* @return this.
* @throws JSONException If the value is a non-finite number.
* @throws JSONException
* If the value is a non-finite number.
*/
public JSONObject putOpt(String key, Object value) throws JSONException {
if(key != null && value != null) {
@@ -1490,7 +1595,8 @@ public class JSONObject {
/**
* Remove a name and its value, if present.
*
* @param key The name to be removed.
* @param key
* The name to be removed.
* @return The value that was associated with the name, or null if there was
* no value.
*/
@@ -1502,7 +1608,8 @@ public class JSONObject {
* Determine if two JSONObjects are similar. They must contain the same set
* of names which must be associated with similar values.
*
* @param other The other JSONObject
* @param other
* The other JSONObject
* @return true if they are equal
*/
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
@@ -1543,10 +1650,12 @@ public class JSONObject {
* Produce a JSONArray containing the values of the members of this
* JSONObject.
*
* @param names A JSONArray containing a list of key strings. This determines
* @param names
* A JSONArray containing a list of key strings. This determines
* the sequence of the values in the result.
* @return A JSONArray of values.
* @throws JSONException If any of the values are non-finite numbers.
* @throws JSONException
* If any of the values are non-finite numbers.
*/
public JSONArray toJSONArray(JSONArray names) throws JSONException {
if(names == null || names.length() == 0) {
@@ -1585,12 +1694,14 @@ public class JSONObject {
* <p>
* Warning: This method assumes that the data structure is acyclical.
*
* @param indentFactor The number of spaces to add to each level of indentation.
* @param indentFactor
* The number of spaces to add to each level of indentation.
* @return a printable, displayable, portable, transmittable representation
* of the object, beginning with <code>{</code>&nbsp;<small>(left
* brace)</small> and ending with <code>}</code>&nbsp;<small>(right
* brace)</small>.
* @throws JSONException If the object contains an invalid number.
* @throws JSONException
* If the object contains an invalid number.
*/
public String toString(int indentFactor) throws JSONException {
StringWriter w = new StringWriter();
@@ -1606,7 +1717,6 @@ public class JSONObject {
* Warning: This method assumes that the data structure is acyclical.
*
* @return The writer.
* @throws JSONException
*/
public Writer write(Writer writer) throws JSONException {
return this.write(writer, 0, 0);
@@ -1619,7 +1729,6 @@ public class JSONObject {
* Warning: This method assumes that the data structure is acyclical.
*
* @return The writer.
* @throws JSONException
*/
Writer write(Writer writer, int indentFactor, int indent) throws JSONException {
try {
@@ -1689,7 +1798,8 @@ public class JSONObject {
/**
* A Null object is equal to the null value and to itself.
*
* @param object An object to test for nullness.
* @param object
* An object to test for nullness.
* @return true if the object parameter is the JSONObject.NULL object or
* null.
*/

View File

@@ -50,7 +50,8 @@ public class JSONTokener {
/**
* Construct a JSONTokener from a Reader.
*
* @param reader A reader.
* @param reader
* A reader.
*/
public JSONTokener(Reader reader) {
this.reader = reader.markSupported() ? reader : new BufferedReader(reader);
@@ -65,7 +66,8 @@ public class JSONTokener {
/**
* Construct a JSONTokener from an InputStream.
*
* @param inputStream The source.
* @param inputStream
* The source.
*/
public JSONTokener(InputStream inputStream) throws JSONException {
this(new InputStreamReader(inputStream));
@@ -74,7 +76,8 @@ public class JSONTokener {
/**
* Construct a JSONTokener from a string.
*
* @param s A source string.
* @param s
* A source string.
*/
public JSONTokener(String s) {
this(new StringReader(s));
@@ -83,7 +86,8 @@ public class JSONTokener {
/**
* Get the hex value of a character (base16).
*
* @param c A character between '0' and '9' or between 'A' and 'F' or
* @param c
* A character between '0' and '9' or between 'A' and 'F' or
* between 'a' and 'f'.
* @return An int between 0 and 15, or -1 if c was not a hex digit.
*/
@@ -175,9 +179,11 @@ public class JSONTokener {
* Consume the next character, and check that it matches a specified
* character.
*
* @param c The character to match.
* @param c
* The character to match.
* @return The character.
* @throws JSONException if the character does not match.
* @throws JSONException
* if the character does not match.
*/
public char next(char c) throws JSONException {
char n = this.next();
@@ -190,9 +196,11 @@ public class JSONTokener {
/**
* Get the next n characters.
*
* @param n The number of characters to take.
* @param n
* The number of characters to take.
* @return A string of n characters.
* @throws JSONException Substring bounds error if there are not n characters
* @throws JSONException
* Substring bounds error if there are not n characters
* remaining in the source string.
*/
public String next(int n) throws JSONException {
@@ -217,7 +225,6 @@ public class JSONTokener {
* Get the next char in the string, skipping whitespace.
*
* @return A character, or 0 if there are no more characters.
* @throws JSONException
*/
public char nextClean() throws JSONException {
for(; ; ) {
@@ -233,11 +240,13 @@ public class JSONTokener {
* processing is done. The formal JSON format does not allow strings in
* single quotes, but an implementation is allowed to accept them.
*
* @param quote The quoting character, either <code>"</code>&nbsp;
* @param quote
* The quoting character, either <code>"</code>&nbsp;
* <small>(double quote)</small> or <code>'</code>&nbsp;
* <small>(single quote)</small>.
* @return A String.
* @throws JSONException Unterminated string.
* @throws JSONException
* Unterminated string.
*/
public String nextString(char quote) throws JSONException {
char c;
@@ -293,7 +302,8 @@ public class JSONTokener {
* Get the text up but not including the specified character or the end of
* line, whichever comes first.
*
* @param delimiter A delimiter character.
* @param delimiter
* A delimiter character.
* @return A string.
*/
public String nextTo(char delimiter) throws JSONException {
@@ -314,7 +324,8 @@ public class JSONTokener {
* Get the text up but not including one of the specified delimiter
* characters or the end of line, whichever comes first.
*
* @param delimiters A set of delimiter characters.
* @param delimiters
* A set of delimiter characters.
* @return A string, trimmed.
*/
public String nextTo(String delimiters) throws JSONException {
@@ -337,7 +348,8 @@ public class JSONTokener {
* JSONArray, JSONObject, Long, or String, or the JSONObject.NULL object.
*
* @return An object.
* @throws JSONException If syntax error.
* @throws JSONException
* If syntax error.
*/
public Object nextValue() throws JSONException {
char c = this.nextClean();
@@ -382,7 +394,8 @@ public class JSONTokener {
* Skip characters until the next character is the requested character. If
* the requested character is not found, no characters are skipped.
*
* @param to A character to skip to.
* @param to
* A character to skip to.
* @return The requested character, or zero if the requested character is
* not found.
*/
@@ -414,7 +427,8 @@ public class JSONTokener {
/**
* Make a JSONException to signal a syntax error.
*
* @param message The error message.
* @param message
* The error message.
* @return A JSONException object, suitable for throwing
*/
public JSONException syntaxError(String message) {

View File

@@ -96,9 +96,11 @@ public class JSONWriter {
/**
* Append a value.
*
* @param string A string value.
* @param string
* A string value.
* @return this
* @throws JSONException If the value is out of sequence.
* @throws JSONException
* If the value is out of sequence.
*/
private JSONWriter append(String string) throws JSONException {
if(string == null) {
@@ -129,7 +131,8 @@ public class JSONWriter {
* <code>endArray</code> method must be called to mark the array's end.
*
* @return this
* @throws JSONException If the nesting is too deep, or if the object is started in
* @throws JSONException
* If the nesting is too deep, or if the object is started in
* the wrong place (for example as a key or after the end of the
* outermost array or object).
*/
@@ -146,10 +149,13 @@ public class JSONWriter {
/**
* End something.
*
* @param mode Mode
* @param c Closing character
* @param mode
* Mode
* @param c
* Closing character
* @return this
* @throws JSONException If unbalanced.
* @throws JSONException
* If unbalanced.
*/
private JSONWriter end(char mode, char c) throws JSONException {
if(this.mode != mode) {
@@ -171,7 +177,8 @@ public class JSONWriter {
* <code>array</code>.
*
* @return this
* @throws JSONException If incorrectly nested.
* @throws JSONException
* If incorrectly nested.
*/
public JSONWriter endArray() throws JSONException {
return this.end('a', ']');
@@ -182,7 +189,8 @@ public class JSONWriter {
* <code>object</code>.
*
* @return this
* @throws JSONException If incorrectly nested.
* @throws JSONException
* If incorrectly nested.
*/
public JSONWriter endObject() throws JSONException {
return this.end('k', '}');
@@ -192,9 +200,11 @@ public class JSONWriter {
* Append a key. The key will be associated with the next value. In an
* object, every value must be preceded by a key.
*
* @param string A key string.
* @param string
* A key string.
* @return this
* @throws JSONException If the key is out of place. For example, keys do not belong
* @throws JSONException
* If the key is out of place. For example, keys do not belong
* in arrays or if the key is null.
*/
public JSONWriter key(String string) throws JSONException {
@@ -226,7 +236,8 @@ public class JSONWriter {
* <code>endObject</code> method must be called to mark the object's end.
*
* @return this
* @throws JSONException If the nesting is too deep, or if the object is started in
* @throws JSONException
* If the nesting is too deep, or if the object is started in
* the wrong place (for example as a key or after the end of the
* outermost array or object).
*/
@@ -247,8 +258,10 @@ public class JSONWriter {
/**
* Pop an array or object scope.
*
* @param c The scope to close.
* @throws JSONException If nesting is wrong.
* @param c
* The scope to close.
* @throws JSONException
* If nesting is wrong.
*/
private void pop(char c) throws JSONException {
if(this.top <= 0) {
@@ -265,8 +278,10 @@ public class JSONWriter {
/**
* Push an array or object scope.
*
* @param jo The scope to open.
* @throws JSONException If nesting is too deep.
* @param jo
* The scope to open.
* @throws JSONException
* If nesting is too deep.
*/
private void push(JSONObject jo) throws JSONException {
if(this.top >= maxdepth) {
@@ -281,7 +296,8 @@ public class JSONWriter {
* Append either the value <code>true</code> or the value <code>false</code>
* .
*
* @param b A boolean.
* @param b
* A boolean.
* @return this
*/
public JSONWriter value(boolean b) throws JSONException {
@@ -291,9 +307,11 @@ public class JSONWriter {
/**
* Append a double value.
*
* @param d A double.
* @param d
* A double.
* @return this
* @throws JSONException If the number is not finite.
* @throws JSONException
* If the number is not finite.
*/
public JSONWriter value(double d) throws JSONException {
return this.value(Double.valueOf(d));
@@ -302,7 +320,8 @@ public class JSONWriter {
/**
* Append a long value.
*
* @param l A long.
* @param l
* A long.
* @return this
*/
public JSONWriter value(long l) throws JSONException {
@@ -312,11 +331,13 @@ public class JSONWriter {
/**
* Append an object value.
*
* @param object The object to append. It can be null, or a Boolean, Number,
* @param object
* The object to append. It can be null, or a Boolean, Number,
* String, JSONObject, or JSONArray, or an object that implements
* JSONString.
* @return this
* @throws JSONException If the value is out of sequence.
* @throws JSONException
* If the value is out of sequence.
*/
public JSONWriter value(Object object) throws JSONException {
return this.append(JSONObject.valueToString(object));

View File

@@ -87,7 +87,8 @@ public class XML {
* &quot; <small>(double quote)</small> is replaced by &amp;quot;
* </pre>
*
* @param string The string to be escaped.
* @param string
* The string to be escaped.
* @return The escaped string.
*/
public static String escape(String string) {
@@ -110,7 +111,8 @@ public class XML {
* Throw an exception if the string contains whitespace. Whitespace is not
* allowed in tagNames and attributes.
*
* @param string A string.
* @param string
* A string.
*/
public static void noSpace(String string) throws JSONException {
int i, length = string.length();
@@ -127,9 +129,12 @@ public class XML {
/**
* Scan the content following the named tag, attaching it to the context.
*
* @param x The XMLTokener containing the source string.
* @param context The JSONObject that will include the new material.
* @param name The tag name.
* @param x
* The XMLTokener containing the source string.
* @param context
* The JSONObject that will include the new material.
* @param name
* The tag name.
* @return true if the close tag is processed.
*/
private static boolean parse(XMLTokener x, JSONObject context, String name) throws JSONException {
@@ -297,7 +302,8 @@ public class XML {
* convert plus forms, octal forms, hex forms, or E forms lacking decimal
* points.
*
* @param string A String.
* @param string
* A String.
* @return A simple JSON value.
*/
public static Object stringToValue(String string) {
@@ -348,7 +354,8 @@ public class XML {
* "content" member. Comments, prologs, DTDs, and <code>&lt;[ [ ]]></code>
* are ignored.
*
* @param string The source string.
* @param string
* The source string.
* @return A JSONObject containing the structured data from the XML string.
*/
public static JSONObject toJSONObject(String string) throws JSONException {
@@ -363,7 +370,8 @@ public class XML {
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
*
* @param object A JSONObject.
* @param object
* A JSONObject.
* @return A string.
*/
public static String toString(Object object) throws JSONException {
@@ -373,8 +381,10 @@ public class XML {
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
*
* @param object A JSONObject.
* @param tagName The optional name of the enclosing tag.
* @param object
* A JSONObject.
* @param tagName
* The optional name of the enclosing tag.
* @return A string.
*/
public static String toString(Object object, String tagName) throws JSONException {

View File

@@ -46,7 +46,8 @@ public class XMLTokener extends JSONTokener {
/**
* Construct an XMLTokener from a string.
*
* @param s A source string.
* @param s
* A source string.
*/
public XMLTokener(String s) {
super(s);
@@ -56,7 +57,8 @@ public class XMLTokener extends JSONTokener {
* Get the text in the CDATA block.
*
* @return The string up to the <code>]]&gt;</code>.
* @throws JSONException If the <code>]]&gt;</code> is not found.
* @throws JSONException
* If the <code>]]&gt;</code> is not found.
*/
public String nextCDATA() throws JSONException {
char c;
@@ -115,9 +117,11 @@ public class XMLTokener extends JSONTokener {
* Return the next entity. These entities are translated to Characters:
* <code>&amp; &apos; &gt; &lt; &quot;</code>.
*
* @param ampersand An ampersand character.
* @param ampersand
* An ampersand character.
* @return A Character or an entity String if the entity is not recognized.
* @throws JSONException If missing ';' in XML entity.
* @throws JSONException
* If missing ';' in XML entity.
*/
public Object nextEntity(char ampersand) throws JSONException {
StringBuilder sb = new StringBuilder();
@@ -143,7 +147,8 @@ public class XMLTokener extends JSONTokener {
* @return Syntax characters (<code>< > / = ! ?</code>) are returned as
* Character, and strings and names are returned as Boolean. We
* don't care what the values actually are.
* @throws JSONException If a string is not properly closed or if the XML is badly
* @throws JSONException
* If a string is not properly closed or if the XML is badly
* structured.
*/
public Object nextMeta() throws JSONException {
@@ -201,7 +206,8 @@ public class XMLTokener extends JSONTokener {
* string wrapped in single quotes or double quotes, or it may be a name.
*
* @return a String or a Character.
* @throws JSONException If the XML is not well formed.
* @throws JSONException
* If the XML is not well formed.
*/
public Object nextToken() throws JSONException {
char c;
@@ -282,7 +288,8 @@ public class XMLTokener extends JSONTokener {
* Skip characters until past the requested string. If it is not found, we
* are left at the end of the source with a result of false.
*
* @param to A string to skip past.
* @param to
* A string to skip past.
*/
public boolean skipPast(String to) throws JSONException {
boolean b;

View File

@@ -68,8 +68,10 @@ public class Mantle {
/**
* Create a new mantle
*
* @param dataFolder the data folder
* @param worldHeight the world's height (in blocks)
* @param dataFolder
* the data folder
* @param worldHeight
* the world's height (in blocks)
*/
@BlockCoordinates
public Mantle(File dataFolder, int worldHeight) {
@@ -89,9 +91,12 @@ public class Mantle {
/**
* Get the file for a region
*
* @param folder the folder
* @param x the x coord
* @param z the z coord
* @param folder
* the folder
* @param x
* the x coord
* @param z
* the z coord
* @return the file
*/
public static File fileForRegion(File folder, int x, int z) {
@@ -101,8 +106,10 @@ public class Mantle {
/**
* Get the file for the given region
*
* @param folder the data folder
* @param key the region key
* @param folder
* the data folder
* @param key
* the region key
* @return the file
*/
public static File fileForRegion(File folder, Long key) {
@@ -116,8 +123,10 @@ public class Mantle {
/**
* Get the long value representing a chunk or region coordinate
*
* @param x the x
* @param z the z
* @param x
* the x
* @param z
* the z
* @return the value
*/
public static Long key(int x, int z) {
@@ -127,10 +136,14 @@ public class Mantle {
/**
* Raise a flag if it is lowered currently, If the flag was raised, execute the runnable
*
* @param x the chunk x
* @param z the chunk z
* @param flag the flag to raise
* @param r the runnable to fire if the flag is now raised (and was previously lowered)
* @param x
* the chunk x
* @param z
* the chunk z
* @param flag
* the flag to raise
* @param r
* the runnable to fire if the flag is now raised (and was previously lowered)
*/
@ChunkCoordinates
public void raiseFlag(int x, int z, MantleFlag flag, Runnable r) {
@@ -144,9 +157,12 @@ public class Mantle {
* Obtain a cached writer which only contains cached chunks.
* This avoids locking on regions when writing to lots of chunks
*
* @param x the x chunk
* @param z the z chunk
* @param radius the radius chunks
* @param x
* the x chunk
* @param z
* the z chunk
* @param radius
* the radius chunks
* @return the writer
*/
@ChunkCoordinates
@@ -157,10 +173,14 @@ public class Mantle {
/**
* Lower a flag if it is raised. If the flag was lowered (meaning it was previously raised), execute the runnable
*
* @param x the chunk x
* @param z the chunk z
* @param flag the flag to lower
* @param r the runnable that is fired if the flag was raised but is now lowered
* @param x
* the chunk x
* @param z
* the chunk z
* @param flag
* the flag to lower
* @param r
* the runnable that is fired if the flag was raised but is now lowered
*/
@ChunkCoordinates
public void lowerFlag(int x, int z, MantleFlag flag, Runnable r) {
@@ -178,10 +198,14 @@ public class Mantle {
/**
* Flag or unflag a chunk
*
* @param x the chunk x
* @param z the chunk z
* @param flag the flag
* @param flagged should it be set to flagged or not
* @param x
* the chunk x
* @param z
* the chunk z
* @param flag
* the flag
* @param flagged
* should it be set to flagged or not
*/
@ChunkCoordinates
public void flag(int x, int z, MantleFlag flag, boolean flagged) {
@@ -195,8 +219,10 @@ public class Mantle {
/**
* Check very quickly if a tectonic plate exists via cached or the file system
*
* @param x the x region coordinate
* @param z the z region coordinate
* @param x
* the x region coordinate
* @param z
* the z region coordinate
* @return true if it exists
*/
@RegionCoordinates
@@ -208,11 +234,16 @@ public class Mantle {
/**
* Iterate data in a chunk
*
* @param x the chunk x
* @param z the chunk z
* @param type the type of data to iterate
* @param iterator the iterator (x,y,z,data) -> do stuff
* @param <T> the type of data to iterate
* @param x
* the chunk x
* @param z
* the chunk z
* @param type
* the type of data to iterate
* @param iterator
* the iterator (x,y,z,data) -> do stuff
* @param <T>
* the type of data to iterate
*/
@ChunkCoordinates
public <T> void iterateChunk(int x, int z, Class<T> type, Consumer4<Integer, Integer, Integer, T> iterator) {
@@ -226,9 +257,12 @@ public class Mantle {
/**
* Does this chunk have a flag on it?
*
* @param x the x
* @param z the z
* @param flag the flag to test
* @param x
* the x
* @param z
* the z
* @param flag
* the flag to test
* @return true if it's flagged
*/
@ChunkCoordinates
@@ -248,11 +282,16 @@ public class Mantle {
* reading & writing other regions. Hyperlocks are slow sync, but in multicore
* environments, they drastically speed up loading & saving large counts of plates
*
* @param x the block's x coordinate
* @param y the block's y coordinate
* @param z the block's z coordinate
* @param t the data to set at the block
* @param <T> the type of data (generic method)
* @param x
* the block's x coordinate
* @param y
* the block's y coordinate
* @param z
* the block's z coordinate
* @param t
* the data to set at the block
* @param <T>
* the type of data (generic method)
*/
@BlockCoordinates
public <T> void set(int x, int y, int z, T t) {
@@ -296,11 +335,16 @@ public class Mantle {
* reading & writing other regions. Hyperlocks are slow sync, but in multicore
* environments, they drastically speed up loading & saving large counts of plates
*
* @param x the block's x coordinate
* @param y the block's y coordinate
* @param z the block's z coordinate
* @param t the class representing the type of data being requested
* @param <T> the type assumed from the provided class
* @param x
* the block's x coordinate
* @param y
* the block's y coordinate
* @param z
* the block's z coordinate
* @param t
* the class representing the type of data being requested
* @param <T>
* the type assumed from the provided class
* @return the returned result (or null) if it doesnt exist
*/
@SuppressWarnings("unchecked")
@@ -370,7 +414,8 @@ public class Mantle {
* Save & unload regions that have not been used for more than the
* specified amount of milliseconds
*
* @param idleDuration the duration
* @param idleDuration
* the duration
*/
public synchronized void trim(long idleDuration) {
if(closed.get()) {
@@ -410,8 +455,10 @@ public class Mantle {
* This retreives a future of the Tectonic Plate at the given coordinates.
* All methods accessing tectonic plates should go through this method
*
* @param x the region x
* @param z the region z
* @param x
* the region x
* @param z
* the region z
* @return the future of a tectonic plate.
*/
@RegionCoordinates
@@ -450,8 +497,10 @@ public class Mantle {
* This retreives a future of the Tectonic Plate at the given coordinates.
* All methods accessing tectonic plates should go through this method
*
* @param x the region x
* @param z the region z
* @param x
* the region x
* @param z
* the region z
* @return the future of a tectonic plate.
*/
@RegionCoordinates

View File

@@ -19,7 +19,6 @@
package com.volmit.iris.util.mantle;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.EnginePanic;
import com.volmit.iris.util.documentation.ChunkCoordinates;
import com.volmit.iris.util.function.Consumer4;
import com.volmit.iris.util.matter.IrisMatter;
@@ -48,7 +47,8 @@ public class MantleChunk {
/**
* Create a mantle chunk
*
* @param sectionHeight the height of the world in sections (blocks >> 4)
* @param sectionHeight
* the height of the world in sections (blocks >> 4)
*/
@ChunkCoordinates
public MantleChunk(int sectionHeight, int x, int z) {
@@ -65,10 +65,14 @@ public class MantleChunk {
/**
* Load a mantle chunk from a data stream
*
* @param sectionHeight the height of the world in sections (blocks >> 4)
* @param din the data input
* @throws IOException shit happens
* @throws ClassNotFoundException shit happens
* @param sectionHeight
* the height of the world in sections (blocks >> 4)
* @param din
* the data input
* @throws IOException
* shit happens
* @throws ClassNotFoundException
* shit happens
*/
public MantleChunk(int sectionHeight, DataInputStream din) throws IOException, ClassNotFoundException {
this(sectionHeight, din.readByte(), din.readByte());
@@ -104,7 +108,8 @@ public class MantleChunk {
/**
* Check if a section exists (same as get(section) != null)
*
* @param section the section (0 - (worldHeight >> 4))
* @param section
* the section (0 - (worldHeight >> 4))
* @return true if it exists
*/
@ChunkCoordinates
@@ -115,7 +120,8 @@ public class MantleChunk {
/**
* Get thje matter at the given section or null if it doesnt exist
*
* @param section the section (0 - (worldHeight >> 4))
* @param section
* the section (0 - (worldHeight >> 4))
* @return the matter or null if it doesnt exist
*/
@ChunkCoordinates
@@ -135,7 +141,8 @@ public class MantleChunk {
/**
* Delete the matter from the given section
*
* @param section the section (0 - (worldHeight >> 4))
* @param section
* the section (0 - (worldHeight >> 4))
*/
@ChunkCoordinates
public void delete(int section) {
@@ -145,7 +152,8 @@ public class MantleChunk {
/**
* Get or create a new matter section at the given section
*
* @param section the section (0 - (worldHeight >> 4))
* @param section
* the section (0 - (worldHeight >> 4))
* @return the matter
*/
@ChunkCoordinates
@@ -163,8 +171,10 @@ public class MantleChunk {
/**
* Write this chunk to a data stream
*
* @param dos the stream
* @throws IOException shit happens
* @param dos
* the stream
* @throws IOException
* shit happens
*/
public void write(DataOutputStream dos) throws IOException {
dos.writeByte(x);

View File

@@ -54,7 +54,8 @@ public class TectonicPlate {
/**
* Create a new tectonic plate
*
* @param worldHeight the height of the world
* @param worldHeight
* the height of the world
*/
public TectonicPlate(int worldHeight, int x, int z) {
this.sectionHeight = worldHeight >> 4;
@@ -66,10 +67,14 @@ public class TectonicPlate {
/**
* Load a tectonic plate from a data stream
*
* @param worldHeight the height of the world
* @param din the data input
* @throws IOException shit happens yo
* @throws ClassNotFoundException real shit bro
* @param worldHeight
* the height of the world
* @param din
* the data input
* @throws IOException
* shit happens yo
* @throws ClassNotFoundException
* real shit bro
*/
public TectonicPlate(int worldHeight, DataInputStream din) throws IOException, ClassNotFoundException {
this(worldHeight, din.readInt(), din.readInt());
@@ -95,8 +100,10 @@ public class TectonicPlate {
/**
* Check if a chunk exists in this plate or not (same as get(x, z) != null)
*
* @param x the chunk relative x (0-31)
* @param z the chunk relative z (0-31)
* @param x
* the chunk relative x (0-31)
* @param z
* the chunk relative z (0-31)
* @return true if the chunk exists
*/
@ChunkCoordinates
@@ -107,8 +114,10 @@ public class TectonicPlate {
/**
* Get a chunk at the given coordinates or null if it doesnt exist
*
* @param x the chunk relative x (0-31)
* @param z the chunk relative z (0-31)
* @param x
* the chunk relative x (0-31)
* @param z
* the chunk relative z (0-31)
* @return the chunk or null if it doesnt exist
*/
@ChunkCoordinates
@@ -128,8 +137,10 @@ public class TectonicPlate {
/**
* Delete a chunk from this tectonic plate
*
* @param x the chunk relative x (0-31)
* @param z the chunk relative z (0-31)
* @param x
* the chunk relative x (0-31)
* @param z
* the chunk relative z (0-31)
*/
@ChunkCoordinates
public void delete(int x, int z) {
@@ -139,8 +150,10 @@ public class TectonicPlate {
/**
* Get a tectonic plate, or create one and insert it & return it if it diddnt exist
*
* @param x the chunk relative x (0-31)
* @param z the chunk relative z (0-31)
* @param x
* the chunk relative x (0-31)
* @param z
* the chunk relative z (0-31)
* @return the chunk (read or created & inserted)
*/
@ChunkCoordinates
@@ -163,8 +176,10 @@ public class TectonicPlate {
/**
* Write this tectonic plate to file
*
* @param file the file to writeNodeData it to
* @throws IOException shit happens
* @param file
* the file to writeNodeData it to
* @throws IOException
* shit happens
*/
public void write(File file) throws IOException {
PrecisionStopwatch p = PrecisionStopwatch.start();
@@ -179,8 +194,10 @@ public class TectonicPlate {
/**
* Write this tectonic plate to a data stream
*
* @param dos the data output
* @throws IOException shit happens
* @param dos
* the data output
* @throws IOException
* shit happens
*/
public void write(DataOutputStream dos) throws IOException {
dos.writeInt(x);

View File

@@ -38,7 +38,8 @@ public class Average {
/**
* Create an average holder
*
* @param size the size of entries to keep
* @param size
* the size of entries to keep
*/
public Average(int size) {
values = new double[size];
@@ -53,7 +54,8 @@ public class Average {
/**
* Put a value into the average (rolls over if full)
*
* @param i the value
* @param i
* the value
*/
public void put(double i) {

View File

@@ -142,7 +142,8 @@ public enum Direction {
* Get the directional value from the given byte from common directional blocks
* (MUST BE BETWEEN 0 and 5 INCLUSIVE)
*
* @param b the byte
* @param b
* the byte
* @return the direction or null if the byte is outside of the inclusive range
* 0-5
*/

View File

@@ -33,7 +33,8 @@ public class FinalInteger extends Wrapper<Integer> {
/**
* Add to this value
*
* @param i the number to add to this value (value = value + i)
* @param i
* the number to add to this value (value = value + i)
*/
public void add(int i) {
set(get() + i);
@@ -42,7 +43,8 @@ public class FinalInteger extends Wrapper<Integer> {
/**
* Subtract from this value
*
* @param i the number to subtract from this value (value = value - i)
* @param i
* the number to subtract from this value (value = value - i)
*/
public void sub(int i) {
set(get() - i);

View File

@@ -88,11 +88,16 @@ public class KochanekBartelsInterpolation implements PathInterpolation {
/**
* Returns the linear combination of the given coefficients with the nodes adjacent to baseIndex.
*
* @param baseIndex node index
* @param f1 coefficient for baseIndex-1
* @param f2 coefficient for baseIndex
* @param f3 coefficient for baseIndex+1
* @param f4 coefficient for baseIndex+2
* @param baseIndex
* node index
* @param f1
* coefficient for baseIndex-1
* @param f2
* coefficient for baseIndex
* @param f3
* coefficient for baseIndex+1
* @param f4
* coefficient for baseIndex+2
* @return linear combination of nodes[n-1..n+2] with f1..4
*/
private Vector linearCombination(int baseIndex, double f1, double f2, double f3, double f4) {
@@ -107,7 +112,8 @@ public class KochanekBartelsInterpolation implements PathInterpolation {
/**
* Retrieves a node. Indexes are clamped to the valid range.
*
* @param index node index to retrieve
* @param index
* node index to retrieve
* @return nodes[clamp(0, nodes.length - 1)]
*/
private Vector retrieve(int index) {

View File

@@ -52,11 +52,16 @@ public class M {
* <br/>
* would return 10
*
* @param amin the resulting minimum
* @param amax the resulting maximum
* @param bmin the initial minimum
* @param bmax the initial maximum
* @param b the initial value
* @param amin
* the resulting minimum
* @param amax
* the resulting maximum
* @param bmin
* the initial minimum
* @param bmax
* the initial maximum
* @param b
* the initial value
* @return the resulting value
*/
public static double rangeScale(double amin, double amax, double bmin, double bmax, double b) {
@@ -68,9 +73,12 @@ public class M {
* <p>
* If from = 0 and to = 100 and at = 25 then it would return 0.25
*
* @param from the from
* @param to the to
* @param at the at
* @param from
* the from
* @param to
* the to
* @param at
* the at
* @return the percent
*/
public static double lerpInverse(double from, double to, double at) {
@@ -80,9 +88,12 @@ public class M {
/**
* Linear interpolation from a to b where f is the percent across
*
* @param a the first pos (0)
* @param b the second pos (1)
* @param f the percent
* @param a
* the first pos (0)
* @param b
* the second pos (1)
* @param f
* the percent
* @return the value
*/
public static double lerp(double a, double b, double f) {
@@ -92,10 +103,14 @@ public class M {
/**
* Bilinear interpolation
*
* @param a the first point (0, 0)
* @param b the second point (1, 0)
* @param c the third point (0, 1)
* @param d the fourth point (1, 1)
* @param a
* the first point (0, 0)
* @param b
* the second point (1, 0)
* @param c
* the third point (0, 1)
* @param d
* the fourth point (1, 1)
* @return the bilerped value
*/
public static double bilerp(double a, double b, double c, double d, double x, double y) {
@@ -105,17 +120,28 @@ public class M {
/**
* Trilinear interpolation
*
* @param a the first point (0, 0, 0)
* @param b the second point (1, 0, 0)
* @param c the third point (0, 0, 1)
* @param d the fourth point (1, 0, 1)
* @param e the fifth point (0, 1, 0)
* @param f the sixth point (1, 1, 0)
* @param g the seventh point (0, 1, 1)
* @param h the eighth point (1, 1, 1)
* @param x the x
* @param y the y
* @param z the z
* @param a
* the first point (0, 0, 0)
* @param b
* the second point (1, 0, 0)
* @param c
* the third point (0, 0, 1)
* @param d
* the fourth point (1, 0, 1)
* @param e
* the fifth point (0, 1, 0)
* @param f
* the sixth point (1, 1, 0)
* @param g
* the seventh point (0, 1, 1)
* @param h
* the eighth point (1, 1, 1)
* @param x
* the x
* @param y
* the y
* @param z
* the z
* @return the trilerped value
*/
public static double trilerp(double a, double b, double c, double d, double e, double f, double g, double h, double x, double y, double z) {
@@ -125,9 +151,12 @@ public class M {
/**
* Clip a value
*
* @param value the value
* @param min the min
* @param max the max
* @param value
* the value
* @param min
* the min
* @param max
* the max
* @return the clipped value
*/
@SuppressWarnings("unchecked")
@@ -138,7 +167,8 @@ public class M {
/**
* Get true or false based on random percent
*
* @param d between 0 and 1
* @param d
* between 0 and 1
* @return true if true
*/
public static boolean r(Double d) {
@@ -154,8 +184,10 @@ public class M {
* Get the ticks per second from a time in nanoseconds, the rad can be used for
* multiple ticks
*
* @param ns the time in nanoseconds
* @param rad the radius of the time
* @param ns
* the time in nanoseconds
* @param rad
* the radius of the time
* @return the ticks per second in double form
*/
public static double tps(long ns, int rad) {
@@ -165,7 +197,8 @@ public class M {
/**
* Get the number of ticks from a time in nanoseconds
*
* @param ns the nanoseconds
* @param ns
* the nanoseconds
* @return the amount of ticks
*/
public static double ticksFromNS(long ns) {
@@ -175,8 +208,10 @@ public class M {
/**
* Get a random int from to (inclusive)
*
* @param f the from
* @param t the to
* @param f
* the from
* @param t
* the to
* @return the value
*/
public static int irand(int f, int t) {
@@ -186,8 +221,10 @@ public class M {
/**
* Get a random float from to (inclusive)
*
* @param f the from
* @param t the to
* @param f
* the from
* @param t
* the to
* @return the value
*/
public static float frand(float f, float t) {
@@ -197,8 +234,10 @@ public class M {
/**
* Get a random double from to (inclusive)
*
* @param f the from
* @param t the to
* @param f
* the from
* @param t
* the to
* @return the value
*/
public static double drand(double f, double t) {
@@ -226,7 +265,8 @@ public class M {
/**
* Fast sin function
*
* @param a the number
* @param a
* the number
* @return the sin
*/
public static float sin(float a) {
@@ -236,7 +276,8 @@ public class M {
/**
* Fast cos function
*
* @param a the number
* @param a
* the number
* @return the cos
*/
public static float cos(float a) {
@@ -246,7 +287,8 @@ public class M {
/**
* Fast tan function
*
* @param a the number
* @param a
* the number
* @return the tan
*/
public static float tan(float a) {
@@ -275,7 +317,8 @@ public class M {
/**
* Smallest number
*
* @param doubles the numbers
* @param doubles
* the numbers
* @return the smallest one
*/
@SuppressWarnings("unchecked")
@@ -298,11 +341,15 @@ public class M {
* makes the expression (4x1)/2 == 2. Keep note that you must use 0-9, you
* cannot skip, or start at a number other than 0.
*
* @param expression the expression with variables
* @param args the arguments/variables
* @param expression
* the expression with variables
* @param args
* the arguments/variables
* @return the resulting double value
* @throws ScriptException ... gg
* @throws IndexOutOfBoundsException learn to count
* @throws ScriptException
* ... gg
* @throws IndexOutOfBoundsException
* learn to count
*/
public static double evaluate(String expression, Double... args) throws ScriptException, IndexOutOfBoundsException {
for(int i = 0; i < args.length; i++) {
@@ -319,9 +366,11 @@ public class M {
/**
* Evaluates an expression using javascript engine and returns the double
*
* @param expression the mathimatical expression
* @param expression
* the mathimatical expression
* @return the double result
* @throws ScriptException ... gg
* @throws ScriptException
* ... gg
*/
public static double evaluate(String expression) throws ScriptException {
ScriptEngineManager mgr = new ScriptEngineManager();
@@ -333,9 +382,12 @@ public class M {
/**
* is the number "is" within from-to
*
* @param from the lower end
* @param to the upper end
* @param is the check
* @param from
* the lower end
* @param to
* the upper end
* @param is
* the check
* @return true if its within
*/
public static boolean within(int from, int to, int is) {
@@ -354,7 +406,8 @@ public class M {
/**
* Get the amount of days past since the epoch time (1970 jan 1 utc)
*
* @param ms the time in milliseconds
* @param ms
* the time in milliseconds
* @return the epoch days
*/
private static long epochDays(long ms) {

View File

@@ -28,14 +28,16 @@ public interface PathInterpolation {
* Sets nodes to be used by subsequent calls to
* {@link #getPosition(double)} and the other methods.
*
* @param nodes the nodes
* @param nodes
* the nodes
*/
void setNodes(List<INode> nodes);
/**
* Gets the result of f(position).
*
* @param position the position to interpolate
* @param position
* the position to interpolate
* @return the result
*/
Vector getPosition(double position);
@@ -43,7 +45,8 @@ public interface PathInterpolation {
/**
* Gets the result of f'(position).
*
* @param position the position to interpolate
* @param position
* the position to interpolate
* @return the result
*/
Vector get1stDerivative(double position);
@@ -53,8 +56,10 @@ public interface PathInterpolation {
* That means it calculates the arc length (in meters) between positionA
* and positionB.
*
* @param positionA lower limit
* @param positionB upper limit
* @param positionA
* lower limit
* @param positionB
* upper limit
* @return the arc length
*/
double arcLength(double positionA, double positionB);
@@ -62,7 +67,8 @@ public interface PathInterpolation {
/**
* Get the segment position.
*
* @param position the position
* @param position
* the position
* @return the segment position
*/
int getSegment(double position);

View File

@@ -30,9 +30,12 @@ public class Point3d extends Tuple3d implements java.io.Serializable {
/**
* Constructs and initializes a Point3d from the specified xyz coordinates.
*
* @param x the x coordinate
* @param y the y coordinate
* @param z the z coordinate
* @param x
* the x coordinate
* @param y
* the y coordinate
* @param z
* the z coordinate
*/
public Point3d(double x, double y, double z) {
super(x, y, z);
@@ -42,7 +45,8 @@ public class Point3d extends Tuple3d implements java.io.Serializable {
/**
* Constructs and initializes a Point3d from the array of length 3.
*
* @param p the array of length 3 containing xyz in order
* @param p
* the array of length 3 containing xyz in order
*/
public Point3d(double[] p) {
super(p);
@@ -52,7 +56,8 @@ public class Point3d extends Tuple3d implements java.io.Serializable {
/**
* Constructs and initializes a Point3d from the specified Point3d.
*
* @param p1 the Point3d containing the initialization x y z data
* @param p1
* the Point3d containing the initialization x y z data
*/
public Point3d(Point3d p1) {
super(p1);
@@ -62,7 +67,8 @@ public class Point3d extends Tuple3d implements java.io.Serializable {
/**
* Constructs and initializes a Point3d from the specified Point3f.
*
* @param p1 the Point3f containing the initialization x y z data
* @param p1
* the Point3f containing the initialization x y z data
*/
public Point3d(Point3f p1) {
super(p1);
@@ -72,7 +78,8 @@ public class Point3d extends Tuple3d implements java.io.Serializable {
/**
* Constructs and initializes a Point3d from the specified Tuple3f.
*
* @param t1 the Tuple3f containing the initialization x y z data
* @param t1
* the Tuple3f containing the initialization x y z data
*/
public Point3d(Tuple3f t1) {
super(t1);
@@ -82,7 +89,8 @@ public class Point3d extends Tuple3d implements java.io.Serializable {
/**
* Constructs and initializes a Point3d from the specified Tuple3d.
*
* @param t1 the Tuple3d containing the initialization x y z data
* @param t1
* the Tuple3d containing the initialization x y z data
*/
public Point3d(Tuple3d t1) {
super(t1);
@@ -100,7 +108,8 @@ public class Point3d extends Tuple3d implements java.io.Serializable {
/**
* Returns the square of the distance between this point and point p1.
*
* @param p1 the other point
* @param p1
* the other point
* @return the square of the distance
*/
public final double distanceSquared(Point3d p1) {
@@ -116,7 +125,8 @@ public class Point3d extends Tuple3d implements java.io.Serializable {
/**
* Returns the distance between this point and point p1.
*
* @param p1 the other point
* @param p1
* the other point
* @return the distance
*/
public final double distance(Point3d p1) {
@@ -134,7 +144,8 @@ public class Point3d extends Tuple3d implements java.io.Serializable {
* point p1. The L-1 distance is equal to:
* abs(x1-x2) + abs(y1-y2) + abs(z1-z2).
*
* @param p1 the other point
* @param p1
* the other point
* @return the L-1 distance
*/
public final double distanceL1(Point3d p1) {
@@ -148,7 +159,8 @@ public class Point3d extends Tuple3d implements java.io.Serializable {
* point p1. The L-infinite distance is equal to
* MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2)].
*
* @param p1 the other point
* @param p1
* the other point
* @return the L-infinite distance
*/
public final double distanceLinf(Point3d p1) {
@@ -163,7 +175,8 @@ public class Point3d extends Tuple3d implements java.io.Serializable {
* Multiplies each of the x,y,z components of the Point4d parameter
* by 1/w and places the projected values into this point.
*
* @param p1 the source Point4d, which is not modified
* @param p1
* the source Point4d, which is not modified
*/
public final void project(Point4d p1) {
double oneOw;

View File

@@ -31,9 +31,12 @@ public class Point3f extends Tuple3f implements java.io.Serializable {
/**
* Constructs and initializes a Point3f from the specified xyz coordinates.
*
* @param x the x coordinate
* @param y the y coordinate
* @param z the z coordinate
* @param x
* the x coordinate
* @param y
* the y coordinate
* @param z
* the z coordinate
*/
public Point3f(float x, float y, float z) {
super(x, y, z);
@@ -43,7 +46,8 @@ public class Point3f extends Tuple3f implements java.io.Serializable {
/**
* Constructs and initializes a Point3f from the array of length 3.
*
* @param p the array of length 3 containing xyz in order
* @param p
* the array of length 3 containing xyz in order
*/
public Point3f(float[] p) {
super(p);
@@ -53,7 +57,8 @@ public class Point3f extends Tuple3f implements java.io.Serializable {
/**
* Constructs and initializes a Point3f from the specified Point3f.
*
* @param p1 the Point3f containing the initialization x y z data
* @param p1
* the Point3f containing the initialization x y z data
*/
public Point3f(Point3f p1) {
super(p1);
@@ -63,7 +68,8 @@ public class Point3f extends Tuple3f implements java.io.Serializable {
/**
* Constructs and initializes a Point3f from the specified Point3d.
*
* @param p1 the Point3d containing the initialization x y z data
* @param p1
* the Point3d containing the initialization x y z data
*/
public Point3f(Point3d p1) {
super(p1);
@@ -73,7 +79,8 @@ public class Point3f extends Tuple3f implements java.io.Serializable {
/**
* Constructs and initializes a Point3f from the specified Tuple3f.
*
* @param t1 the Tuple3f containing the initialization x y z data
* @param t1
* the Tuple3f containing the initialization x y z data
*/
public Point3f(Tuple3f t1) {
super(t1);
@@ -83,7 +90,8 @@ public class Point3f extends Tuple3f implements java.io.Serializable {
/**
* Constructs and initializes a Point3f from the specified Tuple3d.
*
* @param t1 the Tuple3d containing the initialization x y z data
* @param t1
* the Tuple3d containing the initialization x y z data
*/
public Point3f(Tuple3d t1) {
super(t1);
@@ -102,7 +110,8 @@ public class Point3f extends Tuple3f implements java.io.Serializable {
* Computes the square of the distance between this point and
* point p1.
*
* @param p1 the other point
* @param p1
* the other point
* @return the square of the distance
*/
public final float distanceSquared(Point3f p1) {
@@ -118,7 +127,8 @@ public class Point3f extends Tuple3f implements java.io.Serializable {
/**
* Computes the distance between this point and point p1.
*
* @param p1 the other point
* @param p1
* the other point
* @return the distance
*/
public final float distance(Point3f p1) {
@@ -136,7 +146,8 @@ public class Point3f extends Tuple3f implements java.io.Serializable {
* point p1. The L-1 distance is equal to:
* abs(x1-x2) + abs(y1-y2) + abs(z1-z2).
*
* @param p1 the other point
* @param p1
* the other point
* @return the L-1 distance
*/
public final float distanceL1(Point3f p1) {
@@ -149,7 +160,8 @@ public class Point3f extends Tuple3f implements java.io.Serializable {
* point p1. The L-infinite distance is equal to
* MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2)].
*
* @param p1 the other point
* @param p1
* the other point
* @return the L-infinite distance
*/
public final float distanceLinf(Point3f p1) {
@@ -164,7 +176,8 @@ public class Point3f extends Tuple3f implements java.io.Serializable {
* Multiplies each of the x,y,z components of the Point4f parameter
* by 1/w and places the projected values into this point.
*
* @param p1 the source Point4f, which is not modified
* @param p1
* the source Point4f, which is not modified
*/
public final void project(Point4f p1) {
float oneOw;

View File

@@ -31,10 +31,14 @@ public class Point4d extends Tuple4d implements java.io.Serializable {
/**
* Constructs and initializes a Point4d from the specified xyzw coordinates.
*
* @param x the x coordinate
* @param y the y coordinate
* @param z the z coordinate
* @param w the w coordinate
* @param x
* the x coordinate
* @param y
* the y coordinate
* @param z
* the z coordinate
* @param w
* the w coordinate
*/
public Point4d(double x, double y, double z, double w) {
super(x, y, z, w);
@@ -44,7 +48,8 @@ public class Point4d extends Tuple4d implements java.io.Serializable {
* Constructs and initializes a Point4d from the coordinates contained
* in the array.
*
* @param p the array of length 4 containing xyzw in order
* @param p
* the array of length 4 containing xyzw in order
*/
public Point4d(double[] p) {
super(p);
@@ -54,7 +59,8 @@ public class Point4d extends Tuple4d implements java.io.Serializable {
/**
* Constructs and initializes a Point4d from the specified Point4d.
*
* @param p1 the Point4d containing the initialization x y z w data
* @param p1
* the Point4d containing the initialization x y z w data
*/
public Point4d(Point4d p1) {
super(p1);
@@ -64,7 +70,8 @@ public class Point4d extends Tuple4d implements java.io.Serializable {
/**
* Constructs and initializes a Point4d from the specified Point4f.
*
* @param p1 the Point4f containing the initialization x y z w data
* @param p1
* the Point4f containing the initialization x y z w data
*/
public Point4d(Point4f p1) {
super(p1);
@@ -74,7 +81,8 @@ public class Point4d extends Tuple4d implements java.io.Serializable {
/**
* Constructs and initializes a Point4d from the specified Tuple4f.
*
* @param t1 the Tuple4f containing the initialization x y z w data
* @param t1
* the Tuple4f containing the initialization x y z w data
*/
public Point4d(Tuple4f t1) {
super(t1);
@@ -84,7 +92,8 @@ public class Point4d extends Tuple4d implements java.io.Serializable {
/**
* Constructs and initializes a Point4d from the specified Tuple4d.
*
* @param t1 the Tuple4d containing the initialization x y z w data
* @param t1
* the Tuple4d containing the initialization x y z w data
*/
public Point4d(Tuple4d t1) {
super(t1);
@@ -97,7 +106,8 @@ public class Point4d extends Tuple4d implements java.io.Serializable {
* components of tuple t1. The w component of this point
* is set to 1.
*
* @param t1 the tuple to be copied
* @param t1
* the tuple to be copied
* @since vecmath 1.2
*/
public Point4d(Tuple3d t1) {
@@ -118,7 +128,8 @@ public class Point4d extends Tuple4d implements java.io.Serializable {
* components of tuple t1. The w component of this point
* is set to 1.
*
* @param t1 the tuple to be copied
* @param t1
* the tuple to be copied
* @since vecmath 1.2
*/
public final void set(Tuple3d t1) {
@@ -132,7 +143,8 @@ public class Point4d extends Tuple4d implements java.io.Serializable {
/**
* Returns the square of the distance between this point and point p1.
*
* @param p1 the first point
* @param p1
* the first point
* @return the square of distance between this point and point p1
*/
public final double distanceSquared(Point4d p1) {
@@ -149,7 +161,8 @@ public class Point4d extends Tuple4d implements java.io.Serializable {
/**
* Returns the distance between this point and point p1.
*
* @param p1 the first point
* @param p1
* the first point
* @return the distance between these this point and point p1.
*/
public final double distance(Point4d p1) {
@@ -168,7 +181,8 @@ public class Point4d extends Tuple4d implements java.io.Serializable {
* point p1. The L-1 distance is equal to:
* abs(x1-x2) + abs(y1-y2) + abs(z1-z2) + abs(w1-w2).
*
* @param p1 the other point
* @param p1
* the other point
* @return the L-1 distance
*/
public final double distanceL1(Point4d p1) {
@@ -181,7 +195,8 @@ public class Point4d extends Tuple4d implements java.io.Serializable {
* point p1. The L-infinite distance is equal to
* MAX[abs(x1-x2), abs(y1-y2), abs(z1-z2), abs(w1-w2)].
*
* @param p1 the other point
* @param p1
* the other point
* @return the L-infinite distance
*/
public final double distanceLinf(Point4d p1) {
@@ -197,7 +212,8 @@ public class Point4d extends Tuple4d implements java.io.Serializable {
* by 1/w, places the projected values into this point, and places
* a 1 as the w parameter of this point.
*
* @param p1 the source Point4d, which is not modified
* @param p1
* the source Point4d, which is not modified
*/
public final void project(Point4d p1) {
double oneOw;

Some files were not shown because too many files have changed in this diff Show More