All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.umlg.java.metamodel.generated.OJBlockGEN Maven / Gradle / Ivy

There is a newer version: 2.0.15
Show newest version
/*
 * File generated by Grasland Grammar Generator on Dec 23, 2006 7:26:03 PM
 */
package org.umlg.java.metamodel.generated;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;

import org.umlg.java.metamodel.OJBlock;
import org.umlg.java.metamodel.OJElement;
import org.umlg.java.metamodel.OJField;
import org.umlg.java.metamodel.OJStatement;
import org.umlg.java.metamodel.utilities.InvariantError;


/** Class ...
 */
abstract public class OJBlockGEN extends OJStatement {
	private List f_statements = new ArrayList();
	private List f_locals = new ArrayList();
	static protected boolean usesAllInstances = false;
	static protected List allInstances = new ArrayList();

	/** Default constructor for OJBlock
	 */
	protected OJBlockGEN() {
		super();
		if ( usesAllInstances ) {
			allInstances.add(((OJBlock)this));
		}
	}
	
	/** Constructor for OJBlockGEN
	 * 
	 * @param name 
	 * @param comment 
	 */
	protected OJBlockGEN(String name, String comment) {
		super();
		super.setName(name);
		super.setComment(comment);
		if ( usesAllInstances ) {
			allInstances.add(((OJBlock)this));
		}
	}

	/** Implements the getter for feature '+ statements : OrderedSet(OJStatement)'
	 */
	public List getStatements() {
		return f_statements;
	}
	
	/** Implements the setter for feature '+ statements : OrderedSet(OJStatement)'
	 * 
	 * @param element 
	 */
	public void setStatements(List element) {
		if ( f_statements != element ) {
			f_statements = element;
		}
	}
	
	/** Implements the add element function for feature '+ statements : OrderedSet(OJStatement)'
	 * 
	 * @param element 
	 */
	public void addToStatements(OJStatement element) {
		if ( f_statements.contains(element) ) {
			return;
		}
		f_statements.add(element);
	}
	
	/** Implements the remove element function for feature '+ statements : OrderedSet(OJStatement)'
	 * 
	 * @param element 
	 */
	public void removeFromStatements(OJStatement element) {
		f_statements.remove(element);
	}
	
	/** Implements the addition of a number of elements to feature '+ statements : OrderedSet(OJStatement)'
	 * 
	 * @param newElems 
	 */
	public void addToStatements(Collection newElems) {
		Iterator it = newElems.iterator();
		while ( (it.hasNext()) ) {
			Object item = it.next();
			if ( item instanceof OJStatement ) {
				addToStatements((OJStatement)item);
			}
		}
	}
	
	/** Implements the removal of a number of elements from feature '+ statements : OrderedSet(OJStatement)'
	 * 
	 * @param oldElems 
	 */
	public void removeFromStatements(Collection oldElems) {
		Iterator it = oldElems.iterator();
		while ( (it.hasNext()) ) {
			Object item = it.next();
			if ( item instanceof OJStatement ) {
				removeFromStatements((OJStatement)item);
			}
		}
	}
	
	/** Implements the removal of all elements from feature '+ statements : OrderedSet(OJStatement)'
	 */
	public void removeAllFromStatements() {
		/* make a copy of the collection in order to avoid a ConcurrentModificationException*/
		Iterator it = new ArrayList(getStatements()).iterator();
		while ( (it.hasNext()) ) {
			Object item = it.next();
			if ( item instanceof OJStatement ) {
				removeFromStatements((OJStatement)item);
			}
		}
	}
	
	/** Implements the getter for feature '+ locals : OrderedSet(OJField)'
	 */
	public List getLocals() {
		return f_locals;
	}
	
	/** Implements the setter for feature '+ locals : OrderedSet(OJField)'
	 * 
	 * @param element 
	 */
	public void setLocals(List element) {
		if ( f_locals != element ) {
			f_locals = element;
		}
	}
	
