Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java')
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java64
1 files changed, 0 insertions, 64 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java
deleted file mode 100644
index 475fa5d72..000000000
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/VersionCollator.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.team.internal.ccvs.ui;
-
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Collator to compare two CVS revisions
- */
-public class VersionCollator {
- public int compare(String revision1, String revision2) {
- if (revision1 == null && revision2 == null) return 0;
- if (revision1 == null) return -1;
- if (revision2 == null) return 1;
- int[] revision1Segments = getIntSegments(revision1);
- int[] revision2Segments = getIntSegments(revision2);
- for (int i = 0; i < revision1Segments.length && i < revision2Segments.length; i++) {
- int i1 = revision1Segments[i];
- int i2 = revision2Segments[i];
- if (i1 != i2) {
- return i1 > i2 ? 1 : -1;
- }
- }
- if (revision1Segments.length != revision2Segments.length) {
- return revision1Segments.length > revision2Segments.length ? 1 : -1;
- }
- return 0;
- }
-
- int[] getIntSegments(String string) {
- int size = string.length();
- if (size == 0) return new int[0];
- StringBuffer buffer = new StringBuffer();
- List list = new ArrayList();
- for (int i = 0; i < size; i++) {
- char ch = string.charAt(i);
- if (ch == '.') {
- list.add(new Integer(buffer.toString()));
- buffer = new StringBuffer();
- } else {
- buffer.append(ch);
- }
- }
- list.add(new Integer(buffer.toString()));
- int[] result = new int[list.size()];
- Iterator it = list.iterator();
- for (int i = 0; i < result.length; i++) {
- result[i] = ((Integer)it.next()).intValue();
- }
- return result;
- }
-}
-

Back to the top