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