package org.graphstream.gama.tests;

import org.graphstream.graph.Edge;
import org.graphstream.graph.Graph;
import org.graphstream.graph.Node;
import org.graphstream.graph.implementations.SingleGraph;
import org.graphstream.stream.SinkAdapter;
import org.graphstream.stream.netstream.NetStreamReceiver;

public class SimpleSinkAdapter extends SinkAdapter {
	
	private Graph graph;

	public SimpleSinkAdapter(NetStreamReceiver receiver) {
		graph = new SingleGraph("test", false, false);
		receiver.getDefaultStream().addSink(graph);
		receiver.getDefaultStream().addSink(this);
	}

	@Override
	public void stepBegins(String sourceId, long timeId, double step) {
		System.out.println("Edges attributes :");
		for(Edge e : graph.getEachEdge()){
			for(Object o : e.getAttributeKeySet()){
				System.out.println(e.getAttribute((String)o).getClass() + " et value = " + e.getAttribute((String)o));
			}
		}
		System.out.println("Nodes attributes :");
		for(Node e : graph.getEachNode()){
			for(Object o : e.getAttributeKeySet()){
				System.out.println(e.getAttribute((String)o).getClass() + " et value = " + e.getAttribute((String)o));
			}
		}
	}

	public Graph getGraph() {
		return graph;
	}

	public void setGraph(Graph graph) {
		this.graph = graph;
	}
}
@@ -834,32 +834,297 @@
 ).getClass()
- + %22 et 
+);%0A%09%09%09%09if(e.getAttribute((String)o).getClass().isArray())%7B%0A%09%09%09%09%09Object%5B%5D array = (Object%5B%5D)e.getAttribute((String)o);%0A%09%09%09%09%09System.out.print('%5Ct');%0A%09%09%09%09%09for(Object ob : array)%0A%09%09%09%09%09%09System.out.print(ob);%0A%09%09%09%09%09System.out.println();%0A%09%09%09%09%7D%0A%09%09%09%09else%7B%0A%09%09%09%09%09System.out.println(%22%5Ct
 value = %22 + 
@@ -1112,35 +1112,33 @@
 tln(%22%5Ctvalue = %22
- + 
++
 e.getAttribute((
@@ -1141,32 +1141,38 @@
 te((String)o));%0A
+%09%09%09%09%7D%0A
 %09%09%09%7D%0A%09%09%7D%0A%09%09Syste
@@ -1351,16 +1351,281 @@
 ss()
- + %22 et 
+);%0A%09%09%09%09if(e.getAttribute((String)o).getClass().isArray())%7B%0A%09%09%09%09%09Object%5B%5D array = (Object%5B%5D)e.getAttribute((String)o);%0A%09%09%09%09%09System.out.print('%5Ct');%0A%09%09%09%09%09for(Object ob : array)%0A%09%09%09%09%09%09System.out.print(ob);%0A%09%09%09%09%09System.out.println();%0A%09%09%09%09%7D%0A%09%09%09%09else%7B%0A%09%09%09%09%09System.out.println(%22%5Ct
 valu
@@ -1633,11 +1633,9 @@
  = %22
- + 
++
 e.ge
@@ -1658,16 +1658,21 @@
 ng)o));%0A
+%09%09%09%09%7D
 %09%09%09%7D%0A%09%09%7D

Update test of received attributes