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

org.jclarion.clarion.ClarionArray Maven / Gradle / Ivy

The newest version!
package org.jclarion.clarion;

import org.jclarion.clarion.memory.CMem;
import org.jclarion.clarion.runtime.OverGlue;

public class ClarionArray extends ClarionMemoryModel implements ClarionCloneable 
{
	private Object[] array;

    private ClarionMemoryChangeListener notifyChildChange = new ClarionMemoryChangeListener() {
        @Override
        public void objectChanged(ClarionMemoryModel model) {
            notifyChange();
        }
    };
	
	public ClarionArray(int size) {
		array=new Object[size];
	}

	private ClarionArray(Object[] obj)
	{
		this.array=new Object[obj.length];
		for (int scan=0;scan(array);
	}

	public ClarionArray> dim(int size)
	{
		return new ClarionArray>(this,size); 
	}
	
    public ClarionArray setOver(ClarionMemoryModel over) 
    {
        OverGlue glue = new OverGlue(this,over);
        glue.objectChanged(over);
        return this;
    }

    public int length()
    {
    	return array.length;
    }

	@Override
	public void clear(int method) {
		for ( Object o : array ) {
			if (o==null) continue;
			if (!(o instanceof ClarionCloneable)) continue;
			((ClarionCloneable)o).clear(method);
		}
	}

	@Override
	public void clear() {
		clear(0);
	}

	@Override
	public void setValue(Object o) 
	{
 		if (o instanceof ClarionArray) {
 			ClarionArray ca = (ClarionArray)o;
 			for (int scan=0;scan




© 2015 - 2025 Weber Informatics LLC | Privacy Policy