CPD Results

The following document contains the results of PMD's CPD

Duplications

FileLine
edu/nwu/freepastry/bll/Configuration.java134
edu/nwu/pastry/bll/Configuration.java158
    }

    /**
     * Get the leaf set size.
     *
     * @return the leafSetSize
     */
    public int getLeafSetSize()
    {
        return leafSetSize;
    }

    /**
     * Set the leaf set size.
     *
     * @param leafSetSize leaf set size to set
     */
    public void setLeafSetSize(int leafSetSize)
    {
        this.leafSetSize = leafSetSize;
    }

    /**
     * Get the neighbor set size.
     *
     * @return the neighbor set size
     */
    public int getNeighborSetSize()
    {
        return neighborSetSize;
    }

    /**
     * Set the neighbor set size.
     *
     * @param neighborSetSize neighbor set size to set
     */
    public void setNeighborSetSize(int neighborSetSize)
    {
        this.neighborSetSize = neighborSetSize;
    }

    /**
     * Set the crew size.
     *
     * @param size the crew size
     */
    public void setCrewSize(int size)
    {
        this.crewSize = size;
    }

    /**
     * Get the crew size.
     *
     * @return the crew size
     */
    public int getCrewSize()
    {
        return crewSize;
    }

    /**
     * Set the use latency flag.
     *
     * @param useLatency true, if latency is used as cost function
     */
    public void setUseLatency(boolean useLatency)
    {
        this.useLatency = useLatency;
    }

    /**
     * Get the use latency flag.
     *
     * @return true, if latency is used as cost function
     */
    public boolean getUseLatency()
    {
        return useLatency;
    }

    /**
     * Get the replacement threshold.
     *
     * @return the replacement threshold
     */
    public double getReplacementThreshold()
    {
        return replacementThreshold;
    }

    /**
     * Set the replacement threshold.
     *
     * @param val the replacement threshold
     */
    public void setReplacementThreshold(double val)
    {
        replacementThreshold = val;
    }

    /**
     * Get the increasing alpha of the cost.
     *
     * @return increasing alpha of the cost
     */
    public double getCostAlphaUp()
    {
        return costAlphaUp;
    }

    /**
     * Set the increasing alpha of the cost.
     *
     * @param val the increasing alpha of the cost
     */
    public void setCostAlphaUp(double val)
    {
        costAlphaUp = val;
    }

    /**
     * Get the decreasing alpha of the cost.
     *
     * @return decreasing alpha of the cost
     */
    public double getCostAlphaDown()
    {
        return costAlphaDown;
    }

    /**
     * Set the decreasing alpha of the cost.
     *
     * @param val the decreasing alpha of the cost
     */
    public void setCostAlphaDown(double val)
    {
        costAlphaDown = val;
    }

    /**
     * Get the epoch interval.
     *
     * @return the epoch interval, milliseconds
     */
    public long getEpochInterval()
    {
        return epochInterval;
    }

    /**
     * Set the epoch interval.
     *
     * @param val the epoch interval, milliseconds
     */
    public void setEpochInterval(long val)
    {
        epochInterval = val;
    }

    /**
     * Get the heartbeat interval.
     *
     * @return the heartbeat interval, milliseconds
     */
    public long getHeartbeatInterval()
    {
        return heartbeatInterval;
    }

    /**
     * Set the heartbeat interval.
     *
     * @param val the heartbeat interval, milliseconds
     */
    public void setHeartbeatInterval(long val)
    {
        heartbeatInterval = val;
    }

    /**
     * Get the loss threshold.
     *
     * @return the loss threshold, packets
     */
    public int getDeadThreshold()
    {
        return deadThreshold;
    }

    /**
     * Set the loss threshold.
     *
     * @param val the loss threshold, packets
     */
    public void setDeadThreshold(int val)
    {
        deadThreshold = val;
    }

    /**
     * Get the join grace period.
     *
     * @return the grace period, milliseconds
     */
    public long getJoinGracePeriod()

FileLine
edu/nwu/pastry/dll/JoinReply.java129
edu/nwu/pastry/dll/JoinAnnounce.java110
        super.decode(in);

        int rows = in.decodeInteger();
        int cols = in.decodeInteger();
        NodeId[] tmp = (NodeId[]) in.decodeArray();

        routingTable = new NodeId[rows][cols];

        for (int i = 0; i < rows; i++)
        {
            System.arraycopy(tmp, i * cols, routingTable[i], 0, cols);
        }

        leafSet = (NodeId[]) in.decodeArray();
    }

    /**
     * Encode the byte stream.
     *
     * @param out the output stream
     */
    protected void encode(FieldEncoder out)
    {
        super.encode(out);

        int rows = routingTable.length;
        int cols = (rows > 0) ? routingTable[0].length : 0;
        NodeId[] tmp = new NodeId[rows * cols];

        for (int i = 0; i < routingTable.length; i++)
        {
            System.arraycopy(routingTable[i], 0, tmp, i * cols, cols);
        }

        out.encodeInteger(rows);

FileLine
edu/nwu/pastry/bll/PastryService.java249
edu/nwu/bamboo/bll/BambooService.java220
        routing = null;

        if (epochService != null)
        {
            epochService.cancel();
            epochService = null;
        }

        agent = null;
    }

    /**
     * Get the name of this overlay node
     *
     * @return the name
     */
    public String getName()
    {
        StringBuffer res = new StringBuffer();

        if (nodeId != null)
        {
            res.append(nodeId.toFullString());
        }
        else
        {
            res.append("undefined");
        }

        return res.toString();
    }

    /**
     * Get the socket address.
     *
     * @return the socket address
     */
    public SocketAddress getSocketAddress()
    {
        SocketAddress res = null;

        if (nodeId != null)
        {
            res = nodeId.getSocketAddress();
        }

        return res;
    }

    /**
     * Get predessor socket addresses.
     *
     * @return the predessor socket addresses.
     */
    public SocketAddress[] getPredessorSocketAddress()
    {
        List res = new LinkedList();
        NodeId[] neighbors = agent.getRoutingStructure().getNeighbors();

        for (int i = 0; i < neighbors.length; i++)
        {
            res.add(neighbors[i].getSocketAddress());
        }

        return (SocketAddress[]) res.toArray(new SocketAddress[0]);
    }

