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 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 || isAgregation || links.length > 2;
	}
}
