org.umlg.java.metamodel.generated.OJElementGEN Maven / Gradle / Ivy
/*
* 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.HashMap;
import java.util.List;
import java.util.Map;
import org.umlg.java.metamodel.OJElement;
import org.umlg.java.metamodel.utilities.InvariantError;
/**
* Class ...
*/
abstract public class OJElementGEN{
protected String f_name = "";
private String f_comment = "";
static protected boolean usesAllInstances = false;
static protected List allInstances = new ArrayList();
public static Map,Long> counts = new HashMap,Long>();
public void finalize(){
counts.put(getClass(), getCount() - 1);
}
protected Long getCount(){
Long long1 = counts.get(getClass());
if(long1 == null){
return 0l;
}else if(long1 % 100 == 0){
// System.out.println(getClass().getName() + " count :" + long1);
}
return long1;
}
/**
* Default constructor for OJElement
*/
protected OJElementGEN(){
counts.put(getClass(), getCount() + 1);
if(usesAllInstances){
allInstances.add(((OJElement) this));
}
}
/**
* Constructor for OJElementGEN
*
* @param name
* @param comment
*/
protected OJElementGEN(String name,String comment){
super();
this.setName(name);
this.setComment(comment);
if(usesAllInstances){
allInstances.add(((OJElement) this));
}
}
/**
* Implements the getter for feature '+ name : String'
*/
public String getName(){
return f_name;
}
/**
* Implements the setter for feature '+ name : String'
*
* @param element
*/
public void setName(String element){
if(f_name != element){
f_name = element;
}
}
/**
* Implements the getter for feature '+ comment : String'
*/
public String getComment(){
return f_comment;
}
/**
* Implements the setter for feature '+ comment : String'
*
* @param element
*/
public void setComment(String element){
if(f_comment != element){
f_comment = element;
}
}
/**
* 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 OJElement
*/
public String toString(){
String result = "";
if(this.getName() != null){
result = result + " name:" + this.getName() + ", ";
}
if(this.getComment() != null){
result = result + " comment:" + this.getComment();
}
return result;
}
/**
* Returns the default identifier for OJElement
*/
public String getIdString(){
String result = "";
if(this.getName() != null){
result = result + this.getName();
}
return result;
}
/**
* Implements the OCL allInstances operation
*/
static public List allInstances(){
if(!usesAllInstances){
throw new RuntimeException(
"allInstances is not implemented for ((OJElement)this) class. Set usesAllInstances to true, if you want allInstances() implemented.");
}
return allInstances;
}
/**
* 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(OJElement copy){
copy.setName(getName());
copy.setComment(getComment());
}
}