Comparable problems

I have written a compareTo method using the syntax listed in the documentation
public int compareTo(Object o)
but the compiler returns this message. " should be declared abstract; it does not define compareTo(Comparable)."
On other systems I have used this code compiles fine. Any suggestions?

I have implemented Comparable so I can put my objects into a binary tree. Like this:
class BioObject implements Comparable
public int compareTo(Object o)
Is there a reason I would want to change 'Object' to 'Comparable'?
It does compile on certain machines running the same software. I am using TextPad as an editor and JDK 1.3.1 on the machines I have been writing code on. I have uninstalled both and reinstalled them and still get the same thing on two machines now.
Thanks for the replies.

Similar Messages

  • TreeSet Comparator problem

    I've been working on a pathfinding algorithm and have been using a TreeSet with a custom comparator, but seem to have run into a problem. I'm under the assumption that a set should only contain one of each item based on the comparator. For some reason, when I do certain test cases the TreeSet will contain duplicate values. I specify that the values are equal if x == x and y == y, but somehow multiple x,y pairs are contained in the set. I use TreeSet.conatins() to determine if I should put the item in the list, but for some reason even if they share the same x,y pair it puts the same item in the list. Also, on other test cases its having trouble putting the items in the correct order. A pair of coordinates with a higher F value is in the front of the list when it should be in the back. If anyone has some suggestions i would greatly appreciate it. This is my code for the comparator. Maybe I'm doing something wrong and fresh set of eyes could help. This is my first time working with them and I'm not sure if I've made a tiny mistake or not.
    This is the custom comparator class I've implemented
        private class AStarNodeComparator implements Comparator<AStarNode>{
            public int compare(AStarNode o1, AStarNode o2) {
                return (o1.compareTo(o2));
        }And this is the compareTo, equals and hashCode method I've used for my AStarNode
        @Override
        public boolean equals(Object o){
            return(o instanceof AStarNode && this.compareTo((AStarNode)o) == 0);
        @Override
        public int hashCode() {
            int hash = 3;
            hash = 83 * hash + this.x;
            hash = 83 * hash + this.y;
            return hash;
        public int compareTo(AStarNode t) {
            if(this.x == t.getX() && this.y == t.getY()){
                return 0;
            else if(this.f < t.getF()){
                return -1;
            else{
                return 1;
        }If anyone has an idea on why this isn't sorting corectly and why it has duplicate items I would appreciate it.

    Would that exclude a value from the tree if the x and y didnt equal but the f values did? Say 1,3 = 110 and 1,2 = 110. Would it exclude one of the coordinates with that final return 0 at the end?No. It's the most minor key. It sorts items with equal (x,y) pairs only.
    I'm trying to keep duplicate x,y pairs out and sort them by f values at the same time.That is a contradiction in terms. If they are out how can you sort them? You have a major conceptual confusion here.
    Hmm would their be a different data structure I could use that would efficiently let me store them using the x,y coordinates as positions and then find the smallest one?It's not a question of which data structure, it's a question of how you are defining your ordering.
    I think your comparator should look like this:
    // Major key is 'x'
    if (this.x > that.x)
      return 1;
    if (this.x < that.x)
      return -1;
    // Sub-major key is 'y'
    if (this.y > that.y)
      return 1;
    if (this.y < that.y)
      return -1;
    // minor key is 'f'
    if (this.f > that.f)
      return 1;
    if (this.f < that.f)
      return -1;
    // Everything is equal
    return 0;As you are using a TreeSet you can throw away your hashCode() method. Otherwise it should take the 'f' value into account too.

  • String compare problem

    I try to compare 2 strings with compareTo/equalTo, but it's not working, those 2 funcs always return ture.
    public boolean chMark(String name, String test, String newMark)
              boolean flag = false;
              for(int i = 0; i < course.getNumOfStd(); i++)
                   if(course.getStd().getName().compareTo(name)==0)//here is problem;
                        Student tempStd = course.getStd()[i];
                        for(int j = 0; j < tempStd.getMark().getNumOfTests(); j++)
                        if(tempStd.getMark().getTestArray()[j].getTitle().compareTo(test)==0);//here is problem;
                             int mark = Integer.parseInt(newMark);                    }
              return flag;
    Can anybody tell me why?
    REGARDS,
    Elton

    equals() would read more naturally than compareTo()==0. But, in
    either case, use System.out.println() to write the two strings before
    you compare them. This is to check that you are comparing what
    you think you're comparing.System.out.println("name from course is " + course.getStd().getName());
    System.out.println("name is " + name);
    if(course.getStd()[i].getName().compareTo(name)==0)//here is problem;
    System.out.println("name from couse and name compared equal");
    // etc

  • Comparable problem with eclipse

    I want to use "Comparable" in eclipse, but always has a problem with a steatment that " The type Comparable is not generic; it cannot be parameterized with arguments <Node>".
    program is here:
    public class Node implements Comparable<Node>
         public int value;
         public boolean LeftchildSent; //used for checking if leftchild sent the value to the node at last round
         public boolean RightchildSent; //...
         public boolean ParentSent; //...
         //constructor
         public Node(int value, boolean LeftchildSent, boolean RightchildSent, boolean ParentSent, Node left, Node right)
              this.value = value;
              this.LeftchildSent = false;
              this.RightchildSent = false;
              this.ParentSent = false;
         //implements comparable
         public int ComparableTo(Node n)
              if(value < n.value) return -1;
              if(value == n.value) return 0;
              if(value > n.value) return 1;
    }anybody help, thanks very much

    Be sure to:
    1- Use a JRE System Library 5.0+ for your project.
    (Properties / Java Build Path / Libraries)
    2- Use a compiler compliance level 5.0+ for your project.
    (Properties / Java Compiler / Compiler Compliance Level)
    3- Change your last method to:    public int compareTo(Node n) // *** bad name used
            if(value < n.value) return -1;
            if(value > n.value) return 1;
            return 0; // *** be sure to have a return statement
        }or better:     public int compareTo(Node n)
            return value - n.value;
        }

  • CVS Compare Problem

    Hello,
    I'm using JDev 10.1.0.3.4.3673 and CVSNT2.0.8
    When I try to compare a file with another revision, the left filter defaults to the previous revision, and the right filter defaults to the head revision, but underneath the two filters where I expect to see the two source files and the differences from the comparison I just see a white background with the message 'Compare Not Available'.
    Does anybody have any suggestions how to solve this? Am I doing something wrong? This is really a show stopper for me.
    JFYI If I use the feature 'Compare With Other File', it works as expected. But of course my goal is to compare with other CVS revisions to see what changes a colleague has made.

    Thanks again for your help.
    I see this problem on all files that I try to compare from CVS. Below is the ouput from 'cvs log' from the command prompt for an example file. The date format is exactly as you described:
    RCS file: /local/reps/acc-dm/measdb/measdb-client-api/src/java/cern/measurement/MeasurementManager.java,v
    Working file: MeasurementManager.java
    head: 1.10
    branch:
    locks: strict
    access list:
    symbolic names:
    V2_0_1: 1.10
    V2_0_0: 1.10
    V1_5_14: 1.9
    V1_5_13: 1.9
    V1_5_12: 1.9
    V1_5_11: 1.9
    V1_5_10: 1.7
    V1_5_9: 1.6
    V1_5_8: 1.6
    V1_5_7: 1.6
    V1_5_6: 1.6
    V1_5_5: 1.6
    V1_5_4: 1.6
    V1_5_3: 1.5
    V1_5_2: 1.5
    V1_5_1: 1.5
    V1_5_0: 1.4
    V1_4_0: 1.3
    V1_3_0: 1.2
    V1_2_1: 1.1.1.1
    V1_2_0: 1.1.1.1
    V1_1_0: 1.1.1.1
    V1_0_1: 1.1.1.1
    V1_0: 1.1.1.1
    arelease: 1.1.1.1
    avendor: 1.1.1
    keyword substitution: kv
    total revisions: 11; selected revisions: 11
    description:
    revision 1.10
    date: 2006-06-08 15:06:32 +0000; author: konkere; state: Exp; lines: +172 -107; commitid: lnQP1pTMGnOrhdAr;
    JMON-52.
    Refactoring to generalize the fundamental and measurement variable behaviour and handling
    revision 1.9
    date: 2006-04-07 09:57:02 +0000; author: cdroderi; state: Exp; lines: +76 -16; commitid: AiECvh7J3qGRydsr;
    New Fundamental Variable Features, and SavedVariableList for integration with
    Set Of The Day.
    revision 1.8
    date: 2006-01-25 18:19:54 +0000; author: cdroderi; state: Exp; lines: +3 -4;
    Added additional debug information to verify clearing of timeseries data
    revision 1.7
    date: 2006-01-17 14:33:53 +0000; author: cdroderi; state: Exp; lines: +29 -0;
    [no comments]
    revision 1.6
    date: 2005-09-15 20:12:15 +0000; author: cdroderi; state: Exp; lines: +0 -0;
    [no comments]
    revision 1.5
    date: 2005-09-12 08:01:07 +0000; author: cdroderi; state: Exp; lines: +2 -2;
    Extended MetaVariableSet extraction using MetaHierarchy to include all nodes under the node represented by the given hierarchy.
    revision 1.4
    date: 2005-08-30 21:13:04 +0000; author: cdroderi; state: Exp; lines: +24 -3;
    Limited the variable ownership and registration checks to once per session unless variables are added or removed from a variable set.
    revision 1.3
    date: 2005-08-30 14:25:10 +0000; author: cdroderi; state: Exp; lines: +50 -3;
    New methods to read MetaVariableSet objects using a given MetaVariable name pattern or MetaHierarchy to filter the size of the returned set.
    revision 1.2
    date: 2005-08-23 14:16:25 +0000; author: cdroderi; state: Exp; lines: +19 -15;
    Bug fix for writing data for variables with no time series data. Merge data when duplicates are found.
    revision 1.1
    date: 2005-06-01 17:52:43 +0000; author: cdroderi; state: Exp;
    branches: 1.1.1;
    Initial revision
    revision 1.1.1.1
    date: 2005-06-01 17:52:43 +0000; author: cdroderi; state: Exp; lines: +0 -0;
    no message
    =============================================================================

  • TreeSet and Comparator problem

    Hi all ,
    I am using jdk1.3 , jbuilder4.0 , Apache Tomcat 1.3.14 and Window 98 and Access Database.
    I have comparator code below which give me some problem
    public int compare(Object x, Object y) {
    CompanyJB a = (CompanyJB)x , b = (CompanyJB)y;
    double aMinratio = a.getMinratio();
    double bMinratio = b.getMinratio();
    int aCompid = a.getCompanyid();
    int bCompid = b.getCompanyid();
    String aRankstr = a.getRank();
    String bRankstr = b.getRank();
    int tmp;
    tmp = new Integer(aCompid).compareTo(new Integer(bCompid));
    if (tmp == 0) {
    return tmp;
    tmp = a.getRank().compareTo(b.getRank());
    if (tmp !=0) {
    return tmp;
    tmp = new Double(a.getMinratio()).compareTo(new Double(b.getMinratio()));
    if (tmp !=0) {
    return tmp;
    return new Double(a.getMinratio()).compareTo(new Double(b.getMinratio()));
    Client source code below :
    TreeSet list2 = new TreeSet(new test());
    //list2.add(new test(2,1.9,4.2,"NA")); // 1
    list2.add(new test(11,8.5,8.5,"2")); // 3
    list2.add(new test(1,0.6,0.6,"NA")); // 2
    list2.add(new test(11,2.5,2.3,"NA")); // 4
    list2.add(new test(12,0.3,0.3,"1")); // 5
    list2.add(new test(2,1.9,1.2,"NA"));
    list2.add(new test(12,0.9,0.9,"NA"));
    Iterator iterator2 = list2.iterator();
    while(iterator2.hasNext()){
    System.out.println(((test)iterator2.next()).getCompanyid());
    My problem is that the print out display duplicate company id "12" in the set.
    It should not display the duplicate company id in the set.
    What is the problem here ?? Anybody have ideas ??

    Actually, a Set, as defined in java.util.Set, should not contain duplicate members. With SortedSets, however, there must also be consistency between equals() and the compareTo() (or Comparator.compare()). In other words, equal objects must sort to the same or an adjacent place in order for the Set semantics to work.
    In your example, "equal" objects can appear in completely different positions in the sort order, throwing off this consistency. When adding, it's traversing the tree in Rank,MinRatio order. If by chance it runs across a node that has the same company id, it stops and leaves the trees alone (as it does with id=11). If you try graphing the tree out by hand using your compare() as left/right criteria (negative left, positive right, 0 don't change), it'll become immediately clear what's happening.
    Also of interest: you'll find that you can't add test(34,1.9,1.2,"NA") to the list: because it's Rank and MinOrder is the same as the id=2 entry, it'll never get added.

  • Generic Comparator problem

    Hi!
    In our code we use Comparator, but can not make it work with generics.
    The only way is to insert cast in some places, but that destroy the point in using generics in the first place.
    Basically we have a superclass Foo and child classes FooA, FooB, FooC etc. (FooX extends Foo)
    In Foo there is a method that needs to compare two FooX objects (they are always both of the same type).
    So Foo declares an abstract method getComparator() and then calls compare() from it.
    The current code is like this :
    public abstract class Foo {
        public abstract Comparator<? extends Foo> getComparator();
        private int doAndCompare(Foo newFoo) {
            if (0 == this.getComparator().compare(this, newFoo)) {
             // some code ...
    // each FooX is like this
    public class FooA extends Foo {
        static Comparator<FooA> myComparator = new Comparator<FooA>() {
            public int compare(FooA one, FooA two) {
                // the computation is specific for each FooX
                return xxx; // compute and return some int value
        public Comparator<FooA> getComparator() {
            return  myComparator;
    }This code has a compile error in the if statement:
    The method compare(capture-of ? extends Foo, capture-of ? extends Foo) in the type Comparator<capture-of ? extends Foo> is not applicable for the arguments (Foo, Foo)
    I could use "super" instead of "extends" in the getComparator() definition, but the each FooX would have an error, which are solvable only by casting.
    Is there a cast-less solution ?

    This might not be the post that will answer your question (since I honestly do not completely get your question), but might provide some (to) creative insights.
    A weird construct that will work without casting (but probably not very useful):
    public static void main(String[] args) {
         FooX x1 = new FooX();
         FooX x2 = new FooX();
         // requires a parameter of type FooX
         x1.doAndCompare(x2);
         FooY y1 = new FooY();
         FooY y2 = new FooY();
         // requires a parameter of type FooY
         y1.doAndCompare(y2);
         Foo f1 = new FooY();
         Foo f2 = new FooY();
         f1.doAndCompare(y2); // requires a parameter of type Foo, so no actual benifit here? Will work though
         f1.doAndCompare(x2); // Will throw a ClassCastException, so not very usable
    static abstract class Foo<T extends Foo<?>> implements Comparable<T> {
         public void doAndCompare(T foo) {
              if (0 == this.compareTo(foo)) {
                   // do your magic
    static class FooX extends Foo<FooX> {
         public int compareTo(FooX o) {
              // TODO Auto-generated method stub
              return 0;
    static class FooY extends Foo<FooY> {
         public int compareTo(FooY o) {
              // TODO Auto-generated method stub
              return 0;
    }An example that works with casting and that will work:
    public static void main(String[] args) {
         FooX x1 = new FooX();
         FooX x2 = new FooX();
         // requires a parameter of type Foo, FooX.compareTo(FooX) will be invoked
         x1.doAndCompare(x2);
         FooY y1 = new FooY();
         FooY y2 = new FooY();
         // requires a parameter of type Foo, FooY.compareTo(FooY) will be invoked
         y1.doAndCompare(y2);
         // requires a parameter of type Foo
         y1.doAndCompare(x2); // will work
    static abstract class Foo implements Comparable<Foo> {
         public void doAndCompare(Foo foo) {
              if (0 == this.compareTo(foo)) {
                   // do your magic
    static class FooX extends Foo {
         public int compareTo(Foo foo) {
              if (foo instanceof FooX) {
                   return this.compareTo((FooX) foo);
              } else {
                   return 1; // return what's apropriate of not equal
         public int compareTo(FooX fooX) {
              return 0;
    static class FooY extends Foo {
         public int compareTo(Foo foo) {
              if (foo instanceof FooY) {
                   return this.compareTo((FooY) foo);
              } else {
                   return 1; // return what's apropriate of not equal
         public int compareTo(FooY fooY) {
              return 0;
    }I couldn't help noticing that in your original post you very specifically used 'if comparision == 0'. That looks a lot like Foo.equals() to me. Isn't that just what you want?

  • Adobe acrobat pdf compare problem

    I have query on Adobe Acrobat Proffesional 7 on comparing texual difference for the attached two pdf file its show text is identical.
    But in the two pdf files difference is present.
    Please kindly advise on this.
    Thanks..

    If you check teh box to check font issues, then there is a difference indicated with the text comparison. It is indicated that there is a font difference. This was the result I got with AA7 that you said you are using. The characters are apparently the same number, but one in ANSI and the other in Roman of your font style.

  • Array.sort(Object[], comparator) problems

    I have been trying for days to figure out how to sort my array of geneInfo ono the field score1.
    when i try to use Arrays.sort(gInfo, new score1Comp()) it turns all of the array null.
    class score1Comp implements Comparator
    public int compare(Object o1, Object o2)
    geneInfo g1 = (geneInfo)o1;
    geneInfo g2 = (geneInfo)o2;
    // added these checkers to get rid of nullPointerException, but checked to see that most are non null
    if(g1==null&&g2==null)
    return 0;
    if(g1==null)
    return -1;
    if(g2==null)
    return 1;
    if(g1.getScore1() == g2.getScore1())
    return 0;
    else
    double temp = g1.getScore1() - g2.getScore1();
    System.out.println("score g1 - score g2: " + temp);
    System.out.println("rounded: " + (int)Math.round(temp));
    return (int)Math.round(temp);
    public boolean equals(Object obj)
    return obj.equals (this);
    }

    You have sorting your array with null to be the least on value object. For example here:
    MyObject[] objs = new MyObject[1000];
    objs[0] = new MyObject(3);
    objs[1] = new MyObject(2);
    objs[2] = new MyObject(1);
    Arrays.sort(objs, new score1Comp());Guess what the result would be? Your array would have the first 997 elements become null and the last 3 would be sorted to (1), (2), (3).
    So the cause is how your Comparator treats the null value. The solution could be to make sure your sorting array is filled correctly, or reverse the return 1/-1 for the null treatment.
    --lichu                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Comparator Problem in understanding

    hello all please find query as below :
    /* program to alter the ordering of the elements in the collection class TREESET
    class Demo1 overrides compare() of Comparator interface
    which returns the int value.
    when 'return b1.compareTo(a1);' is used then the program output is as
         o/p:- vijay sunil shyjin rupesh ishwar
    i.e., names are displayed in ascending order
    when 'return a1.compareTo(b1);' is used then the program output is as
         o/p:- ishwar rupesh shyjin sunil vijay
    i.e., names are displayed in descending order
    How these change of ordering occurs ?
    import java.util.*;
    class Demo1 implements Comparator
         public int compare(Object a,Object b)
              String a1=(String) a;
              String b1=(String) b;
              return a1.compareTo(b1);
    class DemoComparator
         public static void main(String args[])
              TreeSet t=new TreeSet(new Demo1());
              t.add("sunil");
              t.add("ishwar");
              t.add("shyjin");
              t.add("rupesh");
              t.add("vijay");
              Iterator i=t.iterator();
              while(i.hasNext())
                   Object o=i.next();
                   System.out.print(o+" ");
              System.out.println();
    }

    Per the java docs:
    public interface Comparable
    This interface imposes a total ordering on the objects of each class that implements it. This ordering is referred to as the class's natural ordering, and the class's compareTo method is referred to as its natural comparison method.
    Lists (and arrays) of objects that implement this interface can be sorted automatically by Collections.sort (and Arrays.sort). Objects that implement this interface can be used as keys in a sorted map or elements in a sorted set, without the need to specify a comparator.
    A class's natural ordering is said to be consistent with equals if and only if (e1.compareTo((Object)e2)==0) has the same boolean value as e1.equals((Object)e2) for every e1 and e2 of class C.
    It is strongly recommended (though not required) that natural orderings be consistent with equals. This is so because sorted sets (and sorted maps) without explicit comparators behave "strangely" when they are used with elements (or keys) whose natural ordering is inconsistent with equals. In particular, such a sorted set (or sorted map) violates the general contract for set (or map), which is defined in terms of the equals operation.
    For example, if one adds two keys a and b such that (a.equals((Object)b) && a.compareTo((Object)b) != 0) to a sorted set that does not use an explicit comparator, the second add operation returns false (and the size of the sorted set does not increase) because a and b are equivalent from the sorted set's perspective.
    Virtually all Java core classes that implement comparable have natural orderings that are consistent with equals. One exception is java.math.BigDecimal, whose natural ordering equates BigDecimals with equal values and different precisions (such as 4.0 and 4.00).
    For the mathematically inclined, the relation that defines the natural ordering on a given class C is:
    {(x, y) such that x.compareTo((Object)y) <= 0}.
    The quotient for this total order is:
    {(x, y) such that x.compareTo((Object)y) == 0}.
    It follows immediately from the contract for compareTo that the quotient is an equivalence relation on C, and that the natural ordering is a total order on C. When we say that a class's natural ordering is consistent with equals, we mean that the quotient for the natural ordering is the equivalence relation defined by the class's equals(Object) method:
    {(x, y) such that x.equals((Object)y)}.

  • RME 4.3.1 config compare problem

    Dears,
    I am using LMS 3.2 with RME 4.3.1
    And I use config compare function in RME to compare two versions of one device.
    When I try to show diff only of two different versions.(You may see the result in attached file)
    There is the same line marked as blue(ex:permit IP 172.21.22.46 0.0.0.1 any)
    Maybe because this line has been deleted and added before.( I am not sure because these lines were modified by QPM )
    But in my opinion, this line should be marked as black since the line is exact the same in both versions.
    Is this a bug of RME or it's a normal result?
    Thanks for any response.

    This looks okay as ACLs are order-sensitive.  Just because an ACE is present in two ACLs does not mean the meaning of the ACE is the same in both.  RME's config comparison is context-sensitive, so it is telling you that the meaning of these two ACEs is different.

  • Comparable problem

    i had a class implements comparable, and it has a compareTo method looks like this:
    public int compareTo(Object other)
          if(!(other instanceof NumberObject))
          throw new IllegalArgumentException("It's not a NumberObject");
          NumberObject object = (NumberObject)other;
          return compareTo(object);
    }here is another class that calling compareTo method.
    private boolean find(BinarySearchTreeNode node, NumberObject newNumObj)
        int relation = ((Comparable)newNumObj).compareTo(node.getObject());
        if(relation == 0)
         (node.getObject()).setCount();
          newNumObj = null;
          return true;
        else if(relation > 0)
          find(node.right, newNumObj);
        else if(relation < 0)
          find(node.left, newNumObj);
       return false;
    the queation is i am not sure whether i would work as i supposed or not, could anyone help? thanx in advance

    public int compareTo(Object other)
          if(!(other instanceof NumberObject))
    throw new IllegalArgumentException("It's not a
    a NumberObject");
          NumberObject object = (NumberObject)other;
          return compareTo(object);
    }Unless you have defined a method: public int compateTo(NumberObject object); this method would create an infinite loop, since the last line calls the method again. You should do the comparison after the cast, like:
    if(this.getValue() > object.getValue())
      return 1;
    else
      return -1;or something like that, depending on what the methods the NumberObject has.
    Tuomas Rinta

  • Binary File compare - Problem with char 65533

    Hi,
    I tried to copy an sqlite database (a normal text file) out of my *.jar file. The database is in my java project as a resource file. I read every byte and store it directly into the new file, but somewhow it changes 4 Bytes to 65533! The correct values are 2 times 129 and 2 times 144. It's really strange!
    Have you an idea why this happens? Or is there a better way how to copy out a resource file?
    Thank you for your answers.
            URL u = this.getClass().getResource("/database/resources/mydb.sqlite");
            try {
                InputStreamReader in = new InputStreamReader(u.openStream());
                File outputFile = new File("newdb.sqlite");
                FileWriter out = new FileWriter(outputFile);
                BufferedWriter writer = new BufferedWriter(out);
                while ((c = in.read()) != -1) {
                    writer.write(c);
                in.close();
                writer.close();
            } catch(Exception e) {
                jErrorFld.setText(e.toString());
            }

    Writers are for characters not bytes. Use OutputStreams.

  • RME 4.2 / configuration compare problem

    RME always flag the parameters associated with the
    banner and all parameters that follows it as a delta between 2 images.
    Any clue ?

    Could be due to CSCsu99748
    http://tools.cisco.com/Support/BugToolKit/search/getBugDetails.do?method=fetchBugDetails&bugId=CSCsu99748
    CSCsu99748 Bug Details
    Out of sync on banner when running config fetched by TFTP
    Symptom:
    Device marked as out of sync even though show start and show run are the same. The diff viewer shows that the difference for the configs are due to multiline banners for "banner exec" and "banner login"
    Conditions:
    Appears to affect LMS 3.1 only - LMS 3.0.1 and LMS 2.6 have been observed to be unaffected.
    Latest running config is fetched using TFTP protocol. Telnet and SSH not affected.
    Banners configured for "banner exec" and "banner login". For example:
    banner exec "
    *****************************TEST*******************************
    banner login "
    *****************************TEST*******************************
    Workaround:
    Use telnet or SSH to do fetch the running config instead.
    Or, use the exclusion commands to exclude all banner config if the banner is not a necessary config to be monitored.
    Status
    Fixed
    Severity
    3 - moderate
    Last Modified
    In Last Year
    Product
    CiscoWorks Resource Manager Essentials
    Technology
    1st Found-In
    4.2
    Fixed-In
    4.2
    4.3

  • Gnerics problem with Comparator

    i have to creat a program which deals with LinkedList...but I'll creat my own list which its name is "InOrderLinkedList"
    it's function is to take numbers and put them in the right order node
    i made 2 codes but one of them has an error (which i think it's about Generic Comparator Problem)
    and the other code doesn't have any error...but doesn't do any thing when i run it
    first code is:_
    import java.util.Collections;
    import java.util.List;
    import java.util.*;
    import java.util.Iterator;
    import java.util.ListIterator;
    import java.lang.Integer;
    import java.lang.Object;
    import java.lang.*;
    import javax.swing.*;
    class Node<E>{
              E item_;
              Node nextNode_=null;
              public void setItem(E item){
                   item_=(E)item;
              public Node<E> getNextNode(){
                   return nextNode_;
              public void setNextNode(Node nextNode){
                   this.nextNode_=nextNode;
              public String toString(){
                   return item_.toString();
              E getItem(){
                   return (E)item_;
    /*interface Comparator<E>{
         public int compareTo(E e1,E e2);
    class Comp implements Comparator <Integer>{
         public int compare(Integer e1,Integer e2){
         return e1-e2;
    class LinkedListme<E>{
         Node<Integer> head;
         Node<Integer> tail;
         int size=0;
         public void addFirst(int e){
              /*Node<E> node= new Node<E> (e);
              node.setNextNode(head);
              head=node;
              size++;*/
         public void addLast(int e){
              /*Node<E> node=new Node<E> (e);
              if(head==null){
                   head=node;
                   size++;
                   return;*
              Node<E> lastNode=head;
              while(lastNode.getNextNode()!=null){
                   lastNode=lastNode.getNextNode();
              lastNode.setNextNode(node);*/
         public void clear(){
              head=null;
              size=0;
         public int removeFirst(){
              Node<Integer> firstNode=head;
              head= head.getNextNode();
              size--;
              return firstNode.getItem();
         public int removeLast(){
              if (size==1)
                   return removeFirst();
              if (size==0)
                   return 0;
              Node<Integer> secondLast=head;
              Node<Integer> lastNode=null;
              while(secondLast.getNextNode().getNextNode()!=null){
                   secondLast=secondLast.getNextNode();
              lastNode=secondLast.getNextNode();
              secondLast.setNextNode(null);
              size--;
              return lastNode.getItem();
         public int remove(int index){
              Node<Integer> beforeRemoved=head;
              Node<Integer> removed=null;
              for(int i=1;i<(index-1);i++){
                   beforeRemoved=beforeRemoved.getNextNode();
              removed=beforeRemoved.getNextNode();
              beforeRemoved.setNextNode(removed.getNextNode());
              return removed.getItem();
         public void add(int index,int x){
              /*Node<E> beforeAdd=head;
              Node<E> newNode=new Node<E> (x);
              for(int i=1;i<(index-1);i++){
                   beforeAdd=beforeAdd.getNextNode();
              newNode.setNextNode(beforeAdd.getNextNode());
              beforeAdd.setNextNode(newNode);*/
         /*public void prnt(LinkedListme<E> l){
              System.out.print(l);
    public class InOrderLinkedList <E> extends LinkedListme<E>{
         public void add (int elem){
              Node <Integer> newNode = new Node <Integer>();
              newNode.setItem(elem);
              if(head==null){
                   head=newNode;
                   tail=newNode;
                   newNode.setNextNode(head);
                   head=newNode;
    //public class LinkedListme {
    public static void main(String[]args){
         InOrderLinkedList <Integer> list=new InOrderLinkedList <Integer>();
         Comp com=new Comp();
         list.add(5);
         list.add(5);
         list.add(3);
         list.add(6);
         list.add(3);
         list.add(2);
         list.add(1);
         Collections.sort(list,com); ///here is the error
         System.out.println(list.toString());
    the second code is:_
    import java.util.*;
    import java.util.Iterator;
    import java.util.ListIterator;
    import java.lang.Integer;
    import java.lang.*;
    import javax.swing.*;
    class Node<E>{
              E item_;
              Node <E>nextNode_=null;
              public void setItem(E item){
                   item_=(E)item;
              public Node<E> getNextNode(){
                   return nextNode_;
              public void setNextNode(Node <E>nextNode){
                   this.nextNode_=nextNode;
              public String toString(){
                   return item_.toString();
              E getItem(){
                   return (E)item_;
    /*interface Comparator<E>{
         public int compareTo(E e1,E e2);
    class Comp implements Comparator <Integer>{
         public int compare(Integer e1,Integer e2){
         return e1-e2;
    class LinkedListme<E>{
         Node<Integer> head;
         Node<Integer> tail;
         int size=0;
         public void addFirst(int e){
              /*Node<E> node= new Node<E> (e);
              node.setNextNode(head);
              head=node;
              size++;*/
         public void addLast(int e){
              /*Node<E> node=new Node<E> (e);
              if(head==null){
                   head=node;
                   size++;
                   return;*
              Node<E> lastNode=head;
              while(lastNode.getNextNode()!=null){
                   lastNode=lastNode.getNextNode();
              lastNode.setNextNode(node);*/
         public void clear(){
              head=null;
              size=0;
         public int removeFirst(){
              Node<Integer> firstNode=head;
              head= head.getNextNode();
              size--;
              return firstNode.getItem();
         public int removeLast(){
              if (size==1)
                   return removeFirst();
              if (size==0)
                   return 0;
              Node<Integer> secondLast=head;
              Node<Integer> lastNode=null;
              while(secondLast.getNextNode().getNextNode()!=null){
                   secondLast=secondLast.getNextNode();
              lastNode=secondLast.getNextNode();
              secondLast.setNextNode(null);
              size--;
              return lastNode.getItem();
         public int remove(int index){
              Node<Integer> beforeRemoved=head;
              Node<Integer> removed=null;
              for(int i=1;i<(index-1);i++){
                   beforeRemoved=beforeRemoved.getNextNode();
              removed=beforeRemoved.getNextNode();
              beforeRemoved.setNextNode(removed.getNextNode());
              return removed.getItem();
         public void add(int index,int x){
              /*Node<E> beforeAdd=head;
              Node<E> newNode=new Node<E> (x);
              for(int i=1;i<(index-1);i++){
                   beforeAdd=beforeAdd.getNextNode();
              newNode.setNextNode(beforeAdd.getNextNode());
              beforeAdd.setNextNode(newNode);*/
         /*public void prnt(LinkedListme<E> l){
              System.out.print(l);
    public class InOrderLinkedList <E> extends LinkedListme<E>{
         Comp com=new Comp();
         public void add (int elem){
              Node <Integer> newNode = new Node <Integer>();
              newNode.setItem(elem);
              if(head==null){
                   head=newNode;
                   tail=newNode;
              if(com.compare(head.getItem(), elem)>=0){
                   newNode.setNextNode(head);
                   head=newNode;
                   return;
                   Node<Integer> lastNode=head;
                   //Integer lastNodeInt=(Integer)lastNode;
              int compVal=com.compare(lastNode.getItem(), elem);
              while(compVal<0 && lastNode.getNextNode()!=null){
                   lastNode=lastNode.getNextNode();
              if(lastNode.getNextNode()==null){
                   lastNode.setNextNode(newNode);
              tail=newNode;     
              else{
                   newNode.setNextNode(lastNode.getNextNode());
                   lastNode.setNextNode(newNode);
    //public class LinkedListme {
    public static void main(String[]args){
         InOrderLinkedList <Integer> list=new InOrderLinkedList <Integer>();
         list.add(5);
         list.add(9);
         list.add(3);
         list.add(6);
         list.add(3);
         list.add(2);
         list.add(1);
         System.out.println(list.toString());
    what are thier problems??
    thanks

    So what's the error message?

Maybe you are looking for

  • Error while executing one pl/sql

    i am facing one error while executing a pls/sql kindly suggest the possible cause and solution for the same declare ERROR at line 1: ORA-08102: index key not found, obj# 31850, dba 104863849 (2) ORA-06512: at "ERP.DELBATCHID", line 24 ORA-06512: at l

  • How to use Instant Client  10G DSN-less feature  with SQLDriverConnect?

    We have been trying to use the DSN-less feature of the latest Instant Client, instantclient10_2, with the ODBC programming interface using SQLDriverConnect. We are getting ORA-12560 errors and believe that our connect string isn't correct. The docs d

  • BW Table for T-code RSSM  - Radio Button Checked ODS Infoproviders to AO

    Hello, Need to know the table which reads the tcode RSSM & the table when we check the ODS Infoproviders to right Authorization Objects. RSSM->click Radio Button-->Generating Authorizations for ODS Checks. Table which checks RSSM Tcode Table which ch

  • Can I use data files to control the analog out of PXI-6733?

    Hello, I am new to NI products. I'd like to know if I can use data files(like txt file which contains some amount of data) to generate arbitrary waveform. If this can be done, are there any other file formats can be used to generate arbitrary wavefor

  • Change icloud username

    I have changed provider and need to update lots of  log in info. I have updated my Apple id. but my iCloud log in shows old email address. I started to do the same process as with Aple ID, but when I got to Log Out, it said I would lose all saved dat