	/** Implements the add element function for feature '+ locals : OrderedSet(OJField)'
	 * 
	 * @param element 
	 */
	public void addToLocals(OJField element) {
		if ( f_locals.contains(element) ) {
			return;
		}
		f_locals.add(element);
	}
	
	/** Implements the remove element function for feature '+ locals : OrderedSet(OJField)'
	 * 
	 * @param element 
	 */
	public void removeFromLocals(OJField element) {
		f_locals.remove(element);
	}
	
	/** Implements the addition of a number of elements to feature '+ locals : OrderedSet(OJField)'
	 * 
	 * @param newElems 
	 */
	public void addToLocals(Collection newElems) {
		Iterator it = newElems.iterator();
		while ( (it.hasNext()) ) {
			Object item = it.next();
			if ( item instanceof OJField ) {
				addToLocals((OJField)item);
			}
		}
	}
	
	/** Implements the removal of a number of elements from feature '+ locals : OrderedSet(OJField)'
	 * 
	 * @param oldElems 
	 */
	public void removeFromLocals(Collection oldElems) {
		Iterator it = oldElems.iterator();
		while ( (it.hasNext()) ) {
			Object item = it.next();
			if ( item instanceof OJField ) {
				removeFromLocals((OJField)item);
			}
		}
	}
	
	/** Implements the removal of all elements from feature '+ locals : OrderedSet(OJField)'
	 */
	public void removeAllFromLocals() {
		/* make a copy of the collection in order to avoid a ConcurrentModificationException*/
		Iterator it = new ArrayList(getLocals()).iterator();
		while ( (it.hasNext()) ) {
			Object item = it.next();
			if ( item instanceof OJField ) {
				removeFromLocals((OJField)item);
			}
		}
	}
	
	/** Checks all invariants of this object and returns a list of messages about broken invariants
	 */
	public List checkAllInvariants() {
		List result = new ArrayList();
		return result;
	}
	
	/** Implements a check on the multiplicities of all attributes and association ends
	 */
	public List checkMultiplicities() {
		List result = new ArrayList();
		return result;
	}
	
	/** Default toString implementation for OJBlock
	 */
	public String toString() {
		String result = "";
		result = super.toString();
		return result;
	}
	
	/** Returns the default identifier for OJBlock
	 */
	public String getIdString() {
		String result = "";
		result = super.getIdString();
		return result;
	}
	
	/** Implements the OCL allInstances operation
	 */
	static public List allInstances() {
		if ( !usesAllInstances ) {
			throw new RuntimeException("allInstances is not implemented for ((OJBlock)this) class. Set usesAllInstances to true, if you want allInstances() implemented.");
		}
		return allInstances;
	}
	
	/** Returns a copy of this instance. True parts, i.e. associations marked
			'aggregate' or 'composite', and attributes, are copied as well. References to
			other objects, i.e. associations not marked 'aggregate' or 'composite', will not
			be copied. The returned copy will refer to the same objects as the original (this)
			instance.
	 */
	public OJElement getCopy() {
		OJBlock result = new OJBlock();
		this.copyInfoInto(result);
		return result;
	}
	
	/** Copies all attributes and associations of this instance into 'copy'.
			True parts, i.e. associations marked 'aggregate' or 'composite', and attributes, 
			are copied as well. References to other objects, i.e. associations not marked 
			'aggregate' or 'composite', will not be copied. The 'copy' will refer 
			to the same objects as the original (this) instance.
	 * 
	 * @param copy 
	 */
	public void copyInfoInto(OJBlock copy) {
		super.copyInfoInto(copy);
		Iterator statementsIt = new ArrayList(getStatements()).iterator();
		while ( statementsIt.hasNext() ) {
			OJStatement elem = (OJStatement) statementsIt.next();
			copy.addToStatements(elem);
		}
		Iterator localsIt = new ArrayList(getLocals()).iterator();
		while ( localsIt.hasNext() ) {
			OJField elem = (OJField) localsIt.next();
			copy.addToLocals(elem);
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy