github.com/acm1/terraform@v0.6.2-0.20150729164239-1f314444f45c/depgraph/noun.go (about) 1 package depgraph 2 3 import ( 4 "fmt" 5 6 "github.com/hashicorp/terraform/digraph" 7 ) 8 9 // Nouns are the key structure of the dependency graph. They can 10 // be used to represent all objects in the graph. They are linked 11 // by depedencies. 12 type Noun struct { 13 Name string // Opaque name 14 Meta interface{} 15 Deps []*Dependency 16 } 17 18 // Edges returns the out-going edges of a Noun 19 func (n *Noun) Edges() []digraph.Edge { 20 edges := make([]digraph.Edge, len(n.Deps)) 21 for idx, dep := range n.Deps { 22 edges[idx] = dep 23 } 24 return edges 25 } 26 27 func (n *Noun) GoString() string { 28 return fmt.Sprintf("*%#v", *n) 29 } 30 31 func (n *Noun) String() string { 32 return n.Name 33 }