Nice TWiki > Doc > CodeExamples > GraphParametricTypeExample > GraphConceptsExample (r1.3) TWiki webs:
Dev | Doc | Main | TWiki | Sandbox
Doc . { Changes | Index | Search | Go }
// compilation unit GraphConcepts.nice
package graph;

public interface GraphEdge<Vertex> {
   Vertex source();
   Vertex target();
}

<E> Iterator<E> forIterator(Iterator<E> it) = it;

public interface VertexListGraph<Vertex, Dummy> {
   Iterator<Vertex> vertices();
   int nVertices();
}

public interface IncidenceGraph<Vertex, Edge> {
   Iterator<Edge> outEdges(Vertex v);
   int outDegree(Vertex v);
}

public interface EdgeListGraph<Vertex, Edge> {
   Iterator<Edge> edges();
}

public interface VertexListAndIncidenceGraph<Vertex, Edge> 
   extends VertexListGraph<Vertex, Edge>, IncidenceGraph<Vertex, Edge> 
{}

public interface VertexListAndIncidenceAndEdgeListGraph<Vertex, Edge> 
   extends VertexListAndIncidenceGraph<Vertex, Edge>, EdgeListGraph<Vertex, Edge>
{}

// compilation unit GeneralConcepts.nice
package graph;

// Queue concepts:
public interface Buffer<T> {
  void push(T value);
  T pop();
  boolean empty();
}

public interface MutableBuffer<T> extends Buffer<T> {
  void update(T value);
}

// Property map concepts:
public interface ReadablePropertyMap<K, V> {
  V get(K key);
}

public interface ReadWritePropertyMap<K, V> extends ReadablePropertyMap<K, V> {
  void set(K key, V value);
}

-- IsaacGouy - 07 Jan 2004

Topic GraphConceptsExample . { Edit | Attach | Ref-By | Printable | Diffs | r1.7 | > | r1.6 | > | r1.5 | More }
Revision r1.3 - 07 Feb 2004 - 16:22 GMT - IsaacGouy
Parents: WebHome > CodeExamples > GraphParametricTypeExample
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback.

Doc.GraphConceptsExample moved from Doc.GraphConceptsExamples on 08 Jan 2004 - 09:16 by IsaacGouy - put it back