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

org.modelcc.language.syntax.ObjectCollection 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.syntax;

import java.io.Serializable;

/**
 * Object collection.
 * 
 * @author Fernando Berzal ([email protected])
 */
public class ObjectCollection implements Serializable 
{    
    private Object[] content;
   
    private Symbol symbol;
    private RuleSymbol ruleSymbol;

    
    
    public ObjectCollection () 
    {
    	this(new Object[0],null,null);
    }    

    public ObjectCollection (Object[] content) 
    {
    	this(content,null,null);
    }

    public ObjectCollection (Symbol symbol, RuleSymbol ruleSymbol) 
    {
    	this(new Object[0], symbol, ruleSymbol);
    }
    
    public ObjectCollection (Object[] content, Symbol symbol, RuleSymbol ruleSymbol) 
    {
    	this.content = content;
    	this.symbol = symbol;
    	this.ruleSymbol = ruleSymbol;
    }

    
    public Object[] getContent() 
    {
    	return content;
    }
    
    public Symbol getSymbol() 
    {
    	return symbol;
    }
        
    public void setSymbol (Symbol symbol)
    {
    	this.symbol = symbol;
    }

    public RuleSymbol getRuleSymbol() 
    {
    	return ruleSymbol;
    }
    
    public void setRuleSymbol (RuleSymbol ruleSymbol)
    {
    	this.ruleSymbol = ruleSymbol;
    }
    
    
    public int size ()
    {
    	return content.length;
    }
    
    public Object get (int i)
    {
    	return content[i];
    }
    
    public void set (int i, Object obj)
    {
    	content[i] = obj;
    }
    
    public void resize (int newSize)
    {
    	Object old[] = content;
    	
    	content = new Object[newSize];
    	
    	for (int i=0; (i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy