【不兼容】DLong更名为Uint128

This commit is contained in:
Redkale
2023-01-04 13:56:31 +08:00
parent 5975be44d9
commit 809b574f12
12 changed files with 65 additions and 65 deletions

View File

@@ -116,7 +116,7 @@ public abstract class ConvertFactory<R extends Reader, W extends Writer> {
this.register(BigDecimal.class, BigDecimalSimpledCoder.instance); this.register(BigDecimal.class, BigDecimalSimpledCoder.instance);
this.register(InetAddress.class, InetAddressSimpledCoder.instance); this.register(InetAddress.class, InetAddressSimpledCoder.instance);
this.register(LongAdder.class, LongAdderSimpledCoder.instance); this.register(LongAdder.class, LongAdderSimpledCoder.instance);
this.register(DLong.class, DLongSimpledCoder.instance); this.register(Uint128.class, Uint128SimpledCoder.instance);
this.register(Class.class, TypeSimpledCoder.instance); this.register(Class.class, TypeSimpledCoder.instance);
this.register(InetSocketAddress.class, InetAddressSimpledCoder.InetSocketAddressSimpledCoder.instance); this.register(InetSocketAddress.class, InetAddressSimpledCoder.InetSocketAddressSimpledCoder.instance);
this.register(Pattern.class, PatternSimpledCoder.instance); this.register(Pattern.class, PatternSimpledCoder.instance);

View File

@@ -19,15 +19,15 @@ import org.redkale.util.*;
* @param <R> Reader输入的子类型 * @param <R> Reader输入的子类型
* @param <W> Writer输出的子类型 * @param <W> Writer输出的子类型
*/ */
public final class DLongSimpledCoder<R extends Reader, W extends Writer> extends SimpledCoder<R, W, DLong> { public final class Uint128SimpledCoder<R extends Reader, W extends Writer> extends SimpledCoder<R, W, Uint128> {
private static final ByteArraySimpledCoder bsSimpledCoder = ByteArraySimpledCoder.instance; private static final ByteArraySimpledCoder bsSimpledCoder = ByteArraySimpledCoder.instance;
public static final DLongSimpledCoder instance = new DLongSimpledCoder(); public static final Uint128SimpledCoder instance = new Uint128SimpledCoder();
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void convertTo(final W out, final DLong value) { public void convertTo(final W out, final Uint128 value) {
if (value == null) { if (value == null) {
out.writeNull(); out.writeNull();
} else { } else {
@@ -37,26 +37,26 @@ public final class DLongSimpledCoder<R extends Reader, W extends Writer> extends
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public DLong convertFrom(R in) { public Uint128 convertFrom(R in) {
byte[] bs = bsSimpledCoder.convertFrom(in); byte[] bs = bsSimpledCoder.convertFrom(in);
if (bs == null) { if (bs == null) {
return null; return null;
} }
return DLong.create(bs); return Uint128.create(bs);
} }
/** /**
* DLong 的JsonSimpledCoder实现 * Uint128 的JsonSimpledCoder实现
* *
* @param <R> Reader输入的子类型 * @param <R> Reader输入的子类型
* @param <W> Writer输出的子类型 * @param <W> Writer输出的子类型
*/ */
public static class DLongJsonSimpledCoder<R extends JsonReader, W extends JsonWriter> extends SimpledCoder<R, W, DLong> { public static class Uint128JsonSimpledCoder<R extends JsonReader, W extends JsonWriter> extends SimpledCoder<R, W, Uint128> {
public static final DLongJsonSimpledCoder instance = new DLongJsonSimpledCoder(); public static final Uint128JsonSimpledCoder instance = new Uint128JsonSimpledCoder();
@Override @Override
public void convertTo(final W out, final DLong value) { public void convertTo(final W out, final Uint128 value) {
if (value == null) { if (value == null) {
out.writeNull(); out.writeNull();
} else { } else {
@@ -65,12 +65,12 @@ public final class DLongSimpledCoder<R extends Reader, W extends Writer> extends
} }
@Override @Override
public DLong convertFrom(R in) { public Uint128 convertFrom(R in) {
final String str = in.readSmallString(); final String str = in.readSmallString();
if (str == null) { if (str == null) {
return null; return null;
} }
return DLong.create(Utility.hexToBin(str)); return Uint128.create(Utility.hexToBin(str));
} }
} }
} }

View File

@@ -11,7 +11,7 @@ import java.math.*;
import java.net.*; import java.net.*;
import org.redkale.convert.*; import org.redkale.convert.*;
import org.redkale.convert.ext.*; import org.redkale.convert.ext.*;
import org.redkale.util.DLong; import org.redkale.util.Uint128;
/** /**
* JSON的ConvertFactory * JSON的ConvertFactory
@@ -38,7 +38,7 @@ public final class JsonFactory extends ConvertFactory<JsonReader, JsonWriter> {
if (parent == null) { if (parent == null) {
this.register(InetAddress.class, InetAddressSimpledCoder.InetAddressJsonSimpledCoder.instance); this.register(InetAddress.class, InetAddressSimpledCoder.InetAddressJsonSimpledCoder.instance);
this.register(InetSocketAddress.class, InetAddressSimpledCoder.InetSocketAddressJsonSimpledCoder.instance); this.register(InetSocketAddress.class, InetAddressSimpledCoder.InetSocketAddressJsonSimpledCoder.instance);
this.register(DLong.class, DLongSimpledCoder.DLongJsonSimpledCoder.instance); this.register(Uint128.class, Uint128SimpledCoder.Uint128JsonSimpledCoder.instance);
this.register(BigInteger.class, BigIntegerSimpledCoder.BigIntegerJsonSimpledCoder.instance); this.register(BigInteger.class, BigIntegerSimpledCoder.BigIntegerJsonSimpledCoder.instance);
this.register(BigDecimal.class, BigDecimalSimpledCoder.BigDecimalJsonSimpledCoder.instance); this.register(BigDecimal.class, BigDecimalSimpledCoder.BigDecimalJsonSimpledCoder.instance);
this.register(java.time.Instant.class, InstantSimpledCoder.InstantJsonSimpledCoder.instance); this.register(java.time.Instant.class, InstantSimpledCoder.InstantJsonSimpledCoder.instance);

View File

@@ -57,9 +57,9 @@ public abstract class Sncp {
private Sncp() { private Sncp() {
} }
public static DLong hash(final java.lang.reflect.Method method) { public static Uint128 hash(final java.lang.reflect.Method method) {
if (method == null) { if (method == null) {
return DLong.ZERO; return Uint128.ZERO;
} }
StringBuilder sb = new StringBuilder(); //不能使用method.toString() 因为包含declaringClass信息导致接口与实现类的方法hash不一致 StringBuilder sb = new StringBuilder(); //不能使用method.toString() 因为包含declaringClass信息导致接口与实现类的方法hash不一致
sb.append(method.getReturnType().getName()).append(' '); sb.append(method.getReturnType().getName()).append(' ');
@@ -84,15 +84,15 @@ public abstract class Sncp {
* *
* @return hash值 * @return hash值
*/ */
public static DLong hash(final String name) { public static Uint128 hash(final String name) {
if (name == null || name.isEmpty()) { if (name == null || name.isEmpty()) {
return DLong.ZERO; return Uint128.ZERO;
} }
byte[] bytes = name.trim().getBytes(); byte[] bytes = name.trim().getBytes();
synchronized (md5) { synchronized (md5) {
bytes = md5.digest(bytes); bytes = md5.digest(bytes);
} }
return DLong.create(bytes); return Uint128.create(bytes);
} }
public static boolean isRemote(Service service) { public static boolean isRemote(Service service) {

View File

@@ -49,7 +49,7 @@ public final class SncpClient {
private final int addrPort; private final int addrPort;
protected final DLong serviceid; protected final Uint128 serviceid;
protected final int serviceVersion; protected final int serviceVersion;
@@ -116,7 +116,7 @@ public final class SncpClient {
return clientSncpAddress; return clientSncpAddress;
} }
public DLong getServiceid() { public Uint128 getServiceid() {
return serviceid; return serviceid;
} }
@@ -174,7 +174,7 @@ public final class SncpClient {
public static List<Method> parseMethod(final Class serviceClass) { public static List<Method> parseMethod(final Class serviceClass) {
final List<Method> list = new ArrayList<>(); final List<Method> list = new ArrayList<>();
final List<Method> multis = new ArrayList<>(); final List<Method> multis = new ArrayList<>();
final Map<DLong, Method> actionids = new HashMap<>(); final Map<Uint128, Method> actionids = new HashMap<>();
for (final java.lang.reflect.Method method : serviceClass.getMethods()) { for (final java.lang.reflect.Method method : serviceClass.getMethods()) {
if (method.isSynthetic()) { if (method.isSynthetic()) {
continue; continue;
@@ -204,7 +204,7 @@ public final class SncpClient {
} }
//if (onlySncpDyn && method.getAnnotation(SncpDyn.class) == null) continue; //if (onlySncpDyn && method.getAnnotation(SncpDyn.class) == null) continue;
DLong actionid = Sncp.hash(method); Uint128 actionid = Sncp.hash(method);
Method old = actionids.get(actionid); Method old = actionids.get(actionid);
if (old != null) { if (old != null) {
if (old.getDeclaringClass().equals(method.getDeclaringClass())) { if (old.getDeclaringClass().equals(method.getDeclaringClass())) {
@@ -314,7 +314,7 @@ public final class SncpClient {
} }
final int reqBodyLength = writer.count() - HEADER_SIZE; //body总长度 final int reqBodyLength = writer.count() - HEADER_SIZE; //body总长度
final long seqid = System.nanoTime(); final long seqid = System.nanoTime();
final DLong actionid = action.actionid; final Uint128 actionid = action.actionid;
if (messageAgent != null) { //MQ模式 if (messageAgent != null) { //MQ模式
final ByteArray reqbytes = writer.toByteArray(); final ByteArray reqbytes = writer.toByteArray();
fillHeader(reqbytes, seqid, actionid, traceid, reqBodyLength); fillHeader(reqbytes, seqid, actionid, traceid, reqBodyLength);
@@ -499,7 +499,7 @@ public final class SncpClient {
if (buffer.getChar() != HEADER_SIZE) { if (buffer.getChar() != HEADER_SIZE) {
throw new RuntimeException("sncp(" + action.method + ") buffer receive header.length not " + HEADER_SIZE); throw new RuntimeException("sncp(" + action.method + ") buffer receive header.length not " + HEADER_SIZE);
} }
DLong rserviceid = DLong.read(buffer); Uint128 rserviceid = Uint128.read(buffer);
if (!rserviceid.equals(this.serviceid)) { if (!rserviceid.equals(this.serviceid)) {
throw new RuntimeException("sncp(" + action.method + ") response.serviceid = " + serviceid + ", but request.serviceid =" + rserviceid); throw new RuntimeException("sncp(" + action.method + ") response.serviceid = " + serviceid + ", but request.serviceid =" + rserviceid);
} }
@@ -507,8 +507,8 @@ public final class SncpClient {
if (version != this.serviceVersion) { if (version != this.serviceVersion) {
throw new RuntimeException("sncp(" + action.method + ") response.serviceVersion = " + serviceVersion + ", but request.serviceVersion =" + version); throw new RuntimeException("sncp(" + action.method + ") response.serviceVersion = " + serviceVersion + ", but request.serviceVersion =" + version);
} }
DLong raction = DLong.read(buffer); Uint128 raction = Uint128.read(buffer);
DLong actid = action.actionid; Uint128 actid = action.actionid;
if (!actid.equals(raction)) { if (!actid.equals(raction)) {
throw new RuntimeException("sncp(" + action.method + ") response.actionid = " + action.actionid + ", but request.actionid =(" + raction + ")"); throw new RuntimeException("sncp(" + action.method + ") response.actionid = " + action.actionid + ", but request.actionid =(" + raction + ")");
} }
@@ -516,14 +516,14 @@ public final class SncpClient {
buffer.getChar(); //端口 buffer.getChar(); //端口
} }
private void fillHeader(ByteArray buffer, long seqid, DLong actionid, String traceid, int bodyLength) { private void fillHeader(ByteArray buffer, long seqid, Uint128 actionid, String traceid, int bodyLength) {
fillRespHeader(buffer, seqid, this.serviceid, this.serviceVersion, fillRespHeader(buffer, seqid, this.serviceid, this.serviceVersion,
actionid, traceid, this.addrBytes, this.addrPort, bodyLength, 0); //结果码, 请求方固定传0 actionid, traceid, this.addrBytes, this.addrPort, bodyLength, 0); //结果码, 请求方固定传0
} }
protected static final class SncpAction { protected static final class SncpAction {
protected final DLong actionid; protected final Uint128 actionid;
protected final Method method; protected final Method method;
@@ -550,7 +550,7 @@ public final class SncpClient {
protected final Creator<? extends CompletableFuture> futureCreator; protected final Creator<? extends CompletableFuture> futureCreator;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public SncpAction(final Class clazz, Method method, DLong actionid) { public SncpAction(final Class clazz, Method method, Uint128 actionid) {
this.actionid = actionid == null ? Sncp.hash(method) : actionid; this.actionid = actionid == null ? Sncp.hash(method) : actionid;
Type rt = TypeToken.getGenericType(method.getGenericReturnType(), clazz); Type rt = TypeToken.getGenericType(method.getGenericReturnType(), clazz);
this.resultTypes = rt == void.class ? null : rt; this.resultTypes = rt == void.class ? null : rt;

View File

@@ -17,12 +17,12 @@ import org.redkale.util.*;
* *
* @author zhangjx * @author zhangjx
*/ */
public class SncpDispatcherServlet extends DispatcherServlet<DLong, SncpContext, SncpRequest, SncpResponse, SncpServlet> { public class SncpDispatcherServlet extends DispatcherServlet<Uint128, SncpContext, SncpRequest, SncpResponse, SncpServlet> {
private final Object sncplock = new Object(); private final Object sncplock = new Object();
@Override @Override
public void addServlet(SncpServlet servlet, Object attachment, AnyValue conf, DLong... mappings) { public void addServlet(SncpServlet servlet, Object attachment, AnyValue conf, Uint128... mappings) {
synchronized (sncplock) { synchronized (sncplock) {
for (SncpServlet s : getServlets()) { for (SncpServlet s : getServlets()) {
if (s.service == servlet.service) { if (s.service == servlet.service) {

View File

@@ -39,9 +39,9 @@ public final class SncpDynServlet extends SncpServlet {
private static final Logger logger = Logger.getLogger(SncpDynServlet.class.getSimpleName()); private static final Logger logger = Logger.getLogger(SncpDynServlet.class.getSimpleName());
private final DLong serviceid; private final Uint128 serviceid;
private final HashMap<DLong, SncpServletAction> actions = new HashMap<>(); private final HashMap<Uint128, SncpServletAction> actions = new HashMap<>();
public SncpDynServlet(final BsonConvert convert, final String serviceName, final Class serviceOrSourceType, final Service service, public SncpDynServlet(final BsonConvert convert, final String serviceName, final Class serviceOrSourceType, final Service service,
final AtomicInteger maxTypeLength, AtomicInteger maxNameLength) { final AtomicInteger maxTypeLength, AtomicInteger maxNameLength) {
@@ -49,7 +49,7 @@ public final class SncpDynServlet extends SncpServlet {
this.maxTypeLength = maxTypeLength; this.maxTypeLength = maxTypeLength;
this.maxNameLength = maxNameLength; this.maxNameLength = maxNameLength;
this.serviceid = Sncp.hash(type.getName() + ':' + serviceName); this.serviceid = Sncp.hash(type.getName() + ':' + serviceName);
Set<DLong> actionids = new HashSet<>(); Set<Uint128> actionids = new HashSet<>();
RedkaleClassLoader.putReflectionPublicMethods(service.getClass().getName()); RedkaleClassLoader.putReflectionPublicMethods(service.getClass().getName());
for (java.lang.reflect.Method method : service.getClass().getMethods()) { for (java.lang.reflect.Method method : service.getClass().getMethods()) {
if (method.isSynthetic()) { if (method.isSynthetic()) {
@@ -79,7 +79,7 @@ public final class SncpDynServlet extends SncpServlet {
} }
} }
final DLong actionid = Sncp.hash(method); final Uint128 actionid = Sncp.hash(method);
SncpServletAction action; SncpServletAction action;
try { try {
action = SncpServletAction.create(service, actionid, method); action = SncpServletAction.create(service, actionid, method);
@@ -114,7 +114,7 @@ public final class SncpDynServlet extends SncpServlet {
} }
@Override @Override
public DLong getServiceid() { public Uint128 getServiceid() {
return serviceid; return serviceid;
} }
@@ -326,7 +326,7 @@ public final class SncpDynServlet extends SncpServlet {
* @return SncpServletAction * @return SncpServletAction
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static SncpServletAction create(final Service service, final DLong actionid, final Method method) { public static SncpServletAction create(final Service service, final Uint128 actionid, final Method method) {
final Class serviceClass = service.getClass(); final Class serviceClass = service.getClass();
final String supDynName = SncpServletAction.class.getName().replace('.', '/'); final String supDynName = SncpServletAction.class.getName().replace('.', '/');
final String serviceName = serviceClass.getName().replace('.', '/'); final String serviceName = serviceClass.getName().replace('.', '/');

View File

@@ -10,7 +10,7 @@ import java.nio.ByteBuffer;
import java.util.logging.*; import java.util.logging.*;
import org.redkale.convert.bson.BsonConvert; import org.redkale.convert.bson.BsonConvert;
import org.redkale.net.Request; import org.redkale.net.Request;
import org.redkale.util.DLong; import org.redkale.util.Uint128;
/** /**
* *
@@ -41,9 +41,9 @@ public class SncpRequest extends Request<SncpContext> {
private int serviceVersion; private int serviceVersion;
private DLong serviceid; private Uint128 serviceid;
private DLong actionid; private Uint128 actionid;
private int bodyLength; private int bodyLength;
@@ -82,9 +82,9 @@ public class SncpRequest extends Request<SncpContext> {
} }
return -1; return -1;
} }
this.serviceid = DLong.read(buffer); //16 this.serviceid = Uint128.read(buffer); //16
this.serviceVersion = buffer.getInt(); //4 this.serviceVersion = buffer.getInt(); //4
this.actionid = DLong.read(buffer); //16 this.actionid = Uint128.read(buffer); //16
buffer.get(addrBytes); //ipaddr //6 buffer.get(addrBytes); //ipaddr //6
this.bodyLength = buffer.getInt(); //4 this.bodyLength = buffer.getInt(); //4
@@ -159,11 +159,11 @@ public class SncpRequest extends Request<SncpContext> {
return serviceVersion; return serviceVersion;
} }
public DLong getServiceid() { public Uint128 getServiceid() {
return serviceid; return serviceid;
} }
public DLong getActionid() { public Uint128 getActionid() {
return actionid; return actionid;
} }

View File

@@ -90,19 +90,19 @@ public class SncpResponse extends Response<SncpContext, SncpRequest> {
request.getActionid(), request.getTraceid(), this.addrBytes, this.addrPort, bodyLength, retcode); request.getActionid(), request.getTraceid(), this.addrBytes, this.addrPort, bodyLength, retcode);
} }
protected static void fillRespHeader(ByteArray buffer, long seqid, DLong serviceid, int serviceVersion, protected static void fillRespHeader(ByteArray buffer, long seqid, Uint128 serviceid, int serviceVersion,
DLong actionid, String traceid, byte[] addrBytes, int addrPort, int bodyLength, int retcode) { Uint128 actionid, String traceid, byte[] addrBytes, int addrPort, int bodyLength, int retcode) {
//---------------------head---------------------------------- //---------------------head----------------------------------
int offset = 0; int offset = 0;
buffer.putLong(offset, seqid); buffer.putLong(offset, seqid);
offset += 8; offset += 8;
buffer.putChar(offset, (char) SncpRequest.HEADER_SIZE); buffer.putChar(offset, (char) SncpRequest.HEADER_SIZE);
offset += 2; offset += 2;
DLong.write(buffer, offset, serviceid); Uint128.write(buffer, offset, serviceid);
offset += 16; offset += 16;
buffer.putInt(offset, serviceVersion); buffer.putInt(offset, serviceVersion);
offset += 4; offset += 4;
DLong.write(buffer, offset, actionid); Uint128.write(buffer, offset, actionid);
offset += 16; offset += 16;
buffer.put(offset, addrBytes); buffer.put(offset, addrBytes);
offset += addrBytes.length; //4 offset += addrBytes.length; //4

View File

@@ -24,7 +24,7 @@ import org.redkale.util.*;
* @author zhangjx * @author zhangjx
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public class SncpServer extends Server<DLong, SncpContext, SncpRequest, SncpResponse, SncpServlet> { public class SncpServer extends Server<Uint128, SncpContext, SncpRequest, SncpResponse, SncpServlet> {
private final AtomicInteger maxTypeLength = new AtomicInteger(); private final AtomicInteger maxTypeLength = new AtomicInteger();

View File

@@ -44,7 +44,7 @@ public abstract class SncpServlet extends Servlet<SncpContext, SncpRequest, Sncp
return type; return type;
} }
public abstract DLong getServiceid(); public abstract Uint128 getServiceid();
protected ExecutorService getExecutor() { protected ExecutorService getExecutor() {
Thread thread = Thread.currentThread(); Thread thread = Thread.currentThread();

View File

@@ -10,26 +10,26 @@ import java.util.Arrays;
/** /**
* 16bytes数据结构 * 16bytes数据结构
* 注意 为了提高性能 DLong中的bytes是直接返回 不得对bytes的内容进行修改 * 注意 为了提高性能 Uint128中的bytes是直接返回 不得对bytes的内容进行修改
* *
* <p> * <p>
* 详情见: https://redkale.org * 详情见: https://redkale.org
* *
* @author zhangjx * @author zhangjx
*/ */
public final class DLong extends Number implements Comparable<DLong> { public final class Uint128 extends Number implements Comparable<Uint128> {
public static final DLong ZERO = new DLong(new byte[16]); public static final Uint128 ZERO = new Uint128(new byte[16]);
protected final byte[] value; protected final byte[] value;
protected DLong(long v1, long v2) { //暂时不用 protected Uint128(long v1, long v2) { //暂时不用
this.value = new byte[]{(byte) (v1 >> 56), (byte) (v1 >> 48), (byte) (v1 >> 40), (byte) (v1 >> 32), this.value = new byte[]{(byte) (v1 >> 56), (byte) (v1 >> 48), (byte) (v1 >> 40), (byte) (v1 >> 32),
(byte) (v1 >> 24), (byte) (v1 >> 16), (byte) (v1 >> 8), (byte) v1, (byte) (v2 >> 56), (byte) (v2 >> 48), (byte) (v2 >> 40), (byte) (v2 >> 32), (byte) (v1 >> 24), (byte) (v1 >> 16), (byte) (v1 >> 8), (byte) v1, (byte) (v2 >> 56), (byte) (v2 >> 48), (byte) (v2 >> 40), (byte) (v2 >> 32),
(byte) (v2 >> 24), (byte) (v2 >> 16), (byte) (v2 >> 8), (byte) v2}; (byte) (v2 >> 24), (byte) (v2 >> 16), (byte) (v2 >> 8), (byte) v2};
} }
protected DLong(byte[] bytes) { protected Uint128(byte[] bytes) {
if (bytes == null || bytes.length != 16) { if (bytes == null || bytes.length != 16) {
throw new NumberFormatException("Not 16 length bytes"); throw new NumberFormatException("Not 16 length bytes");
} }
@@ -44,27 +44,27 @@ public final class DLong extends Number implements Comparable<DLong> {
return value; return value;
} }
public static DLong create(byte[] bytes) { public static Uint128 create(byte[] bytes) {
return new DLong(bytes); return new Uint128(bytes);
} }
public static DLong read(ByteBuffer buffer) { public static Uint128 read(ByteBuffer buffer) {
byte[] bs = new byte[16]; byte[] bs = new byte[16];
buffer.get(bs); buffer.get(bs);
return new DLong(bs); return new Uint128(bs);
} }
public static ByteBuffer write(ByteBuffer buffer, DLong dlong) { public static ByteBuffer write(ByteBuffer buffer, Uint128 dlong) {
buffer.put(dlong.value); buffer.put(dlong.value);
return buffer; return buffer;
} }
public static ByteArray write(ByteArray array, DLong dlong) { public static ByteArray write(ByteArray array, Uint128 dlong) {
array.put(dlong.value); array.put(dlong.value);
return array; return array;
} }
public static ByteArray write(ByteArray array, int offset, DLong dlong) { public static ByteArray write(ByteArray array, int offset, Uint128 dlong) {
array.put(offset, dlong.value); array.put(offset, dlong.value);
return array; return array;
} }
@@ -81,7 +81,7 @@ public final class DLong extends Number implements Comparable<DLong> {
if (getClass() != obj.getClass()) { if (getClass() != obj.getClass()) {
return false; return false;
} }
final DLong other = (DLong) obj; final Uint128 other = (Uint128) obj;
return Arrays.equals(this.value, other.value); return Arrays.equals(this.value, other.value);
} }
@@ -126,7 +126,7 @@ public final class DLong extends Number implements Comparable<DLong> {
} }
@Override @Override
public int compareTo(DLong o) { public int compareTo(Uint128 o) {
if (o == null) { if (o == null) {
return 1; return 1;
} }