コード例 #1
0
        public void testOneBlankLine()
        {
            IntList map = RawParseUtils.lineMap(new byte[] { (byte)'\n' }, 0, 1);

            Assert.AreEqual(3, map.size());
            Assert.AreEqual(int.MinValue, map.get(0));
            Assert.AreEqual(0, map.get(1));
            Assert.AreEqual(1, map.get(2));
        }
コード例 #2
0
 internal CustomPropertyCollection(DataValueList expressions, DataValueInstanceList instances)
 {
     m_expressions = expressions;
     m_instances   = instances;
     Global.Tracer.Assert(m_expressions != null);
     Global.Tracer.Assert(m_instances == null || m_instances.Count == m_expressions.Count);
     m_uniqueNames     = new Hashtable(m_expressions.Count);
     m_expressionIndex = new IntList(m_expressions.Count);
 }
コード例 #3
0
        public void testEmpty()
        {
            IntList map = RawParseUtils.lineMap(new byte[] {}, 0, 0);

            Assert.IsNotNull(map);
            Assert.AreEqual(2, map.size());
            Assert.AreEqual(int.MinValue, map.get(0));
            Assert.AreEqual(0, map.get(1));
        }
コード例 #4
0
    public static void Main()
    {
        IntList list = new IntList();

        foreach (int i in list)
        {
            Console.WriteLine(i);
        }
    }
コード例 #5
0
        public void Test_Insert_Should_Correctly_Insert_Element_when_Array_Is_Shorter_Then_4()
        {
            //Given
            IntList array = AddedArray(1, 2, 3);

            //When
            array.Insert(1, 5);
            //Then
            Assert.Equal(1, array.IndexOf(5));
        }
コード例 #6
0
        private static int FindForwardLine(IntList lines, int idx, int ptr)
        {
            int end = lines.Size() - 2;

            while (idx < end && lines.Get(idx + 2) < ptr)
            {
                idx++;
            }
            return(idx);
        }
コード例 #7
0
    static void Test1()
    {
        Console.WriteLine("----Test1");
        IntList list = new IntList();

        foreach (int i in list)
        {
            Console.WriteLine(i);
        }
    }
コード例 #8
0
        public void Test_Insert_Should_Correctly_Insert_Element_when_Array_Is_Longer_Then_4()
        {
            //Given
            IntList array = AddedArray(1, 2, 3, 4, 5, 6, 7, 8);

            //When
            array.Insert(5, 100);
            //Then
            Assert.Equal(5, array.IndexOf(100));
        }
コード例 #9
0
ファイル: IntListTest.cs プロジェクト: zzia615/GitSharp
        public void testFillTo100()
        {
            IntList i = new IntList();

            i.fillTo(100, int.MinValue);
            Assert.AreEqual(100, i.size());
            i.add(3);
            Assert.AreEqual(int.MinValue, i.get(99));
            Assert.AreEqual(3, i.get(100));
        }
コード例 #10
0
        /**
         * Converts the {@link IntList} back into a String containing a comma delimited list of
         * ints.
         */
        //[TypeConverter]
        public static String intListToStoredString(IntList list)
        {
            StringBuilder stringBuilder = new StringBuilder();

            foreach (var integer in list.ints)
            {
                stringBuilder.Append(integer).Append(",");
            }
            return(stringBuilder.ToString());
        }
コード例 #11
0
ファイル: IntListTest.cs プロジェクト: mnoreke/MNorekePublic
 public void IntListSerializationTest()
 {
     IntList dataToSerialize = new IntList();
     byte[] data = SerializationUtil.SerializeData(dataToSerialize);
     Assert.IsNotNull(data);
     Assert.AreNotEqual(0, data.Length);
     IntList deserializedData = SerializationUtil.DeserializeData<IntList>(data);
     Assert.IsNotNull(deserializedData);
     Assert.AreNotSame(dataToSerialize, deserializedData);
 }
コード例 #12
0
ファイル: Search.cs プロジェクト: CnSimonChan/sudoku-solver
        public Grid()
        {
            Numbers = new IntList();
            for (int i = 1; i < 10; i++)
                Numbers.Add(i);

            for (int i = 0; i < 9; i++)
                for (int j = 0; j < 9; j++)
                    Possibilities[i, j] = new IntList(Numbers);
        }
コード例 #13
0
ファイル: Search.cs プロジェクト: CnSimonChan/sudoku-solver
        public Grid(Grid another)
        {
            values = (int[,])another.values.Clone();

            for (int i = 0; i < 9; i++)
                for (int j = 0; j < 9; j++)
                    Possibilities[i, j] = new IntList(another.Possibilities[i, j]);

            SolvedCount = another.SolvedCount;
        }
