Changeset ce5acb4


Ignore:
Timestamp:
Sep 24, 2011 9:47:51 PM (8 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
cc7a802
Parents:
4822e47
Message:

add some convenience methods

Location:
router/java/src/net/i2p/router
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/TunnelInfo.java

    r4822e47 rce5acb4  
    3535    public Hash getPeer(int hop);
    3636
     37    /**
     38     *  For convenience
     39     *  @return getPeer(0)
     40     *  @since 0.8.9
     41     */
     42    public Hash getGateway();
     43
     44    /**
     45     *  For convenience
     46     *  @return getPeer(getLength() - 1)
     47     *  @since 0.8.9
     48     */
     49    public Hash getEndpoint();
     50
     51    /**
     52     *  For convenience
     53     *  @return isInbound() ? getGateway() : getEndpoint()
     54     *  @since 0.8.9
     55     */
     56    public Hash getFarEnd();
     57
    3758    /** is this an inbound tunnel? */
    3859    public boolean isInbound();
  • router/java/src/net/i2p/router/tunnel/TunnelCreatorConfig.java

    r4822e47 rce5acb4  
    8282    public void setPeer(int hop, Hash peer) { _peers[hop] = peer; }
    8383   
     84    /**
     85     *  For convenience
     86     *  @return getPeer(0)
     87     *  @since 0.8.9
     88     */
     89    public Hash getGateway() {
     90        return _peers[0];
     91    }
     92
     93    /**
     94     *  For convenience
     95     *  @return getPeer(getLength() - 1)
     96     *  @since 0.8.9
     97     */
     98    public Hash getEndpoint() {
     99        return _peers[_peers.length - 1];
     100    }
     101
     102    /**
     103     *  For convenience
     104     *  @return isInbound() ? getGateway() : getEndpoint()
     105     *  @since 0.8.9
     106     */
     107    public Hash getFarEnd() {
     108        return _peers[_isInbound ? 0 : _peers.length - 1];
     109    }
     110
    84111    /** is this an inbound tunnel? */
    85112    public boolean isInbound() { return _isInbound; }
Note: See TracChangeset for help on using the changeset viewer.