FileLine
edu/nwu/freepastry/bll/LookupProtocol.java170
edu/nwu/pastry/bll/LookupProtocol.java219
        getEndPoint().route(ping);
    }

    /**
     * Reply a query.
     *
     * @param identifier the identifier
     * @param nodeIdentifier the node identifier
     * @param hopDistance the hop distance
     */
    private void reply(Identifier identifier, NodeId nodeIdentifier,
        int hopDistance)
    {
        Collection res = (Collection) lookups.remove(identifier);

        timestamps.remove(identifier);

        if ((res != null) && !res.isEmpty())
        {
            DHTLookup[] lookups = (DHTLookup[]) res.toArray(new DHTLookup[0]);

            if (logger.isDebugEnabled())
            {
                logger.debug(this + ": reply " + lookups.length
                    + " lookups for " + lookups[0].getId() + " with status "
                    + ((nodeIdentifier == null) ? "failed" : "succeeded"));
            }

            for (int i = 0; i < lookups.length; i++)
            {
                lookups[i].setNodeId(nodeIdentifier, hopDistance,
                    getTimestampFactory().create().getTime()
                    - lookups[i].getTimestamp().getTime());
            }
        }
    }

    /**
     * Receive a message
     *
     * @param msg the mesage
     */
    public void receive(IDHTMessage msg)

FileLine
edu/nwu/pastry/dll/LeafSetRequest.java69
edu/nwu/pastry/dll/LeafSetReply.java69
    public LeafSetReply(NodeId[] leafSet, NodeId[] failed)
    {
        this();
        this.leafSet = leafSet;
        this.failed = failed;
    }

    /**
     * Get the leaf set.
     *
     * @return the leaf set.
     */
    public NodeId[] getLeafSet()
    {
        return leafSet;
    }

    /**
     * Get the failed nodes.
     *
     * @return the failed nodes
     */
    public NodeId[] getFailed()
    {
        return failed;
    }

    /**
     * Decode the byte stream.
     *
     * @param in the input stream
     * @throws InvalidPacketException if the packet is invalid
     */
    protected void decode(FieldDecoder in)
        throws edu.nwu.net.api.InvalidPacketException
    {
        super.decode(in);

        leafSet = (NodeId[]) in.decodeArray();
        failed = (NodeId[]) in.decodeArray();
    }

    /**
     * Encode the byte stream.
     *
     * @param out the output stream
     */
    protected void encode(FieldEncoder out)
    {
        super.encode(out);

        out.encodeArray(leafSet);
        out.encodeArray(failed);
    }
}

FileLine
edu/nwu/freepastry/bll/LookupProtocol.java287
edu/nwu/pastry/bll/LookupProtocol.java178
                ITimestamp deadline = tsmpFactory.create(-getConfig()
                                                              .getQueryTimeout());
                Identifier[] identifiers = (Identifier[]) timestamps.keySet()
                                                                    .toArray(new Identifier[0]);

                for (int i = 0; i < identifiers.length; i++)
                {
                    ITimestamp timestamp = (ITimestamp) timestamps.get(identifiers[i]);

                    if ((timestamp != null) && timestamp.before(deadline))
                    { // timeout

                        if (logger.isWarnEnabled())
                        {
                            logger.warn(this + ": lookup timed out for "
                                + identifiers[i]);
                        }

                        reply(identifiers[i], null, -1);
                    }
                }
            }

FileLine
edu/nwu/pastry/dll/QueryReply.java141
edu/nwu/pastry/dll/JoinAnnounce.java123
        leafSet = (NodeId[]) in.decodeArray();
    }

    /**
     * Encode the byte stream.
     *
     * @param out the output stream
     */
    protected void encode(FieldEncoder out)
    {
        super.encode(out);

        int rows = routingTable.length;
        int cols = (rows > 0) ? routingTable[0].length : 0;
        NodeId[] tmp = new NodeId[rows * cols];

        for (int i = 0; i < routingTable.length; i++)
        {
            System.arraycopy(routingTable[i], 0, tmp, i * cols, cols);
        }

        out.encodeInteger(rows);
        out.encodeInteger(cols);
        out.encodeArray(tmp);
        out.encodeArray(leafSet);

FileLine
edu/nwu/pastry/bll/PastryService.java110
edu/nwu/bamboo/bll/BambooService.java107
            logger.info("create new node identifier " + nodeId);
        }

        sock = socketFactory.register(EPastryPacketType.NAMESPACE);
        sock.getTypeMapping().registerAll(ReefTypeMapping.class);
        sock.getPacketMapping().registerAll(PastryPacketMapping.class);

        routing = new Routing(this.config, nodeId,
                new PastryNodeReplacementChecker(this.config, sock),
                new PastryNodeDistanceGetter(sock));
        epochService = epochServiceFactory.create(this.config);
        agent = new PastryAgent(nodeId, routing, sock);

        sock.setHandler(agent);

        IMaintenanceProtocol maintenance = new BambooMaintenanceProtocol(this.config,