@Override public IDomain computeImageDomain(List<IDomain> imageDomains) { IDomain rawDomain = computeRawImageDomain(imageDomains); for (IDomain domain : imageDomains) { // Cannot cast ANY to META if (domain.isInstanceOf(IDomain.ANY)) { return IDomain.DATE; } if (domain.isInstanceOf(DomainMetaDomain.META)) { return ((IDomainMetaDomain) domain).createMetaDomain(rawDomain); } } // return rawDomain; }
@Override public OperatorDiagnostic validateParameters(List<IDomain> imageDomains) { if (imageDomains.isEmpty() || imageDomains.size() <= 1) { return new OperatorDiagnostic("invalid NULLIF expression", HINT); } IDomain domain = imageDomains.get(0); for (int i = 1; i < imageDomains.size(); i++) { if (imageDomains.get(i).isInstanceOf(domain)) { domain = imageDomains.get(i); } else if (domain.isInstanceOf(imageDomains.get(i))) { // ok } else { return new OperatorDiagnostic("mismatching NULLIF arguments", HINT); } } return OperatorDiagnostic.IS_VALID; }