test_class.declarator: FACTORY = ValueFactoryImpl.getInstance()
test_class.modifier: private static final
test_class.original_string: private static final ValueFactory FACTORY = ValueFactoryImpl.getInstance();
test_class.type: ValueFactory
test_class.var_name: FACTORY
test_class.file: series/src/test/java/com/barchart/feed/series/analytics/BarBuilderTest.java
test_class.identifier: BarBuilderTest
test_case.body: @SuppressWarnings({
  			"unchecked", "rawtypes"
  	})
  	@Test
  	public void testMinuteTo5Minute() {
  		String symbol = "ESZ13";
  		Instrument instr = TestHarness.makeInstrument(symbol);
  		DateTime dt2 = new DateTime(2013, 12, 10, 12, 0, 0);
  		TimeFrameImpl tf2 = new TimeFrameImpl(new Period(PeriodType.MINUTE, 5), dt2, null);
  
  		SeriesSubscription sub2 = new SeriesSubscription(
  			"ESZ13", instr, "IO", new TimeFrameImpl[] {	tf2 }, TradingWeekImpl.DEFAULT);
  
  		BarBuilder barBuilder = new BarBuilder(sub2);
  		barBuilder.addInputTimeSeries(BarBuilder.INPUT_KEY, new DataSeriesImpl<BarImpl>(new Period(PeriodType.MINUTE, 1)));
  		DataSeriesImpl<BarImpl> inputSeries =
  			(DataSeriesImpl) barBuilder.getInputTimeSeries(BarBuilder.INPUT_KEY);
  		assertNotNull(inputSeries);
  
  		barBuilder.addOutputTimeSeries(BarBuilder.OUTPUT_KEY, new DataSeriesImpl<BarImpl>(new Period(PeriodType.MINUTE, 5)));
  		DataSeriesImpl<BarImpl> outputSeries =
  			(DataSeriesImpl) barBuilder.getOutputTimeSeries(BarBuilder.OUTPUT_KEY);
  		assertNotNull(outputSeries);
  		assertEquals(new Period(PeriodType.MINUTE, 5), outputSeries.getPeriod());
  
  		List<BarImpl> list = getBars();
  		SpanImpl span = new SpanImpl(new Period(PeriodType.MINUTE, 5),
  			new DateTime(2013, 12, 10, 12, 0, 0),
  				new DateTime(2013, 12, 10, 12, 30, 0));
  
  		for (int i = 0; i < list.size(); i++) {
  			inputSeries.add(list.get(i));
  		}
  
  		span.setNextDate(inputSeries.get(inputSeries.size() - 1).getDate());
  		barBuilder.process(span);
  
  		assertEquals(6, outputSeries.size());
  		int mins = 5;
  		for (int i = 0; i < outputSeries.size(); i++) {
  			assertEquals(mins, outputSeries.get(i).getDate().getMinuteOfHour());
  			mins += 5;
  		}
  
  		list = getBars2();
  		for (BarImpl db : list) {
  			inputSeries.add(db);
  			span.setDate(db.getDate());
  			span.setNextDate(db.getDate());
  			barBuilder.process(span);
  		}
  
  		assertEquals(12, outputSeries.size());
  	}
