github.com/ezbercih/terraform@v0.1.1-0.20140729011846-3c33865e0839/depgraph/noun.go (about)

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