// 
// Decompiled by Procyon v0.6.0
// 

package org.bson;

public final class BsonTimestamp extends BsonValue implements Comparable<BsonTimestamp>
{
    private final long value;
    
    public BsonTimestamp() {
        this.value = 0L;
    }
    
    public BsonTimestamp(final long value) {
        this.value = value;
    }
    
    public BsonTimestamp(final int seconds, final int increment) {
        this.value = ((long)seconds << 32 | ((long)increment & 0xFFFFFFFFL));
    }
    
    @Override
    public BsonType getBsonType() {
        return BsonType.TIMESTAMP;
    }
    
    public long getValue() {
        return this.value;
    }
    
    public int getTime() {
        return (int)(this.value >> 32);
    }
    
    public int getInc() {
        return (int)this.value;
    }
    
    @Override
    public String toString() {
        return "Timestamp{value=" + this.getValue() + ", seconds=" + this.getTime() + ", inc=" + this.getInc() + '}';
    }
    
    @Override
    public int compareTo(final BsonTimestamp ts) {
        return Long.compareUnsigned(this.value, ts.value);
    }
    
    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || this.getClass() != o.getClass()) {
            return false;
        }
        final BsonTimestamp timestamp = (BsonTimestamp)o;
        return this.value == timestamp.value;
    }
    
    @Override
    public int hashCode() {
        return (int)(this.value ^ this.value >>> 32);
    }
}
