001// ***** This file is automatically generated from SequencesJoinFactory.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 SequencesJoin derived variables. */ 011public final class SequencesJoinFactory extends BinaryDerivationFactory { 012 013 /** Debug tracer. */ 014 public static final Logger debug = 015 Logger.getLogger("daikon.derive.binary.SequencesJoinFactory"); 016 017 @Override 018 public BinaryDerivation @Nullable [] instantiate(VarInfo var1, VarInfo var2) { 019 020 boolean enabled = SequencesJoin.dkconfig_enabled; 021 if (!enabled) { 022 return null; 023 } 024 025 if (!var1.rep_type.isArray() || !var2.rep_type.isArray()) { 026 return null; 027 } 028 029 if (!var1.aux.hasOrder() || !var2.aux.hasOrder()) { 030 // Order doesn't matter, then joining is meaningless 031 return null; 032 } 033 034 /* if (!(var1.rep_type == ProglangType.INT_ARRAY) 035 || !(var2.rep_type == ProglangType.INT_ARRAY)) { 036 return null; 037 } 038 */ 039 040 if (var1.derived != null || var2.derived != null) { 041 // From derived variables. Don't derive. 042 return null; 043 } 044 045 if (var1.name().equals(var2.name())) { 046 return null; 047 } 048 049 if (!var1.is_field() || !var2.is_field()) { 050 return null; 051 } 052 053 if (!var1.has_same_parent(var2)) { 054 return null; 055 } 056 057 // Now we finally can derive 058 059 if (debug.isLoggable(Level.FINE)) { 060 debug.fine( 061 var1.ppt + ": " + var1.name() + " and " + var2.name() + " are worth deriving from"); 062 } 063 064 return new BinaryDerivation[] { 065 new SequencesJoin(var1, var2), 066 }; 067 } 068}