refactor from org.oggio88 to net.woggioni

This commit is contained in:
Walter Oggioni
2019-07-16 15:51:12 +02:00
committed by Walter Oggioni
parent 2adb6143a5
commit 4a9afacb90
37 changed files with 122 additions and 137 deletions

View File

@@ -1,6 +1,6 @@
name := "worth"
organization := "org.oggio88"
organization := "net.woggioni"
version := "1.0"
resolvers += Resolver.mavenLocal
@@ -16,7 +16,7 @@ scalacOptions ++= Seq(
git.useGitDescribe := true
fork := true
//javaOptions in Test += "-Dorg.oggio88.worth.value.ObjectValue.listBasedImplementation=true"
//javaOptions in Test += "-Dnet.woggioni.worth.value.ObjectValue.listBasedImplementation=true"
//javaOptions in Test += "-Xmx14G"
//scalafmtOnCompile := true
libraryDependencies += "org.projectlombok" % "lombok" % "1.18.2"
@@ -33,4 +33,4 @@ artifactName := { (sv: ScalaVersion, module: ModuleID, artifact: Artifact) =>
enablePlugins(Antlr4Plugin)
antlr4Version in Antlr4 := "4.7.1"
antlr4PackageName in Antlr4 := Some("org.oggio88.worth.antlr")
antlr4PackageName in Antlr4 := Some("net.woggioni.worth.antlr")

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.buffer;
package net.woggioni.worth.buffer;
import lombok.SneakyThrows;

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.buffer;
package net.woggioni.worth.buffer;
import lombok.SneakyThrows;

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.buffer;
package net.woggioni.worth.buffer;
import lombok.SneakyThrows;

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.exception;
package net.woggioni.worth.exception;
public class IOException extends WorthException {
public IOException(String msg) {

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.exception;
package net.woggioni.worth.exception;
public class NotImplementedException extends WorthException {
public NotImplementedException(String msg) {

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.exception;
package net.woggioni.worth.exception;
public class ParseException extends WorthException {
public ParseException(String msg) {

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.exception;
package net.woggioni.worth.exception;
public class TypeException extends WorthException {
public TypeException(String msg) {

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.exception;
package net.woggioni.worth.exception;
public class WorthException extends RuntimeException {
public WorthException(String msg) {

View File

@@ -1,11 +1,11 @@
package org.oggio88.worth.serialization;
package net.woggioni.worth.serialization;
import lombok.RequiredArgsConstructor;
import org.oggio88.worth.exception.NotImplementedException;
import org.oggio88.worth.value.ArrayValue;
import org.oggio88.worth.value.ObjectValue;
import org.oggio88.worth.xface.Dumper;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.exception.NotImplementedException;
import net.woggioni.worth.value.ArrayValue;
import net.woggioni.worth.value.ObjectValue;
import net.woggioni.worth.xface.Dumper;
import net.woggioni.worth.xface.Value;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

View File

@@ -1,11 +1,11 @@
package org.oggio88.worth.serialization;
package net.woggioni.worth.serialization;
import lombok.RequiredArgsConstructor;
import org.oggio88.worth.exception.NotImplementedException;
import org.oggio88.worth.utils.WorthUtils;
import org.oggio88.worth.value.*;
import org.oggio88.worth.xface.Parser;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.exception.NotImplementedException;
import net.woggioni.worth.utils.WorthUtils;
import net.woggioni.worth.value.*;
import net.woggioni.worth.xface.Value;
import net.woggioni.worth.xface.Parser;
import java.io.InputStream;
import java.io.InputStreamReader;

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.serialization.binary;
package net.woggioni.worth.serialization.binary;
public enum BinaryMarker {
Float(0x0),

View File

@@ -1,21 +1,20 @@
package org.oggio88.worth.serialization.binary;
package net.woggioni.worth.serialization.binary;
import lombok.SneakyThrows;
import org.oggio88.worth.exception.NotImplementedException;
import org.oggio88.worth.serialization.ValueDumper;
import org.oggio88.worth.utils.Leb128;
import org.oggio88.worth.value.ArrayValue;
import org.oggio88.worth.value.ObjectValue;
import org.oggio88.worth.xface.Dumper;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.exception.NotImplementedException;
import net.woggioni.worth.utils.Leb128;
import net.woggioni.worth.utils.WorthUtils;
import net.woggioni.worth.value.ArrayValue;
import net.woggioni.worth.value.ObjectValue;
import net.woggioni.worth.xface.Value;
import net.woggioni.worth.serialization.ValueDumper;
import net.woggioni.worth.xface.Dumper;
import java.io.OutputStream;
import java.io.Writer;
import java.util.Map;
import java.util.function.Consumer;
import static org.oggio88.worth.utils.WorthUtils.dynamicCast;
public class JBONDumper extends ValueDumper {
public static Dumper newInstance() {
@@ -51,12 +50,12 @@ public class JBONDumper extends ValueDumper {
stringValue(v.asString());
break;
case ARRAY:
ArrayValue arrayValue = dynamicCast(v, ArrayValue.class);
ArrayValue arrayValue = WorthUtils.dynamicCast(v, ArrayValue.class);
stack.push(new ArrayStackLevel(arrayValue));
beginArray(arrayValue.size());
break;
case OBJECT:
ObjectValue objectValue = dynamicCast(v, ObjectValue.class);
ObjectValue objectValue = WorthUtils.dynamicCast(v, ObjectValue.class);
stack.push(new ObjectStackLevel(objectValue));
beginObject(objectValue.size());
break;
@@ -68,14 +67,14 @@ public class JBONDumper extends ValueDumper {
StackLevel last = stack.getFirst();
ArrayStackLevel arrayStackLevel;
ObjectStackLevel objectStackLevel;
if ((arrayStackLevel = dynamicCast(last, ArrayStackLevel.class)) != null) {
if ((arrayStackLevel = WorthUtils.dynamicCast(last, ArrayStackLevel.class)) != null) {
if (arrayStackLevel.hasNext()) {
handle_value.accept(arrayStackLevel.next());
} else {
endArray();
stack.pop();
}
} else if ((objectStackLevel = dynamicCast(last, ObjectStackLevel.class)) != null) {
} else if ((objectStackLevel = WorthUtils.dynamicCast(last, ObjectStackLevel.class)) != null) {
if (objectStackLevel.hasNext()) {
Map.Entry<String, Value> entry = objectStackLevel.next();
objectKey(entry.getKey());

View File

@@ -1,13 +1,13 @@
package org.oggio88.worth.serialization.binary;
package net.woggioni.worth.serialization.binary;
import lombok.SneakyThrows;
import org.oggio88.worth.buffer.LookAheadInputStream;
import org.oggio88.worth.exception.ParseException;
import org.oggio88.worth.serialization.ValueParser;
import org.oggio88.worth.utils.Leb128;
import org.oggio88.worth.utils.WorthUtils;
import org.oggio88.worth.xface.Parser;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.utils.Leb128;
import net.woggioni.worth.utils.WorthUtils;
import net.woggioni.worth.xface.Value;
import net.woggioni.worth.buffer.LookAheadInputStream;
import net.woggioni.worth.exception.ParseException;
import net.woggioni.worth.serialization.ValueParser;
import net.woggioni.worth.xface.Parser;
import java.io.InputStream;
import java.util.function.Function;

View File

@@ -1,11 +1,12 @@
package org.oggio88.worth.serialization.json;
package net.woggioni.worth.serialization.json;
import lombok.SneakyThrows;
import org.oggio88.worth.serialization.ValueDumper;
import org.oggio88.worth.value.ArrayValue;
import org.oggio88.worth.value.ObjectValue;
import org.oggio88.worth.xface.Dumper;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.utils.WorthUtils;
import net.woggioni.worth.value.ArrayValue;
import net.woggioni.worth.value.ObjectValue;
import net.woggioni.worth.xface.Value;
import net.woggioni.worth.serialization.ValueDumper;
import net.woggioni.worth.xface.Dumper;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
@@ -13,8 +14,6 @@ import java.io.Writer;
import java.util.Map;
import java.util.function.Consumer;
import static org.oggio88.worth.utils.WorthUtils.dynamicCast;
public class JSONDumper extends ValueDumper {
public static Dumper newInstance() {
@@ -81,13 +80,13 @@ public class JSONDumper extends ValueDumper {
stringValue(v.asString());
break;
case ARRAY:
ArrayValue arrayValue = dynamicCast(v, ArrayValue.class);
ArrayValue arrayValue = WorthUtils.dynamicCast(v, ArrayValue.class);
stack.push(new ArrayStackLevel(arrayValue));
beginArray(arrayValue.size());
break;
case OBJECT:
ObjectValue objectValue = dynamicCast(v, ObjectValue.class);
stack.push(new ObjectStackLevel(dynamicCast(v, ObjectValue.class)));
ObjectValue objectValue = WorthUtils.dynamicCast(v, ObjectValue.class);
stack.push(new ObjectStackLevel(WorthUtils.dynamicCast(v, ObjectValue.class)));
beginObject(objectValue.size());
break;
}
@@ -98,7 +97,7 @@ public class JSONDumper extends ValueDumper {
StackLevel last = stack.getFirst();
ArrayStackLevel arrayStackLevel;
ObjectStackLevel objectStackLevel;
if ((arrayStackLevel = dynamicCast(last, ArrayStackLevel.class)) != null) {
if ((arrayStackLevel = WorthUtils.dynamicCast(last, ArrayStackLevel.class)) != null) {
if (arrayStackLevel.hasNext()) {
if (arrayStackLevel.index > 0) {
writer.write(",");
@@ -108,7 +107,7 @@ public class JSONDumper extends ValueDumper {
endArray();
stack.pop();
}
} else if ((objectStackLevel = dynamicCast(last, ObjectStackLevel.class)) != null) {
} else if ((objectStackLevel = WorthUtils.dynamicCast(last, ObjectStackLevel.class)) != null) {
if (objectStackLevel.hasNext()) {
if (objectStackLevel.index > 0) {
writer.write(",");

View File

@@ -1,14 +1,14 @@
package org.oggio88.worth.serialization.json;
package net.woggioni.worth.serialization.json;
import lombok.SneakyThrows;
import org.oggio88.worth.buffer.LookAheadTextInputStream;
import org.oggio88.worth.exception.IOException;
import org.oggio88.worth.exception.NotImplementedException;
import org.oggio88.worth.exception.ParseException;
import org.oggio88.worth.serialization.ValueParser;
import org.oggio88.worth.utils.WorthUtils;
import org.oggio88.worth.xface.Parser;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.xface.Value;
import net.woggioni.worth.buffer.LookAheadTextInputStream;
import net.woggioni.worth.exception.IOException;
import net.woggioni.worth.exception.NotImplementedException;
import net.woggioni.worth.exception.ParseException;
import net.woggioni.worth.serialization.ValueParser;
import net.woggioni.worth.utils.WorthUtils;
import net.woggioni.worth.xface.Parser;
import java.io.InputStream;
import java.io.InputStreamReader;

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.utils;
package net.woggioni.worth.utils;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

View File

@@ -1,6 +1,6 @@
package org.oggio88.worth.utils;
package net.woggioni.worth.utils;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.xface.Value;
import java.util.Optional;
import java.util.function.Function;

View File

@@ -1,12 +1,11 @@
package org.oggio88.worth.utils;
package net.woggioni.worth.utils;
import lombok.SneakyThrows;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.xface.Value;
import java.io.*;
import java.lang.reflect.Constructor;
import java.util.Optional;
import java.util.concurrent.Callable;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;

View File

@@ -1,12 +1,11 @@
package org.oggio88.worth.value;
package net.woggioni.worth.value;
import lombok.EqualsAndHashCode;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.xface.Value;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
@EqualsAndHashCode
public class ArrayValue implements Value, Iterable<Value> {

View File

@@ -1,7 +1,7 @@
package org.oggio88.worth.value;
package net.woggioni.worth.value;
import lombok.EqualsAndHashCode;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.xface.Value;
@EqualsAndHashCode
public class BooleanValue implements Value {

View File

@@ -1,7 +1,7 @@
package org.oggio88.worth.value;
package net.woggioni.worth.value;
import lombok.EqualsAndHashCode;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.xface.Value;
@EqualsAndHashCode
public class FloatValue implements Value {

View File

@@ -1,7 +1,7 @@
package org.oggio88.worth.value;
package net.woggioni.worth.value;
import lombok.EqualsAndHashCode;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.xface.Value;
@EqualsAndHashCode
public class IntegerValue implements Value {

View File

@@ -1,7 +1,7 @@
package org.oggio88.worth.value;
package net.woggioni.worth.value;
import lombok.EqualsAndHashCode;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.xface.Value;
@EqualsAndHashCode
public class NullValue implements Value {

View File

@@ -1,8 +1,8 @@
package org.oggio88.worth.value;
package net.woggioni.worth.value;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.xface.Value;
import java.util.*;

View File

@@ -1,7 +1,7 @@
package org.oggio88.worth.value;
package net.woggioni.worth.value;
import lombok.EqualsAndHashCode;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.xface.Value;
@EqualsAndHashCode
public class StringValue implements Value {

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.xface;
package net.woggioni.worth.xface;
import java.io.OutputStream;
import java.io.Writer;

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.xface;
package net.woggioni.worth.xface;
import java.io.InputStream;
import java.io.Reader;

View File

@@ -1,11 +1,10 @@
package org.oggio88.worth.xface;
package net.woggioni.worth.xface;
import org.oggio88.worth.exception.TypeException;
import org.oggio88.worth.value.NullValue;
import net.woggioni.worth.exception.TypeException;
import net.woggioni.worth.value.NullValue;
import java.util.List;
import java.util.Map;
import java.util.Optional;
public interface Value {

View File

@@ -1,10 +1,10 @@
package org.oggio88.worth.antlr;
package net.woggioni.worth.antlr;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
import org.oggio88.worth.serialization.ValueParser;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.serialization.ValueParser;
import net.woggioni.worth.xface.Value;
public class JSONListenerImpl extends ValueParser implements JSONListener {

View File

@@ -1,13 +1,13 @@
package org.oggio88.worth.antlr;
package net.woggioni.worth.antlr;
import lombok.SneakyThrows;
import net.woggioni.worth.xface.Value;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CodePointCharStream;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTreeWalker;
import org.junit.Test;
import org.oggio88.worth.serialization.json.JSONDumper;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.serialization.json.JSONDumper;
import java.io.InputStreamReader;
@@ -26,6 +26,5 @@ public class ParseTest {
walker.walk(listener, parser.json());
Value result = listener.result;
new JSONDumper().dump(result, System.out);
// TestRig.main(new String[] {"org.oggio88.worth.antlr.JSON", "json", "-ps", "tree.ps", "src/test/resources/test.json"});
}
}

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.buffer;
package net.woggioni.worth.buffer;
import lombok.SneakyThrows;
import org.junit.Assert;

View File

@@ -1,16 +1,13 @@
package org.oggio88.worth.serialization.binary;
package net.woggioni.worth.serialization.binary;
import lombok.SneakyThrows;
import org.junit.Assert;
import org.junit.Test;
import org.oggio88.worth.buffer.LookAheadTextInputStream;
import org.oggio88.worth.serialization.binary.JBONDumper;
import org.oggio88.worth.serialization.binary.JBONParser;
import org.oggio88.worth.serialization.json.JSONParser;
import org.oggio88.worth.value.NullValue;
import org.oggio88.worth.value.ObjectValue;
import org.oggio88.worth.xface.Parser;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.buffer.LookAheadTextInputStream;
import net.woggioni.worth.serialization.json.JSONParser;
import net.woggioni.worth.value.ObjectValue;
import net.woggioni.worth.xface.Parser;
import net.woggioni.worth.xface.Value;
import java.io.*;
import java.lang.reflect.Method;

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.serialization.json;
package net.woggioni.worth.serialization.json;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -6,13 +6,13 @@ import com.fasterxml.jackson.databind.node.JsonNodeType;
import lombok.SneakyThrows;
import org.junit.Assert;
import org.junit.Test;
import org.oggio88.worth.buffer.LookAheadTextInputStream;
import org.oggio88.worth.exception.NotImplementedException;
import org.oggio88.worth.utils.WorthUtils;
import org.oggio88.worth.value.ArrayValue;
import org.oggio88.worth.value.ObjectValue;
import org.oggio88.worth.xface.Parser;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.buffer.LookAheadTextInputStream;
import net.woggioni.worth.exception.NotImplementedException;
import net.woggioni.worth.utils.WorthUtils;
import net.woggioni.worth.value.ArrayValue;
import net.woggioni.worth.value.ObjectValue;
import net.woggioni.worth.xface.Parser;
import net.woggioni.worth.xface.Value;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

View File

@@ -1,25 +1,20 @@
package org.oggio88.worth.serialization.json;
package net.woggioni.worth.serialization.json;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.SneakyThrows;
import org.antlr.v4.runtime.ANTLRInputStream;
import net.woggioni.worth.antlr.JSONListenerImpl;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTreeWalker;
import org.junit.Ignore;
import org.junit.Test;
import org.oggio88.worth.antlr.JSONLexer;
import org.oggio88.worth.antlr.JSONListenerImpl;
import org.oggio88.worth.serialization.binary.JBONDumper;
import org.oggio88.worth.value.ObjectValue;
import org.oggio88.worth.xface.Dumper;
import org.oggio88.worth.xface.Value;
import net.woggioni.worth.antlr.JSONLexer;
import net.woggioni.worth.xface.Value;
import org.tukaani.xz.XZInputStream;
import java.io.*;
import java.nio.file.Paths;
class Chronometer {
@@ -99,7 +94,7 @@ public class PerformanceTest {
new InputStreamReader(getClass().getResourceAsStream("/wordpress.json")));
JSONLexer lexer = new JSONLexer(inputStream);
CommonTokenStream commonTokenStream = new CommonTokenStream(lexer);
org.oggio88.worth.antlr.JSONParser parser = new org.oggio88.worth.antlr.JSONParser(commonTokenStream);
net.woggioni.worth.antlr.JSONParser parser = new net.woggioni.worth.antlr.JSONParser(commonTokenStream);
JSONListenerImpl listener = new JSONListenerImpl();
ParseTreeWalker walker = new ParseTreeWalker();
walker.walk(listener, parser.json());
@@ -133,7 +128,7 @@ public class PerformanceTest {
CharStream inputStream = CharStreams.fromReader(new InputStreamReader(is));
JSONLexer lexer = new JSONLexer(inputStream);
CommonTokenStream commonTokenStream = new CommonTokenStream(lexer);
org.oggio88.worth.antlr.JSONParser parser = new org.oggio88.worth.antlr.JSONParser(commonTokenStream);
net.woggioni.worth.antlr.JSONParser parser = new net.woggioni.worth.antlr.JSONParser(commonTokenStream);
JSONListenerImpl listener = new JSONListenerImpl();
ParseTreeWalker walker = new ParseTreeWalker();
walker.walk(listener, parser.json());

View File

@@ -1,4 +1,4 @@
package org.oggio88.worth.utils;
package net.woggioni.worth.utils;
import lombok.SneakyThrows;
import org.junit.Assert;
@@ -6,7 +6,6 @@ import org.junit.Test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.List;

View File

@@ -1,11 +1,11 @@
package org.oggio88.worth.utils;
package net.woggioni.worth.utils;
import lombok.SneakyThrows;
import net.woggioni.worth.serialization.json.JSONParser;
import net.woggioni.worth.xface.Parser;
import net.woggioni.worth.xface.Value;
import org.junit.Assert;
import org.junit.Test;
import org.oggio88.worth.serialization.json.JSONParser;
import org.oggio88.worth.xface.Parser;
import org.oggio88.worth.xface.Value;
import java.io.BufferedInputStream;
import java.io.InputStream;