Github user brightchen commented on a diff in the pull request: https://github.com/apache/apex-malhar/pull/316#discussion_r67746283 --- Diff: library/src/main/java/com/datatorrent/lib/window/WindowOption.java --- @@ -0,0 +1,143 @@ +package com.datatorrent.lib.window; + +import java.util.LinkedList; +import java.util.List; + +/** + * + */ +public abstract class WindowOption +{ + + private TriggerOption[] triggerOptions; + + private AccumulationMode accumulationMode = AccumulationMode.ACCUMULATE; + + private List<Object[]> lateness = new LinkedList<>(); + + public static enum AccumulationMode + { + DISCARD, + ACCUMULATE, + ACCUMULATE_DELTA + } + + public static class GlobalWindow extends WindowOption + { + + } + + public static class FixedWindow extends WindowOption + { + FixedWindow(long quantity, Quantification.Unit unit) + { + size.add(new Object[]{quantity, unit}); + } + + FixedWindow(List<Object[]> size) + { + this.size = size; + } + + private List<Object[]> size = new LinkedList<>(); + + public SlidingWindow slideBy(long slidingQuantity, Quantification.Unit slidingUnit) + { + SlidingWindow sw = new SlidingWindow(this.size); + sw.delta.add(new Object[]{slidingQuantity, slidingUnit}); + return sw; + } + + public FixedWindow and(long quantity, Quantification.Unit unit) + { + size.add(new Object[]{quantity, unit}); + return this; + } + + public List<Object[]> getSize() + { + return size; + } + } + + public static class SlidingWindow extends FixedWindow --- End diff -- The FixedWindow can be treated as special case of SlidingWindow( slide step same as size ). If treat it in this way, we don't need to handle FixedWindow specifically
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---