public static Map<Instruction, Map<String, String>> replaceWitInstruction(
Map<String, Map<String, String>> header, String type) {
Map<Instruction, Map<String, String>> map = newMap();
for (Iterator<Map.Entry<String, Map<String, String>>> e = header
.entrySet().iterator(); e.hasNext();) {
Map.Entry<String, Map<String, String>> entry = e.next();
String pattern = entry.getKey();
Instruction instr = Instruction.getPattern(pattern);
String presence = entry.getValue().get(PRESENCE_DIRECTIVE);
if ("optional".equals(presence))
instr.setOptional();
map.put(instr, entry.getValue());
}
return map;
}