remove unnecessaary initializers from constructors

This commit is contained in:
zzz
2010-05-16 18:08:24 +00:00
parent d770d3c6da
commit 3bc2e469cc
44 changed files with 10 additions and 141 deletions

View File

@ -9,8 +9,6 @@ public class Address extends DataStructureImpl {
private Destination _destination;
public Address() {
_hostname = null;
_destination = null;
}
public String getHostname() {

View File

@ -22,11 +22,9 @@ public class ByteArray implements Serializable, Comparable {
private int _offset;
public ByteArray() {
this(null);
}
public ByteArray(byte[] data) {
_offset = 0;
_data = data;
_valid = (data != null ? data.length : 0);
}
@ -92,4 +90,4 @@ public class ByteArray implements Serializable, Comparable {
public final String toBase64() {
return Base64.encode(_data, _offset, _valid);
}
}
}

View File

@ -42,8 +42,6 @@ public class Certificate extends DataStructureImpl {
public final static int CERTIFICATE_TYPE_MULTIPLE = 4;
public Certificate() {
_type = 0;
_payload = null;
}
public Certificate(int type, byte[] payload) {

View File

@ -27,10 +27,6 @@ public class Destination extends DataStructureImpl {
protected Hash __calculatedHash;
public Destination() {
setCertificate(null);
setSigningPublicKey(null);
setPublicKey(null);
__calculatedHash = null;
}
/**
@ -38,7 +34,6 @@ public class Destination extends DataStructureImpl {
* @param s a Base64 representation of the destination, as (eg) is used in hosts.txt
*/
public Destination(String s) throws DataFormatException {
this();
fromBase64(s);
}

View File

@ -29,7 +29,6 @@ public class Hash extends DataStructureImpl {
public final static Hash FAKE_HASH = new Hash(new byte[HASH_LENGTH]);
public Hash() {
setData(null);
}
public Hash(byte data[]) {

View File

@ -30,11 +30,6 @@ public class Lease extends DataStructureImpl {
private int _numFailure;
public Lease() {
setGateway(null);
setTunnelId(null);
setEndDate(null);
setNumSuccess(0);
setNumFailure(0);
}
/** Retrieve the router at which the destination can be contacted

View File

@ -78,18 +78,8 @@ public class LeaseSet extends DataStructureImpl {
public final static int MAX_LEASES = 6;
public LeaseSet() {
setDestination(null);
setEncryptionKey(null);
setSigningKey(null);
setSignature(null);
setRoutingKey(null);
_leases = new ArrayList(MAX_LEASES);
_routingKeyGenMod = null;
_receivedAsPublished = false;
_firstExpiration = Long.MAX_VALUE;
_lastExpiration = 0;
_decrypted = false;
_checked = false;
}
public Destination getDestination() {

View File

@ -27,8 +27,6 @@ public class Payload extends DataStructureImpl {
private byte[] _unencryptedData;
public Payload() {
setUnencryptedData(null);
setEncryptedData(null);
}
/**

View File

@ -28,8 +28,8 @@ public class PrivateKey extends DataStructureImpl {
public final static int KEYSIZE_BYTES = 256;
public PrivateKey() {
setData(null);
}
public PrivateKey(byte data[]) { setData(data); }
/** constructs from base64
@ -37,7 +37,6 @@ public class PrivateKey extends DataStructureImpl {
* on a prior instance of PrivateKey
*/
public PrivateKey(String base64Data) throws DataFormatException {
this();
fromBase64(base64Data);
}

View File

@ -26,8 +26,8 @@ public class PublicKey extends DataStructureImpl {
public final static int KEYSIZE_BYTES = 256;
public PublicKey() {
setData(null);
}
public PublicKey(byte data[]) {
if ( (data == null) || (data.length != KEYSIZE_BYTES) )
throw new IllegalArgumentException("Data must be specified, and the correct size");
@ -39,7 +39,6 @@ public class PublicKey extends DataStructureImpl {
* on a prior instance of PublicKey
*/
public PublicKey(String base64Data) throws DataFormatException {
this();
fromBase64(base64Data);
}

View File

@ -29,9 +29,6 @@ public class RouterAddress extends DataStructureImpl {
public RouterAddress() {
setCost(-1);
setExpiration(null);
setTransportStyle(null);
setOptions(null);
}
/**

View File

@ -31,10 +31,6 @@ public class RouterIdentity extends DataStructureImpl {
private Hash __calculatedHash;
public RouterIdentity() {
setCertificate(null);
setSigningPublicKey(null);
setPublicKey(null);
__calculatedHash = null;
}
public Certificate getCertificate() {

View File

@ -60,18 +60,9 @@ public class RouterInfo extends DataStructureImpl {
public static final String BW_CAPABILITY_CHARS = "KLMNO";
public RouterInfo() {
setIdentity(null);
setPublished(0);
_addresses = new HashSet(2);
_peers = new HashSet(0);
_options = new OrderedProperties();
setSignature(null);
_validated = false;
_isValid = false;
_currentRoutingKey = null;
_stringified = null;
_byteified = null;
_hashCodeInitialized = false;
}
public RouterInfo(RouterInfo old) {

View File

@ -27,8 +27,8 @@ public class SessionKey extends DataStructureImpl {
public static final SessionKey INVALID_KEY = new SessionKey(new byte[KEYSIZE_BYTES]);
public SessionKey() {
this(null);
}
public SessionKey(byte data[]) {
setData(data);
}

View File

@ -30,7 +30,8 @@ public class Signature extends DataStructureImpl {
FAKE_SIGNATURE[i] = 0x00;
}
public Signature() { this(null); }
public Signature() {}
public Signature(byte data[]) { setData(data); }
public byte[] getData() {

View File

@ -28,7 +28,8 @@ public class SigningPrivateKey extends DataStructureImpl {
public final static int KEYSIZE_BYTES = 20;
public SigningPrivateKey() { this((byte[])null); }
public SigningPrivateKey() {}
public SigningPrivateKey(byte data[]) { setData(data); }
/** constructs from base64
@ -36,7 +37,6 @@ public class SigningPrivateKey extends DataStructureImpl {
* on a prior instance of SigningPrivateKey
*/
public SigningPrivateKey(String base64Data) throws DataFormatException {
this();
fromBase64(base64Data);
}

View File

@ -26,7 +26,8 @@ public class SigningPublicKey extends DataStructureImpl {
public final static int KEYSIZE_BYTES = 128;
public SigningPublicKey() { this((byte[])null); }
public SigningPublicKey() {}
public SigningPublicKey(byte data[]) { setData(data); }
/** constructs from base64
@ -34,7 +35,6 @@ public class SigningPublicKey extends DataStructureImpl {
* on a prior instance of SigningPublicKey
*/
public SigningPublicKey(String base64Data) throws DataFormatException {
this();
fromBase64(base64Data);
}

View File

@ -27,7 +27,6 @@ public class AbuseReason extends DataStructureImpl {
private String _reason;
public AbuseReason() {
setReason(null);
}
public String getReason() {

View File

@ -33,10 +33,6 @@ public class CreateLeaseSetMessage extends I2CPMessageImpl {
private PrivateKey _privateKey;
public CreateLeaseSetMessage() {
setSessionId(null);
setLeaseSet(null);
setSigningPrivateKey(null);
setPrivateKey(null);
}
public SessionId getSessionId() {

View File

@ -27,7 +27,6 @@ public class DestroySessionMessage extends I2CPMessageImpl {
private SessionId _sessionId;
public DestroySessionMessage() {
setSessionId(null);
}
public SessionId getSessionId() {

View File

@ -27,7 +27,6 @@ public class DisconnectMessage extends I2CPMessageImpl {
private String _reason;
public DisconnectMessage() {
setReason(null);
}
public String getReason() {

View File

@ -31,7 +31,6 @@ public class MessagePayloadMessage extends I2CPMessageImpl {
public MessagePayloadMessage() {
setSessionId(-1);
setMessageId(-1);
setPayload(null);
}
public long getSessionId() {

View File

@ -28,8 +28,6 @@ public class ReconfigureSessionMessage extends I2CPMessageImpl {
private SessionConfig _sessionConfig;
public ReconfigureSessionMessage() {
_sessionId = null;
_sessionConfig = null;
}
public SessionId getSessionId() {

View File

@ -30,10 +30,6 @@ public class ReportAbuseMessage extends I2CPMessageImpl {
private MessageId _messageId;
public ReportAbuseMessage() {
setSessionId(null);
setSeverity(null);
setReason(null);
setMessageId(null);
}
public SessionId getSessionId() {

View File

@ -34,9 +34,7 @@ public class RequestLeaseSetMessage extends I2CPMessageImpl {
private Date _end;
public RequestLeaseSetMessage() {
setSessionId(null);
_endpoints = new ArrayList();
setEndDate(null);
}
public SessionId getSessionId() {

View File

@ -34,7 +34,6 @@ public class SendMessageExpiresMessage extends SendMessageMessage {
public SendMessageExpiresMessage() {
super();
setExpiration(null);
}
public Date getExpiration() {

View File

@ -32,10 +32,6 @@ public class SendMessageMessage extends I2CPMessageImpl {
private long _nonce;
public SendMessageMessage() {
setSessionId(null);
setDestination(null);
setPayload(null);
setNonce(0);
}
public SessionId getSessionId() {

View File

@ -51,9 +51,7 @@ public class SessionConfig extends DataStructureImpl {
}
public SessionConfig(Destination dest) {
_destination = dest;
_signature = null;
_creationDate = new Date(Clock.getInstance().now());
_options = null;
}
/**

View File

@ -33,7 +33,6 @@ public class SessionStatusMessage extends I2CPMessageImpl {
public final static int STATUS_INVALID = 3;
public SessionStatusMessage() {
setSessionId(null);
setStatus(STATUS_INVALID);
}

View File

@ -15,9 +15,6 @@ public class Frequency {
public Frequency(long period) {
setPeriod(period);
setLastEvent(0);
setAverageInterval(0);
setMinAverageInterval(0);
}
/** how long is this frequency averaged over? */

View File

@ -120,18 +120,6 @@ public class Rate {
*/
public Rate(long period) throws IllegalArgumentException {
if (period <= 0) throw new IllegalArgumentException("The period must be strictly positive");
_currentTotalValue = 0.0d;
_currentEventCount = 0;
_currentTotalEventTime = 0;
_lastTotalValue = 0.0d;
_lastEventCount = 0;
_lastTotalEventTime = 0;
_extremeTotalValue = 0.0d;
_extremeEventCount = 0;
_extremeTotalEventTime = 0;
_lifetimeTotalValue = 0.0d;
_lifetimeEventCount = 0;
_lifetimeTotalEventTime = 0;
_creationDate = now();
_lastCoalesceDate = _creationDate;

View File

@ -24,7 +24,6 @@ public class DataMessage extends I2NPMessageImpl {
public DataMessage(I2PAppContext context) {
super(context);
_data = null;
}
public byte[] getData() {

View File

@ -34,9 +34,7 @@ public class DatabaseSearchReplyMessage extends I2NPMessageImpl {
// do this in netdb if we need it
//_context.statManager().createRateStat("netDb.searchReplyMessageSend", "How many search reply messages we send", "NetworkDatabase", new long[] { 60*1000, 5*60*1000, 10*60*1000, 60*60*1000 });
//_context.statManager().createRateStat("netDb.searchReplyMessageReceive", "How many search reply messages we receive", "NetworkDatabase", new long[] { 60*1000, 5*60*1000, 10*60*1000, 60*60*1000 });
setSearchKey(null);
_peerHashes = new ArrayList(3);
setFromHash(null);
}
/**

View File

@ -43,12 +43,6 @@ public class DatabaseStoreMessage extends I2NPMessageImpl {
public DatabaseStoreMessage(I2PAppContext context) {
super(context);
setValueType(-1);
setKey(null);
setLeaseSet(null);
setRouterInfo(null);
setReplyToken(0);
setReplyTunnel(null);
setReplyGateway(null);
}
/**

View File

@ -51,14 +51,7 @@ public class DeliveryInstructions extends DataStructureImpl {
private final static long FLAG_DELAY = 16;
public DeliveryInstructions() {
setEncrypted(false);
setEncryptionKey(null);
setDeliveryMode(-1);
setDestination(null);
setRouter(null);
setTunnelId(null);
setDelayRequested(false);
setDelaySeconds(0);
}
public boolean getEncrypted() { return _encrypted; }

View File

@ -40,11 +40,7 @@ public class GarlicClove extends DataStructureImpl {
_context = context;
_log = context.logManager().getLog(GarlicClove.class);
_handler = new I2NPMessageHandler(context);
setInstructions(null);
setData(null);
setCloveId(-1);
setExpiration(null);
setCertificate(null);
}
public DeliveryInstructions getInstructions() { return _instructions; }

View File

@ -26,7 +26,6 @@ public class GarlicMessage extends I2NPMessageImpl {
public GarlicMessage(I2PAppContext context) {
super(context);
setData(null);
}
public byte[] getData() {

View File

@ -33,7 +33,6 @@ public class I2NPMessageHandler {
public I2NPMessageHandler(I2PAppContext context) {
_context = context;
_log = context.logManager().getLog(I2NPMessageHandler.class);
_messageBuffer = null;
_lastSize = -1;
}

View File

@ -54,8 +54,6 @@ public abstract class I2NPMessageImpl extends DataStructureImpl implements I2NPM
_log = context.logManager().getLog(I2NPMessageImpl.class);
_expiration = _context.clock().now() + DEFAULT_EXPIRATION_MS;
_uniqueId = _context.random().nextLong(MAX_ID_VALUE);
_written = false;
_read = false;
//_context.statManager().createRateStat("i2np.writeTime", "How long it takes to write an I2NP message", "I2NP", new long[] { 10*60*1000, 60*60*1000 });
//_context.statManager().createRateStat("i2np.readTime", "How long it takes to read an I2NP message", "I2NP", new long[] { 10*60*1000, 60*60*1000 });
}

View File

@ -24,8 +24,6 @@ public abstract class JobImpl implements Job {
_context = context;
_timing = new JobTiming(context);
_id = ++_idSrc;
_addedBy = null;
_madeReadyOn = 0;
}
public long getJobId() { return _id; }

View File

@ -15,11 +15,8 @@ class JobStats {
public JobStats(String name) {
_job = name;
_numRuns = 0;
_totalTime = 0;
_maxTime = -1;
_minTime = -1;
_totalPendingTime = 0;
_maxPendingTime = -1;
_minPendingTime = -1;
}

View File

@ -23,8 +23,6 @@ public class JobTiming implements Clock.ClockUpdateListener {
public JobTiming(RouterContext context) {
_context = context;
_start = context.clock().now();
_actualStart = 0;
_actualEnd = 0;
//context.clock().addUpdateListener(this);
}

View File

@ -66,18 +66,8 @@ public class OutNetMessage {
public OutNetMessage(RouterContext context) {
_context = context;
_log = context.logManager().getLog(OutNetMessage.class);
setTarget(null);
_message = null;
_messageSize = 0;
setPriority(-1);
setExpiration(-1);
setOnSendJob(null);
setOnFailedSendJob(null);
setOnReplyJob(null);
setOnFailedReplyJob(null);
setReplySelector(null);
_failedTransports = null;
_sendBegin = 0;
//_createdBy = new Exception("Created by");
_created = context.clock().now();
timestamp("Created");

View File

@ -60,12 +60,7 @@ public class TunnelPoolSettings {
_duration = DEFAULT_DURATION;
_length = DEFAULT_LENGTH;
_lengthVariance = DEFAULT_LENGTH_VARIANCE;
_lengthOverride = 0;
_allowZeroHop = DEFAULT_ALLOW_ZERO_HOP;
_isInbound = false;
_isExploratory = false;
_destination = null;
_destinationNickname = null;
_IPRestriction = DEFAULT_IP_RESTRICTION;
_unknownOptions = new Properties();
_randomKey = generateRandomKey();