コード例 #14
0
ファイル: IntListTest.cs プロジェクト: zzia615/GitSharp
        public void testToString()
        {
            IntList i = new IntList();

            i.add(1);
            Assert.AreEqual("[1]", i.toString());
            i.add(13);
            i.add(5);
            Assert.AreEqual("[1, 13, 5]", i.toString());
        }
コード例 #15
0
        public IntList CompareTo(string other)
        {
            var results = new IntList();

            foreach (var v in this)
            {
                results.Add(string.CompareOrdinal(v.ToString(), other));
            }
            return(results);
        }
コード例 #16
0
 /// <summary>
 /// Constructor.
 /// </summary>
 public HeroList()
 {
     ints         = new IntList();
     floats       = new FloatList();
     bools        = new BoolList();
     strings      = new StringList();
     gameObjects  = new GameObjectList();
     heroObjects  = new HeroObjectList();
     unityObjects = new UnityObjectList();
 }
コード例 #17
0
 public SimpleIntListPool(int initPoolSize, int listSize)
 {
     this.listSize       = listSize;
     m_UnusedObjectLists = new Queue <IntList>(initPoolSize);
     for (int i = 0; i < initPoolSize; ++i)
     {
         IntList t = new IntList(listSize);
         m_UnusedObjectLists.Enqueue(t);
     }
 }
コード例 #18
0
ファイル: IntListTest.cs プロジェクト: zzia615/GitSharp
        public void testFillTo1()
        {
            IntList i = new IntList();

            i.fillTo(1, int.MinValue);
            Assert.AreEqual(1, i.size());
            i.add(0);
            Assert.AreEqual(int.MinValue, i.get(0));
            Assert.AreEqual(0, i.get(1));
        }
コード例 #19
0
    /// <summary>
    /// 回池
    /// </summary>
    protected override void toRelease(DataPool pool)
    {
        base.toRelease(pool);

        this.attackID         = 0;
        this.attackLevel      = 0;
        this.targetData       = null;
        this.targets          = null;
        this.isBulletFirstHit = false;
    }
