test_class.file: dexter-core/src/test/java/it/cnr/isti/hpc/dexter/spot/ContextExtractorTest.java
test_class.identifier: ContextExtractorTest
test_case.body: @Test
  	public void testBinSearch() {
  		ContextExtractor extractor = new ContextExtractor(
  				"diego ceccarelli prova test pippo pluto belen");
  		List<Integer> test = Arrays.asList(new Integer[] { 1, 5, 10, 50, 100,
  				110 });
  		assertEquals(0, extractor.closest(2, test));
  		assertEquals(0, extractor.closest(3, test));
  		assertEquals(0, extractor.closest(4, test));
  		assertEquals(1, extractor.closest(5, test));
  		assertEquals(4, extractor.closest(105, test));
  		assertEquals(5, extractor.closest(120, test));
  		assertEquals(3, extractor.closest(99, test));
  
  		test = Arrays.asList(new Integer[] { 0, 1 });
  
  		assertEquals(1, extractor.closest(10000, test));
  		assertEquals(0, extractor.closest(0, test));
  
  		test = Arrays.asList(new Integer[] { 0, 1 });
  
  		assertEquals(1, extractor.closest(10000, test));
  		assertEquals(0, extractor.closest(0, test));
  		test = Arrays.asList(new Integer[] { 1, 5, 10, 50, 100, 110, 1000 });
  		assertEquals(0, extractor.closest(2, test));
  		assertEquals(0, extractor.closest(3, test));
  		assertEquals(0, extractor.closest(4, test));
  		assertEquals(1, extractor.closest(5, test));
  		assertEquals(4, extractor.closest(105, test));
  		assertEquals(5, extractor.closest(120, test));
  
  		assertEquals(6, extractor.closest(1000, test));
  		assertEquals(6, extractor.closest(10000, test));
  
  	}
