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

org.dmd.dms.generated.types.DmcTypeRuleScopeEnumSET Maven / Gradle / Ivy

Go to download

The dark-matter project provides mechanism to define concepts associated with Domain Specific Languages (DSLs) and generate code that can be extended with business logic that supports the given DSL purpose.

There is a newer version: 3.1.15
Show newest version
//	---------------------------------------------------------------------------
//	dark-matter-data
//	Copyright (c) 2012 dark-matter-data committers
//	---------------------------------------------------------------------------
//	This program is free software; you can redistribute it and/or modify it
//	under the terms of the GNU Lesser General Public License as published by the
//	Free Software Foundation; either version 3 of the License, or (at your
//	option) any later version.
//	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 Lesser General Public License for
//	more details.
//	You should have received a copy of the GNU Lesser General Public License along
//	with this program; if not, see .
//	---------------------------------------------------------------------------
package org.dmd.dms.generated.types;

import java.io.Serializable;
import java.util.Set;
import java.util.HashSet;
import java.util.TreeSet;
import java.util.Iterator;
import org.dmd.dmc.DmcAttribute;
import org.dmd.dmc.DmcAttributeInfo;
import org.dmd.dmc.DmcValueException;
import org.dmd.dms.generated.enums.ValueTypeEnum;
import org.dmd.dms.generated.enums.RuleScopeEnum;    // DmcType import
/**
 * The DmcTypeRuleScopeEnumSET provides storage for a set of RuleScopeEnum
 * 

* This code was auto-generated and shouldn't be altered manually! * Generated from: org.dmd.dms.util.GenUtility.dumpSETType(GenUtility.java:2571) * Called from: org.dmd.dms.meta.MetaGenerator.dumpDerivedTypes(MetaGenerator.java:556) */ @SuppressWarnings("serial") public class DmcTypeRuleScopeEnumSET extends DmcTypeRuleScopeEnum implements Serializable { protected Set value; public DmcTypeRuleScopeEnumSET(){ value = null; } public DmcTypeRuleScopeEnumSET(DmcAttributeInfo ai){ super(ai); initValue(); } void initValue(){ if (getAttributeInfo().valueType == ValueTypeEnum.HASHSET) value = new HashSet(); else value = new TreeSet(); } @Override public DmcTypeRuleScopeEnumSET getNew(){ return(new DmcTypeRuleScopeEnumSET(getAttributeInfo())); } @Override // org.dmd.dms.util.GenUtility.dumpSETType(GenUtility.java:2608) public DmcAttribute cloneIt(){ synchronized(this){ DmcTypeRuleScopeEnumSET rc = getNew(); for(RuleScopeEnum val: value) try { rc.add(val); } catch (DmcValueException e) { throw(new IllegalStateException("typeCheck() should never fail here!",e)); } return(rc); } } @Override // org.dmd.dms.util.GenUtility.dumpSETType(GenUtility.java:2627) public RuleScopeEnum add(Object v) throws DmcValueException { synchronized(this){ RuleScopeEnum rc = typeCheck(v); if (value == null) initValue(); // If false is returned, we didn't modify the set, so return null if (!value.add(rc)) rc = null; return(rc); } } @Override // org.dmd.dms.util.GenUtility.dumpSETType(GenUtility.java:2644) public RuleScopeEnum del(Object v){ synchronized(this){ RuleScopeEnum rc = null; if (value == null) return(rc); try { rc = typeCheck(v); } catch (DmcValueException e) { throw(new IllegalStateException("Incompatible type passed to del():" + getName(),e)); } if (value.contains(rc)){ value.remove(rc); if (value.size() == 0) value = null; } else rc = null; return(rc); } } @Override // org.dmd.dms.util.GenUtility.dumpSETType(GenUtility.java:2669) public Iterator getMV(){ synchronized(this){ if (getAttributeInfo().valueType == ValueTypeEnum.HASHSET) return( (new HashSet(value)).iterator() ); else return( (new TreeSet(value)).iterator() ); } } // org.dmd.dms.util.GenUtility.dumpSETType(GenUtility.java:2686) public Set getMVCopy(){ synchronized(this){ if (getAttributeInfo().valueType == ValueTypeEnum.HASHSET) return(new HashSet(value)); else return(new TreeSet(value)); } } @Override // org.dmd.dms.util.GenUtility.dumpSETType(GenUtility.java:2704) public int getMVSize(){ synchronized(this){ if (value == null) return(0); return(value.size()); } } @Override // org.dmd.dms.util.GenUtility.dumpSETType(GenUtility.java:2715) public boolean contains(Object v){ synchronized(this){ if (value == null) return(false); try { RuleScopeEnum val = typeCheck(v); return(value.contains(val)); } catch (DmcValueException e) { return(false); } } } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy