/*
 * Addressimpl.java
 * class to implement Address interface
 * in AddressBook API
 */

import addressbooklib.*;
import addressbooklib.Application;
import java.io.Serializable;
import com.ms.com.IUnknown;
import com.ms.com.Variant;

/**
 * Implementation of Address dual interface
 * @Author Ken Bandes
 */
public class Addressimpl 
    implements Address, Serializable
{
    private static final String CLSID = 
        "4F9DFA93-32EF-11D1-B5AC-9E4A44000000";

    /**
     * Constructor
     * @param parent the containing AddressBookimpl object
     */
    public Addressimpl(
                AddressBookimpl parent)
    {
        this.parent = parent;
    }

    /**
     * implementation of addressbook.Address.getApplication
     * @return the Application object for this API instance
     */
    public Application getApplication()
    {
        return parent.getApplication();
    }

    /**
     * implementation of addressbook.Address.getParent
     * @return the parent AddressBook containing this entry
     */
    public AddressBook getParent()
    {
        return (AddressBook) parent;
    }

    /**
     * implementation of addressbook.Address.getName
     * @return the Name field of the entry
     */
    public String getName()
    {
        return name;
    }

    /**
     * implementation of addressbook.Address.setName
     * @param val the Name field of the entry
     */
    public void setName(String val)
    {
        name = val;
        parent.setUnsaved();
    }

    /**
     * implementation of addressbook.Address.getAddress
     * @return the Address field of the entry
     */
    public String getAddress()
    {
        return address;
    }

    /**
     * implementation of addressbook.Address.setAddress
     * @param val the Address field of the entry
     */
    public void setAddress(String val)
    {
        address = val;
        parent.setUnsaved();
    }

    /**
     * implementation of addressbook.Address.getCity
     * @return the City field of the entry
     */
    public String getCity()
    {
        return city;
    }

    /**
     * implementation of addressbook.Address.setCity
     * @param val the City field of the entry
     */
    public void setCity(String val)
    {
        city = val;
        parent.setUnsaved();
    }

    /**
     * implementation of addressbook.Address.getState
     * @return the State field of the entry
     */
    public String getState()
    {
        return state;
    }

    /**
     * implementation of addressbook.Address.setState
     * @param val the State field of the entry
     */
    public void setState(String val)
    {
        state = val;
        parent.setUnsaved();
    }

    /**
     * implementation of addressbook.Address.getZip
     * @return the Zip field of the entry
     */
    public String getZip()
    {
        return zip;
    }

    /**
     * implementation of addressbook.Address.setZip
     * @param val the Zip field of the entry
     */
    public void setZip(String val)
    {
        zip = val;
        parent.setUnsaved();
    }

    /**
     * implementation of addressbook.Address.getPhone
     * @return the Phone field of the entry
     */
    public String getPhone()
    {
        return phone;
    }

    /**
     * implementation of addressbook.Address.setPhone
     * @param val the Phone field of the entry
     */
    public void setPhone(String val)
    {
        phone = val;
        parent.setUnsaved();
    }

    // private data
    private AddressBookimpl parent;
    private String name;
    private String address;
    private String city;
    private String state;
    private String zip;
    private String phone;
}
