001// ***** This file is automatically generated from SequencesPredicateFactory.java.jpp 002 003package daikon.derive.binary; 004 005import org.checkerframework.checker.nullness.qual.Nullable; 006import daikon.*; 007import java.util.logging.Level; 008import java.util.logging.Logger; 009 010/** Factory for SequencesPredicate derived variables. */ 011public final class SequencesPredicateFactoryFloat extends BinaryDerivationFactory { 012 013 /** Debug tracer. */ 014 public static final Logger debug = 015 Logger.getLogger("daikon.derive.binary.SequencesPredicateFactoryFloat"); 016 017 @Override 018 public BinaryDerivation @Nullable [] instantiate(VarInfo var1, VarInfo var2) { 019 boolean enabled = SequencesPredicateFloat.dkconfig_enabled; 020 if (!enabled) { 021 return null; 022 } 023 024 if (debug.isLoggable(Level.FINE)) { 025 debug.fine("Trying to instantiate " + var1.name() + " and " + var2.name()); 026 } 027 028 if (!var1.rep_type.isArray() || !var2.rep_type.isArray()) { 029 return null; 030 } 031 032 if (!var1.aux.hasOrder() || !var2.aux.hasOrder()) { 033 // Order doesn't matter, then predication is meaningless 034 return null; 035 } 036 037 if (SequencesPredicateFloat.dkconfig_boolOnly) { 038 if (var2.file_rep_type != ProglangType.BOOLEAN_ARRAY) { 039 return null; 040 } 041 } 042 043 if (var1.derived != null || var2.derived != null) { 044 // From derived variables. Don't derive. 045 return null; 046 } 047 048 if (SequencesPredicateFloat.dkconfig_fieldOnly) { 049 050 if (!var1.is_field() || !var2.is_field()) { 051 return null; 052 } 053 054 if (!var1.has_same_parent(var2)) { 055 return null; 056 } 057 058 } else { 059 // There may be predications that aren't of the x.a and x.b type 060 } 061 062 // Now we finally can derive 063 064 if (debug.isLoggable(Level.FINE)) { 065 debug.fine( 066 var1.ppt + ": " + var1.name() + " and " + var2.name() + " are worth deriving from"); 067 } 068 069 return new BinaryDerivation[] { 070 new SequencesPredicateFloat(var1, var2, 0, "false"), 071 new SequencesPredicateFloat(var1, var2, 1, "true"), 072 // new SequencesPredicate (var1, var2, 0, "nonNull", false), 073 }; 074 } 075}