package model;

class Association extends Set {
	public var links : Array<Link>;
	public var isAgregation : Bool;

	public function new(name : String) {
		super(name);
		links = new Array();
		isAgregation = false;
	}

	public function isReflexive() : Bool {
		return links.length == 2 && links[0].set.name == links[1].set.name;
	}

	public function isNN() : Bool {
		return !Lambda.exists(links, l -> l.max == "1");
	}

	public function isRelation() : Bool {
		return isClass() || isNN();
	}

	public function isClass() : Bool { //UML
		return fields.length != 0 || links.length > 2;
	}
}
