package it.cavallium.warppi.math.functions.equations;

import it.cavallium.warppi.gui.expression.blocks.Block;
import it.cavallium.warppi.math.Function;
import it.cavallium.warppi.math.FunctionDynamic;
import it.cavallium.warppi.math.FunctionVisitor;
import it.cavallium.warppi.math.MathContext;
import it.cavallium.warppi.util.Error;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;

public class EquationsSystem extends FunctionDynamic {
	static final int spacing = 2;

	public EquationsSystem(final MathContext root) {
		super(root);
	}

	public EquationsSystem(final MathContext root, final Function value) {
		super(root, new Function[] { value });
	}

	public EquationsSystem(final MathContext root, final Function[] value) {
		super(root, value);
	}

	@Override
	public EquationsSystem clone() {
		Function[] newFuncs = functions.clone();
		for (int i = 0; i < newFuncs.length; i++) {
			newFuncs[i] = newFuncs[i].clone();
		}
		return new EquationsSystem(root, newFuncs);
	}

	@Override
	public EquationsSystem clone(MathContext c) {
		Function[] newFuncs = new Function[this.functions.length];
		for (int i = 0; i < newFuncs.length; i++) {
			newFuncs[i] = this.functions[i] == null ? null : this.functions[i].clone(c);
		}
		return new EquationsSystem(c, newFuncs);
	}

	@Override
	public ObjectArrayList<Block> toBlock(final MathContext context) throws Error {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public <T> T accept(final FunctionVisitor<T> visitor) {
		return visitor.visit(this);
	}

}

@@ -773,32 +773,435 @@
  value);%0D%0A%09%7D%0D%0A%0D%0A
+%09@Override%0D%0A%09public boolean equals(final Object o) %7B%0D%0A%09%09if (o instanceof EquationsSystem) %7B%0D%0A%09%09%09final FunctionDynamic f = (FunctionDynamic) o;%0D%0A%09%09%09if (functions.length != f.getParametersLength()) %7B%0D%0A%09%09%09%09return false;%0D%0A%09%09%09%7D%0D%0A%09%09%09for (int i = 0; i %3C functions.length; i++) %7B%0D%0A%09%09%09%09if (!functions%5Bi%5D.equals(f.getParameter(i))) %7B%0D%0A%09%09%09%09%09return false;%0D%0A%09%09%09%09%7D%0D%0A%09%09%09%7D%0D%0A%09%09%09return true;%0D%0A%09%09%7D%0D%0A%09%09return false;%0D%0A%09%7D%0D%0A%0D%0A
 %09@Override%0D%0A%09pub

Implement equals for EquationsSystem as ordered parameter equality