/*
 * $Id$
 *
 * JSDAI(TM), a way to implement STEP, ISO 10303
 * Copyright (C) 1997-2008, LKSoftWare GmbH, Germany
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License
 * version 3 as published by the Free Software Foundation (AGPL v3).
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * JSDAI is a registered trademark of LKSoftWare GmbH, Germany
 * This software is also available under commercial licenses.
 * See also http://www.jsdai.net/
 */

package jsdai.SContextual_shape_positioning_xim;

/**
* @author Giedrius Liutkus
* @version $$
* $$
*/

import jsdai.lang.*;
import jsdai.libutil.*;
import jsdai.SRepresentation_schema.*;

public class CxGeometric_operator_transformation extends CGeometric_operator_transformation implements EMappedXIMEntity, RepresentationMapAttributesImplementer
{

	public int attributeState = ATTRIBUTES_MODIFIED;	

	// Taken from Mapped_item
	// attribute (current explicit or supertype explicit) : mapping_source, base type: entity representation_map
/*	public static int usedinMapping_source(EMapped_item type, ERepresentation_map instance, ASdaiModel domain, AEntity result) throws SdaiException {
		return ((CEntity)instance).makeUsedin(definition, a1$, domain, result);
	}*/
	public boolean testMapping_source2(EMapped_item type) throws SdaiException {
		return test_instance(a1);
	}
	public ERepresentation_map getMapping_source2(EMapped_item type) throws SdaiException {
		a1 = get_instance(a1);
		return (ERepresentation_map)a1;
	}
	public void setMapping_source(EMapped_item type, ERepresentation_map value) throws SdaiException {
		a1 = set_instanceX(a1, value);
	}
	public void unsetMapping_source(EMapped_item type) throws SdaiException {
		a1 = unset_instance(a1);
	}
	public static jsdai.dictionary.EAttribute attributeMapping_source(EMapped_item type) throws SdaiException {
		return a1$;
	}
	// ENDOF Taken from Mapped_item

	// Taken from Representation_item
	/// methods for attribute: name, base type: STRING
/*	public boolean testName(ERepresentation_item type) throws SdaiException {
		return test_string(a0);
	}
	public String getName(ERepresentation_item type) throws SdaiException {
		return get_string(a0);
	}*/
	public void setName(ERepresentation_item type, String value) throws SdaiException {
		a0 = set_string(value);
	}
	public void unsetName(ERepresentation_item type) throws SdaiException {
		a0 = unset_string();
	}
	public static jsdai.dictionary.EAttribute attributeName(ERepresentation_item type) throws SdaiException {
		return a0$;
	}
	// ENDOF Taken from Representation_item
	
	public void createAimData(SdaiContext context) throws SdaiException {
		if (attributeState == ATTRIBUTES_MODIFIED) {
			attributeState = ATTRIBUTES_UNMODIFIED;
		} else {
			return;
		}

		setTemp("AIM", CMapped_item.definition);

		setMappingConstraints(context, this);

      // source 		
		setSource(context, this);
		
      // template_definition 		
		setTemplate_definition(context, this);
		
		// clean ARM
      // source 		
		unsetSource(null);
		
      // associated_shape_definition 		
		unsetTemplate_definition(null);
		
	}

	public void removeAimData(SdaiContext context) throws SdaiException {
		unsetMappingConstraints(context, this);

      // source 		
		unsetSource(context, this);
		
      // associated_shape_definition 		
		unsetTemplate_definition(context, this);

	}
	
	
	/**
	* Sets/creates data for mapping constraints.
	*
	* <p>
	* mapping_constraints;
	* 	{mapped_item &lt;=
	*  representation_item
	*  representation_item.name = 'ucur'}
	* end_mapping_constraints;
	* </p>
	* @param context SdaiContext.
	* @param armEntity arm entity.
	* @throws SdaiException
	*/
	public static void setMappingConstraints(SdaiContext context, EGeometric_operator_transformation armEntity) throws SdaiException
	{
		unsetMappingConstraints(context, armEntity);
		CxGeometric_placement_operation.setMappingConstraints(context, armEntity);
	}

	public static void unsetMappingConstraints(SdaiContext context, EGeometric_operator_transformation armEntity) throws SdaiException
	{
		CxGeometric_placement_operation.unsetMappingConstraints(context, armEntity);
	}


   //********** "Geometric_placement_operation" attributes


  /**
   * Sets/creates data for template_definition attribute.
   *
   *
   *  attribute_mapping template_definition (template_definition
   * , (*PATH*), geometric_model);
   * 	mapped_item
   * 	mapped_item.mapping_source ->
   * 	representation_map
   * 	representation_map.mapped_representation ->
   * 	representation =>
   * 	shape_representation
   *  end_attribute_mapping;
   *
   * @param context SdaiContext.
   * @param armEntity arm entity.
   * @throws SdaiException
   */
  // MI -> RM -> SR
	public static void setTemplate_definition(SdaiContext context, EGeometric_placement_operation armEntity) throws SdaiException
	{
		CxGeometric_placement_operation.setTemplate_definition(context, armEntity);
	}

  /**
   * Unsets/deletes data for associated_feature_shape_definition attribute.
   *
   * @param context SdaiContext.
   * @param armEntity arm entity.
   * @throws SdaiException
   */
  // MI - RM -> SR, break here
  public static void unsetTemplate_definition(SdaiContext context,
      EGeometric_placement_operation armEntity) throws
     SdaiException {
  	CxGeometric_placement_operation.unsetTemplate_definition(context, armEntity);  	
  }

  public static void setSource(SdaiContext context, EGeometric_placement_operation armEntity)throws SdaiException{
  	CxGeometric_placement_operation.setSource(context, armEntity);  	
  }
  
  public static void unsetSource(SdaiContext context, EGeometric_placement_operation armEntity)throws SdaiException{
  	CxGeometric_placement_operation.unsetSource(context, armEntity);  	
  }
  
}