コード例 #20
0
        public SWIGTYPE_p_float at(IntList indexes)
        {
            SWIGTYPE_p_float ret = new SWIGTYPE_p_float(OpenPosePINVOKE.FloatArray_at__SWIG_2(swigCPtr, IntList.getCPtr(indexes)), false);

            if (OpenPosePINVOKE.SWIGPendingException.Pending)
            {
                throw OpenPosePINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #21
0
        public void EmptyComparisons_FalseButWhenNotEq()
        {
            var empty = new IntList();

            Assert.False(empty == 0);
            Assert.True(empty != 0);
            Assert.False(empty < 0);
            Assert.False(empty > 0);
            Assert.False(empty <= 0);
            Assert.False(empty >= 0);
        }
コード例 #22
0
        protected IntList AddedArray(params int[] numbers)
        {
            IntList array = new IntList();

            foreach (var number in numbers)
            {
                array.Add(number);
            }

            return(array);
        }
コード例 #23
0
 public void Recycle(IntList t)
 {
     if (null != t)
     {
         if (m_UnusedObjectLists.Count < m_PoolSize)
         {
             m_UnusedObjectLists.Enqueue(t);
         }
         t.Clear();
     }
 }
コード例 #24
0
        private IntList CreateTestList()
        {
            var list = new IntList();

            for (var i = 0; i < 25; i++)
            {
                list.Add(i);
            }

            return(list);
        }
コード例 #25
0
ファイル: IntList.cs プロジェクト: zjmsky/SharpFace
        public IntList GetRange(int index, int count)
        {
            global::System.IntPtr cPtr = LandmarkDetectorPINVOKE.IntList_GetRange(swigCPtr, index, count);
            IntList ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntList(cPtr, true);

            if (LandmarkDetectorPINVOKE.SWIGPendingException.Pending)
            {
                throw LandmarkDetectorPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #26
0
ファイル: IntList.cs プロジェクト: zjmsky/SharpFace
        public static IntList Repeat(int value, int count)
        {
            global::System.IntPtr cPtr = LandmarkDetectorPINVOKE.IntList_Repeat(value, count);
            IntList ret = (cPtr == global::System.IntPtr.Zero) ? null : new IntList(cPtr, true);

            if (LandmarkDetectorPINVOKE.SWIGPendingException.Pending)
            {
                throw LandmarkDetectorPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }
コード例 #27
0
        public void TestRoundtripIntList()
        {
            var obj = new IntList
            {
                Values = new List <int>(IntValues)
            };
            var actualObj = Roundtrip(obj);

            actualObj.Should().NotBeNull();
            actualObj.Values.Should().Equal(IntValues);
        }
コード例 #28
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="list">The hero list to construct.</param>
 public HeroList(HeroList list)
 {
     visible      = list.visible;
     ints         = (list.ints == null) ? new IntList() : list.ints.Clone(list.ints);
     floats       = (list.floats == null) ? new FloatList() : list.floats.Clone(list.floats);
     bools        = (list.bools == null) ? new BoolList() : list.bools.Clone(list.bools);
     strings      = (list.strings == null) ? new StringList() : list.strings.Clone(list.strings);
     gameObjects  = (list.gameObjects == null) ? new GameObjectList() : list.gameObjects.Clone(list.gameObjects);
     heroObjects  = (list.heroObjects == null) ? new HeroObjectList() : list.heroObjects.Clone(list.heroObjects);
     unityObjects = (list.unityObjects == null) ? new UnityObjectList() : list.unityObjects.Clone(list.unityObjects);
 }
コード例 #29
0
        public void Test_Exception_RemoveAt_Should_Throw_Exception_When_Index_Does_Not_Exist()
        {
            //Given
            IntList array = new IntList();
            //When
            var exception = Assert.Throws <ArgumentOutOfRangeException>(() => array.RemoveAt(1));

            //Then
            Assert.Equal("index", exception.ParamName);
            Assert.Equal(0, array.Count);
        }
コード例 #30
0
 private static void BuildHiddenColumns(MatrixMember member, ref IntList hiddenColumns)
 {
     if (hiddenColumns == null)
     {
         hiddenColumns = new IntList();
     }
     for (int i = 0; i < member.ColumnSpan; i++)
     {
         hiddenColumns.Add(member.MemberCellIndex + i);
     }
 }
コード例 #31
0
ファイル: Group.cs プロジェクト: erynet/IMS
 public void Copy(Info rhs)
 {
     isUsing = rhs.isUsing;
     groupIdx = rhs.groupIdx;
     groupNo = rhs.groupNo;
     isGroupVisible = rhs.isGroupVisible;
     groupName = rhs.groupName;
     coordinate = new Point(rhs.coordinate);
     upsIdxList = new IntList(rhs.upsIdxList);
     upsNoList = new IntList(rhs.upsNoList);
 }
コード例 #32
0
        private IntList AddArray(params int[] values)
        {
            IntList array = new IntList();

            foreach (var value in values)
            {
                array.Add(value);
            }

            return(array);
        }
コード例 #33
0
    /// <summary>
    /// 转文本输出
    /// </summary>
    protected override void toWriteDataString(DataWriter writer)
    {
        base.toWriteDataString(writer);

        writer.writeTabs();
        writer.sb.Append("isAssist");
        writer.sb.Append(':');
        writer.sb.Append(this.isAssist);

        writer.writeEnter();
        writer.writeTabs();
        writer.sb.Append("isNecessary");
        writer.sb.Append(':');
        writer.sb.Append(this.isNecessary);

        writer.writeEnter();
        writer.writeTabs();
        writer.sb.Append("areaIDList");
        writer.sb.Append(':');
        writer.sb.Append("List<int>");
        if (this.areaIDList != null)
        {
            IntList areaIDListT   = this.areaIDList;
            int     areaIDListLen = areaIDListT.size();
            writer.sb.Append('(');
            writer.sb.Append(areaIDListLen);
            writer.sb.Append(')');
            writer.writeEnter();
            writer.writeLeftBrace();
            for (int areaIDListI = 0; areaIDListI < areaIDListLen; ++areaIDListI)
            {
                int areaIDListV = areaIDListT.get(areaIDListI);
                writer.writeTabs();
                writer.sb.Append(areaIDListI);
                writer.sb.Append(':');
                writer.sb.Append(areaIDListV);

                writer.writeEnter();
            }
            writer.writeRightBrace();
        }
        else
        {
            writer.sb.Append("=null");
        }

        writer.writeEnter();
        writer.writeTabs();
        writer.sb.Append("countryID");
        writer.sb.Append(':');
        writer.sb.Append(this.countryID);

        writer.writeEnter();
    }
コード例 #34
0
ファイル: IntListTest.cs プロジェクト: mnoreke/MNorekePublic
        public void IntListConstructorTest()
        {
            IntList list = new IntList(true);
            Assert.IsTrue(list.IsUniqueList, "List Uniqueness Failure");

            list = new IntList(false);
            Assert.IsFalse(list.IsUniqueList, "List Uniqueness Failure");

            list = new IntList();
            Assert.AreEqual(false, list.IsUniqueList, "List Uniqueness Failure");
        }
コード例 #35
0
ファイル: BigNumberData.cs プロジェクト: shineTeam7/home3
    /// <summary>
    /// 复制(潜拷贝)
    /// </summary>
    protected override void toShadowCopy(BaseData data)
    {
        if (!(data is BigNumberData))
        {
            return;
        }

        BigNumberData mData = (BigNumberData)data;

        this.values = mData.values;
    }
コード例 #36
0
ファイル: Kata.cs プロジェクト: kkorus/kata
        public static int Solution(IntList L)
        {
            int count = 1;

            while (L.next != null)
            {
                count++;
                L = L.next;
            }

            return count;
        }
コード例 #37
0
ファイル: Cdu.cs プロジェクト: erynet/IMS
 public void Copy(Info rhs)
 {
     isUsing = rhs.isUsing;
     cduIdx = rhs.cduIdx;
     cduNo = rhs.cduNo;
     cduName = rhs.cduName;
     isExtended = rhs.isExtended;
     upsIdxList = new IntList(rhs.upsIdxList);
     upsNoList = new IntList(rhs.upsNoList);
     installDate = rhs.installDate;
     ip = rhs.ip;
 }
コード例 #38
0
ファイル: UPS.cs プロジェクト: erynet/IMS
 public void Copy(Info rhs)
 {
     isUsing = rhs.isUsing;
     upsIdx = rhs.upsIdx;
     upsNo = rhs.upsNo;
     groupIdx = rhs.groupIdx;
     groupNo = rhs.groupNo;
     upsName = rhs.upsName;
     partnerIdxList = new IntList(rhs.partnerIdxList);
     partnerNoList = new IntList(rhs.partnerNoList);
     cduIdx = rhs.cduIdx;
     cduNo = rhs.cduNo;
     batteryDescription = rhs.batteryDescription;
     batteryCapacity = rhs.batteryCapacity;
     ip = rhs.ip;
     installDate = rhs.installDate;
 }
コード例 #39
0
        private static void Main(string[] args)
        {
            IntList iList = new IntList(1, 24, 3, 44, 54, 6, 7);
             iList.Act(Console.WriteLine);
             iList.Filter(delegate(int x) { return x % 2 == 0; }).Act(Console.WriteLine);

             iList.Filter(delegate(int x) { return x >= 25; }).Act(Console.WriteLine);

             int sum = 0;
             iList.Act(delegate(int x) { sum += x; });
             Console.WriteLine(String.Format("The sum is {0}", sum));

             //Lamda
             iList.Filter(x => x % 2 == 0).Act(Console.WriteLine);
             iList.Filter(x => x >= 25).Act(Console.WriteLine);

             sum = 0;
             iList.Act(x => sum += x);
             Console.WriteLine(String.Format("The sum is {0}", sum));
        }
コード例 #40
0
ファイル: Group.cs プロジェクト: erynet/IMS
 public Info()
 {
     coordinate = new Point();
     upsIdxList = new IntList();
     upsNoList = new IntList();
 }
コード例 #41
0
ファイル: AuthoringPaneView.cs プロジェクト: GNOME/mistelix
        // Processing of dropped files from the Project Element View is done here
        void HandleTargetDragDataReceived(object sender, DragDataReceivedArgs args)
        {
            Logger.Debug ("AuthoringPaneView.HandleTargetDragDataReceived. {0} {1}", args.X, args.Y);

            IntList list = new IntList ();
            list.FromString (System.Text.Encoding.UTF8.GetString (args.SelectionData.Data));
            foreach (int item_id in list) {
                Logger.Debug ("AuthoringPaneView.HandleTargetDragDataReceived.Item {0}", item_id);
                project.AddButton (new Core.Button (args.X, args.Y, item_id));
            }

            args.RetVal = true;
            Gtk.Drag.Finish (args.Context, true, false, args.Time);
            // QueueDraw fired by CollectionChanged
        }
コード例 #42
0
ファイル: main.cs プロジェクト: Ozerich/labs
    public static int Main()
    {
        Console.WriteLine("Lab №4, Ozierski Vital, group 052004");

        StringList sl = new StringList();
        IntList il = new IntList();

        string cmd, command, mode;
        bool found;
        while (true)
        {
            Console.WriteLine();
            Console.WriteLine("Commands: addback, addfront, getfront, getback, find, print");
            Console.WriteLine("Format: <command> <int|string> or exit");
            Console.Write("? ");
            cmd = Console.ReadLine();
            if (cmd == "exit")
                break;
            if (cmd.Split(' ').Length != 2)
                Console.WriteLine("Incorrect command format");
            else
            {
                command = cmd.Split(' ')[0];
                mode = cmd.Split(' ')[1];
                if (mode != "string" && mode != "int")
                    Console.WriteLine("Incorrect mode");
                else
                {
                    if (command == "addback")
                    {
                        Console.Write("Value: ");
                        if (mode == "int")
                            il.AddBack(Int32.Parse(Console.ReadLine()));
                        else if (mode == "string")
                            sl.AddBack(Console.ReadLine());
                    }
                    else if (command == "addfront")
                    {
                        Console.Write("Value: ");
                        if (mode == "int")
                            il.AddFront(Int32.Parse(Console.ReadLine()));
                        else if (mode == "string")
                            sl.AddFront(Console.ReadLine());
                    }
                    else if (command == "print")
                    {
                        if (mode == "int")
                            il.Print();
                        else if (mode == "string")
                            sl.Print();
                    }
                    else if (command == "getfront")
                    {
                        if (mode == "int")
                            Console.WriteLine(il.GetFront());
                        else if (mode == "string")
                            Console.WriteLine(sl.GetFront());
                    }
                    else if (command == "getback")
                    {
                        if (mode == "int")
                            Console.WriteLine(il.GetBack());
                        else if (mode == "string")
                            Console.WriteLine(sl.GetBack());
                    }
                    else if (command == "find")
                    {
                        Console.Write("Value: ");
                        found = false;
                        if (mode == "int")
                            found = il.Find(Int32.Parse(Console.ReadLine()));
                        else if (mode == "string")
                            found = sl.Find(Console.ReadLine());
                        Console.WriteLine(found ? "found" : "no found");
                    }
                    else
                        Console.WriteLine("Incorrect Command");
                }
                Console.WriteLine();
            }
        }

        return 0;
    }
コード例 #43
0
ファイル: Cdu.cs プロジェクト: erynet/IMS
 public Info()
 {
     upsIdxList = new IntList();
     upsNoList = new IntList();
 }
コード例 #44
0
ファイル: Ups.cs プロジェクト: erynet/IMS
        public static Ups.Info GetUpsByNo(int upsNo)
        {
            try
            {
                using (var ctx = new LocalDB())
                {
                    var groupTotal = (from g in ctx.Group orderby g.No ascending select g).ToArray();
                    var upsTotal = (from ups in ctx.Ups orderby ups.No ascending select ups).ToArray();
                    var cduTotal = (from c in ctx.Cdu orderby c.No ascending select c).ToArray();

                    var u = (from ups in ctx.Ups where ups.No == upsNo select ups).DefaultIfEmpty(null).First();
                    if (u == null)
                        return null;

                    IntList tempPartnerIdxList;
                    IntList tempPartnerNoList;
                    if ((u.MateList == null) || (u.MateList.Length == 0))
                    {
                        tempPartnerIdxList = new IntList();
                        tempPartnerNoList = new IntList();
                    }
                    else
                    {
                        tempPartnerIdxList = new IntList((from iu in upsTotal where (Regex.Split(u.MateList, @"\D+").Select(n => Convert.ToInt32(n)).Contains(iu.No)) orderby iu.No ascending select iu.Idx).ToArray());
                        tempPartnerNoList = new IntList(Regex.Split(u.MateList, @"\D+").Select(n => Convert.ToInt32(n)).ToArray());
                    }

                    return new Ups.Info()
                    {
                        isUsing = u.Enabled,
                        upsIdx = u.Idx,
                        upsNo = u.No,
                        groupIdx = u.GroupNo,
                        groupNo = (from g in groupTotal where g.Idx == u.GroupNo select g.No).DefaultIfEmpty(0).FirstOrDefault(),
                        upsName = u.Name,
                        partnerIdxList = tempPartnerIdxList,
                        partnerNoList = tempPartnerNoList,
                        cduIdx = (from c in cduTotal where c.Idx == u.CduNo select c.Idx).DefaultIfEmpty(0).FirstOrDefault(),
                        cduNo = u.CduNo,
                        batteryDescription = u.Specification,
                        batteryCapacity = u.Capacity,
                        ip = u.IpAddress,
                        installDate = u.InstallAt
                    };

                    //return (from u in ctx.Ups
                    //        where u.No == upsNo
                    //        select new Ups.Info()
                    //        {
                    //            isUsing = u.Enabled,
                    //            upsIdx = u.Idx,
                    //            upsNo = u.No,
                    //            groupIdx = (from g in groupTotal where g.No == u.GroupNo select g.Idx).DefaultIfEmpty(0).FirstOrDefault(),
                    //            groupNo = u.GroupNo,
                    //            upsName = u.Name,
                    //            partnerIdxList = new IntList((from iu in upsTotal where Regex.Split(u.MateList, @"\D+").Select(n => Convert.ToInt32(n)).ToArray().Contains(iu.No) orderby iu.No ascending select iu.Idx).ToArray()),
                    //            partnerNoList = new IntList(Regex.Split(u.MateList, @"\D+").Select(n => Convert.ToInt32(n)).ToArray()),
                    //            cduIdx = (from c in cduTotal where c.Idx == u.CduNo select c.Idx).DefaultIfEmpty(0).FirstOrDefault(),
                    //            cduNo = u.CduNo,
                    //            batteryDescription = u.Specification,
                    //            batteryCapacity = u.Capacity,
                    //            ip = u.IpAddress,
                    //            installDate = u.InstallAt
                    //        }).DefaultIfEmpty(null).First();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"GetUpsByNo : {e.ToString()}");
                return null;
            }
        }
コード例 #45
0
ファイル: Program.cs プロジェクト: evolvedmicrobe/ccsviewer
        public static void Main(string[] args)
        {
            try {
                PlatformManager.Services.MaxSequenceSize = int.MaxValue;
                PlatformManager.Services.DefaultBufferSize = 4096;
                PlatformManager.Services.Is64BitProcessType = true;

                if (args.Length > 4) {
                    Console.WriteLine ("Too many arguments");
                    DisplayHelp ();
                } else if (args.Length < 4) {
                    Console.WriteLine ("Not enough arguments");
                    DisplayHelp();
                }else if (args [0] == "h" || args [0] == "help" || args [0] == "?" || args [0] == "-h") {
                    DisplayHelp ();
                } else {

                    string subreads_name = args [0];
                    string ccs_name = args [1];
                    string ref_name = args [2];
                    string zmw = args[3];

                    // Validate files exist
                    for(int i = 0; i < 3; i++) {
                        var fname = args[i];
                        if (!File.Exists(fname)) {
                            Console.WriteLine ("Can't find file: " + fname);
                            return;
                        }
                        if (i < 2) {
                            //TODO: Add code to ensure BAM exists here
                        }
                    }

                    // Validate ZMW Number
                    int holeNumber;
                    bool converted = int.TryParse(zmw, out holeNumber);
                    if (!converted || holeNumber < 0) {
                        Console.WriteLine("Could not convert " + zmw +" into hole number >= 0");
                    }

                    Console.WriteLine("Loading Data ...");

                    // Get CCS Read
                    IntList zmws = new IntList();
                    zmws.Add(holeNumber);
                    //zmws.Add(133403);
                    DataSet dt = new DataSet(ccs_name);
                    var query = new ZmwQuery(zmws, dt);
                    var ccs = query.FirstOrDefault();
                    if (ccs == null) {
                        Console.WriteLine("Could not query hole number " + holeNumber + " from file " + ccs_name);
                        return;
                    }
                    var seq_str = ccs.Sequence();
                    var sequence = new Sequence(DnaAlphabet.Instance, seq_str);
                    sequence.ID = ccs.FullName();
                    //Clean up
                    query.Dispose(); query = null;
                    ccs.Dispose(); ccs = null;
                    dt.Dispose(); dt = null;

                    Console.WriteLine("Aligning Data ... ");
                    BWAPairwiseAligner bwa = new BWAPairwiseAligner(ref_name, false);

                    // Now get initial alignment and variants
                    BWAPairwiseAlignment aln =  bwa.AlignRead(sequence) as BWAPairwiseAlignment;
                    if (aln == null) {
                        Console.WriteLine("Consensus read did not align");
                        return;
                    }

                    // Now get all the subreads
                    dt = new DataSet(subreads_name);
                    query = new ZmwQuery(zmws, dt);
                    // We must copy the data right away, or we wind up with a bunch of pointers that all hit the same thing
                    var subreads = query.Select(s => new Sequence(DnaAlphabet.Instance, s.Sequence()) {ID = s.FullName()}).ToList();
                    if (subreads.Count == 0 )
                    {
                        Console.WriteLine("Did not find any subreads from " + holeNumber + " in file " + subreads_name);
                        return;
                    }
                    subreads.ForEach( s => {
                        var split = s.ID.Split('/');
                        s.ID = String.Join("/", split.Skip(1)); });

                    zmws.Dispose(); zmws = null;
                    query.Dispose(); query = null;

                    // Now generate the dataset
                    var data = new CCSDataSet(sequence, subreads, aln);

                    Application.Init ();
                    MainWindow win = new MainWindow (data);
                    win.Show ();
                    Application.Run ();

                }

            }
            catch(DllNotFoundException thrown) {
                Console.WriteLine ("Error thrown when attempting to generate the CCS results.");
                Console.WriteLine("A shared library was not found.  To solve this, please add the folder" +
                    " with the downloaded files *.so and *.dylib " +
                    "to your environmental variables (LD_LIBRARY_PATH on Ubuntu, DYLD_LIBRARY_PATH on Mac OS X).");
                Console.WriteLine ("Error: " + thrown.Message);
                Console.WriteLine (thrown.StackTrace);

            }
            catch(Exception thrown) {
                Console.WriteLine ("Error thrown when attempting to generate the CCS results");
                Console.WriteLine ("Error: " + thrown.Message);
                Console.WriteLine (thrown.StackTrace);
                while (thrown.InnerException != null) {
                    Console.WriteLine ("Inner Exception: " + thrown.InnerException.Message);
                    thrown = thrown.InnerException;
                }
            }
        }
コード例 #46
0
        public void SessionAuthUserAccessTest()
        {
            SessionAuthUser authUser = new SessionAuthUser("UNIT_TEST", 1, "Tester", "Mr. Tester", 1);
            Assert.IsNotNull(authUser);

            IntList allAcceessLevelIds = new IntList();
            allAcceessLevelIds.Add(CoreConstants.MODULE_ADMINISTRATION_ACCESS_NONE);
            allAcceessLevelIds.Add(CoreConstants.MODULE_ADMINISTRATION_ACCESS_READ_ONLY);
            allAcceessLevelIds.Add(CoreConstants.MODULE_ADMINISTRATION_ACCESS_EDIT);
            allAcceessLevelIds.Add(CoreConstants.MODULE_ADMINISTRATION_ACCESS_FULL);

            allAcceessLevelIds.Add(CoreConstants.MODULE_AUTH_ACCESS_NONE);
            allAcceessLevelIds.Add(CoreConstants.MODULE_AUTH_ACCESS_READ_ONLY);
            allAcceessLevelIds.Add(CoreConstants.MODULE_AUTH_ACCESS_EDIT);
            allAcceessLevelIds.Add(CoreConstants.MODULE_AUTH_ACCESS_FULL);

            allAcceessLevelIds.Add(CoreConstants.MODULE_BILLING_ACCESS_NONE);
            allAcceessLevelIds.Add(CoreConstants.MODULE_BILLING_ACCESS_READ_ONLY);
            allAcceessLevelIds.Add(CoreConstants.MODULE_BILLING_ACCESS_EDIT);
            allAcceessLevelIds.Add(CoreConstants.MODULE_BILLING_ACCESS_FULL);

            allAcceessLevelIds.Add(CoreConstants.MODULE_SAAS_ACCESS_NONE);
            allAcceessLevelIds.Add(CoreConstants.MODULE_SAAS_ACCESS_READ_ONLY);
            allAcceessLevelIds.Add(CoreConstants.MODULE_SAAS_ACCESS_EDIT);
            allAcceessLevelIds.Add(CoreConstants.MODULE_SAAS_ACCESS_FULL);

            allAcceessLevelIds.Add(CoreConstants.MODULE_GLOBAL_ACCESS_NONE);
            allAcceessLevelIds.Add(CoreConstants.MODULE_GLOBAL_ACCESS_READ_ONLY);
            allAcceessLevelIds.Add(CoreConstants.MODULE_GLOBAL_ACCESS_EDIT);
            allAcceessLevelIds.Add(CoreConstants.MODULE_GLOBAL_ACCESS_FULL);

            IntList acceessLevelIds = new IntList();
            authUser.AccessLevels = new IntList();
            foreach (int acceessLevelID in acceessLevelIds)
                Assert.IsFalse(authUser.IsAuthorized(acceessLevelID), "Default access should be off");

            #region Administrator Check
            authUser.IsAdministrator = true;
            foreach (int acceessLevelID in allAcceessLevelIds)
                Assert.IsTrue(authUser.IsAuthorized(acceessLevelID), "IsAdministrator should have access to all");

            authUser.IsAdministrator = false;
            foreach (int acceessLevelID in allAcceessLevelIds)
                Assert.IsFalse(authUser.IsAuthorized(acceessLevelID), "IsAdministrator turned off should disable access to all");

            #endregion

            #region Limited Access Check
            authUser.AccessLevels = new IntList();
            authUser.AccessLevels.Add(CoreConstants.MODULE_AUTH_ACCESS_NONE);
            authUser.AccessLevels.Add(CoreConstants.MODULE_AUTH_ACCESS_READ_ONLY);
            authUser.AccessLevels.Add(CoreConstants.MODULE_AUTH_ACCESS_EDIT);

            foreach (int acceessLevelIDtoCheck in allAcceessLevelIds)
            {
                bool isAuthorized = authUser.IsAuthorized(acceessLevelIDtoCheck);
                bool shouldBeAuthorized = (
                    (acceessLevelIDtoCheck == CoreConstants.MODULE_AUTH_ACCESS_NONE) ||
                    (acceessLevelIDtoCheck == CoreConstants.MODULE_AUTH_ACCESS_READ_ONLY) ||
                    (acceessLevelIDtoCheck == CoreConstants.MODULE_AUTH_ACCESS_EDIT)
                    );

                Assert.AreEqual(isAuthorized, shouldBeAuthorized, "Failed to correctly authorize the only set item.");
            }
            #endregion
        }
コード例 #47
0
ファイル: Search.cs プロジェクト: CnSimonChan/sudoku-solver
 public IntList(IntList another)
 {
     Array.Copy(another.items, items, another.Count);
     Count = another.Count;
 }
コード例 #48
0
ファイル: Client.cs プロジェクト: joshmoore/ice
    private static void allTests(Ice.Communicator communicator)
    {
        Console.Out.Write("testing equals() for Slice structures... ");
        Console.Out.Flush();

        //
        // Define some default values.
        //
        C def_cls = new C(5);
        S1 def_s = new S1("name");
        string[] def_ss = new string[]{ "one", "two", "three" };
        IntList def_il = new IntList();
        def_il.Add(1);
        def_il.Add(2);
        def_il.Add(3);
        Dictionary<string, string> def_sd = new Dictionary<string, string>();
        def_sd.Add("abc", "def");
        Ice.ObjectPrx def_prx = communicator.stringToProxy("test");
        S2 def_s2 = new S2(true, (byte)98, (short)99, 100, 101, (float)1.0, 2.0, "string", def_ss, def_il, def_sd,
                           def_s, def_cls, def_prx);

        //
        // Compare default-constructed structures.
        //
        {
            test(new S2().Equals(new S2()));
        }

        //
        // Change one primitive member at a time.
        //
        {
            S2 v;

            v = (S2)def_s2.Clone();
            test(v.Equals(def_s2));

            v = (S2)def_s2.Clone();
            v.bo = false;
            test(!v.Equals(def_s2));

            v = (S2)def_s2.Clone();
            v.by--;
            test(!v.Equals(def_s2));

            v = (S2)def_s2.Clone();
            v.sh--;
            test(!v.Equals(def_s2));

            v = (S2)def_s2.Clone();
            v.i--;
            test(!v.Equals(def_s2));

            v = (S2)def_s2.Clone();
            v.l--;
            test(!v.Equals(def_s2));

            v = (S2)def_s2.Clone();
            v.f--;
            test(!v.Equals(def_s2));

            v = (S2)def_s2.Clone();
            v.d--;
            test(!v.Equals(def_s2));

            v = (S2)def_s2.Clone();
            v.str = "";
            test(!v.Equals(def_s2));
        }

        //
        // String member
        //
        {
            S2 v1, v2;

            v1 = (S2)def_s2.Clone();
            v1.str = (string)def_s2.str.Clone();
            test(v1.Equals(def_s2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v1.str = null;
            test(!v1.Equals(v2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v2.str = null;
            test(!v1.Equals(v2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v1.str = null;
            v2.str = null;
            test(v1.Equals(v2));
        }

        //
        // Sequence member
        //
        {
            S2 v1, v2;

            v1 = (S2)def_s2.Clone();
            v1.ss = (string[])def_s2.ss.Clone();
            test(v1.Equals(def_s2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v1.ss = null;
            test(!v1.Equals(v2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v2.ss = null;
            test(!v1.Equals(v2));
        }

        //
        // Custom sequence member
        //
        {
            S2 v1, v2;

            v1 = (S2)def_s2.Clone();
            v1.il = (IntList)def_s2.il.Clone();
            test(v1.Equals(def_s2));

            v1 = (S2)def_s2.Clone();
            v1.il = new IntList();
            test(!v1.Equals(def_s2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v1.il = null;
            test(!v1.Equals(v2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v2.il = null;
            test(!v1.Equals(v2));
        }

        //
        // Dictionary member
        //
        {
            S2 v1, v2;

            v1 = (S2)def_s2.Clone();
            v1.sd = new Dictionary<string, string>(def_s2.sd);
            test(v1.Equals(def_s2));

            v1 = (S2)def_s2.Clone();
            v1.sd = new Dictionary<string, string>();
            test(!v1.Equals(def_s2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v1.sd = null;
            test(!v1.Equals(v2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v2.sd = null;
            test(!v1.Equals(v2));
        }

        //
        // Struct member
        //
        {
            S2 v1, v2;

            v1 = (S2)def_s2.Clone();
            v1.s = (S1)def_s2.s.Clone();
            test(v1.Equals(def_s2));

            v1 = (S2)def_s2.Clone();
            v1.s = new S1("name");
            test(v1.Equals(def_s2));

            v1 = (S2)def_s2.Clone();
            v1.s = new S1("noname");
            test(!v1.Equals(def_s2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v1.s = null;
            test(!v1.Equals(v2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v2.s = null;
            test(!v1.Equals(v2));
        }

        //
        // Class member
        //
        {
            S2 v1, v2;

            v1 = (S2)def_s2.Clone();
            v1.cls = (C)def_s2.cls.Clone();
            test(!v1.Equals(def_s2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v1.cls = null;
            test(!v1.Equals(v2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v2.cls = null;
            test(!v1.Equals(v2));
        }

        //
        // Proxy member
        //
        {
            S2 v1, v2;

            v1 = (S2)def_s2.Clone();
            v1.prx = communicator.stringToProxy("test");
            test(v1.Equals(def_s2));

            v1 = (S2)def_s2.Clone();
            v1.prx = communicator.stringToProxy("test2");
            test(!v1.Equals(def_s2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v1.prx = null;
            test(!v1.Equals(v2));

            v1 = (S2)def_s2.Clone();
            v2 = (S2)def_s2.Clone();
            v2.prx = null;
            test(!v1.Equals(v2));
        }

        Console.Out.WriteLine("ok");
    }
コード例 #49
0
ファイル: UPS.cs プロジェクト: erynet/IMS
 public Info()
 {
     partnerIdxList = new IntList();
     partnerNoList = new IntList();
 }