/*
Visual TODO List v1.1
Copyright Florent D'Halluin 2010
This file is part of Visual TODO List v1.1.
See VisualTODO.pde for help.
COPYRIGHT NOTICE
------------------------------------------------------------------------
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 3 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, see .
------------------------------------------------------------------------
*/
// Graph definition
class Edge implements Comparable
{
public Edge()
{
}
Edge(int id, int order, String type, String text, Vertex p, Vertex s)
{
this.id = id;
this.order = order;
this.type = type;
this.text = text;
this.p = p;
this.s = s;
}
void writeExternal(ObjectOutput out) throws IOException
{
out.writeInt(id);
out.writeInt(order);
out.writeInt(p.id);
out.writeInt(s.id);
out.writeObject(type);
out.writeObject(text);
}
void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
id = in.readInt();
order = in.readInt();
int p_id = in.readInt();
int s_id = in.readInt();
type = (String) in.readObject();
text = (String) in.readObject();
edges.put(id, this);
p = vertices.get(p_id);
s = vertices.get(s_id);
p.s.put(this, s);
s.p.put(this, p);
}
int compareTo(Edge e)
{
if (id == e.id)
return 0;
if (order < e.order)
return -1;
if (order > e.order)
return 1;
if (id < e.id)
return -1;
return 1;
}
void save()
{
if (saver.saveEdge(this))
confirmation = 1;
}
int id;
int order;
String type;
String text;
Vertex p;
Vertex s;
}