Exemple #1
0
 /// <exclude />
 public IndexAttribute(string fieldName, IndexDirection indexDirection)
 {
     _fields = new List <Tuple <string, IndexDirection> >
     {
         new Tuple <string, IndexDirection>(fieldName, indexDirection)
     };
 }
Exemple #2
0
 /// <exclude />
 public IndexAttribute(string fieldName, IndexDirection indexDirection)
 {
     _fields = new List<Tuple<string, IndexDirection>>
     {
         new Tuple<string, IndexDirection>(fieldName, indexDirection)
     };
 }
Exemple #3
0
        public BoardIndex GetIndex(IndexDirection direction)
        {
            switch (direction)
            {
            case IndexDirection.Up:
                return(new BoardIndex(RowIndex - 1, ColIndex));

            case IndexDirection.Down:
                return(new BoardIndex(RowIndex + 1, ColIndex));

            case IndexDirection.Left:
                return(new BoardIndex(RowIndex, ColIndex - 1));

            case IndexDirection.Right:
                return(new BoardIndex(RowIndex, ColIndex + 1));

            case IndexDirection.UpLeft:
                return(new BoardIndex(RowIndex - 1, ColIndex - 1));

            case IndexDirection.DownLeft:
                return(new BoardIndex(RowIndex + 1, ColIndex - 1));

            case IndexDirection.UpRight:
                return(new BoardIndex(RowIndex - 1, ColIndex + 1));

            case IndexDirection.DownRight:
                return(new BoardIndex(RowIndex + 1, ColIndex + 1));

            default:
                throw new ArgumentException("無効な方向です。");
            }
        }
Exemple #4
0
        public IndexAnimator(int indexLenght = 1, int currentIndex = 0, IndexDirection indexMovingTo = IndexDirection.Forward, bool isBiderctional = false)
        {
            _IndexLenght    = indexLenght;
            _CurrentIndex   = currentIndex;
            _IndexMovingTo  = indexMovingTo;
            _IsBiderctional = isBiderctional;

            _IndexBase = (_CurrentIndex / _IndexLenght) * _IndexLenght;
        }
Exemple #5
0
 /// <exclude />
 public IndexAttribute(string field1Name, IndexDirection indexDirection1,
                       string field2Name, IndexDirection indexDirection2)
 {
     _fields = new List<Tuple<string, IndexDirection>>
     {
         new Tuple<string, IndexDirection>(field1Name, indexDirection1),
         new Tuple<string, IndexDirection>(field2Name, indexDirection2)
     };
 }
Exemple #6
0
 /// <exclude />
 public IndexAttribute(string field1Name, IndexDirection indexDirection1,
                       string field2Name, IndexDirection indexDirection2)
 {
     _fields = new List <Tuple <string, IndexDirection> >
     {
         new Tuple <string, IndexDirection>(field1Name, indexDirection1),
         new Tuple <string, IndexDirection>(field2Name, indexDirection2)
     };
 }
        private IEnumerable <BoardIndex> GetIndexEnumerable(BoardIndex index, IndexDirection direction)
        {
            var ary = new BoardIndex[Setting.ConnectCount];

            foreach (var ii in Enumerable.Range(0, Setting.ConnectCount))
            {
                ary[ii] = index;
                index   = index.GetIndex(direction);
            }
            return(ary);
        }
Exemple #8
0
        public void ChangeDirection()
        {
            // Is it bidirectional index?
            if (_IsBiderctional == true)
            {
                // Yes.
                _CurrentIndex += (_IndexMovingTo == IndexDirection.Forward) ? -_IndexLenght / 2 : _IndexLenght / 2;
            }

            _IndexMovingTo = (_IndexMovingTo == IndexDirection.Forward) ? IndexDirection.Backward : IndexDirection.Forward;
        }
Exemple #9
0
 /// <summary>
 /// Creates the channel index <see cref="ChannelIndex"/>
 /// </summary>
 /// <param name="indexType">Type of the index.</param>
 /// <param name="direction">The direction.</param>
 /// <param name="mnemonic">The mnemonic.</param>
 /// <param name="uom">The uom.</param>
 /// <param name="datumReference">The datum reference.</param>
 /// <returns></returns>
 public ChannelIndex CreateChannelIndex(ChannelIndexType indexType, IndexDirection direction, string mnemonic, UnitOfMeasure?uom, string datumReference)
 {
     return(new ChannelIndex()
     {
         Direction = direction,
         IndexType = indexType,
         Mnemonic = mnemonic,
         Uom = uom,
         DatumReference = datumReference
     });
 }
