// MetaToTableRow converts a list or object into one or more table rows. The provided rowFn is invoked for
// each accessed item, with name and age being passed to each.
964543
func MetaToTableRow(obj runtime.Object, rowFn func(obj runtime.Object, m metav1.Object, name, age string) ([]interface{}, error)) ([]metav1beta1.TableRow, error) {
	if meta.IsListType(obj) {
		rows := make([]metav1beta1.TableRow, 0, 16)
		err := meta.EachListItem(obj, func(obj runtime.Object) error {
			nestedRows, err := MetaToTableRow(obj, rowFn)
			if err != nil {
				return err
			}
			rows = append(rows, nestedRows...)
			return nil
		})
		if err != nil {
			return nil, err
		}
		return rows, nil
	}

	rows := make([]metav1beta1.TableRow, 0, 1)
	m, err := meta.Accessor(obj)
	if err != nil {
		return nil, err
	}
	row := metav1beta1.TableRow{
		Object: runtime.RawExtension{Object: obj},
	}
	row.Cells, err = rowFn(obj, m, m.GetName(), ConvertToHumanReadableDateType(m.GetCreationTimestamp()))
	if err != nil {
		return nil, err
	}
	rows = append(rows, row)
	return rows, nil
}
618420
func (d *Dataset) SaveFirstRowTo(decodedObjects ...interface{}) *Dataset {
	fn := func(reader io.Reader) error {
		return util.TakeMessage(reader, 1, func(encodedBytes []byte) error {
			row, err := util.DecodeRow(encodedBytes)
			if err != nil {
				fmt.Fprintf(os.Stderr, "Failed to decode byte: %v\n", err)
				return err
			}
			var counter int
			for _, v := range row.K {
				if err := setValueTo(v, decodedObjects[counter]); err != nil {
					return err
				}
				counter++
			}
			for _, v := range row.V {
				if err := setValueTo(v, decodedObjects[counter]); err != nil {
					return err
				}
				counter++
			}

			return nil
		})
	}
	return d.Output(fn)
}
691215
func (m *matrix3x3) setRow(row int, p Point) *matrix3x3 {
	m[row][0] = p.X
	m[row][1] = p.Y
	m[row][2] = p.Z

	return m
}
578785
func copyRows(rows []map[string]dosa.FieldValue) []map[string]dosa.FieldValue {
	copied := make([]map[string]dosa.FieldValue, len(rows))
	for i, row := range rows {
		copied[i] = copyRow(row)
	}
	return copied
}
305249
func MetaNamespaceIndexFunc(obj interface{}) ([]string, error) {
	meta, err := meta.Accessor(obj)
	if err != nil {
		return []string{""}, fmt.Errorf("object has no meta: %v", err)
	}
	return []string{meta.GetNamespace()}, nil
}
248325
func (e *ElasticTable) AddRow(row []string) {
	e.rows = append(e.rows, row)
	for i, v := range row {
		l, c := runeWidth(v), &e.cols[i]
		if l < c.min {
			c.min = l
		}
		if l > c.max {
			c.max, c.width = l, l
		}
	}
}
821447
func (m *Mat4) SetRow(row int, v Vec4) {
	m[row+0], m[row+4], m[row+8], m[row+12] = v[0], v[1], v[2], v[3]
}
64308
func (l *List) AppendRow(row Row) RowPtr {
	chkIdx := len(l.chunks) - 1
	if chkIdx == -1 || l.chunks[chkIdx].NumRows() >= l.chunks[chkIdx].Capacity() || chkIdx == l.consumedIdx {
		newChk := l.allocChunk()
		l.chunks = append(l.chunks, newChk)
		if chkIdx != l.consumedIdx {
			l.memTracker.Consume(l.chunks[chkIdx].MemoryUsage())
			l.consumedIdx = chkIdx
		}
		chkIdx++
	}
	chk := l.chunks[chkIdx]
	rowIdx := chk.NumRows()
	chk.AppendRow(row)
	l.length++
	return RowPtr{ChkIdx: uint32(chkIdx), RowIdx: uint32(rowIdx)}
}
833160
func (d *Dataset) Row(index int) (map[string]interface{}, error) {
	if index < 0 || index >= d.rows {
		return nil, ErrInvalidRowIndex
	}

	row := make(map[string]interface{})
	for i, e := range d.data[index] {
		switch e.(type) {
		case DynamicColumn:
			row[d.headers[i]] = e.(DynamicColumn)(d.data[index])
		default:
			row[d.headers[i]] = e
		}
	}
	return row, nil
}
147680
func ReadRow(reader io.Reader) (row *Row, err error) {
	encodedBytes, hasErr := ReadMessage(reader)
	if hasErr != nil {
		if hasErr != io.EOF {
			return row, fmt.Errorf("ReadRow ReadMessage: %v", hasErr)
		}
		return row, io.EOF
	}
	if row, err = DecodeRow(encodedBytes); err != nil {
		return row, fmt.Errorf("ReadRow failed to decode byte: %v", err)
	}
	return row, err
}
1320290
func (nuageTable *NuageTable) InsertRow(ovs *libovsdb.OvsdbClient, row NuageTableRow) error {

	glog.V(2).Infof("Trying to insert (%+v) into the Nuage Table (%s)", row, nuageTable.TableName)

	ovsdbRow := make(map[string]interface{})
	err := row.CreateOVSDBRow(ovsdbRow)
	if err != nil {
		glog.Errorf("Unable to create the OVSDB row %v", err)
		return err
	}

	insertOp := libovsdb.Operation{
		Op:       "insert",
		Table:    nuageTable.TableName,
		Row:      ovsdbRow,
		UUIDName: "gopher",
	}

	operations := []libovsdb.Operation{insertOp}
	reply, err := ovs.Transact(OvsDBName, operations...)

	glog.V(2).Infof("reply : (%+v) err : (%+v)", reply, err)

	if err != nil || len(reply) != 1 || reply[0].Error != "" {
		errStr := fmt.Errorf("Problem inserting row in the Nuage table row = "+
			" (%+v) ovsdbrow (%+v) err (%+v) reply (%+v)", row, ovsdbRow, err, reply)
		glog.Error(errStr)
		return (errStr)
	}

	glog.V(2).Info("Insertion into Nuage VM Table succeeded with UUID %s", reply[0].UUID)

	return nil
}
721472
func (s *translateStore) TranslateRowToString(index, frame string, values uint64) (string, error) {
	return "", pilosa.ErrNotImplemented
}
201652
func (s *Sheet) AddRow() *Row {
	row := &Row{Sheet: s}
	s.Rows = append(s.Rows, row)
	if len(s.Rows) > s.MaxRow {
		s.MaxRow = len(s.Rows)
	}
	return row
}
50939
func (g *Grid) RemoveRow(index int) {
	if index < g.rows {
		g.rows--
		for i := index; i <= g.rows; i++ {
			for j := 0; j < g.cols; j++ {
				if i == g.rows {
					delete(g.cells, image.Point{j, g.rows})
				} else {
					g.cells[image.Point{j, i}] = g.cells[image.Point{j, i + 1}]
				}
			}
		}
	}
}
1232485
func (l *State) MetaTable(index int) bool {
	var mt *table
	switch v := l.indexToValue(index).(type) {
	case *table:
		mt = v.metaTable
	case *userData:
		mt = v.metaTable
	default:
		mt = l.global.metaTable(v)
	}
	if mt == nil {
		return false
	}
	l.apiPush(mt)
	return true
}
211136
func hasOnlySetRowAttrs(calls []*pql.Call) bool {
	if len(calls) == 0 {
		return false
	}

	for _, call := range calls {
		if call.Name != "SetRowAttrs" {
			return false
		}
	}
	return true
}
638864
func (f *fragment) row(rowID uint64) *Row {
	f.mu.Lock()
	defer f.mu.Unlock()
	return f.unprotectedRow(rowID)
}