Prompt:
Please complete the code given below.
///////////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2006-2015 Esper Team. All rights reserved.                           /
// http://esper.codehaus.org                                                          /
// ---------------------------------------------------------------------------------- /
// The software in this package is published under the terms of the GPL license       /
// a copy of which has been included with this distribution in the license.txt file.  /
///////////////////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using com.espertech.esper.common.client.scopetest;
using com.espertech.esper.common.@internal.epl.@join.lookup;
using com.espertech.esper.common.@internal.epl.lookupplansubord;
using com.espertech.esper.common.@internal.support;
using com.espertech.esper.compat;
using com.espertech.esper.compat.collections;
using com.espertech.esper.regressionlib.framework;
using com.espertech.esper.regressionlib.support.bean;
using com.espertech.esper.regressionlib.support.util;
using NUnit.Framework;
using static com.espertech.esper.regressionlib.framework.SupportMessageAssertUtil;
namespace com.espertech.esper.regressionlib.suite.infra.nwtable
{
    public class InfraNWTableCreateIndex
    {
        public static IList<RegressionExecution> Executions()
        {
            var execs = new List<RegressionExecution>();
            execs.Add(new InfraMultiRangeAndKey(true));
            execs.Add(new InfraMultiRangeAndKey(false));
            execs.Add(new InfraHashBTreeWidening(true));
            execs.Add(new InfraHashBTreeWidening(false));
            execs.Add(new InfraWidening(true));
            execs.Add(new InfraWidening(false));
            execs.Add(new InfraCompositeIndex(true));
            execs.Add(new InfraCompositeIndex(false));
            execs.Add(new InfraLateCreate(true));
            execs.Add(new InfraLateCreate(false));
            execs.Add(new InfraLateCreateSceneTwo(true));
            execs.Add(new InfraLateCreateSceneTwo(false));
            execs.Add(new InfraMultipleColumnMultipleIndex(true));
            execs.Add(new InfraMultipleColumnMultipleIndex(false));
            execs.Add(new InfraDropCreate(true));
            execs.Add(new InfraDropCreate(false));
            execs.Add(new InfraOnSelectReUse(true));
            execs.Add(new InfraOnSelectReUse(false));
            execs.Add(new InfraInvalid(true));
            execs.Add(new InfraInvalid(false));
            execs.Add(new InfraMultikeyIndexFAF(true));
            execs.Add(new InfraMultikeyIndexFAF(false));
            return execs;
        }
        private static void RunQueryAssertion(
            RegressionEnvironment env,
            RegressionPath path,
            string epl,
            string[] fields,
            object[][] expected)
        {
            var result = env.CompileExecuteFAF(epl, path);
            EPAssertionUtil.AssertPropsPerRow(result.Array, fields, expected);
        }
        private static void SendEventLong(
            RegressionEnvironment env,
            string theString,
            long longPrimitive)
        {
            var theEvent = new SupportBean();
            theEvent.TheString = theString;
            theEvent.LongPrimitive = longPrimitive;
            env.SendEventBean(theEvent);
        }
        private static void SendEventShort(
            RegressionEnvironment env,
            string theString,
            short shortPrimitive)
        {
            var theEvent = new SupportBean();
            theEvent.TheString = theString;
            theEvent.ShortPrimitive = shortPrimitive;
            env.SendEventBean(theEvent);
        }
        private static void MakeSendSupportBean(
            RegressionEnvironment env,
            string theString,
            int intPrimitive,
            long longPrimitive)
        {
            var b = new SupportBean(theString, intPrimitive);
            b.LongPrimitive = longPrimitive;
            env.SendEventBean(b);
        }
        private static void AssertCols(
            RegressionEnvironment env,
            string listOfP00,
            object[][] expected)
        {
            var p00s = listOfP00.SplitCsv();
            Assert.AreEqual(p00s.Length, expected.Length);
            for (var i = 0; i < p00s.Length; i++) {
                env.SendEventBean(new SupportBean_S0(0, p00s[i]));
                if (expected[i] == null) {
                    Assert.IsFalse(env.Listener("s0").IsInvoked);
                }
                else {
                    EPAssertionUtil.AssertProps(
                        env.Listener("s0").AssertOneGetNewAndReset(),
                        new [] { "col0","col1" },
                        expected[i]);
                }
            }
        }
        private static int GetIndexCount(
            RegressionEnvironment env,
            bool namedWindow,
            string infraStmtName,
            string infraName)
        {
            return SupportInfraUtil.GetIndexCountNoContext(env, namedWindow, infraStmtName, infraName);
        }
        private static void AssertIndexesRef(
            RegressionEnvironment env,
            bool namedWindow,
            string name,
            string csvNames)
        {
            var entry = GetIndexEntry(env, namedWindow, name);
            if (string.IsNullOrEmpty(csvNames)) {
                Assert.IsNull(entry);
            }
            else {
                EPAssertionUtil.AssertEqualsAnyOrder(csvNames.SplitCsv(), entry.ReferringDeployments);
            }
        }
        private static void AssertIndexCountInstance(
            RegressionEnvironment env,
            bool namedWindow,
            string name,
            int count)
        {
            var repo = GetIndexInstanceRepo(env, namedWindow, name);
            Assert.AreEqual(count, repo.Tables.Count);
        }
        private static EventTableIndexRepository GetIndexInstanceRepo(
            RegressionEnvironment env,
            bool namedWindow,
            string name)
        {
            if (namedWindow) {
                var namedWindowInstance = SupportInfraUtil.GetInstanceNoContextNW(env, "create", name);
                return namedWindowInstance.RootViewInstance.IndexRepository;
            }
            var instance = SupportInfraUtil.GetInstanceNoContextTable(env, "create", name);
            return instance.IndexRepository;
        }
        private static EventTableIndexMetadataEntry GetIndexEntry(
            RegressionEnvironment env,
            bool namedWindow,
            string name)
        {
            var descOne = new IndexedPropDesc("col0", typeof(string));
            var index = new IndexMultiKey(
                false,
                Arrays.AsList(descOne),
                Collections.GetEmptyList<IndexedPropDesc>(),
                null);
            var meta = GetIndexMetaRepo(env, namedWindow, name);
            return meta.Indexes.Get(index);
        }
        private static EventTableIndexMetadata GetIndexMetaRepo(
            RegressionEnvironment env,
            bool namedWindow,
            string name)
        {
            if (namedWindow) {
                var processor = SupportInfraUtil.GetNamedWindow(env, "create", name);
                return processor.EventTableIndexMetadata;
            }
            var table = SupportInfraUtil.GetTable(env, "create", name);
            return table.EventTableIndexMetadata;
        }
        internal class InfraInvalid : RegressionExecution
        {
            private readonly bool namedWindow;
            public InfraInvalid(bool namedWindow)
            {
                this.namedWindow = namedWindow;
            }
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                var eplCreate = namedWindow
                    ? "create window MyInfraOne#keepall as (f1 string, f2 int)"
                    : "create table MyInfraOne as (f1 string primary key, f2 int primary key)";
                env.CompileDeploy(eplCreate, path);
                env.CompileDeploy("create index MyInfraIndex on MyInfraOne(f1)", path);
                env.CompileDeploy("create context ContextOne initiated by SupportBean terminated after 5 sec", path);
                env.CompileDeploy("create context ContextTwo initiated by SupportBean terminated after 5 sec", path);
                var eplCreateWContext = namedWindow
                    ? "context ContextOne create window MyInfraCtx#keepall as (f1 string, f2 int)"
                    : "context ContextOne create table MyInfraCtx as (f1 string primary key, f2 int primary key)";
                env.CompileDeploy(eplCreateWContext, path);
                // invalid context
                TryInvalidCompile(
                    env,
                    path,
                    "create unique index IndexTwo on MyInfraCtx(f1)",
                    (namedWindow ? "Named window" : "Table") +
                    " by name 'MyInfraCtx' has been declared for context 'ContextOne' and can only be used within the same context");
                TryInvalidCompile(
                    env,
                    path,
                    "context ContextTwo create unique index IndexTwo on MyInfraCtx(f1)",
                    (namedWindow ? "Named window" : "Table") +
                    " by name 'MyInfraCtx' has been declared for context 'ContextOne' and can only be used within the same context");
                TryInvalidCompile(
                    env,
                    path,
                    "create index MyInfraIndex on MyInfraOne(f1)",
                    "An index by name 'MyInfraIndex' already exists [");
                TryInvalidCompile(
                    env,
                    path,
                    "create index IndexTwo on MyInfraOne(fx)",
                    "Property named 'fx' not found");
                TryInvalidCompile(
                    env,
                    path,
                    "create index IndexTwo on MyInfraOne(f1, f1)",
                    "Property named 'f1' has been declared more then once [create index IndexTwo on MyInfraOne(f1, f1)]");
                TryInvalidCompile(
                    env,
                    path,
                    "create index IndexTwo on MyWindowX(f1, f1)",
                    "A named window or table by name 'MyWindowX' does not exist [create index IndexTwo on MyWindowX(f1, f1)]");
                TryInvalidCompile(
                    env,
                    path,
                    "create index IndexTwo on MyInfraOne(f1 bubu, f2)",
                    "Unrecognized advanced-type index 'bubu'");
                TryInvalidCompile(
                    env,
                    path,
                    "create gugu index IndexTwo on MyInfraOne(f2)",
                    "Invalid keyword 'gugu' in create-index encountered, expected 'unique' [create gugu index IndexTwo on MyInfraOne(f2)]");
                TryInvalidCompile(
                    env,
                    path,
                    "create unique index IndexTwo on MyInfraOne(f2 btree)",
                    "Combination of unique index with btree (range) is not supported [create unique index IndexTwo on MyInfraOne(f2 btree)]");
                // invalid insert-into unique index
                var eplCreateTwo = namedWindow
                    ? "@Name('create') create window MyInfraTwo#keepall as SupportBean"
                    : "@Name('create') create table MyInfraTwo(TheString string primary key, IntPrimitive int primary key)";
                env.CompileDeploy(eplCreateTwo, path);
                env.CompileDeploy(
                    "@Name('insert') insert into MyInfraTwo select TheString, IntPrimitive from SupportBean",
                    path);
                env.CompileDeploy("create unique index I1 on MyInfraTwo(TheString)", path);
                env.SendEventBean(new SupportBean("E1", 1));
                try {
                    env.SendEventBean(new SupportBean("E1", 2));
                    Assert.Fail();
                }
                catch (Exception ex) {
                    var text = namedWindow
                        ? "Unexpected exception in statement 'create': Unique index violation, index 'I1' is a unique index and key 'E1' already exists"
                        : "Unexpected exception in statement 'insert': Unique index violation, index 'I1' is a unique index and key 'E1' already exists";
                    Assert.AreEqual(text, ex.Message);
                }
                if (!namedWindow) {
                    env.CompileDeploy("create table MyTable (p0 string, sumint sum(int))", path);
                    TryInvalidCompile(
                        env,
                        path,
                        "create index MyIndex on MyTable(p0)",
                        "Tables without primary key column(s) do not allow creating an index [");
                }
                env.UndeployAll();
            }
        }
        internal class InfraOnSelectReUse : RegressionExecution
        {
            private readonly bool namedWindow;
            public InfraOnSelectReUse(bool namedWindow)
            {
                this.namedWindow = namedWindow;
            }
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                var stmtTextCreateOne = namedWindow
                    ? "@Name('create') create window MyInfraONR#keepall as (f1 string, f2 int)"
                    : "@Name('create') create table MyInfraONR as (f1 string primary key, f2 int primary key)";
                env.CompileDeploy(stmtTextCreateOne, path);
                env.CompileDeploy(
                    "insert into MyInfraONR(f1, f2) select TheString, IntPrimitive from SupportBean",
                    path);
                env.CompileDeploy("@Name('indexOne') create index MyInfraONRIndex1 on MyInfraONR(f2)", path);
                var fields = new [] { "f1","f2" };
                env.SendEventBean(new SupportBean("E1", 1));
                env.CompileDeploy(
                        "@Name('s0') on SupportBean_S0 S0 select nw.f1 as f1, nw.f2 as f2 from MyInfraONR nw where nw.f2 = S0.Id",
                        path)
                    .AddListener("s0");
                Assert.AreEqual(namedWindow ? 1 : 2, GetIndexCount(env, namedWindow, "create", "MyInfraONR"));
                env.SendEventBean(new SupportBean_S0(1));
                EPAssertionUtil.AssertProps(
                    env.Listener("s0").AssertOneGetNewAndReset(),
                    fields,
                    new object[] {"E1", 1});
                // create second identical statement
                env.CompileDeploy(
                    "@Name('stmtTwo') on SupportBean_S0 S0 select nw.f1 as f1, nw.f2 as f2 from MyInfraONR nw where nw.f2 = S0.Id",
                    path);
                Assert.AreEqual(namedWindow ? 1 : 2, GetIndexCount(env, namedWindow, "create", "MyInfraONR"));
                env.UndeployModuleContaining("s0");
                Assert.AreEqual(namedWindow ? 1 : 2, GetIndexCount(env, namedWindow, "create", "MyInfraONR"));
                env.UndeployModuleContaining("stmtTwo");
                Assert.AreEqual(namedWindow ? 1 : 2, GetIndexCount(env, namedWindow, "create", "MyInfraONR"));
                env.UndeployModuleContaining("indexOne");
                // two-key index order test
                env.CompileDeploy("@Name('cw') create window MyInfraFour#keepall as SupportBean", path);
                env.CompileDeploy("create index Idx1 on MyInfraFour (TheString, IntPrimitive)", path);
                env.CompileDeploy(
                    "on SupportBean sb select * from MyInfraFour w where w.TheString = sb.TheString and w.IntPrimitive = sb.IntPrimitive",
                    path);
                env.CompileDeploy(
                    "on SupportBean sb select * from MyInfraFour w where w.IntPrimitive = sb.IntPrimitive and w.TheString = sb.TheString",
                    path);
                Assert.AreEqual(1, SupportInfraUtil.GetIndexCountNoContext(env, true, "cw", "MyInfraFour"));
                env.UndeployAll();
            }
        }
        internal class InfraDropCreate : RegressionExecution
        {
            private readonly bool namedWindow;
            public InfraDropCreate(bool namedWindow)
            {
                this.namedWindow = namedWindow;
            }
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                var stmtTextCreateOne = namedWindow
                    ? "@Name('create') create window MyInfraDC#keepall as (f1 string, f2 int, f3 string, f4 string)"
                    : "@Name('create') create table MyInfraDC as (f1 string primary key, f2 int primary key, f3 string primary key, f4 string primary key)";
                env.CompileDeploy(stmtTextCreateOne, path);
                env.CompileDeploy(
                    "insert into MyInfraDC(f1, f2, f3, f4) select TheString, IntPrimitive, '>'||TheString||'<', '?'||TheString||'?' from SupportBean",
                    path);
                env.CompileDeploy("@Name('indexOne') create index MyInfraDCIndex1 on MyInfraDC(f1)", path);
                env.CompileDeploy("@Name('indexTwo') create index MyInfraDCIndex2 on MyInfraDC(f4)", path);
                var fields = new [] { "f1","f2" };
                env.SendEventBean(new SupportBean("E1", -2));
                env.UndeployModuleContaining("indexOne");
                var result = env.CompileExecuteFAF("select * from MyInfraDC where f1='E1'", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2}});
                result = env.CompileExecuteFAF("select * from MyInfraDC where f4='?E1?'", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2}});
                env.UndeployModuleContaining("indexTwo");
                result = env.CompileExecuteFAF("select * from MyInfraDC where f1='E1'", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2}});
                result = env.CompileExecuteFAF("select * from MyInfraDC where f4='?E1?'", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2}});
                path.Compileds.RemoveAt(path.Compileds.Count - 1);
                env.CompileDeploy("@Name('IndexThree') create index MyInfraDCIndex2 on MyInfraDC(f4)", path);
                result = env.CompileExecuteFAF("select * from MyInfraDC where f1='E1'", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2}});
                result = env.CompileExecuteFAF("select * from MyInfraDC where f4='?E1?'", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2}});
                env.UndeployModuleContaining("IndexThree");
                Assert.AreEqual(namedWindow ? 0 : 1, GetIndexCount(env, namedWindow, "create", "MyInfraDC"));
                env.UndeployAll();
            }
        }
        internal class InfraMultipleColumnMultipleIndex : RegressionExecution
        {
            private readonly bool namedWindow;
            public InfraMultipleColumnMultipleIndex(bool namedWindow)
            {
                this.namedWindow = namedWindow;
            }
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                var stmtTextCreateOne = namedWindow
                    ? "create window MyInfraMCMI#keepall as (f1 string, f2 int, f3 string, f4 string)"
                    : "create table MyInfraMCMI as (f1 string primary key, f2 int, f3 string, f4 string)";
                env.CompileDeploy(stmtTextCreateOne, path);
                env.CompileDeploy(
                    "insert into MyInfraMCMI(f1, f2, f3, f4) select TheString, IntPrimitive, '>'||TheString||'<', '?'||TheString||'?' from SupportBean",
                    path);
                env.CompileDeploy("create index MyInfraMCMIIndex1 on MyInfraMCMI(f2, f3, f1)", path);
                env.CompileDeploy("create index MyInfraMCMIIndex2 on MyInfraMCMI(f2, f3)", path);
                env.CompileDeploy("create index MyInfraMCMIIndex3 on MyInfraMCMI(f2)", path);
                var fields = new [] { "f1","f2","f3","f4" };
                env.SendEventBean(new SupportBean("E1", -2));
                env.SendEventBean(new SupportBean("E2", -4));
                env.SendEventBean(new SupportBean("E3", -3));
                var result = env.CompileExecuteFAF("select * from MyInfraMCMI where f3='>E1<'", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2, ">E1<", "?E1?"}});
                result = env.CompileExecuteFAF("select * from MyInfraMCMI where f3='>E1<' and f2=-2", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2, ">E1<", "?E1?"}});
                result = env.CompileExecuteFAF("select * from MyInfraMCMI where f3='>E1<' and f2=-2 and f1='E1'", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2, ">E1<", "?E1?"}});
                result = env.CompileExecuteFAF("select * from MyInfraMCMI where f2=-2", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2, ">E1<", "?E1?"}});
                result = env.CompileExecuteFAF("select * from MyInfraMCMI where f1='E1'", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2, ">E1<", "?E1?"}});
                result = env.CompileExecuteFAF(
                    "select * from MyInfraMCMI where f3='>E1<' and f2=-2 and f1='E1' and f4='?E1?'",
                    path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2, ">E1<", "?E1?"}});
                env.UndeployAll();
            }
        }
        public class InfraLateCreate : RegressionExecution
        {
            private readonly bool namedWindow;
            public InfraLateCreate(bool namedWindow)
            {
                this.namedWindow = namedWindow;
            }
            public void Run(RegressionEnvironment env)
            {
                string[] fields = {"TheString", "IntPrimitive"};
                var path = new RegressionPath();
                // create infra
                var stmtTextCreate = namedWindow
                    ? "@Name('Create') create window MyInfra.win:keepall() as SupportBean"
                    : "@Name('Create') create table MyInfra(TheString string primary key, IntPrimitive int primary key)";
                env.CompileDeploy(stmtTextCreate, path).AddListener("Create");
                // create insert into
                var stmtTextInsertOne =
                    "@Name('Insert') insert into MyInfra select TheString, IntPrimitive from SupportBean";
                env.CompileDeploy(stmtTextInsertOne, path);
                env.SendEventBean(new SupportBean("A1", 1));
                env.SendEventBean(new SupportBean("B2", 2));
                env.SendEventBean(new SupportBean("B2", 1));
                // create index
                var stmtTextCreateIndex = "@Name('Index') create index MyInfra_IDX on MyInfra(TheString)";
                env.CompileDeploy(stmtTextCreateIndex, path);
                env.Milestone(0);
                // perform on-demand query
                var result = env.CompileExecuteFAF(
                    "select * from MyInfra where TheString = 'B2' order by IntPrimitive asc",
                    path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"B2", 1}, new object[] {"B2", 2}});
                // cleanup
                env.UndeployAll();
                env.Milestone(1);
            }
        }
        internal class InfraLateCreateSceneTwo : RegressionExecution
        {
            private readonly bool namedWindow;
            public InfraLateCreateSceneTwo(bool namedWindow)
            {
                this.namedWindow = namedWindow;
            }
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                var stmtTextCreateOne = namedWindow
                    ? "create window MyInfraLC#keepall as (f1 string, f2 int, f3 string, f4 string)"
                    : "create table MyInfraLC as (f1 string primary key, f2 int primary key, f3 string primary key, f4 string primary key)";
                env.CompileDeploy(stmtTextCreateOne, path);
                env.CompileDeploy(
                    "insert into MyInfraLC(f1, f2, f3, f4) select TheString, IntPrimitive, '>'||TheString||'<', '?'||TheString||'?' from SupportBean",
                    path);
                env.SendEventBean(new SupportBean("E1", -4));
                env.Milestone(0);
                env.SendEventBean(new SupportBean("E1", -2));
                env.SendEventBean(new SupportBean("E1", -3));
                env.CompileDeploy("create index MyInfraLCIndex on MyInfraLC(f2, f3, f1)", path);
                var fields = new [] { "f1","f2","f3","f4" };
                env.Milestone(1);
                var result = env.CompileExecuteFAF("select * from MyInfraLC where f3='>E1<' order by f2 asc", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {
                        new object[] {"E1", -4, ">E1<", "?E1?"}, new object[] {"E1", -3, ">E1<", "?E1?"},
                        new object[] {"E1", -2, ">E1<", "?E1?"}
                    });
                env.UndeployAll();
            }
        }
        internal class InfraCompositeIndex : RegressionExecution
        {
            private readonly bool namedWindow;
            public InfraCompositeIndex(bool namedWindow)
            {
                this.namedWindow = namedWindow;
            }
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                var stmtTextCreate = namedWindow
                    ? "create window MyInfraCI#keepall as (f1 string, f2 int, f3 string, f4 string)"
                    : "create table MyInfraCI as (f1 string primary key, f2 int, f3 string, f4 string)";
                env.CompileDeploy(stmtTextCreate, path);
                var compiledWindow = path.Compileds[0];
                env.CompileDeploy(
                    "insert into MyInfraCI(f1, f2, f3, f4) select TheString, IntPrimitive, '>'||TheString||'<', '?'||TheString||'?' from SupportBean",
                    path);
                env.CompileDeploy("@Name('indexOne') create index MyInfraCIIndex on MyInfraCI(f2, f3, f1)", path);
                var fields = new [] { "f1","f2","f3","f4" };
                env.SendEventBean(new SupportBean("E1", -2));
                var result = env.CompileExecuteFAF("select * from MyInfraCI where f3='>E1<'", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2, ">E1<", "?E1?"}});
                result = env.CompileExecuteFAF("select * from MyInfraCI where f3='>E1<' and f2=-2", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2, ">E1<", "?E1?"}});
                result = env.CompileExecuteFAF("select * from MyInfraCI where f3='>E1<' and f2=-2 and f1='E1'", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
                    new[] {new object[] {"E1", -2, ">E1<", "?E1?"}});
                env.UndeployModuleContaining("indexOne");
                // test SODA
                path.Clear();
                path.Add(compiledWindow);
                env.EplToModelCompileDeploy("create index MyInfraCIIndexTwo on MyInfraCI(f2, f3, f1)", path)
                    .UndeployAll();
            }
        }
        internal class InfraWidening : RegressionExecution
        {
            private readonly bool namedWindow;
            public InfraWidening(bool namedWindow)
            {
                this.namedWindow = namedWindow;
            }
            public void Run(RegressionEnvironment env)
            {
                var path = new RegressionPath();
                // widen to long
                var stmtTextCreate = namedWindow
                    ? "create window MyInfraW#keepall as (f1 long, f2 string)"
                    : "create table MyInfraW as (f1 long primary key, f2 string primary key)";
                env.CompileDeploy(stmtTextCreate, path);
                env.CompileDeploy(
                    "insert into MyInfraW(f1, f2) select LongPrimitive, TheString from SupportBean",
                    path);
                env.CompileDeploy("create index MyInfraWIndex1 on MyInfraW(f1)", path);
                var fields = new [] { "f1","f2" };
                SendEventLong(env, "E1", 10L);
                var result = env.CompileExecuteFAF("select * from MyInfraW where f1=10", path);
                EPAssertionUtil.AssertPropsPerRow(
                    result.Array,
                    fields,
Next line of code:


Prompt:
Please complete the code given below.
using System.Data.Common;
using System.Collections;
using NHibernate.Cache;
using NHibernate.Cfg;
using NHibernate.Engine;
using NUnit.Framework;
namespace NHibernate.Test.SecondLevelCacheTests
{
	using Criterion;
	[TestFixture]
	public class SecondLevelCacheTest : TestCase
	{
		protected override string MappingsAssembly
		{
			get { return "NHibernate.Test"; }
		}
		protected override IList Mappings
		{
			get { return new string[] { "SecondLevelCacheTest.Item.hbm.xml" }; }
		}
		protected override void Configure(Configuration configuration)
		{
			base.Configure(configuration);
			configuration.Properties[Environment.CacheProvider] = typeof(HashtableCacheProvider).AssemblyQualifiedName;
			configuration.Properties[Environment.UseQueryCache] = "true";
		}
		protected override void OnSetUp()
		{
			// Clear cache at each test.
			RebuildSessionFactory();
			using (ISession session = OpenSession())
			using (ITransaction tx = session.BeginTransaction())
			{
				Item item = new Item();
				item.Id = 1;
				session.Save(item);
				for (int i = 0; i < 4; i++)
				{
					Item child = new Item();
					child.Id = i + 2;
					child.Parent = item;
					session.Save(child);
					item.Children.Add(child);
				}
				for (int i = 0; i < 5; i++)
				{
					AnotherItem obj = new AnotherItem("Item #" + i);
					obj.Id = i + 1;
					session.Save(obj);
				}
				tx.Commit();
			}
			Sfi.Evict(typeof(Item));
			Sfi.EvictCollection(typeof(Item).FullName + ".Children");
		}
		protected override void OnTearDown()
		{
			using (ISession session = OpenSession())
			{
				session.Delete("from Item"); //cleaning up
				session.Delete("from AnotherItem"); //cleaning up
				session.Flush();
			}
		}
		[Test]
		public void CachedQueriesHandlesEntitiesParametersCorrectly()
		{
			using (ISession session = OpenSession())
			{
				Item one = (Item)session.Load(typeof(Item), 1);
				IList results = session.CreateQuery("from Item item where item.Parent = :parent")
					.SetEntity("parent", one)
					.SetCacheable(true).List();
				Assert.AreEqual(4, results.Count);
				foreach (Item item in results)
				{
					Assert.AreEqual(1, item.Parent.Id);
				}
			}
			using (ISession session = OpenSession())
			{
				Item two = (Item)session.Load(typeof(Item), 2);
				IList results = session.CreateQuery("from Item item where item.Parent = :parent")
					.SetEntity("parent", two)
					.SetCacheable(true).List();
				Assert.AreEqual(0, results.Count);
			}
		}
		[Test]
		public void DeleteItemFromCollectionThatIsInTheSecondLevelCache()
		{
			using (ISession session = OpenSession())
			{
				Item item = (Item)session.Load(typeof(Item), 1);
				Assert.IsTrue(item.Children.Count == 4); // just force it into the second level cache here
			}
			int childId = -1;
			using (ISession session = OpenSession())
			{
				Item item = (Item)session.Load(typeof(Item), 1);
				Item child = (Item)item.Children[0];
				childId = child.Id;
				session.Delete(child);
				item.Children.Remove(child);
				session.Flush();
			}
			using (ISession session = OpenSession())
			{
				Item item = (Item)session.Load(typeof(Item), 1);
				Assert.AreEqual(3, item.Children.Count);
				foreach (Item child in item.Children)
				{
					NHibernateUtil.Initialize(child);
					Assert.IsFalse(child.Id == childId);
				}
			}
		}
		[Test]
		public void InsertItemToCollectionOnTheSecondLevelCache()
		{
			using (ISession session = OpenSession())
			{
				Item item = (Item)session.Load(typeof(Item), 1);
				Item child = new Item();
				child.Id = 6;
				item.Children.Add(child);
				session.Save(child);
				session.Flush();
			}
			using (ISession session = OpenSession())
			{
				Item item = (Item)session.Load(typeof(Item), 1);
				int count = item.Children.Count;
				Assert.AreEqual(5, count);
			}
		}
		[Test]
		public void SecondLevelCacheWithCriteriaQueries()
		{
			using (ISession session = OpenSession())
			{
				IList list = session.CreateCriteria(typeof(AnotherItem))
					.Add(Expression.Gt("Id", 2))
					.SetCacheable(true)
					.List();
				Assert.AreEqual(3, list.Count);
				using (var cmd = session.Connection.CreateCommand())
				{
					cmd.CommandText = "DELETE FROM AnotherItem";
					cmd.ExecuteNonQuery();
				}
			}
			using (ISession session = OpenSession())
			{
				//should bring from cache
				IList list = session.CreateCriteria(typeof(AnotherItem))
					.Add(Expression.Gt("Id", 2))
					.SetCacheable(true)
					.List();
				Assert.AreEqual(3, list.Count);
			}
		}
		[Test]
		public void SecondLevelCacheWithCriteriaQueriesForItemWithCollections()
		{
			using (ISession session = OpenSession())
			{
				IList list = session.CreateCriteria(typeof(Item))
					.Add(Expression.Gt("Id", 2))
					.SetCacheable(true)
					.List();
				Assert.AreEqual(3, list.Count);
				using (var cmd = session.Connection.CreateCommand())
				{
					cmd.CommandText = "DELETE FROM Item";
					cmd.ExecuteNonQuery();
				}
			}
			using (ISession session = OpenSession())
			{
				//should bring from cache
Next line of code:


The White House on Friday declassified a partisan and bitterly disputed memo on the Russia investigation, and a House committee immediately made it public. Media outlets were just beginning to assess it. You can read the document here, via the Washington Post. The White House move came over the fierce objections of the FBI and Justice Department, which have said the document prepared by Republicans on the House intelligence committee is inaccurate and missing critical context, per the AP. The memo alleges that the FBI abused US government surveillance powers in its investigation into Russian election interference. Trump, who has called the investigation a "witch hunt," has supported the release of the memo in the apparent hopes that it could help undermine the probe being led by special counsel Robert Mueller. The president, dogged by the unrelenting investigation into his campaign's ties to Russia, lashed out anew Friday at the FBI and Justice Department as politically biased against Republicans. "The top Leadership and Investigators of the FBI and the Justice Department have politicized the sacred investigative process in favor of Democrats and against Republicans - something which would have been unthinkable just a short time ago. Rank & File are great people!" Trump tweeted.

Prompt:
You are given several news passages. Write a one-page summary of all news.

News:
Passage 1:
The Nunes memo is a document created by the staff of House Intelligence Committee Chairman Devin Nunes (R-Calif.) that alleges the FBI abused its surveillance authority, particularly when it sought a secret court order to monitor a former Trump campaign adviser. The FBI and the Justice Department had lobbied strenuously against its release. On Wednesday, the FBI had said it was “gravely concerned” that key facts were missing from the memo. President approves release of GOP memo criticizing FBI surveillance NEWLINE_CHAR NEWLINE_CHAR THE WHITE HOUSE NEWLINE_CHAR NEWLINE_CHAR WASHINGTON NEWLINE_CHAR NEWLINE_CHAR February 2, 2018 NEWLINE_CHAR NEWLINE_CHAR The Honorable Devin Nunes NEWLINE_CHAR NEWLINE_CHAR Chairman, House Permanent Select Committee on Intelligence NEWLINE_CHAR NEWLINE_CHAR United States Capitol NEWLINE_CHAR NEWLINE_CHAR Washington, DC 20515 NEWLINE_CHAR NEWLINE_CHAR Dear Mr. Chairman: NEWLINE_CHAR NEWLINE_CHAR On January 29, 2018, the House Permanent Select Committee on Intelligence (hereinafter ?the NEWLINE_CHAR NEWLINE_CHAR Committee?) voted to disclose publicly a memorandum containing classi?ed information NEWLINE_CHAR NEWLINE_CHAR provided to the Committee in connection with its oversight activities (the ?Memorandum,? NEWLINE_CHAR NEWLINE_CHAR which is attached to this letter). As provided by clause 11(g) of Rule of the House of NEWLINE_CHAR NEWLINE_CHAR Representatives, the Committee has forwarded this Memorandum to the President based on its NEWLINE_CHAR NEWLINE_CHAR determination that the release of the Memorandum would serve the public interest. NEWLINE_CHAR NEWLINE_CHAR The Constitution vests the President with the authority to protect national security secrets from it NEWLINE_CHAR NEWLINE_CHAR disclosure. As the Supreme Court has recognized, it is the President?s responsibility to classify, NEWLINE_CHAR NEWLINE_CHAR declassify, and control access to information bearing on our intelligence sources and methods NEWLINE_CHAR NEWLINE_CHAR and national defense. See, Dep of Navy v. Egan, 484 US. 518, 527 (1988). In order to NEWLINE_CHAR NEWLINE_CHAR facilitate appropriate congressional oversight, the Executive Branch may entrust classi?ed NEWLINE_CHAR NEWLINE_CHAR information to the appropriate committees of Congress, as it has done in connection with the NEWLINE_CHAR NEWLINE_CHAR Committee?s oversight activities here. The Executive Branch does so on the assumption that the NEWLINE_CHAR NEWLINE_CHAR Committee will responsibly protect such classi?ed information, consistent with the laws of the NEWLINE_CHAR NEWLINE_CHAR United States. NEWLINE_CHAR NEWLINE_CHAR The Committee has now determined that the release of the Memorandum would be appropriate. NEWLINE_CHAR NEWLINE_CHAR The Executive Branch, across Administrations of both parties, has worked to accommodate NEWLINE_CHAR NEWLINE_CHAR congressional requests to declassify speci?c materials in the public interest.1 However, public NEWLINE_CHAR NEWLINE_CHAR release of classi?ed information by unilateral action of the Legislative Branch is extremely rare NEWLINE_CHAR NEWLINE_CHAR and raises signi?cant separation of powers concerns. Accordingly, the Committee?s request to NEWLINE_CHAR NEWLINE_CHAR release the Memorandum is interpreted as a request for declassi?cation pursuant to the NEWLINE_CHAR NEWLINE_CHAR President?s authority. NEWLINE_CHAR NEWLINE_CHAR The President understands that the protection of our national security represents his highest NEWLINE_CHAR NEWLINE_CHAR obligation. Accordingly, he has directed lawyers and national security staff to assess the NEWLINE_CHAR NEWLINE_CHAR 1 See, e. S. Rept. 114?8 at 12 (Administration of Barack Obama) (?On April 3, 2014 . . . the Committee agreed to NEWLINE_CHAR NEWLINE_CHAR send the revised Findings and Conclusions, and the updated Executive Summary of the Committee Study, to the NEWLINE_CHAR NEWLINE_CHAR President for declassi?cation and public release?); H. Rept. 107-792 (Administration of George W. Bush) (similar); NEWLINE_CHAR NEWLINE_CHAR E.O. 12812 (Administration of George H.W. Bush) (noting Senate resolution requesting that President provide for NEWLINE_CHAR NEWLINE_CHAR declassi?cation of certain information Via Executive Order). NEWLINE_CHAR NEWLINE_CHAR declassi?cation request, consistent with established standards governing the handling of NEWLINE_CHAR NEWLINE_CHAR classi?ed information, including those under Section 3.1(d) of Executive Order 13526. Those NEWLINE_CHAR NEWLINE_CHAR standards permit declassi?cation when the public interest in disclosure outweighs any need to NEWLINE_CHAR NEWLINE_CHAR protect the information. The White House review process also included input from the Of?ce of NEWLINE_CHAR NEWLINE_CHAR the Director of National Intelligence and the Department of Justice. Consistent with this review NEWLINE_CHAR NEWLINE_CHAR and these standards, the President has determined that declassification of the Memorandum is NEWLINE_CHAR NEWLINE_CHAR appropriate. NEWLINE_CHAR NEWLINE_CHAR Based on this assessment and in light of the signi?cant public interest in the memorandum, the NEWLINE_CHAR NEWLINE_CHAR President has authorized the declassi?cation of the Memorandum. To be clear, the NEWLINE_CHAR NEWLINE_CHAR Memorandum re?ects the judgments of its congressional authors. The President understands NEWLINE_CHAR NEWLINE_CHAR that oversight concerning matters related to the Memorandum may be continuing. Though the NEWLINE_CHAR NEWLINE_CHAR circumstances leading to the declassi?cation through this process are extraordinary, the NEWLINE_CHAR NEWLINE_CHAR Executive Branch stands ready to work with Congress to accommodate oversight requests NEWLINE_CHAR NEWLINE_CHAR consistent with applicable standards and processes, including the need to protect intelligence NEWLINE_CHAR NEWLINE_CHAR sources and methods. NEWLINE_CHAR NEWLINE_CHAR Sincerely, NEWLINE_CHAR NEWLINE_CHAR Donald F. McGahn II NEWLINE_CHAR NEWLINE_CHAR Counsel to the President NEWLINE_CHAR NEWLINE_CHAR cc: The Honorable Paul Ryan NEWLINE_CHAR NEWLINE_CHAR Speaker of the House of Representatives NEWLINE_CHAR NEWLINE_CHAR The Honorable Adam Schiff NEWLINE_CHAR NEWLINE_CHAR Ranking Member, House Permanent Select Committee on Intelligence NEWLINE_CHAR NEWLINE_CHAR ssnua NEWLINE_CHAR NEWLINE_CHAR DeclasSi?ed by order of the President NEWLINE_CHAR NEWLINE_CHAR February 2, 2018 NEWLINE_CHAR NEWLINE_CHAR January 18, 2018 NEWLINE_CHAR NEWLINE_CHAR To: HPSCI Majority Members NEWLINE_CHAR NEWLINE_CHAR From: HPSCI Majority Staff NEWLINE_CHAR NEWLINE_CHAR Subject: Foreign Intelligence Surveillance Act Abuses at the Department of Justice and the NEWLINE_CHAR NEWLINE_CHAR Federal Bureau of Investigation NEWLINE_CHAR NEWLINE_CHAR Purpose NEWLINE_CHAR NEWLINE_CHAR This memorandum provides Members an update on significant facts relating to the NEWLINE_CHAR NEWLINE_CHAR Committee?s ongoing investigation into the Department of Justice (DOJ) and Federal Bureau of NEWLINE_CHAR NEWLINE_CHAR Investigation (FBI) and their use of the Foreign Intelligence Surveillance Act (F ISA) during the NEWLINE_CHAR NEWLINE_CHAR 2016 presidential election cycle. Our ?ndings, which are detailed below, 1) raise concerns with NEWLINE_CHAR NEWLINE_CHAR the legitimacy and legality of certain DOJ and FBI interactions with the Foreign Intelligence NEWLINE_CHAR NEWLINE_CHAR Surveillance Court (FISC), and 2) represent a troubling breakdown of legal processes established NEWLINE_CHAR NEWLINE_CHAR to protect the American people from abuses related to the ISA process. NEWLINE_CHAR NEWLINE_CHAR Investigation Update NEWLINE_CHAR NEWLINE_CHAR - On October 21, 2016, DOJ and FBI sought and received a ISA probable cause order NEWLINE_CHAR NEWLINE_CHAR (up; under Title VII) authorizing electronic surveillance on Carter Page from the FISC. Page is a NEWLINE_CHAR NEWLINE_CHAR US citizen who served as a volunteer advisor to the Trump presidential campaign. Consistent . NEWLINE_CHAR NEWLINE_CHAR with requirements under FISA, the application had to be ?rst certi?ed by the Director or Deputy NEWLINE_CHAR NEWLINE_CHAR Director of the FBI. It then required the approval of the Attorney General, Deputy Attorney NEWLINE_CHAR NEWLINE_CHAR General (DAG), or the Senate?con?rmed Assistant Attorney General for the National Security NEWLINE_CHAR NEWLINE_CHAR Division. NEWLINE_CHAR NEWLINE_CHAR The FBI and DOJ obtained one initial FISA warrant targeting Carter Page and three FISA NEWLINE_CHAR NEWLINE_CHAR renewals from the FISC. As required by statute (50 U.S.C. a FISA order on an NEWLINE_CHAR NEWLINE_CHAR American citizen must be renewed by the ISC every 90 days and each renewal requires a NEWLINE_CHAR NEWLINE_CHAR separate finding of probable cause. Then-Director James Comey signed three FISA applications NEWLINE_CHAR NEWLINE_CHAR . in question on behalf of the FBI, and Deputy Director Andrew McCabe signed one. NEWLINE_CHAR NEWLINE_CHAR Sally Yates, then-Acting DAG Dana Boente, and DAG Rod Rosenstein each signed one or more NEWLINE_CHAR NEWLINE_CHAR FISA applications on behalf of NEWLINE_CHAR NEWLINE_CHAR Due to the sensitive nature of foreign intelligence activity, FISA submissions (including NEWLINE_CHAR NEWLINE_CHAR renewals) before the ISC are classified. As such, the public?s con?dence in the integrity of the NEWLINE_CHAR NEWLINE_CHAR FISA process depends on the court?s ability to hold the government to the highest standard?? NEWLINE_CHAR NEWLINE_CHAR particularly as it relates to surveillance of American citizens. However, the rigor in NEWLINE_CHAR NEWLINE_CHAR protecting the rights of Americans, which is reinforced by 90?day renewals of surveillance NEWLINE_CHAR NEWLINE_CHAR orders, is necessarily dependent on the government?s production to the court of all material and NEWLINE_CHAR NEWLINE_CHAR relevant facts. This should include information potentially favorable to the target of the FISA NEWLINE_CHAR NEWLINE_CHAR PROPERTY OF THE U.S. HOUSE OF REPRESENTATIVES NEWLINE_CHAR NEWLINE_CHAR TGIF-SEW NEWLINE_CHAR NEWLINE_CHAR application that is known by the government. In the case of Carter Page, the government had at NEWLINE_CHAR NEWLINE_CHAR least four independent opportunities before the FISC to accurately provide an accounting of the NEWLINE_CHAR NEWLINE_CHAR relevant facts. However, our ?ndings indicate that, as described below, material and relevant NEWLINE_CHAR NEWLINE_CHAR information was omitted. NEWLINE_CHAR NEWLINE_CHAR 1) NEWLINE_CHAR NEWLINE_CHAR 2) NEWLINE_CHAR NEWLINE_CHAR The ?dossier?- compiled by Christopher Steele (Steele dossier) on behalf of the NEWLINE_CHAR NEWLINE_CHAR Democratic National Committee (DNC) and the Hillary Clinton campaign formed an NEWLINE_CHAR NEWLINE_CHAR essential part of the Carter Page FISA application. Steele was a longtime FBI source who NEWLINE_CHAR NEWLINE_CHAR was paid over $160,000 by the DNC and Clinton campaign, via the law ?rm Perkins Coie NEWLINE_CHAR NEWLINE_CHAR and research ?rm Fusion GPS, to obtain derogatory information on Donald Trump?s ties NEWLINE_CHAR NEWLINE_CHAR to Russia. NEWLINE_CHAR NEWLINE_CHAR a) Neither the initial application in October 2016, nor any of the renewals, disclose or NEWLINE_CHAR NEWLINE_CHAR reference the role of the DNC, Clinton campaign, or. any party/campaign in funding NEWLINE_CHAR NEWLINE_CHAR Steele?s efforts, even though the political origins of the Steele dossier were then NEWLINE_CHAR NEWLINE_CHAR known to senior and FBI of?cials. NEWLINE_CHAR NEWLINE_CHAR b) The initial FISA application notes Steele was working for a named US. person, but NEWLINE_CHAR NEWLINE_CHAR does not name Fusion GPS and principal Glenn Simpson, who was paid by a US. law NEWLINE_CHAR NEWLINE_CHAR ?rm (Perkins Coie) representing the DNC (even though it was known by DOI at the, NEWLINE_CHAR NEWLINE_CHAR time that political actors were involved with the Steele dossier). The application does NEWLINE_CHAR NEWLINE_CHAR not mention Steele was ultimately working on behalf of?and paid by?wthe DNC and NEWLINE_CHAR NEWLINE_CHAR Clinton campaign, or that the FBI had separately authorized payment to Steele for the NEWLINE_CHAR NEWLINE_CHAR same information. NEWLINE_CHAR NEWLINE_CHAR The Carter Page FISA application also cited extensively a September 23, 2016, Yahoo NEWLINE_CHAR NEWLINE_CHAR News article by- Michael Isikoff, which focuses on Page?s July 2016 trip to Moscow. NEWLINE_CHAR NEWLINE_CHAR - This article does not corroborate the Steele dossier because it is derived from information NEWLINE_CHAR NEWLINE_CHAR leaked by Steele himself to Yahoo News. The Page FISA application incorrectly assesses NEWLINE_CHAR NEWLINE_CHAR that Steele did not directly provide information to Yahoo News. Steele has admitted in NEWLINE_CHAR NEWLINE_CHAR British court ?lings that he met with Yahoo Newly?and several other. outlets?in NEWLINE_CHAR NEWLINE_CHAR September 2016 at the direction of Fusion GPS. Perkins Coie was aware of Steele?s NEWLINE_CHAR NEWLINE_CHAR initial media contacts because they hosted at least one meeting in Washington DC. in NEWLINE_CHAR NEWLINE_CHAR 2016 with Steele and Fusion GPS where this matter was discussed." NEWLINE_CHAR NEWLINE_CHAR a) Steele was suspended and then terminated as an FBI source for what the FBI de?nes NEWLINE_CHAR NEWLINE_CHAR as the most serious of violations?an unauthorized disclosure to the media of his NEWLINE_CHAR NEWLINE_CHAR relationship with the FBI in an October 30, 2016, Mother Jones article by David NEWLINE_CHAR NEWLINE_CHAR Corn Steele should have been terminated for his previous undisclosed contacts with NEWLINE_CHAR NEWLINE_CHAR Yahoo and other outlets' 1n September?before the Page application was submitted to NEWLINE_CHAR NEWLINE_CHAR PROPERTY OF THE US. HOUSE OF REPRESENTATIVES NEWLINE_CHAR NEWLINE_CHAR 3) NEWLINE_CHAR NEWLINE_CHAR 4) NEWLINE_CHAR NEWLINE_CHAR the FISC in October-but Steele improperly concealed from and lied to the FBI about NEWLINE_CHAR NEWLINE_CHAR those contacts. NEWLINE_CHAR NEWLINE_CHAR b) Steele?s numerous encounters with the media violated the cardinal rule of source NEWLINE_CHAR NEWLINE_CHAR handling?maintaining con?dentiality?and demonstrated that Steele had become a NEWLINE_CHAR NEWLINE_CHAR less than reliable source for the FBI. NEWLINE_CHAR NEWLINE_CHAR Before and after Steele was terminated as a source, he maintained contact with DOJ via NEWLINE_CHAR NEWLINE_CHAR then-Associate Deputy Attorney General Bruce 0hr, a senior DOJ of?cial who worked NEWLINE_CHAR NEWLINE_CHAR closely with Deputy Attorneys General Yates and later Rosenstein. Shortly after the NEWLINE_CHAR NEWLINE_CHAR election, the FBI began interviewing 0hr, documenting his communications with Steele. NEWLINE_CHAR NEWLINE_CHAR For example, in September 2016, Steele admitted to 0hr his feelings against then- NEWLINE_CHAR NEWLINE_CHAR candidate Trump when Steele said he ?was desperate that Donald Trump not get NEWLINE_CHAR NEWLINE_CHAR elected and was passionate about him not, being president.? This clear evidence of . NEWLINE_CHAR NEWLINE_CHAR Steele? bias was recorded by Ohr at the time and subsequently in of?cial FBI ?les?but NEWLINE_CHAR NEWLINE_CHAR not re?ected in any of the Page FISA applications. NEWLINE_CHAR NEWLINE_CHAR a) During this same time period, Ohr?s wife was employed by Fusion GPS to assist in NEWLINE_CHAR NEWLINE_CHAR the cultivation of opposition research on Trump. Ohr later provided the FBI with all NEWLINE_CHAR NEWLINE_CHAR of his wife?s opposition research, paid for by the DNC and Clinton campaign via NEWLINE_CHAR NEWLINE_CHAR Fusion GPS. The Ohrs? relationship with Steele and Fusion GPS was inexplicably NEWLINE_CHAR NEWLINE_CHAR concealed from the FISC. . NEWLINE_CHAR NEWLINE_CHAR According to the head of the counterintelligence division, Assistant Director Bill NEWLINE_CHAR NEWLINE_CHAR Priestap, corroboration of the Steele dossier was in its ?infancy? at the time of the initial NEWLINE_CHAR NEWLINE_CHAR Page FISA application. After Steele was terminated, a source validation report conducted NEWLINE_CHAR NEWLINE_CHAR by an independent unit within FBI assessed Steele?s reporting as only minimally NEWLINE_CHAR NEWLINE_CHAR corroborated. Yet, in early January 2017, Director Comey briefed President-elect Trump NEWLINE_CHAR NEWLINE_CHAR on a summary of the Steele dossier, even though it was??according to his June 2017 NEWLINE_CHAR NEWLINE_CHAR and unveri?ed.? While the FISA application relied on Steele?s NEWLINE_CHAR NEWLINE_CHAR past record of credible reporting on other unrelated matters, it ignored or concealed his NEWLINE_CHAR NEWLINE_CHAR anti?Trump ?nancial and ideological motivations. Furthermore, Deputy Director NEWLINE_CHAR NEWLINE_CHAR McCabe testi?ed before the Committee in December 2017 that no surveillance warrant NEWLINE_CHAR NEWLINE_CHAR would have been sought from the FISC without the Steele dossier information. NEWLINE_CHAR NEWLINE_CHAR r; .r NEWLINE_CHAR NEWLINE_CHAR i. a: NEWLINE_CHAR NEWLINE_CHAR 3:4 ,af- .9.- NEWLINE_CHAR NEWLINE_CHAR PROPERTY OF THE U.S. HOUSE OF REPRESENTATIVES NEWLINE_CHAR NEWLINE_CHAR 5) The Page FISA application also mentions information regarding fellow Trump campaign NEWLINE_CHAR NEWLINE_CHAR advisor George Papadopoulos, but there is no evidence of any cooperation or conspiracy NEWLINE_CHAR NEWLINE_CHAR between Page and Papadopoulos. The Papadopoulos information triggered the opening NEWLINE_CHAR NEWLINE_CHAR of an FBI counterintelligence investigation in late July 2016 by FBI agent Pete Strzok. NEWLINE_CHAR NEWLINE_CHAR Strzok was reassigned by the Special Counsel?s Office to FBI Human Resources for NEWLINE_CHAR NEWLINE_CHAR improper text messages with his mistress, FBI Attorney Lisa Page (no known relation to NEWLINE_CHAR NEWLINE_CHAR Carter Page), where they both demonstrated a clear bias against Trump and in favor of NEWLINE_CHAR NEWLINE_CHAR Clinton, Whom Strzok had also investigated. The Strzok/Lisa Page texts also re?ect NEWLINE_CHAR NEWLINE_CHAR extensive discussions about the investigation, orchestrating leaks to the media, and NEWLINE_CHAR NEWLINE_CHAR include a meeting with Deputy Director McCabe to discuss an ?insurance? policy against NEWLINE_CHAR NEWLINE_CHAR President Trump?s election. NEWLINE_CHAR NEWLINE_CHAR I NEWLINE_CHAR NEWLINE_CHAR PROPERTY OF THE U.S. HOUSE OF REPRESENTATIVES
Passage 2:
Tweet with a location NEWLINE_CHAR NEWLINE_CHAR You can add location information to your Tweets, such as your city or precise location, from the web and via third-party applications. You always have the option to delete your Tweet location history. Learn more

Now, write a one-page summary of all the news.

Summary:


String[] sTDocUrls = m_oInspector.getTDocUrls();

Prompt:
Please complete the code given below.
/*************************************************************************
 *
 *  The Contents of this file are made available subject to the terms of
 *  the BSD license.
 *
 *  Copyright 2000, 2010 Oracle and/or its affiliates.
 *  All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *  1. Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *  3. Neither the name of Sun Microsystems, Inc. nor the names of its
 *     contributors may be used to endorse or promote products derived
 *     from this software without specific prior written permission.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
 *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
 *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
 *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
 *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *************************************************************************/
import com.sun.star.uno.XComponentContext;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.ButtonGroup;
import javax.swing.JDialog;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.JRadioButtonMenuItem;
import javax.swing.JTabbedPane;
import javax.swing.KeyStroke;
public class SwingDialogProvider implements XDialogProvider{
    private JPopupMenu m_jPopupMenu = new JPopupMenu();
    private XComponentContext m_xComponentContext;
    private Inspector._Inspector m_oInspector;
    private JDialog m_jInspectorDialog = new JDialog();
    private JTabbedPane m_jTabbedPane1 = new JTabbedPane();
    private Container cp;
    private JMenu jMnuOptions = new JMenu("Options");
    private JRadioButtonMenuItem jJavaMenuItem = null;
    private JRadioButtonMenuItem jCPlusPlusMenuItem = null;
    private JRadioButtonMenuItem jBasicMenuItem = null;
    /** Creates a new instance of SwingPopupMentuProvider */
    public SwingDialogProvider(Inspector._Inspector _oInspector, String _sTitle) {
        m_oInspector = _oInspector;
        m_xComponentContext = _oInspector.getXComponentContext();
        insertMenus();
        initializePopupMenu();
        cp = m_jInspectorDialog.getContentPane();
        cp.setLayout(new java.awt.BorderLayout(0, 10));
        m_jTabbedPane1.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        m_jInspectorDialog.addWindowListener(new InspectorWindowAdapter());
        m_jInspectorDialog.addComponentListener(new InspectorComponentAdapter());
        m_jInspectorDialog.setTitle(_sTitle);
        m_jInspectorDialog.setLocation(100, 50);
        m_jInspectorDialog.getContentPane().add(m_jTabbedPane1);
    }
        public JDialog getDialog(){
            return m_jInspectorDialog;
        }
        private void addMenuBar(JMenuBar _jMenuBar){
            getDialog().setJMenuBar(_jMenuBar);
        }
        private void  removeTabPaneByIndex(int _nIndex){
            if (_nIndex > -1){
                String sSelInspectorPanelTitle = m_jTabbedPane1.getTitleAt(_nIndex);
                m_jTabbedPane1.remove(_nIndex);
                m_oInspector.getInspectorPages().remove(sSelInspectorPanelTitle);
            }
        }
        public void selectInspectorPageByIndex(int nTabIndex){
            m_jTabbedPane1.setSelectedIndex(nTabIndex);
        }
        public int getInspectorPageCount(){
            return  m_jTabbedPane1.getTabCount();
        }
        public JTabbedPane getTabbedPane(){
            return m_jTabbedPane1;
        }
        public InspectorPane getSelectedInspectorPage(){
            int nIndex = m_jTabbedPane1.getSelectedIndex();
            return getInspectorPage(nIndex);
        }
        public InspectorPane getInspectorPage(int _nIndex){
            InspectorPane oInspectorPane = null;
            if (_nIndex > -1){
                String sInspectorPanelTitle = m_jTabbedPane1.getTitleAt(_nIndex);
                oInspectorPane = m_oInspector.getInspectorPages().get(sInspectorPanelTitle);
            }
            return oInspectorPane;
        }
        private void removeTabPanes(){
            int nCount = m_jTabbedPane1.getTabCount();
            if (nCount > 0){
                for (int i = nCount-1; i >= 0; i--){
                    removeTabPaneByIndex(i);
                }
            }
        }
        private void removeSelectedTabPane(){
            int nIndex = getTabbedPane().getSelectedIndex();
            removeTabPaneByIndex(nIndex);
        }
        private class InspectorComponentAdapter extends ComponentAdapter{
            @Override
            public void componentHidden(ComponentEvent e){
                m_jInspectorDialog.pack();
                m_jInspectorDialog.invalidate();
            }
            @Override
            public void componentShown(ComponentEvent e){
                m_jInspectorDialog.pack();
                m_jInspectorDialog.invalidate();
            }
        }
        private class InspectorWindowAdapter extends WindowAdapter{
            @Override
            public void windowClosed(WindowEvent e){
                removeTabPanes();
                m_oInspector.disposeHiddenDocuments();
            }
            @Override
            public void windowClosing(WindowEvent e){
                removeTabPanes();
                m_oInspector.disposeHiddenDocuments();
            }
        }
        private void initializePopupMenu(){
            m_jPopupMenu.add(getInspectMenuItem("Inspect"));
            m_jPopupMenu.add(getSourceCodeMenuItem(SADDTOSOURCECODE));
            m_jPopupMenu.add(getInvokeMenuItem(SINVOKE));
            m_jPopupMenu.addSeparator();
            m_jPopupMenu.add(getHelpMenuItem("Help"));
        }
        private void addOpenDocumentMenu(JMenu _jMnuRoot){
            ActionListener oActionListener = new ActionListener(){
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    String sTDocUrl = evt.getActionCommand();
                    m_oInspector.inspectOpenDocument(sTDocUrl);
                }
            };
Next line of code:


Prompt:
Please complete the code given below.
/*
Bullet Continuous Collision Detection and Physics Library
Copyright (c) 2003-2008 Erwin Coumans  http://bulletphysics.com
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include <stdio.h>
#include "LinearMath/btIDebugDraw.h"
#include "BulletCollision/CollisionDispatch/btGhostObject.h"
#include "BulletCollision/CollisionShapes/btMultiSphereShape.h"
#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h"
#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionWorld.h"
#include "LinearMath/btDefaultMotionState.h"
#include "btKinematicCharacterController.h"
// static helper method
static btVector3
getNormalizedVector(ref btVector3 v)
{
	btVector3 n(0, 0, 0);
	if (v.length() > SIMD_EPSILON) {
		n = v.normalized();
	}
	return n;
}
///@todo Interact with dynamic objects,
///Ride kinematicly animated platforms properly
///More realistic (or maybe just a config option) falling
/// . Should integrate falling velocity manually and use that in stepDown()
///Support jumping
///Support ducking
class btKinematicClosestNotMeRayResultCallback : btCollisionWorld::ClosestRayResultCallback
{
public:
	btKinematicClosestNotMeRayResultCallback (btCollisionObject me) : btCollisionWorld::ClosestRayResultCallback(btVector3(0.0, 0.0, 0.0), btVector3(0.0, 0.0, 0.0))
	{
		m_me = me;
	}
	virtual double addSingleResult(btCollisionWorld::LocalRayResult& rayResult,bool normalInWorldSpace)
	{
		if (rayResult.m_collisionObject == m_me)
			return 1.0;
		return ClosestRayResultCallback::addSingleResult (rayResult, normalInWorldSpace);
	}
protected:
	btCollisionObject m_me;
};
class btKinematicClosestNotMeConvexResultCallback : btCollisionWorld::ClosestConvexResultCallback
{
public:
	btKinematicClosestNotMeConvexResultCallback (btCollisionObject me, ref btVector3 up, double minSlopeDot)
	: btCollisionWorld::ClosestConvexResultCallback(btVector3(0.0, 0.0, 0.0), btVector3(0.0, 0.0, 0.0))
	, m_me(me)
	, m_up(up)
	, m_minSlopeDot(minSlopeDot)
	{
	}
	virtual double addSingleResult(btCollisionWorld::LocalConvexResult& convexResult,bool normalInWorldSpace)
	{
		if (convexResult.m_hitCollisionObject == m_me)
			return (double)(1.0);
		if (!convexResult.m_hitCollisionObject.hasContactResponse())
			return (double)(1.0);
		btVector3 hitNormalWorld;
		if (normalInWorldSpace)
		{
			hitNormalWorld = convexResult.m_hitNormalLocal;
		} else
		{
			///need to transform normal into worldspace
			hitNormalWorld = convexResult.m_hitCollisionObject.getWorldTransform().getBasis()*convexResult.m_hitNormalLocal;
		}
		double dotUp = m_up.dot(hitNormalWorld);
		if (dotUp < m_minSlopeDot) {
			return (double)(1.0);
		}
		return ClosestConvexResultCallback::addSingleResult (convexResult, normalInWorldSpace);
	}
protected:
	btCollisionObject m_me;
	btVector3 m_up;
	double m_minSlopeDot;
};
/*
 * Returns the reflection direction of a ray going 'direction' hitting a surface with normal 'normal'
 *
 * from: http://www-cs-students.stanford.edu/~adityagp/final/node3.html
 */
btVector3 btKinematicCharacterController::computeReflectionDirection (ref btVector3 direction, ref btVector3 normal)
{
	return direction - ((double)(2.0) * direction.dot(normal)) * normal;
}
/*
 * Returns the portion of 'direction' that is parallel to 'normal'
 */
btVector3 btKinematicCharacterController::parallelComponent (ref btVector3 direction, ref btVector3 normal)
{
	double magnitude = direction.dot(normal);
	return normal * magnitude;
}
/*
 * Returns the portion of 'direction' that is perpindicular to 'normal'
 */
btVector3 btKinematicCharacterController::perpindicularComponent (ref btVector3 direction, ref btVector3 normal)
{
	return direction - parallelComponent(direction, normal);
}
btKinematicCharacterController::btKinematicCharacterController (btPairCachingGhostObject* ghostObject,btConvexShape* convexShape,double stepHeight, int upAxis)
{
	m_upAxis = upAxis;
	m_addedMargin = 0.02;
	m_walkDirection.setValue(0,0,0);
	m_useGhostObjectSweepTest = true;
	m_ghostObject = ghostObject;
	m_stepHeight = stepHeight;
	m_turnAngle = (double)(0.0);
	m_convexShape=convexShape;
	m_useWalkDirection = true;	// use walk direction by default, legacy behavior
	m_velocityTimeInterval = 0.0;
	m_verticalVelocity = 0.0;
	m_verticalOffset = 0.0;
	m_gravity = 9.8 * 3 ; // 3G acceleration.
	m_fallSpeed = 55.0; // Terminal velocity of a sky diver in m/s.
	m_jumpSpeed = 10.0; // ?
	m_wasOnGround = false;
	m_wasJumping = false;
	m_interpolateUp = true;
	setMaxSlope(btRadians(45.0));
	m_currentStepOffset = 0;
	full_drop = false;
	bounce_fix = false;
}
btKinematicCharacterController::~btKinematicCharacterController ()
{
}
btPairCachingGhostObject* btKinematicCharacterController::getGhostObject()
{
	return m_ghostObject;
}
bool btKinematicCharacterController::recoverFromPenetration ( btCollisionWorld* collisionWorld)
{
	// Here we must refresh the overlapping paircache as the penetrating movement itself or the
	// previous recovery iteration might have used setWorldTransform and pushed us into an object
	// that is not in the previous cache contents from the last timestep, as will happen if we
	// are pushed into a new AABB overlap. Unhandled this means the next convex sweep gets stuck.
	//
	// Do this by calling the broadphase's setAabb with the moved AABB, this will update the broadphase
	// paircache and the ghostobject's internal paircache at the same time.    /BW
	btVector3 minAabb, maxAabb;
	m_convexShape.getAabb(m_ghostObject.getWorldTransform(), minAabb,maxAabb);
	collisionWorld.getBroadphase().setAabb(m_ghostObject.getBroadphaseHandle(),
						 minAabb,
						 maxAabb,
						 collisionWorld.getDispatcher());

	bool penetration = false;
	collisionWorld.getDispatcher().dispatchAllCollisionPairs(m_ghostObject.getOverlappingPairCache(), collisionWorld.getDispatchInfo(), collisionWorld.getDispatcher());
	m_currentPosition = m_ghostObject.getWorldTransform().getOrigin();

	double maxPen = (double)(0.0);
	for (int i = 0; i < m_ghostObject.getOverlappingPairCache().getNumOverlappingPairs(); i++)
	{
		m_manifoldArray.resize(0);
		btBroadphasePair* collisionPair = &m_ghostObject.getOverlappingPairCache().getOverlappingPairArray()[i];
		btCollisionObject obj0 = static_cast<btCollisionObject>(collisionPair.m_pProxy0.m_clientObject);
                btCollisionObject obj1 = static_cast<btCollisionObject>(collisionPair.m_pProxy1.m_clientObject);
		if ((obj0 && !obj0.hasContactResponse()) || (obj1 && !obj1.hasContactResponse()))
			continue;

		if (collisionPair.m_algorithm)
			collisionPair.m_algorithm.getAllContactManifolds(m_manifoldArray);

		for (int j=0;j<m_manifoldArray.Count;j++)
		{
			btPersistentManifold* manifold = m_manifoldArray[j];
			double directionSign = manifold.getBody0() == m_ghostObject ? (double)(-1.0) : (double)(1.0);
			for (int p=0;p<manifold.getNumContacts();p++)
			{
				btManifoldPointpt = manifold.getContactPoint(p);
				double dist = pt.getDistance();
				if (dist < 0.0)
				{
					if (dist < maxPen)
					{
						maxPen = dist;
						m_touchingNormal = pt.m_normalWorldOnB * directionSign;//??
					}
					m_currentPosition += pt.m_normalWorldOnB * directionSign * dist * (double)(0.2);
					penetration = true;
				} else {
					//Console.WriteLine("touching %f\n", dist);
				}
			}

			//manifold.clearManifold();
		}
	}
	btTransform newTrans = m_ghostObject.getWorldTransform();
	newTrans.setOrigin(m_currentPosition);
	m_ghostObject.setWorldTransform(newTrans);
//	Console.WriteLine("m_touchingNormal = %f,%f,%f\n",m_touchingNormal,m_touchingNormal[1],m_touchingNormal[2]);
	return penetration;
}
void btKinematicCharacterController::stepUp ( btCollisionWorld* world)
{
	// phase 1: up
	btTransform start, end;
	m_targetPosition = m_currentPosition + getUpAxisDirections()[m_upAxis] * (m_stepHeight + (m_verticalOffset > 0?m_verticalOffset:0));
	start.setIdentity ();
	end.setIdentity ();
	/* FIXME: Handle penetration properly */
	start.setOrigin (m_currentPosition + getUpAxisDirections()[m_upAxis] * (m_convexShape.getMargin() + m_addedMargin));
	end.setOrigin (m_targetPosition);
	btKinematicClosestNotMeConvexResultCallback callback (m_ghostObject, -getUpAxisDirections()[m_upAxis], (double)(0.7071));
	callback.m_collisionFilterGroup = getGhostObject().getBroadphaseHandle().m_collisionFilterGroup;
	callback.m_collisionFilterMask = getGhostObject().getBroadphaseHandle().m_collisionFilterMask;

	if (m_useGhostObjectSweepTest)
	{
		m_ghostObject.convexSweepTest (m_convexShape, start, end, callback, world.getDispatchInfo().m_allowedCcdPenetration);
	}
	else
	{
		world.convexSweepTest (m_convexShape, start, end, callback);
	}

	if (callback.hasHit())
	{
		// Only modify the position if the hit was a slope and not a wall or ceiling.
		if(callback.m_hitNormalWorld.dot(getUpAxisDirections()[m_upAxis]) > 0.0)
		{
			// we moved up only a fraction of the step height
			m_currentStepOffset = m_stepHeight * callback.m_closestHitFraction;
			if (m_interpolateUp == true)
				m_currentPosition.setInterpolate3 (m_currentPosition, m_targetPosition, callback.m_closestHitFraction);
			else
				m_currentPosition = m_targetPosition;
		}
		m_verticalVelocity = 0.0;
		m_verticalOffset = 0.0;
	} else {
		m_currentStepOffset = m_stepHeight;
		m_currentPosition = m_targetPosition;
	}
}
void btKinematicCharacterController::updateTargetPositionBasedOnCollision (ref btVector3 hitNormal, double tangentMag, double normalMag)
{
	btVector3 movementDirection = m_targetPosition - m_currentPosition;
	double movementLength = movementDirection.length();
	if (movementLength>SIMD_EPSILON)
	{
		movementDirection.normalize();
		btVector3 reflectDir = computeReflectionDirection (movementDirection, hitNormal);
		reflectDir.normalize();
		btVector3 parallelDir, perpindicularDir;
		parallelDir = parallelComponent (reflectDir, hitNormal);
		perpindicularDir = perpindicularComponent (reflectDir, hitNormal);
		m_targetPosition = m_currentPosition;
		if (0)//tangentMag != 0.0)
		{
			btVector3 parComponent = parallelDir * double (tangentMag*movementLength);
//			Console.WriteLine("parComponent=%f,%f,%f\n",parComponent[0],parComponent[1],parComponent[2]);
			m_targetPosition +=  parComponent;
		}
		if (normalMag != 0.0)
		{
			btVector3 perpComponent = perpindicularDir * double (normalMag*movementLength);
//			Console.WriteLine("perpComponent=%f,%f,%f\n",perpComponent[0],perpComponent[1],perpComponent[2]);
			m_targetPosition += perpComponent;
		}
	} else
	{
//		Console.WriteLine("movementLength don't normalize a zero vector\n");
	}
}
void btKinematicCharacterController::stepForwardAndStrafe ( btCollisionWorld* collisionWorld, ref btVector3 walkMove)
{
	// Console.WriteLine("m_normalizedDirection=%f,%f,%f\n",
	// 	m_normalizedDirection[0],m_normalizedDirection[1],m_normalizedDirection[2]);
	// phase 2: forward and strafe
	btTransform start, end;
	m_targetPosition = m_currentPosition + walkMove;
	start.setIdentity ();
	end.setIdentity ();

	double fraction = 1.0;
	double distance2 = (m_currentPosition-m_targetPosition).length2();
//	Console.WriteLine("distance2=%f\n",distance2);
	if (m_touchingContact)
	{
		if (m_normalizedDirection.dot(m_touchingNormal) > (double)(0.0))
		{
			//interferes with step movement
			//updateTargetPositionBasedOnCollision (m_touchingNormal);
		}
	}
	int maxIter = 10;
	while (fraction > (double)(0.01) && maxIter-- > 0)
	{
		start.setOrigin (m_currentPosition);
		end.setOrigin (m_targetPosition);
		btVector3 sweepDirNegative(m_currentPosition - m_targetPosition);
		btKinematicClosestNotMeConvexResultCallback callback (m_ghostObject, sweepDirNegative, (double)(0.0));
		callback.m_collisionFilterGroup = getGhostObject().getBroadphaseHandle().m_collisionFilterGroup;
		callback.m_collisionFilterMask = getGhostObject().getBroadphaseHandle().m_collisionFilterMask;
		double margin = m_convexShape.getMargin();
		m_convexShape.setMargin(margin + m_addedMargin);
		if (m_useGhostObjectSweepTest)
		{
			m_ghostObject.convexSweepTest (m_convexShape, start, end, callback, collisionWorld.getDispatchInfo().m_allowedCcdPenetration);
		} else
		{
			collisionWorld.convexSweepTest (m_convexShape, start, end, callback, collisionWorld.getDispatchInfo().m_allowedCcdPenetration);
		}

		m_convexShape.setMargin(margin);

		fraction -= callback.m_closestHitFraction;
		if (callback.hasHit())
		{
			// we moved only a fraction
			//double hitDistance;
			//hitDistance = (callback.m_hitPointWorld - m_currentPosition).length();
//			m_currentPosition.setInterpolate3 (m_currentPosition, m_targetPosition, callback.m_closestHitFraction);
			updateTargetPositionBasedOnCollision (callback.m_hitNormalWorld);
			btVector3 currentDir = m_targetPosition - m_currentPosition;
			distance2 = currentDir.length2();
			if (distance2 > SIMD_EPSILON)
			{
				currentDir.normalize();
				/* See Quake2: "If velocity is against original velocity, stop ead to avoid tiny oscilations in sloping corners." */
				if (currentDir.dot(m_normalizedDirection) <= (double)(0.0))
				{
					break;
				}
			} else
			{
//				Console.WriteLine("currentDir: don't normalize a zero vector\n");
				break;
			}
		} else {
			// we moved whole way
			m_currentPosition = m_targetPosition;
		}
	//	if (callback.m_closestHitFraction == 0)
	//		break;
	}
}
void btKinematicCharacterController::stepDown ( btCollisionWorld* collisionWorld, double dt)
{
	btTransform start, end, end_double;
	bool runonce = false;
	// phase 3: down
	/*double additionalDownStep = (m_wasOnGround && !onGround()) ? m_stepHeight : 0.0;
	btVector3 step_drop = getUpAxisDirections()[m_upAxis] * (m_currentStepOffset + additionalDownStep);
	double downVelocity = (additionalDownStep == 0.0 && m_verticalVelocity<0.0?-m_verticalVelocity:0.0) * dt;
	btVector3 gravity_drop = getUpAxisDirections()[m_upAxis] * downVelocity;
	m_targetPosition -= (step_drop + gravity_drop);*/
	btVector3 orig_position = m_targetPosition;

	double downVelocity = (m_verticalVelocity<0?-m_verticalVelocity:0) * dt;
	if(downVelocity > 0.0 && downVelocity > m_fallSpeed
		&& (m_wasOnGround || !m_wasJumping))
		downVelocity = m_fallSpeed;
	btVector3 step_drop = getUpAxisDirections()[m_upAxis] * (m_currentStepOffset + downVelocity);
	m_targetPosition -= step_drop;
	btKinematicClosestNotMeConvexResultCallback callback (m_ghostObject, getUpAxisDirections()[m_upAxis], m_maxSlopeCosine);
        callback.m_collisionFilterGroup = getGhostObject().getBroadphaseHandle().m_collisionFilterGroup;
        callback.m_collisionFilterMask = getGhostObject().getBroadphaseHandle().m_collisionFilterMask;
        btKinematicClosestNotMeConvexResultCallback callback2 (m_ghostObject, getUpAxisDirections()[m_upAxis], m_maxSlopeCosine);
        callback2.m_collisionFilterGroup = getGhostObject().getBroadphaseHandle().m_collisionFilterGroup;
        callback2.m_collisionFilterMask = getGhostObject().getBroadphaseHandle().m_collisionFilterMask;
	while (1)
	{
		start.setIdentity ();
		end.setIdentity ();
		end_double.setIdentity ();
		start.setOrigin (m_currentPosition);
		end.setOrigin (m_targetPosition);
		//set double test for 2x the step drop, to check for a large drop vs small drop
		end_double.setOrigin (m_targetPosition - step_drop);
		if (m_useGhostObjectSweepTest)
		{
			m_ghostObject.convexSweepTest (m_convexShape, start, end, callback, collisionWorld.getDispatchInfo().m_allowedCcdPenetration);
			if (!callback.hasHit())
			{
				//test a double fall height, to see if the character should interpolate it's fall (full) or not (partial)
				m_ghostObject.convexSweepTest (m_convexShape, start, end_double, callback2, collisionWorld.getDispatchInfo().m_allowedCcdPenetration);
			}
		} else
		{
			collisionWorld.convexSweepTest (m_convexShape, start, end, callback, collisionWorld.getDispatchInfo().m_allowedCcdPenetration);
			if (!callback.hasHit())
					{
							//test a double fall height, to see if the character should interpolate it's fall (large) or not (small)
							collisionWorld.convexSweepTest (m_convexShape, start, end_double, callback2, collisionWorld.getDispatchInfo().m_allowedCcdPenetration);
					}
		}

		double downVelocity2 = (m_verticalVelocity<0?-m_verticalVelocity:0) * dt;
		bool has_hit = false;
		if (bounce_fix == true)
			has_hit = callback.hasHit() || callback2.hasHit();
		else
			has_hit = callback2.hasHit();
		if(downVelocity2 > 0.0 && downVelocity2 < m_stepHeight && has_hit == true && runonce == false
					&& (m_wasOnGround || !m_wasJumping))
		{
			//redo the velocity calculation when falling a small amount, for fast stairs motion
			//for larger falls, use the smoother/slower interpolated movement by not touching the target position
			m_targetPosition = orig_position;
					downVelocity = m_stepHeight;
				btVector3 step_drop = getUpAxisDirections()[m_upAxis] * (m_currentStepOffset + downVelocity);
			m_targetPosition -= step_drop;
			runonce = true;
			continue; //re-run previous tests
		}
		break;
	}
	if (callback.hasHit() || runonce == true)
	{
		// we dropped a fraction of the height . hit floor
		double fraction = (m_currentPosition.y - callback.m_hitPointWorld.y) / 2;
		//Console.WriteLine("hitpoint: %g - pos %g\n", callback.m_hitPointWorld.y, m_currentPosition.y);
		if (bounce_fix == true)
		{
			if (full_drop == true)
                                m_currentPosition.setInterpolate3 (m_currentPosition, m_targetPosition, callback.m_closestHitFraction);
                        else
                                //due to errors in the closestHitFraction variable when used with large polygons, calculate the hit fraction manually
                                m_currentPosition.setInterpolate3 (m_currentPosition, m_targetPosition, fraction);
		}
		else
			m_currentPosition.setInterpolate3 (m_currentPosition, m_targetPosition, callback.m_closestHitFraction);
		full_drop = false;
		m_verticalVelocity = 0.0;
		m_verticalOffset = 0.0;
		m_wasJumping = false;
	} else {
		// we dropped the full height

		full_drop = true;
		if (bounce_fix == true)
		{
			downVelocity = (m_verticalVelocity<0?-m_verticalVelocity:0) * dt;
			if (downVelocity > m_fallSpeed && (m_wasOnGround || !m_wasJumping))
			{
				m_targetPosition += step_drop; //undo previous target change
				downVelocity = m_fallSpeed;
				step_drop = getUpAxisDirections()[m_upAxis] * (m_currentStepOffset + downVelocity);
				m_targetPosition -= step_drop;
			}
		}
		//Console.WriteLine("full drop - %g, %g\n", m_currentPosition.y, m_targetPosition.y);
		m_currentPosition = m_targetPosition;
	}
}
void btKinematicCharacterController::setWalkDirection
(
ref btVector3 walkDirection
)
{
	m_useWalkDirection = true;
	m_walkDirection = walkDirection;
	m_normalizedDirection = getNormalizedVector(m_walkDirection);
}
void btKinematicCharacterController::setVelocityForTimeInterval
(
ref btVector3 velocity,
double timeInterval
)
{
//	Console.WriteLine("setVelocity!\n");
//	Console.WriteLine("  interval: %f\n", timeInterval);
//	Console.WriteLine("  velocity: (%f, %f, %f)\n",
//		 velocity.x, velocity.y, velocity.z);
	m_useWalkDirection = false;
	m_walkDirection = velocity;
	m_normalizedDirection = getNormalizedVector(m_walkDirection);
	m_velocityTimeInterval += timeInterval;
}
void btKinematicCharacterController::reset ( btCollisionWorld* collisionWorld )
{
        m_verticalVelocity = 0.0;
        m_verticalOffset = 0.0;
        m_wasOnGround = false;
        m_wasJumping = false;
        m_walkDirection.setValue(0,0,0);
        m_velocityTimeInterval = 0.0;
        //clear pair cache
        btHashedOverlappingPairCache *cache = m_ghostObject.getOverlappingPairCache();
        while (cache.getOverlappingPairArray().Count > 0)
        {
                cache.removeOverlappingPair(cache.getOverlappingPairArray()[0].m_pProxy0, cache.getOverlappingPairArray()[0].m_pProxy1, collisionWorld.getDispatcher());
        }
}
void btKinematicCharacterController::warp (ref btVector3 origin)
{
	btTransform xform;
	xform.setIdentity();
	xform.setOrigin (origin);
	m_ghostObject.setWorldTransform (xform);
}
void btKinematicCharacterController::preStep (  btCollisionWorld* collisionWorld)
{

	int numPenetrationLoops = 0;
	m_touchingContact = false;
	while (recoverFromPenetration (collisionWorld))
	{
		numPenetrationLoops++;
		m_touchingContact = true;
		if (numPenetrationLoops > 4)
		{
			//Console.WriteLine("character could not recover from penetration = %d\n", numPenetrationLoops);
			break;
		}
	}
	m_currentPosition = m_ghostObject.getWorldTransform().getOrigin();
	m_targetPosition = m_currentPosition;
//	Console.WriteLine("m_targetPosition=%f,%f,%f\n",m_targetPosition[0],m_targetPosition[1],m_targetPosition[2]);

}
#include <stdio.h>
void btKinematicCharacterController::playerStep (  btCollisionWorld* collisionWorld, double dt)
{
//	Console.WriteLine("playerStep(): ");
//	Console.WriteLine("  dt = %f", dt);
	// quick check...
	if (!m_useWalkDirection & (m_velocityTimeInterval <= 0.0 || m_walkDirection.fuzzyZero())) {
//		Console.WriteLine("\n");
		return;		// no motion
	}
	m_wasOnGround = onGround();
	// Update fall velocity.
	m_verticalVelocity -= m_gravity * dt;
	if(m_verticalVelocity > 0.0 && m_verticalVelocity > m_jumpSpeed)
	{
		m_verticalVelocity = m_jumpSpeed;
	}
	if(m_verticalVelocity < 0.0 && btFabs(m_verticalVelocity) > btFabs(m_fallSpeed))
	{
		m_verticalVelocity = -btFabs(m_fallSpeed);
	}
	m_verticalOffset = m_verticalVelocity * dt;
	btTransform xform;
	xform = m_ghostObject.getWorldTransform ();
//	Console.WriteLine("walkDirection(%f,%f,%f)\n",walkDirection,walkDirection[1],walkDirection[2]);
//	Console.WriteLine("walkSpeed=%f\n",walkSpeed);
	stepUp (collisionWorld);
	if (m_useWalkDirection) {
		stepForwardAndStrafe (collisionWorld, m_walkDirection);
	} else {
		//Console.WriteLine("  time: %f", m_velocityTimeInterval);
		// still have some time left for moving!
		double dtMoving =
			(dt < m_velocityTimeInterval) ? dt : m_velocityTimeInterval;
		m_velocityTimeInterval -= dt;
		// how far will we move while we are moving?
		btVector3 move = m_walkDirection * dtMoving;
		//Console.WriteLine("  dtMoving: %f", dtMoving);
		// okay, step
		stepForwardAndStrafe(collisionWorld, move);
	}
	stepDown (collisionWorld, dt);
	// Console.WriteLine("\n");
	xform.setOrigin (m_currentPosition);
	m_ghostObject.setWorldTransform (xform);
}
void btKinematicCharacterController::setFallSpeed (double fallSpeed)
{
	m_fallSpeed = fallSpeed;
}
void btKinematicCharacterController::setJumpSpeed (double jumpSpeed)
{
	m_jumpSpeed = jumpSpeed;
}
void btKinematicCharacterController::setMaxJumpHeight (double maxJumpHeight)
{
	m_maxJumpHeight = maxJumpHeight;
}
bool btKinematicCharacterController::canJump ()
{
	return onGround();
}
void btKinematicCharacterController::jump ()
{
	if (!canJump())
		return;
	m_verticalVelocity = m_jumpSpeed;
	m_wasJumping = true;
#if 0
	currently no jumping.
	btTransform xform;
	m_rigidBody.getMotionState().getWorldTransform (xform);
	btVector3 up = xform.getBasis()[1];
	up.normalize ();
	double magnitude = ((double)(1.0)/m_rigidBody.getInvMass()) * (double)(8.0);
	m_rigidBody.applyCentralImpulse (up * magnitude);
#endif
}
void btKinematicCharacterController::setGravity(double gravity)
{
	m_gravity = gravity;
}
double btKinematicCharacterController::getGravity()
{
	return m_gravity;
}
void btKinematicCharacterController::setMaxSlope(double slopeRadians)
{
	m_maxSlopeRadians = slopeRadians;
Next line of code: