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;
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 import com.google.common.collect.Maps;
19 public class TableUpdate<E extends TableSchema<E>> {
20 private Map<UUID, RowUpdate<E>> rows;
22 public Map<UUID, RowUpdate<E>> getRows() {
26 public class RowUpdate<E extends TableSchema<E>> {
28 private Row<E> oldRow;
29 private Row<E> newRow;
31 public RowUpdate(UUID uuid, Row<E> oldRow, Row<E> newRow) {
37 public UUID getUuid() {
41 public Row<E> getOld() {
45 public void setOld(Row<E> oldRow) {
49 public Row<E> getNew() {
53 public void setNew(Row<E> newRow) {
58 public String toString() {
59 return "RowUpdate [uuid=" + uuid + ", oldRow=" + oldRow + ", newRow=" + newRow
64 public TableUpdate() {
66 rows = Maps.newHashMap();
69 public void addRow(UUID uuid, Row<E> oldRow, Row<E> newRow) {
70 rows.put(uuid, new RowUpdate<E>(uuid, oldRow, newRow));
73 public Row<E> getOld(UUID uuid) {
74 RowUpdate<E> rowUpdate = rows.get(uuid);
75 if (rowUpdate == null) {
78 return rowUpdate.getOld();
81 public Row<E> getNew(UUID uuid) {
82 RowUpdate<E> rowUpdate = rows.get(uuid);
83 if (rowUpdate == null) {
86 return rowUpdate.getNew();
90 public String toString() {
91 return "TableUpdate [" + rows + "]";