test_case.class_method_signature: BarBuilderTest.testMinuteTo5Minute()
test_case.full_signature: @SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testMinuteTo5Minute()
test_case.identifier: testMinuteTo5Minute
test_case.invocations: makeInstrument addInputTimeSeries getInputTimeSeries assertNotNull addOutputTimeSeries getOutputTimeSeries assertNotNull assertEquals getPeriod getBars size add get setNextDate getDate get size process assertEquals size size assertEquals getMinuteOfHour getDate get getBars2 add setDate getDate setNextDate getDate process assertEquals size
test_case.modifiers: @SuppressWarnings({ "unchecked", "rawtypes" }) @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testMinuteTo5Minute()
focal_class.declarator: NAME = "BarBuilder"
focal_class.modifier: public static final
focal_class.original_string: public static final String NAME = "BarBuilder";
focal_class.type: String
focal_class.var_name: NAME
focal_class.declarator: INPUT_KEY = "Input"
focal_class.modifier: public static final
focal_class.original_string: public static final String INPUT_KEY = "Input";
focal_class.type: String
focal_class.var_name: INPUT_KEY
focal_class.declarator: OUTPUT_KEY = "Output"
focal_class.modifier: public static final
focal_class.original_string: public static final String OUTPUT_KEY = "Output";
focal_class.type: String
focal_class.var_name: OUTPUT_KEY
focal_class.declarator: inputs = new String[] { INPUT_KEY }
focal_class.modifier: private static
focal_class.original_string: private static String[] inputs = new String[] { INPUT_KEY };
focal_class.type: String[]
focal_class.var_name: inputs
focal_class.declarator: outputs = new String[] { OUTPUT_KEY }
focal_class.modifier: private static
focal_class.original_string: private static String[] outputs = new String[] { OUTPUT_KEY };
focal_class.type: String[]
focal_class.var_name: outputs
focal_class.declarator: currentMergeBar
focal_class.modifier: private
focal_class.original_string: private BarImpl currentMergeBar;
focal_class.type: BarImpl
focal_class.var_name: currentMergeBar
focal_class.declarator: inputSpan
focal_class.modifier: private
focal_class.original_string: private SpanImpl inputSpan;
focal_class.type: SpanImpl
focal_class.var_name: inputSpan
focal_class.declarator: workingSpan
focal_class.modifier: private
focal_class.original_string: private SpanImpl workingSpan;
focal_class.type: SpanImpl
focal_class.var_name: workingSpan
focal_class.declarator: workingTargetDate
focal_class.modifier: private
focal_class.original_string: private DateTime workingTargetDate;
focal_class.type: DateTime
focal_class.var_name: workingTargetDate
focal_class.declarator: subscription
focal_class.modifier: private
focal_class.original_string: private SeriesSubscription subscription;
focal_class.type: SeriesSubscription
focal_class.var_name: subscription
focal_class.file: series/src/main/java/com/barchart/feed/series/analytics/BarBuilder.java
focal_class.identifier: BarBuilder
focal_class.class_method_signature: BarBuilder.BarBuilder(SeriesSubscription s)
focal_class.full_signature:   BarBuilder(SeriesSubscription s)
focal_class.identifier: BarBuilder
focal_class.parameters: (SeriesSubscription s)
focal_class.signature:  BarBuilder(SeriesSubscription s)
focal_class.class_method_signature: BarBuilder.getSubscription()
focal_class.full_signature: public SeriesSubscription getSubscription()
focal_class.identifier: getSubscription
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: SeriesSubscription
focal_class.signature: SeriesSubscription getSubscription()
focal_class.class_method_signature: BarBuilder.process(Span span)
focal_class.full_signature: @SuppressWarnings(value = { "unchecked", "rawtypes" }) @Override public Span process(Span span)
focal_class.identifier: process
focal_class.modifiers: @SuppressWarnings(value = { "unchecked", "rawtypes" }) @Override public
focal_class.parameters: (Span span)
focal_class.return: Span
focal_class.signature: Span process(Span span)
focal_class.class_method_signature: BarBuilder.getInputKeys()
focal_class.full_signature: public static String[] getInputKeys()
focal_class.identifier: getInputKeys
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: String[]
focal_class.signature: String[] getInputKeys()
focal_class.class_method_signature: BarBuilder.getOutputKeys()
focal_class.full_signature: public static String[] getOutputKeys()
focal_class.identifier: getOutputKeys
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: String[]
focal_class.signature: String[] getOutputKeys()
focal_class.superclass: extends AnalyticBase
focal_method.body: @SuppressWarnings(value = { "unchecked", "rawtypes" })
  	@Override
  	public Span process(Span span) {
  	    //System.out.println(this + " processing span: " + span);
  		this.inputSpan = (SpanImpl)span;
  
  		DataSeriesImpl<DataPointImpl> outputSeries = (DataSeriesImpl)getOutputTimeSeries(BarBuilder.OUTPUT_KEY);
  		DataSeriesImpl<DataPointImpl> inputSeries = (DataSeriesImpl)getInputTimeSeries(BarBuilder.INPUT_KEY);
  		int inputStartIdx = inputSeries.indexOf(inputSpan.getDate(), false);
  		int inputLastIdx = inputSeries.indexOf(inputSpan.getNextDate(), false);
  
  		Period inputPeriod = inputSeries.getPeriod();
          Period outputPeriod = outputSeries.getPeriod();
  
          boolean barCompleted = false;
  
          if(inputPeriod.equals(outputPeriod)) {
  		    for(int i = inputStartIdx;i <= inputLastIdx;i++) {
  		        outputSeries.insertData(inputSeries.get(i));
  		    }
  		    return new SpanImpl(inputSpan);
  		}else{
  			if(inputPeriod.size() > 1) {
  				throw new IllegalStateException(
  					"Can't build bars from Type with an Interval that's not 1. Input=" +
  						inputPeriod + ", output=" + outputPeriod);
  			}
  
  			if(subscription.getTimeFrame(0).getPeriod().equals(new Period(PeriodType.SECOND, 1))) {
  			    System.out.println("debug");
  			}
  
  			boolean wasAddedDuringInit = false;
  			if(currentMergeBar == null) {
  			    wasAddedDuringInit = true;
  				currentMergeBar = new BarImpl((BarImpl)inputSeries.get(inputStartIdx));
  				workingTargetDate = subscription.getTradingWeek().getNextSessionDate(inputSpan.getDate(), outputPeriod);
  				currentMergeBar.setDate(workingTargetDate);
  				workingSpan = new SpanImpl(subscription.getTimeFrame(0).getPeriod(), inputSpan.getDate(), inputSpan.getNextDate());
  				this.workingSpan.setNextDate(workingTargetDate);
  				System.out.println("IS INIT: ADDING NEW BAR " + currentMergeBar + "   " + outputSeries.getPeriod() + "  :  span = " + this.workingSpan);
  				outputSeries.add(currentMergeBar);
  			}else{
  				workingSpan.setDate(workingTargetDate);
  			}
  
  			for(int i = wasAddedDuringInit ? inputStartIdx + 1 : inputStartIdx;i <= inputLastIdx;i++) {
  				BarImpl currentIdxBar = (BarImpl)inputSeries.get(i);
  				if(currentIdxBar.getDate().isAfter(workingTargetDate)) {
  					workingTargetDate = subscription.getTradingWeek().getNextSessionDate(workingTargetDate, outputPeriod);
  					currentMergeBar = new BarImpl(currentIdxBar);
  					currentMergeBar.setDate(workingTargetDate);
  					this.workingSpan.setNextDate(workingTargetDate);
  					System.out.println("IS AFTER: ADDING NEW BAR " + currentMergeBar + "   " + outputSeries.getPeriod() + "  :  span = " + this.workingSpan);
  					outputSeries.add(currentMergeBar);
  					barCompleted = true;
  				}else{
  				    currentMergeBar.merge(currentIdxBar, false);
  				    if(workingSpan.getPeriod().equals(new Period(PeriodType.SECOND, 1))) {
  				        System.out.println("\tNOT IS AFTER: MERGING NEW BAR " + currentMergeBar + "   " + outputSeries.getPeriod() + "  :  span = " + this.workingSpan);
  				    }
  				}
  			}
  
  			//Notify of change
  			valueUpdated();
  		}
  
  		return barCompleted ? workingSpan : null;
  	}
focal_method.class_method_signature: BarBuilder.process(Span span)
focal_method.full_signature: @SuppressWarnings(value = { "unchecked", "rawtypes" }) @Override public Span process(Span span)
focal_method.identifier: process
focal_method.invocations: getOutputTimeSeries getInputTimeSeries indexOf getDate indexOf getNextDate getPeriod getPeriod equals insertData get size equals getPeriod getTimeFrame println get getNextSessionDate getTradingWeek getDate setDate getPeriod getTimeFrame getDate getNextDate setNextDate println getPeriod add setDate get isAfter getDate getNextSessionDate getTradingWeek setDate setNextDate println getPeriod add merge equals getPeriod println getPeriod valueUpdated
focal_method.modifiers: @SuppressWarnings(value = { "unchecked", "rawtypes" }) @Override public
focal_method.parameters: (Span span)
focal_method.return: Span
focal_method.signature: Span process(Span span)