test_case.class_method_signature: ContextExtractorTest.testBinSearch()
test_case.full_signature: @Test public void testBinSearch()
test_case.identifier: testBinSearch
test_case.invocations: asList assertEquals closest assertEquals closest assertEquals closest assertEquals closest assertEquals closest assertEquals closest assertEquals closest asList assertEquals closest assertEquals closest asList assertEquals closest assertEquals closest asList assertEquals closest assertEquals closest assertEquals closest assertEquals closest assertEquals closest assertEquals closest assertEquals closest assertEquals closest
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testBinSearch()
focal_class.declarator: logger = LoggerFactory.getLogger(ContextExtractor.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = LoggerFactory.getLogger(ContextExtractor.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: windowSize = 50
focal_class.modifier: private
focal_class.original_string: private int windowSize = 50;
focal_class.type: int
focal_class.var_name: windowSize
focal_class.declarator: text
focal_class.modifier: protected
focal_class.original_string: protected String text;
focal_class.type: String
focal_class.var_name: text
focal_class.declarator: positions = new ArrayList<Integer>()
focal_class.modifier: protected
focal_class.original_string: protected List<Integer> positions = new ArrayList<Integer>();
focal_class.type: List<Integer>
focal_class.var_name: positions
focal_class.declarator: MAX_TERM_NUMBER=300
focal_class.modifier: private final
focal_class.original_string: private final int MAX_TERM_NUMBER=300;
focal_class.type: int
focal_class.var_name: MAX_TERM_NUMBER
focal_class.file: dexter-core/src/main/java/it/cnr/isti/hpc/dexter/spot/ContextExtractor.java
focal_class.identifier: ContextExtractor
focal_class.class_method_signature: ContextExtractor.ContextExtractor()
focal_class.full_signature: protected  ContextExtractor()
focal_class.identifier: ContextExtractor
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.signature:  ContextExtractor()
focal_class.class_method_signature: ContextExtractor.ContextExtractor(Field field)
focal_class.full_signature: public  ContextExtractor(Field field)
focal_class.identifier: ContextExtractor
focal_class.modifiers: public
focal_class.parameters: (Field field)
focal_class.signature:  ContextExtractor(Field field)
focal_class.class_method_signature: ContextExtractor.ContextExtractor(String text)
focal_class.full_signature: protected  ContextExtractor(String text)
focal_class.identifier: ContextExtractor
focal_class.modifiers: protected
focal_class.parameters: (String text)
focal_class.signature:  ContextExtractor(String text)
focal_class.class_method_signature: ContextExtractor.cleanContext(String context)
focal_class.full_signature: private String cleanContext(String context)
focal_class.identifier: cleanContext
focal_class.modifiers: private
focal_class.parameters: (String context)
focal_class.return: String
focal_class.signature: String cleanContext(String context)
focal_class.class_method_signature: ContextExtractor.closest(int key, List<Integer> list)
focal_class.full_signature: protected int closest(int key, List<Integer> list)
focal_class.identifier: closest
focal_class.modifiers: protected
focal_class.parameters: (int key, List<Integer> list)
focal_class.return: int
focal_class.signature: int closest(int key, List<Integer> list)
focal_class.class_method_signature: ContextExtractor.getContext(int l, int r)
focal_class.full_signature: private String getContext(int l, int r)
focal_class.identifier: getContext
focal_class.modifiers: private
focal_class.parameters: (int l, int r)
focal_class.return: String
focal_class.signature: String getContext(int l, int r)
focal_class.class_method_signature: ContextExtractor.getContext(String label)
focal_class.full_signature: public String getContext(String label)
focal_class.identifier: getContext
focal_class.modifiers: public
focal_class.parameters: (String label)
focal_class.return: String
focal_class.signature: String getContext(String label)
focal_class.class_method_signature: ContextExtractor.getWindowSize()
focal_class.full_signature: public int getWindowSize()
focal_class.identifier: getWindowSize
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getWindowSize()
focal_class.class_method_signature: ContextExtractor.init(String text)
focal_class.full_signature: protected void init(String text)
focal_class.identifier: init
focal_class.modifiers: protected
focal_class.parameters: (String text)
focal_class.return: void
focal_class.signature: void init(String text)
focal_class.class_method_signature: ContextExtractor.setWindowSize(int windowSize)
focal_class.full_signature: public void setWindowSize(int windowSize)
focal_class.identifier: setWindowSize
focal_class.modifiers: public
focal_class.parameters: (int windowSize)
focal_class.return: void
focal_class.signature: void setWindowSize(int windowSize)
focal_class.class_method_signature: ContextExtractor.termPos(int pos)
focal_class.full_signature: private int termPos(int pos)
focal_class.identifier: termPos
focal_class.modifiers: private
focal_class.parameters: (int pos)
focal_class.return: int
focal_class.signature: int termPos(int pos)
focal_method.body: protected int closest(int key, List<Integer> list) {
  		int size = list.size();
  		int delta = size / 2;
  		int i = size / 2;
  		while (delta > 1) {
  			logger.debug("i = {} \t delta = {} ", i, delta);
  
  			int elem = list.get(i);
  			delta = (delta % 2 == 0) ? (delta) / 2 : (delta + 1) / 2;
  			if (elem == key)
  				return i;
  			if (elem > key) {
  				i = Math.max(i - delta, 0);
  			} else {
  				i = Math.min(delta + i, size - 1);
  			}
  
  		}
  		int elem = list.get(i);
  		if (elem > key)
  			return i - 1;
  		return i;
  	}
focal_method.class_method_signature: ContextExtractor.closest(int key, List<Integer> list)
focal_method.full_signature: protected int closest(int key, List<Integer> list)
focal_method.identifier: closest
focal_method.invocations: size debug get max min get
focal_method.modifiers: protected
focal_method.parameters: (int key, List<Integer> list)
focal_method.return: int
focal_method.signature: int closest(int key, List<Integer> list)