/* Generated by JSDAI Express Compiler, version 3.5, build 225, 2003-04-23 */

// Java class implementing entity second_entity$third_entity

package jsdai.SExample_2;
import jsdai.lang.*;

public class CSecond_entity$third_entity extends CEntity implements ESecond_entity, EThird_entity {
	public static final jsdai.dictionary.CEntity_definition definition = initEntityDefinition(CSecond_entity$third_entity.class, SExample_2.ss);

	/*----------------------------- Attributes -----------*/

	protected int a0; // attr_1 - non-java inheritance - INTEGER
	protected static final jsdai.dictionary.CExplicit_attribute a0$ = CEntity.initExplicitAttribute(definition, 0);
	protected String a1; // attr_2 - non-java inheritance - STRING
	protected static final jsdai.dictionary.CExplicit_attribute a1$ = CEntity.initExplicitAttribute(definition, 1);
	protected Object a2; // attr_c - non-java inheritance - ENTITY second_entity
	protected static final jsdai.dictionary.CExplicit_attribute a2$ = CEntity.initExplicitAttribute(definition, 2);

	public jsdai.dictionary.EEntity_definition getInstanceType() {
		return definition;
	}

	protected void changeReferences(InverseEntity old, InverseEntity newer) throws SdaiException {
		if (a2 == old) {
			a2 = newer;
		}
	}

	/*----------- Methods for attribute access -----------*/

	/// methods for attribute: attr_1, base type: INTEGER
	public boolean testAttr_1(jsdai.SExample_1.EFirst_entity type) throws SdaiException {
		return test_integer(a0);
	}
	public int getAttr_1(jsdai.SExample_1.EFirst_entity type) throws SdaiException {
		return get_integer(a0);
	}
	public void setAttr_1(jsdai.SExample_1.EFirst_entity type, int value) throws SdaiException {
		a0 = set_integer(value);
	}
	public void unsetAttr_1(jsdai.SExample_1.EFirst_entity type) throws SdaiException {
		a0 = unset_integer();
	}
	public static jsdai.dictionary.EAttribute attributeAttr_1(jsdai.SExample_1.EFirst_entity type) throws SdaiException {
		return a0$;
	}

	/// methods for attribute: attr_2, base type: STRING
	public boolean testAttr_2(ESecond_entity type) throws SdaiException {
		return test_string(a1);
	}
	public String getAttr_2(ESecond_entity type) throws SdaiException {
		return get_string(a1);
	}
	public void setAttr_2(ESecond_entity type, String value) throws SdaiException {
		a1 = set_string(value);
	}
	public void unsetAttr_2(ESecond_entity type) throws SdaiException {
		a1 = unset_string();
	}
	public static jsdai.dictionary.EAttribute attributeAttr_2(ESecond_entity type) throws SdaiException {
		return a1$;
	}

	// attribute: attr_c, base type: entity second_entity
	public static int usedinAttr_c(EThird_entity type, ESecond_entity instance, ASdaiModel domain, AEntity result) throws SdaiException {
		return ((CEntity)instance).makeUsedin(definition, a2$, domain, result);
	}
	public boolean testAttr_c(EThird_entity type) throws SdaiException {
		return test_instance(a2);
	}
	public ESecond_entity getAttr_c(EThird_entity type) throws SdaiException {
		a2 = get_instance(a2);
		return (ESecond_entity)a2;
	}
	public void setAttr_c(EThird_entity type, ESecond_entity value) throws SdaiException {
		a2 = set_instance(a2, value);
	}
	public void unsetAttr_c(EThird_entity type) throws SdaiException {
		a2 = unset_instance(a2);
	}
	public static jsdai.dictionary.EAttribute attributeAttr_c(EThird_entity type) throws SdaiException {
		return a2$;
	}


	/*---------------------- setAll() --------------------*/

	protected void setAll(ComplexEntityValue av) throws SdaiException {
		if (av == null) {
			a0 = Integer.MIN_VALUE;
			a1 = null;
			a2 = unset_instance(a2);
			return;
		}
		a0 = av.entityValues[0].getInteger(0);
		a1 = av.entityValues[1].getString(0);
		a2 = av.entityValues[2].getInstance(0, this, a2$);
	}

	/*---------------------- getAll() --------------------*/

	protected void getAll(ComplexEntityValue av) throws SdaiException {
		// partial entity: first_entity
		av.entityValues[0].setInteger(0, a0);
		// partial entity: second_entity
		av.entityValues[1].setString(0, a1);
		// partial entity: third_entity
		av.entityValues[2].setInstance(0, a2);
	}
}
