@Test public void testGetVersionByIndex() { FileVersion v0 = new FileVersion(0, 1213, 100, new ArrayList<MetaChunk>()); FileVersion v1 = new FileVersion(1, 312, 1000, new ArrayList<MetaChunk>()); FileVersion v2 = new FileVersion(2, 213, 999, new ArrayList<MetaChunk>()); List<FileVersion> versions = new ArrayList<FileVersion>(); versions.add(v0); versions.add(v1); versions.add(v2); MetaFileSmall metaFileSmall = new MetaFileSmall(keys.getPublic(), versions, keys); Assert.assertEquals(v0, metaFileSmall.getVersionByIndex(0)); Assert.assertEquals(v1, metaFileSmall.getVersionByIndex(1)); Assert.assertEquals(v2, metaFileSmall.getVersionByIndex(2)); }
public FileVersion getVersionByIndex(int index) { if (versions == null || versions.isEmpty()) { return null; } for (FileVersion version : versions) { if (version.getIndex() == index) { return version; } } return null; }
MetaFileSmall extends BaseMetaFile { public FileVersion getVersionByIndex(int index) { if (versions == null || versions.isEmpty()) { return null; } for (FileVersion version : versions) { if (version.getIndex() == index) { return version; } } return null; } }
MetaFileSmall extends BaseMetaFile { public FileVersion getVersionByIndex(int index) { if (versions == null || versions.isEmpty()) { return null; } for (FileVersion version : versions) { if (version.getIndex() == index) { return version; } } return null; } MetaFileSmall(PublicKey id, List<FileVersion> versions, KeyPair chunkKey); }
MetaFileSmall extends BaseMetaFile { public FileVersion getVersionByIndex(int index) { if (versions == null || versions.isEmpty()) { return null; } for (FileVersion version : versions) { if (version.getIndex() == index) { return version; } } return null; } MetaFileSmall(PublicKey id, List<FileVersion> versions, KeyPair chunkKey); List<FileVersion> getVersions(); KeyPair getChunkKey(); BigInteger getTotalSize(); FileVersion getNewestVersion(); FileVersion getVersionByIndex(int index); }
MetaFileSmall extends BaseMetaFile { public FileVersion getVersionByIndex(int index) { if (versions == null || versions.isEmpty()) { return null; } for (FileVersion version : versions) { if (version.getIndex() == index) { return version; } } return null; } MetaFileSmall(PublicKey id, List<FileVersion> versions, KeyPair chunkKey); List<FileVersion> getVersions(); KeyPair getChunkKey(); BigInteger getTotalSize(); FileVersion getNewestVersion(); FileVersion getVersionByIndex(int index);  }