2 * Copyright © 2014, 2017 EBay Software Foundation and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.ovsdb.lib.message;
10 import java.util.HashMap;
12 import org.opendaylight.ovsdb.lib.notation.Row;
13 import org.opendaylight.ovsdb.lib.notation.UUID;
14 import org.opendaylight.ovsdb.lib.schema.TableSchema;
16 public class TableUpdate<E extends TableSchema<E>> {
17 private final Map<UUID, RowUpdate<E>> rows = new HashMap<>();
19 public Map<UUID, RowUpdate<E>> getRows() {
23 public static final class RowUpdate<E extends TableSchema<E>> {
24 private final UUID uuid;
25 private final Row<E> oldRow;
26 private final Row<E> newRow;
28 public RowUpdate(final UUID uuid, final Row<E> oldRow, final Row<E> newRow) {
34 public UUID getUuid() {
38 public Row<E> getOld() {
42 public Row<E> getNew() {
47 public String toString() {
48 return "RowUpdate [uuid=" + uuid + ", oldRow=" + oldRow + ", newRow=" + newRow + "]";
52 public void addRow(final UUID uuid, final Row<E> oldRow, final Row<E> newRow) {
53 rows.put(uuid, new RowUpdate<>(uuid, oldRow, newRow));
56 public Row<E> getOld(final UUID uuid) {
57 RowUpdate<E> rowUpdate = rows.get(uuid);
58 return rowUpdate != null ? rowUpdate.getOld() : null;
61 public Row<E> getNew(final UUID uuid) {
62 RowUpdate<E> rowUpdate = rows.get(uuid);
63 return rowUpdate != null ? rowUpdate.getNew() : null;
67 public String toString() {
68 return "TableUpdate [" + rows + "]";