Menu

Extending DirectedSparseEdge

Anonymous
2003-11-16
2003-11-16
  • Anonymous

    Anonymous - 2003-11-16

    When trying to extend DirectedSparseEdge I get the following error:

    jungtest.java:6: cannot resolve symbol
    symbol  : constructor DirectedSparseEdge ()
    location: class edu.uci.ics.jung.graph.impl.DirectedSparseEdge
        public jungtest(DirectedSparseVertex from, DirectedSparseVertex to) {
                                                                            ^
    The file is simply contains:
    import edu.uci.ics.jung.graph.impl.DirectedSparseEdge;
    import edu.uci.ics.jung.graph.impl.DirectedSparseVertex;

    public class jungtest extends DirectedSparseEdge {
       
        public jungtest(DirectedSparseVertex from, DirectedSparseVertex to) {
           
        }
    }

     
    • Anonymous

      Anonymous - 2003-11-16

      Sorry about the text formatting. The Carot marking the error is under the first curly bracket in the constructor

       
    • D. Fisher

      D. Fisher - 2003-11-16

      Joshua,

      By default, in Java, a constructor starts off by calling the constructor of its superclass. Thus, your function is essentially

      public jungtest ( ... ) {
         super();
      }

      As the system is pointing out, that's not the appropriate constructor for the superclass. Try, instead,

      public jungtest(DirectedSparseVertex from, DirectedSparseVertex to) {
         super( from, to );
      }

      For a good example, look at the source code for BipartiteGraph, which extends UndirectedSparseGraph.

       

Log in to post a comment.