diff src/org/tmatesoft/hg/internal/IntVector.java @ 561:d3c71498919c

Do not process child revisions before all possible parent paths were visited
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Wed, 27 Feb 2013 19:37:58 +0100
parents 45751456b471
children e49f9d9513fa
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/internal/IntVector.java	Tue Feb 26 21:06:43 2013 +0100
+++ b/src/org/tmatesoft/hg/internal/IntVector.java	Wed Feb 27 19:37:58 2013 +0100
@@ -16,6 +16,8 @@
  */
 package org.tmatesoft.hg.internal;
 
+import java.util.Arrays;
+
 /**
  * Vector of primitive values
  * 
@@ -101,6 +103,18 @@
 		}
 	}
 
+	/**
+	 * 
+	 * @param ascending <code>true</code> to sort in ascending order, <code>false</code> for descending
+	 */
+	public void sort(boolean ascending) {
+		Arrays.sort(data, 0, count);
+		if (!ascending) {
+			reverse();
+		}
+	}
+
+
 	@Override
 	public String toString() {
 		return String.format("%s[%d]", IntVector.class.getSimpleName(), size());