Hi Jens,
Thanks for the prompt response.
I was playing with jgrapht for a couple of hours -
In the file org.jgrapht.graph.AbstractBaseGraph.java (which extends AbstractGraph)
AbstractBaseGraph<V, E> newGraph =
TypeUtil.uncheckedCast(super.clone(), typeDecl);
In the file org.jgrapht.graph.AbstractGraph.java
- there is no clone() implementation - so the compiler looks for Object.clone
Also in the file org.jgrapht.graph.IntrusiveEdge.java
Again - the compiler looks for Object.clone
So, I implemented a clone() in AbstractGraph.java & IntrusiveEdge.java
And finally I hit :- ClassBasedEdgeFactory.java
Maybe I am doing something wrong.. any pointers is helpful.
Regards
On Thursday, September 12, 2013 4:06:03 PM UTC-4, Jens wrote:
-- Thanks for the prompt response.
I was playing with jgrapht for a couple of hours -
In the file org.jgrapht.graph.AbstractBaseGraph.java (which extends AbstractGraph)
AbstractBaseGraph<V, E> newGraph =
TypeUtil.uncheckedCast(super.clone(), typeDecl);
In the file org.jgrapht.graph.AbstractGraph.java
public abstract class AbstractGraph<V, E>
implements Graph<V, E>
implements Graph<V, E>
- there is no clone() implementation - so the compiler looks for Object.clone
Also in the file org.jgrapht.graph.IntrusiveEdge.java
class IntrusiveEdge
implements Cloneable,
Serializable
{
/**
* @see Object#clone()
*/
public Object clone()
{
try {
return super.clone();
} catch (CloneNotSupportedException e) {
// shouldn't happen as we are Cloneable
throw new InternalError();
}
}
}
implements Cloneable,
Serializable
{
/**
* @see Object#clone()
*/
public Object clone()
{
try {
return super.clone();
} catch (CloneNotSupportedException e) {
// shouldn't happen as we are Cloneable
throw new InternalError();
}
}
}
Again - the compiler looks for Object.clone
So, I implemented a clone() in AbstractGraph.java & IntrusiveEdge.java
And finally I hit :- ClassBasedEdgeFactory.java
private final Class<? extends E> edgeClass;
.
.
public E createEdge(V source, V target)
{
try {
return edgeClass.newInstance();
} catch (Exception ex) {
throw new RuntimeException("Edge factory failed", ex);
}
}
At this point :- I looked for some other graph library. :(.
.
public E createEdge(V source, V target)
{
try {
return edgeClass.newInstance();
} catch (Exception ex) {
throw new RuntimeException("Edge factory failed", ex);
}
}
Maybe I am doing something wrong.. any pointers is helpful.
Regards
On Thursday, September 12, 2013 4:06:03 PM UTC-4, Jens wrote:
I am looking for an implementation of a Directed Graph for my GWT project - came across jgrapht - but porting it to GWT with all "CloneNotSupportedException" / "Object.clone()" / "newInstance()" issues proved to be troublesome.Looks like JGraphT does not use newInstance() in the library itself, only in a test case. GWT trunk already emulates CloneNotSupportedException so implementing clone() methods would also work. But be aware that GWT does not provide an implementation of Object.clone() so at some point you must create the instance on your own instead of calling super.clone().But maybe you don't even need to emulate clone() because the only library class that calls .clone() is an adapter class for JGraph <-> JGraphT living outside of jgrapht-core.So I think jgrapht-core can made GWT ready without major issues.Search ".newInstance()": https://github.com/jgrapht/jgrapht/ search?q=.newInstance%28%29& type=Code Search ".clone()": https://github.com/jgrapht/jgrapht/search?q=. clone%28%29&type=Code -- J.
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment