Trigger implements Serializable { @Internal public boolean isCompatible(Trigger other) { if (!getClass().equals(other.getClass())) { return false; } if (subTriggers == null) { return other.subTriggers == null; } else if (other.subTriggers == null) { return false; } else if (subTriggers.size() != other.subTriggers.size()) { return false; } for (int i = 0; i < subTriggers.size(); i++) { if (!subTriggers.get(i).isCompatible(other.subTriggers.get(i))) { return false; } } return true; } protected  Trigger(List<Trigger> subTriggers); protected  Trigger(); List<Trigger> subTriggers(); Trigger getContinuationTrigger(); @Internal abstract Instant getWatermarkThatGuaranteesFiring(BoundedWindow window); @Internal abstract boolean mayFinish(); @Internal boolean isCompatible(Trigger other); @Override String toString(); @Override boolean equals(@Nullable Object obj); @Override int hashCode(); OrFinallyTrigger orFinally(OnceTrigger until);  }
@Test public void testIsCompatible() throws Exception { assertTrue(new Trigger1(null).isCompatible(new Trigger1(null))); assertTrue( new Trigger1(Arrays.asList(new Trigger2(null))) .isCompatible(new Trigger1(Arrays.asList(new Trigger2(null))))); assertFalse(new Trigger1(null).isCompatible(new Trigger2(null))); assertFalse( new Trigger1(Arrays.asList(new Trigger1(null))) .isCompatible(new Trigger1(Arrays.asList(new Trigger2(null))))); }