@Test public void testSelectSecondAlternative() { DefaultFromCobolChoiceStrategy strategy = new DefaultFromCobolChoiceStrategy(cobolContext); CobolChoiceType choice = (CobolChoiceType) new CobolRdef01Record().getFields().get("comDetail1Choice"); byte[] hostData = HexUtils.decodeHex("00010250000F40404040404000010260000F404040404040"); CobolType alternative = strategy.choose("comDetail1Choice", choice, null, hostData, 2, hostData.length); assertEquals(choice.getAlternatives().get("comDetail2"), alternative); }
public CobolType choose(String choiceFieldName, CobolChoiceType cobolChoiceType, Map < String, Object > variables, byte[] hostData, int start, int length) { for (Entry < String, CobolType > alternative : cobolChoiceType .getAlternatives().entrySet()) { if (tryAlternative(choiceFieldName, alternative.getValue(), alternative.getKey(), hostData, start, length)) { return alternative.getValue(); } } return null; }
DefaultFromCobolChoiceStrategy implements FromCobolChoiceStrategy { public CobolType choose(String choiceFieldName, CobolChoiceType cobolChoiceType, Map < String, Object > variables, byte[] hostData, int start, int length) { for (Entry < String, CobolType > alternative : cobolChoiceType .getAlternatives().entrySet()) { if (tryAlternative(choiceFieldName, alternative.getValue(), alternative.getKey(), hostData, start, length)) { return alternative.getValue(); } } return null; } }
DefaultFromCobolChoiceStrategy implements FromCobolChoiceStrategy { public CobolType choose(String choiceFieldName, CobolChoiceType cobolChoiceType, Map < String, Object > variables, byte[] hostData, int start, int length) { for (Entry < String, CobolType > alternative : cobolChoiceType .getAlternatives().entrySet()) { if (tryAlternative(choiceFieldName, alternative.getValue(), alternative.getKey(), hostData, start, length)) { return alternative.getValue(); } } return null; } DefaultFromCobolChoiceStrategy(CobolContext cobolContext); }
DefaultFromCobolChoiceStrategy implements FromCobolChoiceStrategy { public CobolType choose(String choiceFieldName, CobolChoiceType cobolChoiceType, Map < String, Object > variables, byte[] hostData, int start, int length) { for (Entry < String, CobolType > alternative : cobolChoiceType .getAlternatives().entrySet()) { if (tryAlternative(choiceFieldName, alternative.getValue(), alternative.getKey(), hostData, start, length)) { return alternative.getValue(); } } return null; } DefaultFromCobolChoiceStrategy(CobolContext cobolContext); CobolType choose(String choiceFieldName,
            CobolChoiceType cobolChoiceType, Map < String, Object > variables,
            byte[] hostData, int start, int length); Set < String > getVariableNames(); }
DefaultFromCobolChoiceStrategy implements FromCobolChoiceStrategy { public CobolType choose(String choiceFieldName, CobolChoiceType cobolChoiceType, Map < String, Object > variables, byte[] hostData, int start, int length) { for (Entry < String, CobolType > alternative : cobolChoiceType .getAlternatives().entrySet()) { if (tryAlternative(choiceFieldName, alternative.getValue(), alternative.getKey(), hostData, start, length)) { return alternative.getValue(); } } return null; } DefaultFromCobolChoiceStrategy(CobolContext cobolContext); CobolType choose(String choiceFieldName,
            CobolChoiceType cobolChoiceType, Map < String, Object > variables,
            byte[] hostData, int start, int length); Set < String > getVariableNames();  }