public static Domain Combine(IDomain first, IDomain second) { if (first.GetNumberOfComponents() + second.GetNumberOfComponents() > 2) { SimpleDomain[] domainsArray = new SimpleDomain[first.GetNumberOfComponents() + second.GetNumberOfComponents()]; int i = 0; if (first is CompositeDomain) //prvi argument je tipa 'CompositeDomain' { for (int j = 0; j < first.GetNumberOfComponents(); j++) { domainsArray[i] = (SimpleDomain)first.GetComponent(j); i++; } } else { domainsArray[i] = (SimpleDomain)first.GetComponent(0); i++; } if (second is CompositeDomain) //drugi argument je tipa 'CompositeDomain' { for (int j = 0; j < second.GetNumberOfComponents(); j++) { domainsArray[i] = (SimpleDomain)second.GetComponent(j); i++; } } else { domainsArray[i] = (SimpleDomain)second.GetComponent(0); i++; } return(new CompositeDomain(domainsArray)); } else { SimpleDomain[] domainsArray = new SimpleDomain[] { (SimpleDomain)first, (SimpleDomain)second }; return(new CompositeDomain(domainsArray)); } }
public static bool IsUTimesURelation(IFuzzySet relation) { IDomain domain = relation.GetDomain(); if (domain.GetNumberOfComponents() != 2) { return(false); } IDomain a = domain[0]; IDomain b = domain[1]; return(a.All(element => b.HasElement(element))); }
public static IDomain Combine(IDomain first, IDomain second) { var domains = new List <SimpleDomain>(); for (var i = 0; i < first.GetNumberOfComponents(); ++i) { domains.Add(first[i] as SimpleDomain); } for (var i = 0; i < second.GetNumberOfComponents(); ++i) { domains.Add(second[i] as SimpleDomain); } return(new CompositeDomain(domains.ToArray())); }