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

org.modelcc.language.metamodel.MemberCollection Maven / Gradle / Ivy

Go to download

ModelCC is a model-based parser generator (a.k.a. compiler compiler) that decouples language specification from language processing, avoiding some of the problems caused by grammar-driven parser generators. ModelCC receives a conceptual model as input, along with constraints that annotate it. It is then able to create a parser for the desired textual language and the generated parser fully automates the instantiation of the language conceptual model. ModelCC also includes a built-in reference resolution mechanism that results in abstract syntax graphs, rather than mere abstract syntax trees.

The newest version!
/*
 * ModelCC, distributed under ModelCC Shared Software License, www.modelcc.org
 */

package org.modelcc.language.metamodel;

import java.io.Serializable;
import java.util.List;

import org.modelcc.lexer.recognizer.PatternRecognizer;
import org.modelcc.metamodel.Evaluator;

/**
 * Collection member
 *  
 * @author Luis Quesada ([email protected]) & Fernando Berzal ([email protected])
 */
public final class MemberCollection extends LanguageMember implements Serializable 
{
    /**
     * Collection type.
     */
    private MemberCollectionType collection;

    /**
     * Minimum multiplicity.
     */
    private int minimumMultiplicity;

	/**
     * Maximum multiplicity
     */
    private int maximumMultiplicity;

    /**
     * Constructor
     * @param field the content field
     * @param elementClass the element class
     * @param collection the collection type
     */
    public MemberCollection (String field, Class elementClass, MemberCollectionType collection)
    {
    	super(field,elementClass);
    	this.collection = collection;
    }
    
    /**
     * Constructor
     * @param field the content field
     * @param elementClass the content element class
     * @param optional whether content is optional or not
     * @param id is id
     * @param reference is reference
     * @param prefix the content prefix
     * @param suffix the content suffix
     * @param separator the ad hoc separator
     * @param collection the collection type
     * @param minimumMultiplicity the minimum multiplicity
     * @param maximumMultiplicity the maximum multiplicity
     * @param evaluator the evaluator
     */
    public MemberCollection (
    		String field,
    		Class elementClass,
    		boolean optional,
    		boolean id,
    		boolean reference,
    		List prefix,
    		List suffix,
    		List separator,
    		MemberCollectionType collection,
    		int minimumMultiplicity,
    		int maximumMultiplicity,
    		Evaluator evaluator ) 
    {
        super(field,elementClass,optional,id,reference,prefix,suffix,separator,evaluator);

        this.collection = collection;
        this.minimumMultiplicity = minimumMultiplicity;
        this.maximumMultiplicity = maximumMultiplicity;
    }

    // Getters & setters
    
    public MemberCollectionType getCollection() {
        return collection;
    }

    public int getMinimumMultiplicity() {
        return minimumMultiplicity;
    }

    public int getMaximumMultiplicity() {
        return maximumMultiplicity;
    }

    public void setMinimumMultiplicity(int minimumMultiplicity) {
		this.minimumMultiplicity = minimumMultiplicity;
	}

	public void setMaximumMultiplicity(int maximumMultiplicity) {
		this.maximumMultiplicity = maximumMultiplicity;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy