File: GraphArguments.cs

package info (click to toggle)
graphviz 2.26.3-5%2Bsqueeze2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 63,032 kB
  • ctags: 25,930
  • sloc: ansic: 212,134; sh: 20,316; cpp: 7,239; makefile: 4,211; yacc: 3,335; xml: 2,450; tcl: 1,900; cs: 1,890; objc: 1,149; perl: 829; lex: 363; awk: 171; python: 41; ruby: 35; php: 26
file content (134 lines) | stat: -rwxr-xr-x 3,527 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/* $Id: GraphArguments.cs,v 1.3 2009/06/03 01:10:59 ellson Exp $ $Revision: 1.3 $ */
/* vim:set shiftwidth=4 ts=8: */

/**********************************************************
*      This software is part of the graphviz package      *
*                http://www.graphviz.org/                 *
*                                                         *
*            Copyright (c) 1994-2008 AT&T Corp.           *
*                and is licensed under the                *
*            Common Public License, Version 1.0           *
*                      by AT&T Corp.                      *
*                                                         *
*        Information and Software Systems Research        *
*              AT&T Research, Florham Park NJ             *
**********************************************************/

using System;
using System.Collections;
using System.Collections.Generic;

namespace Graphviz
{
	public class GraphArguments : IDictionary<string, string>
	{
		public GraphArguments(Graph graph)
		{
			_dictionary = new Dictionary<string, string>();
			_graph = graph;
		}
		
		void IDictionary<string, string>.Add(string key, string value)
		{
			_dictionary.Add(key, value);
			_graph.NoteChanged(true);
		}

		bool IDictionary<string, string>.ContainsKey(string key)
		{
			return _dictionary.ContainsKey(key);
		}

		ICollection<string> IDictionary<string, string>.Keys
		{
			get { return _dictionary.Keys; }
		}

		bool IDictionary<string, string>.Remove(string key)
		{
			if (_dictionary.Remove(key)) {
				_graph.NoteChanged(true);
				return true;
			}
			else
				return false;
		}

		bool IDictionary<string, string>.TryGetValue(string key, out string value)
		{
			return _dictionary.TryGetValue(key, out value);
		}

		ICollection<string> IDictionary<string, string>.Values
		{
			get { return _dictionary.Values; }
		}

		string IDictionary<string, string>.this[string key]
		{
			get
			{
				return _dictionary[key];
			}
			set
			{
				_dictionary[key] = value;
				_graph.NoteChanged(true);
			}
		}

		void ICollection<KeyValuePair<string, string>>.Add(KeyValuePair<string, string> item)
		{
			_dictionary.Add(item);
		}

		void ICollection<KeyValuePair<string, string>>.Clear()
		{
			_dictionary.Clear();
			_graph.NoteChanged(true);
		}

		bool ICollection<KeyValuePair<string, string>>.Contains(KeyValuePair<string, string> item)
		{
			return _dictionary.Contains(item);
		}

		void ICollection<KeyValuePair<string, string>>.CopyTo(KeyValuePair<string, string>[] array, int arrayIndex)
		{
			_dictionary.CopyTo(array, arrayIndex);
		}

		int ICollection<KeyValuePair<string, string>>.Count
		{
			get { return ((ICollection<KeyValuePair<string, string>>)_dictionary).Count; }
		}

		bool ICollection<KeyValuePair<string, string>>.IsReadOnly
		{
			get { return true; }
		}

		bool ICollection<KeyValuePair<string, string>>.Remove(KeyValuePair<string, string> item)
		{
			if (_dictionary.Remove(item)) {
				_graph.NoteChanged(true);
				return true;
			}
			else
				return false;
		}

		IEnumerator<KeyValuePair<string, string>> IEnumerable<KeyValuePair<string, string>>.GetEnumerator()
		{
			return _dictionary.GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return _dictionary.GetEnumerator();
		}

		private readonly Graph _graph;
		private readonly IDictionary<string, string> _dictionary;
	}
}