Skip to content

Commit

Permalink
fix method name clash for List.sort() in Java 8
Browse files Browse the repository at this point in the history
  • Loading branch information
satta committed Nov 7, 2015
1 parent ceb2d52 commit 0771424
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 56 deletions.
16 changes: 8 additions & 8 deletions uk/ac/sanger/artemis/AlignMatchVector.java
Expand Up @@ -3,19 +3,19 @@
* created: Sat Jun 17 2000
*
* This file is part of Artemis
*
*
* Copyright (C) 2000,2001 Genome Research Limited
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Expand Down Expand Up @@ -51,15 +51,15 @@ public AlignMatchVector () {
public void addElement (AlignMatch item) {
vector.add (item);
}

/**
* Appends the given AlignMatch object to the vector if and only if it
* isn't already in the vector. (same as addElement ()).
**/
public void add (AlignMatch item) {
addElement (item);
}

/**
* Performs the same function as Vector.elementAt ()
**/
Expand Down Expand Up @@ -101,13 +101,13 @@ public int indexOf (AlignMatch item) {
public int size () {
return vector.size ();
}

/**
* Sort this vector.
* @param cmp The returned vector will be sorted with this Comparator.
**/
public void sort (final Comparator cmp) {
vector = vector.sort (cmp);
vector = vector.mysort (cmp);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion uk/ac/sanger/artemis/FeatureVector.java
Expand Up @@ -154,7 +154,7 @@ public Object clone () {
public FeatureVector sort (final Comparator cmp) {
final FeatureVector return_vector = (FeatureVector) clone ();

return_vector.vector = return_vector.vector.sort (cmp);
return_vector.vector = return_vector.vector.mysort (cmp);

return return_vector;
}
Expand Down
26 changes: 13 additions & 13 deletions uk/ac/sanger/artemis/io/KeyVector.java
Expand Up @@ -3,19 +3,19 @@
* created: Fri Apr 16 1999
*
* This file is part of Artemis
*
*
* Copyright (C) 1999 Genome Research Limited
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Expand All @@ -39,13 +39,13 @@ public class KeyVector extends FastVector

public KeyVector ()
{
super();
super();
}

/**
* Create a new vector which contains only the given Key.
**/
public KeyVector (final Key new_key)
public KeyVector (final Key new_key)
{
super();
add (new_key);
Expand All @@ -54,7 +54,7 @@ public KeyVector (final Key new_key)
/**
* Return a new copy of this object.
**/
public KeyVector copy ()
public KeyVector copy ()
{
final KeyVector new_key_vector = (KeyVector)clone();

Expand All @@ -65,21 +65,21 @@ public KeyVector copy ()
* Sorts the elements of the vector using a simple O(n^2) selection
* sort.
*/
public void sort()
public void mysort()
{
int smallest;

for (int i = 0; i < size (); ++i)
for (int i = 0; i < size (); ++i)
{
//find smallest remaining element
smallest = i;
for(int j = i + 1 ; j < size () ; ++j)
for(int j = i + 1 ; j < size () ; ++j)
{
if(((Key)get(j)).compareTo( (Key)get(smallest)) < 0)
if(((Key)get(j)).compareTo( (Key)get(smallest)) < 0)
smallest = j;
}
//exchange smallest and i
if (smallest != i)
if (smallest != i)
{
final Key tmp = (Key)get(i);
setElementAt (get(smallest), i);
Expand Down
8 changes: 4 additions & 4 deletions uk/ac/sanger/artemis/io/SimpleEntryInformation.java
Expand Up @@ -175,7 +175,7 @@ public KeyVector getSortedValidKeys () {
return null;
}

return_vector.sort ();
return_vector.mysort ();
return return_vector;
}

Expand All @@ -187,11 +187,11 @@ public Key getDefaultKey () {

if (isValidKey (misc_feature_key))
return misc_feature_key;

misc_feature_key = new Key ("region");
if (isValidKey (misc_feature_key))
return misc_feature_key;

return (Key)getValidKeys ().get (0);
}

Expand Down Expand Up @@ -397,7 +397,7 @@ public QualifierInfoHash getAllQualifierInfo () {
return getQualifierInfoHash ().copy ();
}
}

/**
* Fix this EntryInformation so that the given exception won't happen
* again.
Expand Down
26 changes: 13 additions & 13 deletions uk/ac/sanger/artemis/util/FastVector.java
Expand Up @@ -3,19 +3,19 @@
* created: Sun Feb 20 2000
*
* This file is part of Artemis
*
*
* Copyright (C) 2000 Genome Research Limited
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Expand Down Expand Up @@ -43,9 +43,9 @@ public class FastVector extends ArrayList
/**
* Performs the same function as Vector.addElement()
*/
public boolean add(Object object)
public boolean add(Object object)
{
if(object == null)
if(object == null)
throw new Error("internal error - adding a null object");
else if(contains(object))
throw new Error("internal error - object added a second time");
Expand All @@ -56,32 +56,32 @@ else if(contains(object))
/**
* Performs the same function as Vector.lastElement()
**/
public Object lastElement()
public Object lastElement()
{
return (Object)get(size() - 1);
}

/**
* Insert an Object after another.
* @param old_object The new_object will be inserted after this object
* or at the start if old_object isn't in the vector.
* @param new_object The new object to insert.
**/
public void insertElementAfter(Object old_object, Object new_object)
public void insertElementAfter(Object old_object, Object new_object)
{
final int old_object_index = indexOf(old_object);

if(old_object_index == -1)
if(old_object_index == -1)
add(0, new_object);
else
else
add(old_object_index + 1, new_object);
}

/**
* Replace the Object at the given index. (Performs the same function as
* Vector.elementAt())
**/
public void setElementAt(final Object object, final int index)
public void setElementAt(final Object object, final int index)
{
remove(index);
add(index, object);
Expand All @@ -91,7 +91,7 @@ public void setElementAt(final Object object, final int index)
* Return a sorted copy of this vector.
* @param cmp The returned vector will be sorted with this Comparator.
**/
public FastVector sort(final Comparator cmp)
public FastVector mysort(final Comparator cmp)
{
final FastVector return_vector = (FastVector)clone();
Collections.sort(return_vector, cmp);
Expand Down
34 changes: 17 additions & 17 deletions uk/ac/sanger/artemis/util/StringVector.java
Expand Up @@ -51,11 +51,11 @@ public StringVector()
/**
* Create a new vector which contains the given Strings.
**/
public StringVector(final String[] new_strings)
public StringVector(final String[] new_strings)
{
super(new_strings.length);
int len = new_strings.length;
for(int i = 0; i < len; ++i)
for(int i = 0; i < len; ++i)
add(new_strings[i]);
}

Expand All @@ -68,15 +68,15 @@ public StringVector(final String new_string)
/**
* Create a new vector which contains the given Strings.
**/
public StringVector(final StringVector new_strings)
public StringVector(final StringVector new_strings)
{
super(new_strings);
}

/**
* Call add() on each of the String objects in the given StringVector.
**/
public void add(final StringVector new_strings)
public void add(final StringVector new_strings)
{
for (int i = 0; i < new_strings.size(); ++i)
add (new_strings.elementAt(i));
Expand All @@ -87,19 +87,19 @@ public void add(final StringVector new_strings)
* package.
*/
public void sort()
{
{
final Comparator<String> comparator = new Comparator<String>()
{
public int compare(String fst, String snd)
public int compare(String fst, String snd)
{
if(fst == null)
if(fst == null)
{
if(snd == null)
return 0;
else
return -1;
}
else
}
else
{
if(snd == null)
return 1;
Expand All @@ -114,7 +114,7 @@ public int compare(String fst, String snd)
/**
* Return a new copy of this object.
**/
public StringVector copy()
public StringVector copy()
{
return new StringVector(this);
}
Expand All @@ -132,7 +132,7 @@ public StringVector copy()
**/
public static StringVector getStrings(final String argument,
final String delim,
final boolean keep_zero_char_toks)
final boolean keep_zero_char_toks)
{
final StringVector strVector = new StringVector();

Expand All @@ -153,23 +153,23 @@ public static StringVector getStrings(final String argument,

if(idx2 < 0)
idx2 = argLen;

tok = argument.substring(idx1,idx2);
idx1 = idx2+1;

if(tok.length() == 1 &&
delim.indexOf(tok.charAt(0)) != -1)
delim.indexOf(tok.charAt(0)) != -1)
{
// ignore the split characters
if(keep_zero_char_toks &&
(lastTok == null ||
lastTok != null && lastTok.length () == 1 &&
delim.indexOf (lastTok) != -1))
delim.indexOf (lastTok) != -1))
{
// add a space because of two split_characters in a row
strVector.add("");
}
}
}
else
strVector.add(tok);

Expand All @@ -186,7 +186,7 @@ public static StringVector getStrings(final String argument,
* vector will be zero length.
**/
public static StringVector getStrings(final String argument,
final String split_characters)
final String split_characters)
{
return getStrings(argument, split_characters, false);
}
Expand All @@ -198,7 +198,7 @@ public static StringVector getStrings(final String argument,
* String is zero length or it consists only of whitespace, the return
* vector will be zero length.
**/
public static StringVector getStrings(final String argument)
public static StringVector getStrings(final String argument)
{
return getStrings(argument, " ", false);
}
Expand Down

0 comments on commit 0771424

Please sign in to comment.