/*
 * This Java file has been generated by smidump 0.2.17. Do not edit!
 * It is intended to be used within a Java AgentX sub-agent environment.
 *
 * $Id: IfTestTable.java 8676 2008-01-17 23:11:17Z ispringer $
 */

/**
    This class represents a Java AgentX (JAX) implementation of
    the table ifTestTable defined in IF-MIB.

    @version 1
    @author  smidump 0.2.17
    @see     AgentXTable
 */

import java.util.Vector;

import jax.AgentXOID;
import jax.AgentXVarBind;
import jax.AgentXResponsePDU;
import jax.AgentXSetPhase;
import jax.AgentXTable;
import jax.AgentXEntry;

public class IfTestTable extends AgentXTable
{

    // entry OID
    private final static long[] OID = {1, 3, 6, 1, 2, 1, 31, 1, 3, 1};

    // constructors
    public IfTestTable()
    {
        oid = new AgentXOID(OID);

        // register implemented columns
        columns.addElement(new Long(1));
        columns.addElement(new Long(2));
        columns.addElement(new Long(3));
        columns.addElement(new Long(4));
        columns.addElement(new Long(5));
        columns.addElement(new Long(6));
    }

    public IfTestTable(boolean shared)
    {
        super(shared);

        oid = new AgentXOID(OID);

        // register implemented columns
        columns.addElement(new Long(1));
        columns.addElement(new Long(2));
        columns.addElement(new Long(3));
        columns.addElement(new Long(4));
        columns.addElement(new Long(5));
        columns.addElement(new Long(6));
    }

    public AgentXVarBind getVarBind(AgentXEntry entry, long column)
    {
        AgentXOID oid = new AgentXOID(getOID(), column, entry.getInstance());

        switch ((int)column) {
        case 1: // ifTestId
        {
            int value = ((IfTestEntry)entry).get_ifTestId();
            return new AgentXVarBind(oid, AgentXVarBind.INTEGER, value);
        }
        case 2: // ifTestStatus
        {
            int value = ((IfTestEntry)entry).get_ifTestStatus();
            return new AgentXVarBind(oid, AgentXVarBind.INTEGER, value);
        }
        case 3: // ifTestType
        {
            AgentXOID value = ((IfTestEntry)entry).get_ifTestType();
            return new AgentXVarBind(oid, AgentXVarBind.OBJECTIDENTIFIER, value);
        }
        case 4: // ifTestResult
        {
            int value = ((IfTestEntry)entry).get_ifTestResult();
            return new AgentXVarBind(oid, AgentXVarBind.INTEGER, value);
        }
        case 5: // ifTestCode
        {
            AgentXOID value = ((IfTestEntry)entry).get_ifTestCode();
            return new AgentXVarBind(oid, AgentXVarBind.OBJECTIDENTIFIER, value);
        }
        case 6: // ifTestOwner
        {
            byte[] value = ((IfTestEntry)entry).get_ifTestOwner();
            return new AgentXVarBind(oid, AgentXVarBind.OCTETSTRING, value);
        }
        }

        return null;
    }

    public int setEntry(AgentXSetPhase phase,
                        AgentXEntry entry,
                        long column,
                        AgentXVarBind vb)
    {

        switch ((int)column) {
        case 1: // ifTestId
        {
            if (vb.getType() != AgentXVarBind.INTEGER)
                return AgentXResponsePDU.WRONG_TYPE;
            else
                return ((IfTestEntry)entry).set_ifTestId(phase, vb.intValue());
        }
        case 2: // ifTestStatus
        {
            if (vb.getType() != AgentXVarBind.INTEGER)
                return AgentXResponsePDU.WRONG_TYPE;
            else
                return ((IfTestEntry)entry).set_ifTestStatus(phase, vb.intValue());
        }
        case 3: // ifTestType
        {
            if (vb.getType() != AgentXVarBind.OBJECTIDENTIFIER)
                return AgentXResponsePDU.WRONG_TYPE;
            else
                return ((IfTestEntry)entry).set_ifTestType(phase, vb.AgentXOIDValue());
        }
        case 6: // ifTestOwner
        {
            if (vb.getType() != AgentXVarBind.OCTETSTRING)
                return AgentXResponsePDU.WRONG_TYPE;
            else
                return ((IfTestEntry)entry).set_ifTestOwner(phase, vb.bytesValue());
        }
        }

        return AgentXResponsePDU.NOT_WRITABLE;
    }

}

