class HgNodePartition {

    private final Long nodeId;
    //当前key的hashcode
    private final Integer keyCode;

    //分区的开始结束范围
    private final Integer startKey;
    private final Integer endKey;
    private int hash = -1;

    HgNodePartition(Long nodeId, Integer keyCode) {
        this.nodeId = nodeId;
        this.keyCode = keyCode;
        this.startKey = this.endKey = keyCode;
    }

    HgNodePartition(Long nodeId, Integer keyCode, Integer startKey, Integer endKey) {
        this.nodeId = nodeId;
        this.keyCode = keyCode;
        this.startKey = startKey;
        this.endKey = endKey;
    }

    public static HgNodePartition of(Long nodeId, Integer keyCode) {
        return new HgNodePartition(nodeId, keyCode);
    }

    public static HgNodePartition of(Long nodeId, Integer keyCode, Integer startKey,
                                     Integer endKey) {
        return new HgNodePartition(nodeId, keyCode, startKey, endKey);
    }

    public Long getNodeId() {
        return nodeId;
    }

    public Integer getKeyCode() {
        return keyCode;
    }

    public Integer getStartKey() {
        return startKey;
    }

    public Integer getEndKey() {
        return endKey;
    }

    @Override
    public boolean equals(Object o) {<FILL_FUNCTION_BODY>}

    @Override
    public int hashCode() {
        if (this.hash == -1) {
            this.hash = Objects.hash(nodeId, keyCode);
        }
        return this.hash;
    }

    @Override
    public String toString() {
        return "HgNodePartition{" +
               "nodeId=" + nodeId +
               ", partitionId=" + keyCode +
               '}';
    }
}

        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        HgNodePartition that = (HgNodePartition) o;
        return Objects.equals(nodeId, that.nodeId) && Objects.equals(keyCode, that.keyCode);
    
<no_super_class>