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

org.eclipse.ocl.expressions.CollectionKind Maven / Gradle / Ivy

/**
 * 
 * 
 * Copyright (c) 2006, 2008 IBM Corporation, Zeligsoft Inc., and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *   IBM - Initial API and implementation
 *   Zeligsoft - Bug 207365
 * 
 * 
 *
 * $Id: CollectionKind.java,v 1.6 2008/10/12 01:09:49 cdamus Exp $
 */
package org.eclipse.ocl.expressions;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.eclipse.emf.common.util.Enumerator;

/**
 * 
 * A representation of the literals of the enumeration 'Collection Kind',
 * and utility methods for working with them.
 * 
 * @see org.eclipse.ocl.expressions.ExpressionsPackage#getCollectionKind()
 * @model
 * @generated
 */
public enum CollectionKind
		implements Enumerator {
	//$NON-NLS-1$ //$NON-NLS-2$

	/**
	 * The 'Set' literal object.
	 * 
	 * 
	 * @see #SET
	 * @generated
	 * @ordered
	 */
	SET_LITERAL(0, "Set", "Set"), //$NON-NLS-1$ //$NON-NLS-2$

	/**
	 * The 'Ordered Set' literal object.
	 * 
	 * 
	 * @see #ORDERED_SET
	 * @generated
	 * @ordered
	 */
	ORDERED_SET_LITERAL(1, "OrderedSet", "OrderedSet"), //$NON-NLS-1$ //$NON-NLS-2$

	/**
	 * The 'Bag' literal object.
	 * 
	 * 
	 * @see #BAG
	 * @generated
	 * @ordered
	 */
	BAG_LITERAL(2, "Bag", "Bag"), //$NON-NLS-1$ //$NON-NLS-2$

	/**
	 * The 'Sequence' literal object.
	 * 
	 * 
	 * @see #SEQUENCE
	 * @generated
	 * @ordered
	 */
	SEQUENCE_LITERAL(3, "Sequence", "Sequence"), //$NON-NLS-1$ //$NON-NLS-2$

	/**
	 * The 'Collection' literal object.
	 * 
	 * 
	 * @see #COLLECTION
	 * @generated
	 * @ordered
	 */
	COLLECTION_LITERAL(4, "Collection", "Collection"); //$NON-NLS-1$ //$NON-NLS-2$

	/**
	 * The 'Set' literal value.
	 * 
	 * 

* If the meaning of 'Set' literal object isn't clear, * there really should be more of a description here... *

* * @see #SET_LITERAL * @model name="Set" * @generated * @ordered */ public static final int SET = 0; /** * The 'Ordered Set' literal value. * *

* If the meaning of 'Ordered Set' literal object isn't clear, * there really should be more of a description here... *

* * @see #ORDERED_SET_LITERAL * @model name="OrderedSet" * @generated * @ordered */ public static final int ORDERED_SET = 1; /** * The 'Bag' literal value. * *

* If the meaning of 'Bag' literal object isn't clear, * there really should be more of a description here... *

* * @see #BAG_LITERAL * @model name="Bag" * @generated * @ordered */ public static final int BAG = 2; /** * The 'Sequence' literal value. * *

* If the meaning of 'Sequence' literal object isn't clear, * there really should be more of a description here... *

* * @see #SEQUENCE_LITERAL * @model name="Sequence" * @generated * @ordered */ public static final int SEQUENCE = 3; /** * The 'Collection' literal value. * *

* If the meaning of 'Collection' literal object isn't clear, * there really should be more of a description here... *

* * @see #COLLECTION_LITERAL * @model name="Collection" * @generated * @ordered */ public static final int COLLECTION = 4; /** * An array of all the 'Collection Kind' enumerators. * * * @generated */ private static final CollectionKind[] VALUES_ARRAY = new CollectionKind[]{ SET_LITERAL, ORDERED_SET_LITERAL, BAG_LITERAL, SEQUENCE_LITERAL, COLLECTION_LITERAL,}; /** * A public read-only list of all the 'Collection Kind' enumerators. * * * @generated */ public static final List VALUES = Collections .unmodifiableList(Arrays.asList(VALUES_ARRAY)); /** * Returns the 'Collection Kind' literal with the specified literal value. * * * @generated */ public static CollectionKind get(String literal) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CollectionKind result = VALUES_ARRAY[i]; if (result.toString().equals(literal)) { return result; } } return null; } /** * Returns the 'Collection Kind' literal with the specified name. * * * @generated */ public static CollectionKind getByName(String name) { for (int i = 0; i < VALUES_ARRAY.length; ++i) { CollectionKind result = VALUES_ARRAY[i]; if (result.getName().equals(name)) { return result; } } return null; } /** * Returns the 'Collection Kind' literal with the specified integer value. * * * @generated */ public static CollectionKind get(int value) { switch (value) { case SET : return SET_LITERAL; case ORDERED_SET : return ORDERED_SET_LITERAL; case BAG : return BAG_LITERAL; case SEQUENCE : return SEQUENCE_LITERAL; case COLLECTION : return COLLECTION_LITERAL; } return null; } /** * * * @generated */ private final int value; /** * * * @generated */ private final String name; /** * * * @generated */ private final String literal; /** * Only this class can construct instances. * * * @generated */ private CollectionKind(int value, String name, String literal) { this.value = value; this.name = name; this.literal = literal; } /** * * * @generated */ public int getValue() { return value; } /** * * * @generated */ public String getName() { return name; } /** * * * @generated */ public String getLiteral() { return literal; } /** * Returns the literal value of the enumerator, which is its string representation. * * * @generated */ @Override public String toString() { return literal; } public static CollectionKind getKind(boolean ordered, boolean unique) { if (ordered) { return unique ? ORDERED_SET_LITERAL : SEQUENCE_LITERAL; } else { return unique ? SET_LITERAL : BAG_LITERAL; } } } //CollectionKind




© 2015 - 2024 Weber Informatics LLC | Privacy Policy