2 * Copyright (c) 2016 Ericsson India Global Services Pvt Ltd. 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.genius.mdsalutil;
10 import com.google.common.base.MoreObjects;
11 import java.io.Serializable;
12 import java.math.BigInteger;
13 import java.util.Arrays;
14 import java.util.List;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
18 public class InstructionInfo extends AbstractActionInfoList implements Serializable {
20 private static final long serialVersionUID = 1L;
22 private final InstructionType m_instructionType;
23 private final long[] m_alInstructionValues;
24 private final BigInteger[] m_alBigInstructionValues;
26 // This constructor should be used incase of clearAction
27 public InstructionInfo(InstructionType instructionType) {
29 m_instructionType = instructionType;
30 m_alInstructionValues = null;
31 m_alBigInstructionValues = null;
34 public InstructionInfo(InstructionType instructionType, long[] instructionValues) {
36 m_instructionType = instructionType;
37 m_alInstructionValues = instructionValues;
38 m_alBigInstructionValues = null;
41 public InstructionInfo(InstructionType instructionType, BigInteger[] instructionValues) {
43 m_instructionType = instructionType;
44 m_alInstructionValues = null;
45 m_alBigInstructionValues = instructionValues;
48 public InstructionInfo(InstructionType instructionType, List<ActionInfo> actionInfos) {
50 m_instructionType = instructionType;
51 m_alInstructionValues = null;
52 m_alBigInstructionValues = null;
55 public Instruction buildInstruction(int instructionKey) {
56 return m_instructionType.buildInstruction(this, instructionKey);
59 public InstructionType getInstructionType() {
60 return m_instructionType;
63 public long[] getInstructionValues() {
64 return m_alInstructionValues;
67 public BigInteger[] getBigInstructionValues() {
68 return m_alBigInstructionValues;
72 public String toString() {
73 return MoreObjects.toStringHelper(this).omitNullValues().add("instructionType", m_instructionType)
74 .add("instructionValues", Arrays.toString(m_alInstructionValues))
75 .add("bigInstructionValues", Arrays.deepToString(m_alBigInstructionValues))
76 .add("actionInfos", getActionInfos()).toString();