/** * * Find all objects in the ooTreeListX that's between startTime and endTime inclusive, and have * branch.getID() if branch is not null We don't have any optimization for time, but we could make * the treeset use custom comparator. */ public List<ObjyCommitInfo> getCommitInfo(CDOBranch branch, long startTime, long endTime) { ooTreeSetX treeSet = getTreeSet(); ObjyCommitInfo ooCommitInfo = null; List<ObjyCommitInfo> results = new ArrayList<ObjyCommitInfo>(); boolean getIt = false; @SuppressWarnings("unchecked") Iterator<ObjyCommitInfo> itr = treeSet.iterator(); while (itr.hasNext()) { ooCommitInfo = itr.next(); getIt = true; // assume it's what we need, then we filter below. long timeStamp = ooCommitInfo.getTimeStamp(); long branchId = ooCommitInfo.getBranchId(); if (branch != null && branch.getID() != branchId) { getIt = false; } if (getIt && startTime != CDOBranchPoint.UNSPECIFIED_DATE && timeStamp < startTime) { getIt = false; } if (getIt && endTime != CDOBranchPoint.UNSPECIFIED_DATE && timeStamp > endTime) { getIt = false; } if (getIt) { results.add(ooCommitInfo); } } return results; }
/** * Factory method to create the CommitInfoList, which is a TreeListX */ public static ooId create(ooId scopeContOid) { ooTreeSetX treeSet = new ooTreeSetX(20, true); ooObj clusterObject = ooObj.create_ooObj(scopeContOid); clusterObject.cluster(treeSet); return treeSet.getOid(); }