/*public static List<O2Finding> glueSinksToSources(O2Assessment o2AssessmentWithSinks, O2Assessment o2AssessmentWithSources)
         * {
         *  var webLayerSources = getO2StringIndexes(webLayer, TraceType.Source);
         *
         *  foreach (var clickButtonFinding in clickButton.o2Findings)
         *  {
         *      results.Add(clickButtonFinding);
         *      var sink = OzasmtUtils.getKnownSink(clickButtonFinding.o2Trace);
         *      DI.log.debug(sink.signature);
         *      if (webLayerSources.ContainsKey(sink.signature))
         *          foreach (var webLayerSource in webLayerSources[sink.signature])
         *          {
         *              results.Add(OzasmtGlue.createCopyAndGlueTraceAndSink(clickButtonFinding,
         *                                                                   OzasmtUtils.getSource(
         *                                                                       webLayerSource.o2Trace)));
         *              /*var o2NewFinding = OzasmtCopy.createCopy(clickButtonFinding);
         *              var newFindingSink = OzasmtUtils.getKnownSink(o2NewFinding.o2Trace);
         *              newFindingSink.traceType = TraceType.Type_4;
         *              var sourceToGlue = OzasmtCopy.createCopy(OzasmtUtils.getSource(webLayerSource.o2Trace));
         *              sourceToGlue.traceType = TraceType.Type_0;
         *              newFindingSink.childTraces.Add(sourceToGlue);
         *              results.Add(o2NewFinding);*/
        /*         }
         * }*/

        public static IO2Finding createCopyAndGlueTraceSinkWithSource(IO2Finding o2TemplateFinding,
                                                                      IO2Trace o2TraceWithSource)
        {
            IO2Trace sourceToGlue = OzasmtCopy.createCopy(OzasmtUtils.getSource(o2TraceWithSource));

            return(createCopyAndGlueTraceSinkWithTrace(o2TemplateFinding, sourceToGlue));
        }
        public static IO2Finding createCopyAndGlueTraceSinkWithTrace(IO2Finding o2TemplateFinding,
                                                                     List <IO2Trace> o2TracesToGlue)
        {
            IO2Finding o2NewFinding = OzasmtCopy.createCopy(o2TemplateFinding);
            //IO2Trace newFindingSink = OzasmtUtils.getKnownSink(o2NewFinding.o2Traces);
            IO2Trace newFindingSink = OzasmtUtils.getSink(o2NewFinding.o2Traces);

            newFindingSink.traceType = TraceType.Root_Call;
            foreach (O2Trace o2TraceToGlue in o2TracesToGlue)
            {
                o2TraceToGlue.traceType = TraceType.Root_Call;
                newFindingSink.childTraces.Add(o2TraceToGlue);
            }
            return(o2NewFinding);
        }
        public static IO2Finding createO2FindingFromTrace(IO2Trace o2Trace)
        {
            var o2Finding = new O2Finding
            {
                callerName   = o2Trace.signature,
                context      = o2Trace.context,
                columnNumber = o2Trace.columnNumber,
                file         = o2Trace.file,
                lineNumber   = o2Trace.lineNumber,
                o2Traces     = new List <IO2Trace> {
                    OzasmtCopy.createCopy(o2Trace)
                },
                ordinal  = o2Trace.ordinal,
                text     = OzasmtCopy.createCopy(o2Trace.text),
                vulnName = o2Trace.signature,
                vulnType = "FindingFromTrace"
            };

            return(o2Finding);
        }