001/*
002 =================== DO NOT EDIT THIS FILE ====================
003 Generated by Modello 1.9.0-SNAPSHOT,
004 any modifications will be overwritten.
005 ==============================================================
006 */
007
008package org.codehaus.modello.test.features;
009
010  //---------------------------------/
011 //- Imported classes and packages -/
012//---------------------------------/
013
014import org.codehaus.modello.test.features.other.PackageNameFeature;
015import org.codehaus.modello.test.features.other.SubInterfaceInPackage;
016
017/**
018 * 
019 *         Test of a bidirectional association, ie an association
020 * that has a reference to its parent.
021 *       
022 * 
023 * @version $Revision$ $Date$
024 */
025@SuppressWarnings( "all" )
026public class Bidirectional
027    implements java.io.Serializable
028{
029
030      //--------------------------/
031     //- Class/Member Variables -/
032    //--------------------------/
033
034    /**
035     * Field parent.
036     */
037    private AssociationFeatures parent;
038
039
040      //-----------/
041     //- Methods -/
042    //-----------/
043
044    /**
045     * Method breakAssociationFeaturesAssociation.
046     * 
047     * @param associationFeatures
048     */
049    public void breakAssociationFeaturesAssociation( AssociationFeatures associationFeatures )
050    {
051        if ( this.parent != associationFeatures )
052        {
053            throw new IllegalStateException( "associationFeatures isn't associated." );
054        }
055
056        this.parent = null;
057    } //-- void breakAssociationFeaturesAssociation( AssociationFeatures )
058
059    /**
060     * Method createAssociationFeaturesAssociation.
061     * 
062     * @param associationFeatures
063     */
064    public void createAssociationFeaturesAssociation( AssociationFeatures associationFeatures )
065    {
066        if ( this.parent != null )
067        {
068            breakAssociationFeaturesAssociation( this.parent );
069        }
070
071        this.parent = associationFeatures;
072    } //-- void createAssociationFeaturesAssociation( AssociationFeatures )
073
074    /**
075     * Get the parent field.
076     * 
077     * @return AssociationFeatures
078     */
079    public AssociationFeatures getParent()
080    {
081        return this.parent;
082    } //-- AssociationFeatures getParent()
083
084    /**
085     * Set the parent field.
086     * 
087     * @param parent
088     */
089    public void setParent( AssociationFeatures parent )
090    {
091        if ( this.parent != null )
092        {
093            this.parent.breakBidirectionalAssociation( this );
094        }
095
096        this.parent = parent;
097
098        if ( parent != null )
099        {
100            this.parent.createBidirectionalAssociation( this );
101        }
102    } //-- void setParent( AssociationFeatures )
103
104}