001/*
002 * Copyright 2006 - 2013
003 *     Stefan Balev     <stefan.balev@graphstream-project.org>
004 *     Julien Baudry    <julien.baudry@graphstream-project.org>
005 *     Antoine Dutot    <antoine.dutot@graphstream-project.org>
006 *     Yoann Pigné      <yoann.pigne@graphstream-project.org>
007 *     Guilhelm Savin   <guilhelm.savin@graphstream-project.org>
008 * 
009 * This file is part of GraphStream <http://graphstream-project.org>.
010 * 
011 * GraphStream is a library whose purpose is to handle static or dynamic
012 * graph, create them from scratch, file or any source and display them.
013 * 
014 * This program is free software distributed under the terms of two licenses, the
015 * CeCILL-C license that fits European law, and the GNU Lesser General Public
016 * License. You can  use, modify and/ or redistribute the software under the terms
017 * of the CeCILL-C license as circulated by CEA, CNRS and INRIA at the following
018 * URL <http://www.cecill.info> or under the terms of the GNU LGPL as published by
019 * the Free Software Foundation, either version 3 of the License, or (at your
020 * option) any later version.
021 * 
022 * This program is distributed in the hope that it will be useful, but WITHOUT ANY
023 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
024 * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
025 * 
026 * You should have received a copy of the GNU Lesser General Public License
027 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
028 * 
029 * The fact that you are presently reading this means that you have had
030 * knowledge of the CeCILL-C and LGPL licenses and that you accept their terms.
031 */
032package org.graphstream.stream;
033
034/**
035 * Interface to listen at changes on attributes of a graph.
036 * 
037 * <p>
038 * The graph attributes listener is called each time an attribute is added, or
039 * removed, and each time its value is changed.
040 * </p>
041 */
042public interface AttributeSink {
043        /**
044         * A graph attribute was added.
045         * 
046         * @param sourceId
047         *            Identifier of the graph where the attribute changed.
048         * @param attribute
049         *            The attribute name.
050         * @param value
051         *            The attribute new value.
052         */
053        void graphAttributeAdded(String sourceId, long timeId, String attribute,
054                        Object value);
055
056        /**
057         * A graph attribute was changed.
058         * 
059         * @param sourceId
060         *            Identifier of the graph where the attribute changed.
061         * @param attribute
062         *            The attribute name.
063         * @param oldValue
064         *            The attribute old value.
065         * @param newValue
066         *            The attribute new value.
067         */
068        void graphAttributeChanged(String sourceId, long timeId, String attribute,
069                        Object oldValue, Object newValue);
070
071        /**
072         * A graph attribute was removed.
073         * 
074         * @param sourceId
075         *            Identifier of the graph where the attribute was removed.
076         * @param attribute
077         *            The removed attribute name.
078         */
079        void graphAttributeRemoved(String sourceId, long timeId, String attribute);
080
081        /**
082         * A node attribute was added.
083         * 
084         * @param sourceId
085         *            Identifier of the graph where the change occurred.
086         * @param nodeId
087         *            Identifier of the node whose attribute changed.
088         * @param attribute
089         *            The attribute name.
090         * @param value
091         *            The attribute new value.
092         */
093        void nodeAttributeAdded(String sourceId, long timeId, String nodeId,
094                        String attribute, Object value);
095
096        /**
097         * A node attribute was changed.
098         * 
099         * @param sourceId
100         *            Identifier of the graph where the change occurred.
101         * @param nodeId
102         *            Identifier of the node whose attribute changed.
103         * @param attribute
104         *            The attribute name.
105         * @param oldValue
106         *            The attribute old value.
107         * @param newValue
108         *            The attribute new value.
109         */
110        void nodeAttributeChanged(String sourceId, long timeId, String nodeId,
111                        String attribute, Object oldValue, Object newValue);
112
113        /**
114         * A node attribute was removed.
115         * 
116         * @param sourceId
117         *            Identifier of the graph where the attribute was removed.
118         * @param nodeId
119         *            Identifier of the node whose attribute was removed.
120         * @param attribute
121         *            The removed attribute name.
122         */
123        void nodeAttributeRemoved(String sourceId, long timeId, String nodeId,
124                        String attribute);
125
126        /**
127         * A edge attribute was added.
128         * 
129         * @param sourceId
130         *            Identifier of the graph where the change occurred.
131         * @param edgeId
132         *            Identifier of the edge whose attribute changed.
133         * @param attribute
134         *            The attribute name.
135         * @param value
136         *            The attribute new value.
137         */
138        void edgeAttributeAdded(String sourceId, long timeId, String edgeId,
139                        String attribute, Object value);
140
141        /**
142         * A edge attribute was changed.
143         * 
144         * @param sourceId
145         *            Identifier of the graph where the change occurred.
146         * @param edgeId
147         *            Identifier of the edge whose attribute changed.
148         * @param attribute
149         *            The attribute name.
150         * @param oldValue
151         *            The attribute old value.
152         * @param newValue
153         *            The attribute new value.
154         */
155        void edgeAttributeChanged(String sourceId, long timeId, String edgeId,
156                        String attribute, Object oldValue, Object newValue);
157
158        /**
159         * A edge attribute was removed.
160         * 
161         * @param sourceId
162         *            Identifier of the graph where the attribute was removed.
163         * @param edgeId
164         *            Identifier of the edge whose attribute was removed.
165         * @param attribute
166         *            The removed attribute name.
167         */
168        void edgeAttributeRemoved(String sourceId, long timeId, String edgeId,
169                        String attribute);
170}