Exemple #10
0
        /// <summary>
        /// Creates the log.
        /// </summary>
        /// <param name="indexType">Type of the index.</param>
        /// <param name="isIncreasing">if set to <c>true</c> [is increasing].</param>
        /// <returns></returns>
        public Log CreateLog(ChannelIndexType indexType, bool isIncreasing)
        {
            Log log = new Log();

            log.Citation = Citation("ChannelSet");
            log.Uuid     = Uid();

            log.ChannelSet = new List <ChannelSet>();
            log.Wellbore   = DataObjectReference(ObjectTypes.Wellbore, Name("Wellbore"), Uid());

            List <ChannelIndex> indexList = new List <ChannelIndex>();
            IndexDirection      direction = isIncreasing ? IndexDirection.increasing : IndexDirection.decreasing;

            if (LogGenerator.DepthIndexTypes.Contains(indexType))
            {
                log.TimeDepth = ObjectFolders.Depth;
                ChannelIndex channelIndex = LogGenerator.CreateMeasuredDepthIndex(direction);

                if (indexType.Equals(ChannelIndexType.trueverticaldepth))
                {
                    channelIndex = LogGenerator.CreateTrueVerticalDepthIndex(direction);
                }
                else if (indexType.Equals(ChannelIndexType.passindexeddepth))
                {
                    channelIndex = LogGenerator.CreatePassIndexDepthIndex(direction);
                }

                indexList.Add(channelIndex);
            }
            else if (LogGenerator.TimeIndexTypes.Contains(indexType))
            {
                log.TimeDepth = ObjectFolders.Time;

                if (indexType.Equals(ChannelIndexType.datetime))
                {
                    // DateTime should be increasing only
                    indexList.Add(LogGenerator.CreateDateTimeIndex());
                }
                else if (indexType.Equals(ChannelIndexType.elapsedtime))
                {
                    indexList.Add(LogGenerator.CreateElapsedTimeIndex(direction));
                }
            }
            else
            {
                log.TimeDepth = ObjectFolders.Other;
                return(null);
            }

            InitChannelSet(log, indexList);

            return(log);
        }
Exemple #11
0
 /// <exclude />
 public IndexAttribute(string field1Name, IndexDirection indexDirection1,
                       string field2Name, IndexDirection indexDirection2,
                       string field3Name, IndexDirection indexDirection3,
                       string field4Name, IndexDirection indexDirection4,
                       string field5Name, IndexDirection indexDirection5)
 {
     _fields = new List<Tuple<string, IndexDirection>>
     {
         new Tuple<string, IndexDirection>(field1Name, indexDirection1),
         new Tuple<string, IndexDirection>(field2Name, indexDirection2),
         new Tuple<string, IndexDirection>(field3Name, indexDirection3),
         new Tuple<string, IndexDirection>(field4Name, indexDirection4),
         new Tuple<string, IndexDirection>(field5Name, indexDirection5)
     };
 }
Exemple #12
0
 /// <exclude />
 public IndexAttribute(string field1Name, IndexDirection indexDirection1,
                       string field2Name, IndexDirection indexDirection2,
                       string field3Name, IndexDirection indexDirection3,
                       string field4Name, IndexDirection indexDirection4,
                       string field5Name, IndexDirection indexDirection5)
 {
     _fields = new List <Tuple <string, IndexDirection> >
     {
         new Tuple <string, IndexDirection>(field1Name, indexDirection1),
         new Tuple <string, IndexDirection>(field2Name, indexDirection2),
         new Tuple <string, IndexDirection>(field3Name, indexDirection3),
         new Tuple <string, IndexDirection>(field4Name, indexDirection4),
         new Tuple <string, IndexDirection>(field5Name, indexDirection5)
     };
 }
        protected string CreateIndex(Expression <Func <T, object> > field, IndexDirection direction, TimeSpan?TTL = null)
        {
            if (TTL == TimeSpan.Zero)
            {
                throw new Exception(TTL_ZERO_ERROR_MESSAGE);
            }

            return(Collection.Indexes.CreateOne(
                       new CreateIndexModel <T>(
                           direction == IndexDirection.Ascending ?
                           Builders <T> .IndexKeys.Ascending(field) :
                           Builders <T> .IndexKeys.Descending(field),
                           new CreateIndexOptions()
            {
                ExpireAfter = TTL
            }
                           )));
        }
