2 * Copyright (c) 2014, 2015 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
9 package org.opendaylight.ovsdb.lib.message;
11 import com.google.common.collect.Maps;
13 import org.opendaylight.ovsdb.lib.notation.Row;
14 import org.opendaylight.ovsdb.lib.notation.UUID;
15 import org.opendaylight.ovsdb.lib.schema.TableSchema;
17 public class TableUpdate<E extends TableSchema<E>> {
18 private Map<UUID, RowUpdate<E>> rows;
20 public Map<UUID, RowUpdate<E>> getRows() {
24 public class RowUpdate<E extends TableSchema<E>> {
26 private Row<E> oldRow;
27 private Row<E> newRow;
29 public RowUpdate(UUID uuid, Row<E> oldRow, Row<E> newRow) {
35 public UUID getUuid() {
39 public Row<E> getOld() {
43 public void setOld(Row<E> oldRow) {
47 public Row<E> getNew() {
51 public void setNew(Row<E> newRow) {
56 public String toString() {
57 return "RowUpdate [uuid=" + uuid + ", oldRow=" + oldRow + ", newRow=" + newRow
62 public TableUpdate() {
64 rows = Maps.newHashMap();
67 public void addRow(UUID uuid, Row<E> oldRow, Row<E> newRow) {
68 rows.put(uuid, new RowUpdate<>(uuid, oldRow, newRow));
71 public Row<E> getOld(UUID uuid) {
72 RowUpdate<E> rowUpdate = rows.get(uuid);
73 if (rowUpdate == null) {
76 return rowUpdate.getOld();
79 public Row<E> getNew(UUID uuid) {
80 RowUpdate<E> rowUpdate = rows.get(uuid);
81 if (rowUpdate == null) {
84 return rowUpdate.getNew();
88 public String toString() {
89 return "TableUpdate [" + rows + "]";