@Test public void testCreatePeerSequence() throws Exception { assertNotNull(NodeIdConv.createPeerSequence(nodeIds1)); assertNotNull(NodeIdConv.createPeerSequence(new ArrayList<NodeId>())); assertNotNull(NodeIdConv.createPeerSequence(null)); assertEquals(3, NodeIdConv.createPeerSequence(nodeIds1).getPeer().size()); assertTrue(NodeIdConv.createPeerSequence(null).getPeer().isEmpty()); }
public static PeerSequence createPeerSequence(List<NodeId> nodeIds) { if (nodeIds == null) { nodeIds = new ArrayList<>(); } List<Peer> peers = new ArrayList<>(); for (NodeId nodeId : nodeIds) { PeerBuilder peerBuilder = new PeerBuilder(); peerBuilder.setSeq(nodeIds.indexOf(nodeId)); peerBuilder.setNodeId(new NodeId(nodeId)); peers.add(peerBuilder.build()); } PeerSequenceBuilder peerSequenceBuilder = new PeerSequenceBuilder(); peerSequenceBuilder.setPeer(peers); return peerSequenceBuilder.build(); }
NodeIdConv { public static PeerSequence createPeerSequence(List<NodeId> nodeIds) { if (nodeIds == null) { nodeIds = new ArrayList<>(); } List<Peer> peers = new ArrayList<>(); for (NodeId nodeId : nodeIds) { PeerBuilder peerBuilder = new PeerBuilder(); peerBuilder.setSeq(nodeIds.indexOf(nodeId)); peerBuilder.setNodeId(new NodeId(nodeId)); peers.add(peerBuilder.build()); } PeerSequenceBuilder peerSequenceBuilder = new PeerSequenceBuilder(); peerSequenceBuilder.setPeer(peers); return peerSequenceBuilder.build(); } }
NodeIdConv { public static PeerSequence createPeerSequence(List<NodeId> nodeIds) { if (nodeIds == null) { nodeIds = new ArrayList<>(); } List<Peer> peers = new ArrayList<>(); for (NodeId nodeId : nodeIds) { PeerBuilder peerBuilder = new PeerBuilder(); peerBuilder.setSeq(nodeIds.indexOf(nodeId)); peerBuilder.setNodeId(new NodeId(nodeId)); peers.add(peerBuilder.build()); } PeerSequenceBuilder peerSequenceBuilder = new PeerSequenceBuilder(); peerSequenceBuilder.setPeer(peers); return peerSequenceBuilder.build(); } private  NodeIdConv(); }
NodeIdConv { public static PeerSequence createPeerSequence(List<NodeId> nodeIds) { if (nodeIds == null) { nodeIds = new ArrayList<>(); } List<Peer> peers = new ArrayList<>(); for (NodeId nodeId : nodeIds) { PeerBuilder peerBuilder = new PeerBuilder(); peerBuilder.setSeq(nodeIds.indexOf(nodeId)); peerBuilder.setNodeId(new NodeId(nodeId)); peers.add(peerBuilder.build()); } PeerSequenceBuilder peerSequenceBuilder = new PeerSequenceBuilder(); peerSequenceBuilder.setPeer(peers); return peerSequenceBuilder.build(); } private  NodeIdConv(); static NodeId _decode(byte[] array); static NodeId create(int nodeId); static NodeId createNodeId(InetAddress inetAddress); static NodeId createNodeId(String prefix); static PeerSequence createPeerSequence(List<NodeId> nodeIds); static List<NodeId> decode(byte[] array); static boolean equalTo(NodeId nodeId1, NodeId nodeId2); static List<NodeId> getPeerSequence(PeerSequence peerSequence); static byte[] toBytes(List<NodeId> nodesIds); static byte[] toBytes(NodeId nodeId); static String toString(NodeId nodeId); static String toString(PeerSequence peerSequence); }
NodeIdConv { public static PeerSequence createPeerSequence(List<NodeId> nodeIds) { if (nodeIds == null) { nodeIds = new ArrayList<>(); } List<Peer> peers = new ArrayList<>(); for (NodeId nodeId : nodeIds) { PeerBuilder peerBuilder = new PeerBuilder(); peerBuilder.setSeq(nodeIds.indexOf(nodeId)); peerBuilder.setNodeId(new NodeId(nodeId)); peers.add(peerBuilder.build()); } PeerSequenceBuilder peerSequenceBuilder = new PeerSequenceBuilder(); peerSequenceBuilder.setPeer(peers); return peerSequenceBuilder.build(); } private  NodeIdConv(); static NodeId _decode(byte[] array); static NodeId create(int nodeId); static NodeId createNodeId(InetAddress inetAddress); static NodeId createNodeId(String prefix); static PeerSequence createPeerSequence(List<NodeId> nodeIds); static List<NodeId> decode(byte[] array); static boolean equalTo(NodeId nodeId1, NodeId nodeId2); static List<NodeId> getPeerSequence(PeerSequence peerSequence); static byte[] toBytes(List<NodeId> nodesIds); static byte[] toBytes(NodeId nodeId); static String toString(NodeId nodeId); static String toString(PeerSequence peerSequence);  }