Exemple #14
0
        public void InitHeader(Log log, LoggingMethod loggingMethod, ChannelIndex channelIndex, IndexDirection direction = IndexDirection.increasing)
        {
            log.ChannelSet    = new List <ChannelSet>();
            log.LoggingMethod = loggingMethod;

            var index = List(channelIndex);

            if (channelIndex.IndexType == ChannelIndexType.measureddepth)
            {
                log.TimeDepth = "depth";

                var pointMetadataList = List(LogGenerator.CreatePointMetadata("Quality", "Quality", EtpDataType.boolean));

                ChannelSet channelSet = LogGenerator.CreateChannelSet(log);
                channelSet.Index = index;

                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "Rate of Penetration", "ROP", UnitOfMeasure.mh, "Velocity", EtpDataType.@double, pointMetadataList: pointMetadataList));
                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "Hookload", "HKLD", UnitOfMeasure.klbf, "Force", EtpDataType.@double, null));
                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "GR1AX", "GR", UnitOfMeasure.gAPI, "Gamma_Ray", EtpDataType.@double, null));

                CreateMockChannelSetData(channelSet, channelSet.Index);
                log.ChannelSet.Add(channelSet);
            }
            else if (channelIndex.IndexType == ChannelIndexType.datetime)
            {
                log.TimeDepth = "time";

                var pointMetadataList = List(LogGenerator.CreatePointMetadata("Confidence", "Confidence", EtpDataType.@float));

                ChannelSet channelSet = LogGenerator.CreateChannelSet(log);
                channelSet.Index = index;

                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "Rate of Penetration", "ROP", UnitOfMeasure.mh, "Velocity", EtpDataType.@double, pointMetadataList: pointMetadataList));
                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "GR1AX", "GR", UnitOfMeasure.gAPI, "Gamma_Ray", EtpDataType.@double, null));

                CreateMockChannelSetData(channelSet, channelSet.Index);
                log.ChannelSet.Add(channelSet);
            }
        }
Exemple #15
0
 /// <summary>
 /// Creates the index <see cref="ChannelIndex"/> of the elapsed time.
 /// </summary>
 /// <param name="direction">The direction.</param>
 /// <returns></returns>
 public ChannelIndex CreateElapsedTimeIndex(IndexDirection direction)
 {
     return(CreateChannelIndex(ChannelIndexType.elapsedtime, direction, "TIME", UnitOfMeasure.ms, "MSL"));
 }
Exemple #16
0
 /// <summary>
 /// Creates the index <see cref="ChannelIndex"/> of the pass index depth.
 /// </summary>
 /// <param name="direction">The direction.</param>
 /// <returns></returns>
 public ChannelIndex CreatePassIndexDepthIndex(IndexDirection direction)
 {
     return(CreateChannelIndex(ChannelIndexType.passindexeddepth, direction, "PID", UnitOfMeasure.m, "MSL"));
 }
Exemple #17
0
 /// <summary>
 /// Creates the index <see cref="ChannelIndex"/> of the true vertical depth.
 /// </summary>
 /// <param name="direction">The direction.</param>
 /// <returns></returns>
 public ChannelIndex CreateTrueVerticalDepthIndex(IndexDirection direction)
 {
     return(CreateChannelIndex(ChannelIndexType.trueverticaldepth, direction, "TVD", UnitOfMeasure.ft, "MSL"));
 }
Exemple #18
0
 /// <summary>
 /// Creates the index <see cref="ChannelIndex"/> of the measured depth
 /// </summary>
 /// <param name="direction">The direction.</param>
 /// <returns></returns>
 public ChannelIndex CreateMeasuredDepthIndex(IndexDirection direction)
 {
     return(CreateChannelIndex(ChannelIndexType.measureddepth, direction, "MD", UnitOfMeasure.m, "MSL"));
 }
Exemple #19
0
 public MongoIndexField(string indexName, IndexDirection direction) : this(indexName, 0, direction)
 {
 }
Exemple #20
0
 public MongoIndexField(string indexName, int columnIndex, IndexDirection direction)
 {
     Direction   = direction;
     ColumnIndex = columnIndex;
     IndexName   = indexName;
 }
        private (double first, double second) EvaluateCellDirectionValue(ISimpleBoard board, BoardIndex index, IndexDirection direction)
        {
            var count_first     = 0;
            var count_second    = 0;
            var count_available = 0;
            var count_void      = 0;
            var count_out       = 0;

            foreach (var cellVal in GetIndexEnumerable(index, direction).Select(idx => board.GetCellStatus(idx)))
            {
                switch (cellVal)
                {
                case CellStatus.First:
                    count_first++;
                    break;

                case CellStatus.Second:
                    count_second++;
                    break;

                case CellStatus.Available:
                    count_available++;
                    break;

                case CellStatus.Void:
                    count_void++;
                    break;

                case CellStatus.OutOfOrder:
                    count_out++;
                    break;
                }
            }


            // 枠内で上がることがない。単純個数評価
            if (0 < count_out)
            {
                return(count_first, count_second);
            }

            // 枠内混在
            if (0 < count_first && 0 < count_second)
            {
                return(count_first, count_second);
            }

            // 単一で埋まっている場合は高評価。空きがavailableでない場合妨害がしにくいため評価を上げてみる。
            var ratio = count_void > 0 ? 2.0 : 1.5;

            return(ratio * Math.Pow(count_first, 2), ratio *Math.Pow(count_second, 2));
        }