func newClusterNode(fmtr lattice.Formatter, n lattice.Node, attr string) (*clusterNode, error) { items, err := itemset(n, attr) if err != nil { return nil, err } labels, err := labelset(n) if err != nil { return nil, err } cn := &clusterNode{n.Pattern(), fmtr.PatternName(n), items, labels} return cn, nil }
func (r *PrFormatter) FormatMatrices(w io.Writer, fmtr lattice.Formatter, n lattice.Node, m interface{}) error { QRu := m.(*Matrices) bytes, err := json.Marshal(map[string]interface{}{ "Name": fmtr.PatternName(n), "Q": QRu.Q, "R": QRu.R, "u": QRu.U, "startingPoints": 1, }) if err != nil { return err } _, err = w.Write(bytes) if err != nil { return err } _, err = w.Write([]byte("\n")) if err != nil { return err } return nil }