public IVariable[] extractRobotDebugVariables(final int stackTraceId,final Map<String,Object> newVariables){
  final RobotDebugVariablesContext currentVariablesContext=findCurrentVariablesContext(stackTraceId);
  Map<String,IVariable> previousVariablesMap=initPreviousVariablesState(currentVariablesContext);
  final Map<String,IVariable> nonGlobalVariablesMap=new LinkedHashMap<>();
  if (previousVariablesMap == null) {
    initNewNonGlobalVariables(newVariables,nonGlobalVariablesMap);
  }
 else {
    initVariablesComparingWithPreviousState(newVariables,previousVariablesMap,nonGlobalVariablesMap);
  }
  final LinkedList<IVariable> currentVariablesList=createCurrentVariablesList(nonGlobalVariablesMap);
  saveCurrentVariablesState(stackTraceId,currentVariablesContext,nonGlobalVariablesMap);
  return currentVariablesList.toArray(new IVariable[currentVariablesList.size()]);
}

public IVariable [ ] extractRobotDebugVariables ( final int stackTraceId , final Map < String , Object > newVariables ) { final RobotDebugVariablesContext currentVariablesContext = findCurrentVariablesContext ( stackTraceId ) ; Map < String , IVariable > previousVariablesMap = initPreviousVariablesState ( currentVariablesContext ) ; final Map < String , IVariable > nonGlobalVariablesMap = new LinkedHashMap < > ( ) ; if ( previousVariablesMap == null ) { initNewNonGlobalVariables ( newVariables , nonGlobalVariablesMap ) ; } else { initVariablesComparingWithPreviousState ( newVariables , previousVariablesMap , nonGlobalVariablesMap ) ; } final LinkedList < IVariable > currentVariablesList = createCurrentVariablesList ( nonGlobalVariablesMap ) ; saveCurrentVariablesState ( stackTraceId , currentVariablesContext , nonGlobalVariablesMap ) ; return currentVariablesList . toArray ( new IVariable [ currentVariablesList . size ( ) ] ) ; }
extract and sort variables for given stacktrace level . every level of stacktrace has its own context in previousvariables map . current variables are compared with previous state . if current level of stacktrace has not any previous state , then previous state will be variables from level below . this is for saving previous order of variables in higher levels .
