コード例 #1
0
ファイル: Map.cs プロジェクト: jtheis85/GoT
 /// Region adjacency by type, order-independent
 /// <summary>
 /// Determines whether a pair of regions are adjacent with a specific
 /// adjacency type. Order-independent
 /// </summary>
 /// <param name="adjacencyType">The type of adjacency between the regions</param>
 /// <param name="firstRegionID">The first region ID</param>
 /// <param name="secondRegionID">The second region ID</param>
 /// <returns>Whether they are adjacent by the given type</returns>
 public bool AreAdjacentBy(AdjacencyType adjacencyType, int firstRegionID, int secondRegionID)
 {
     return(adjacency.Contains(new RegionAdjacency()
     {
         FirstRegion = firstRegionID, SecondRegion = secondRegionID, AdjacencyType = adjacencyType
     }));
 }
コード例 #2
0
ファイル: Morpheme.cs プロジェクト: cambell-prince/FieldWorks
 /// <summary>
 /// Initializes a new instance of the <see cref="MorphCoOccurrence"/> class.
 /// </summary>
 /// <param name="others">The other allomorphs or morphemes.</param>
 /// <param name="objectType">Type of the object.</param>
 /// <param name="adjacency">The adjacency.</param>
 public MorphCoOccurrence(IEnumerable <HCObject> others, ObjectType objectType, AdjacencyType adjacency)
 {
     m_others     = new HCObjectSet <HCObject>(others);
     m_objectType = objectType;
     m_adjacency  = adjacency;
 }
コード例 #3
0
        public void Read(TProtocol iprot)
        {
            TField field;

            iprot.ReadStructBegin();
            while (true)
            {
                field = iprot.ReadFieldBegin();
                if (field.Type == TType.Stop)
                {
                    break;
                }
                switch (field.ID)
                {
                case 1:
                    if (field.Type == TType.String)
                    {
                        Node = iprot.ReadString();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 2:
                    if (field.Type == TType.List)
                    {
                        {
                            Children = new List <string>();
                            TList _list0 = iprot.ReadListBegin();
                            for (int _i1 = 0; _i1 < _list0.Count; ++_i1)
                            {
                                string _elem2 = null;
                                _elem2 = iprot.ReadString();
                                Children.Add(_elem2);
                            }
                            iprot.ReadListEnd();
                        }
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                case 3:
                    if (field.Type == TType.I32)
                    {
                        AdjacencyType = (AdjacencyType)iprot.ReadI32();
                    }
                    else
                    {
                        TProtocolUtil.Skip(iprot, field.Type);
                    }
                    break;

                default:
                    TProtocolUtil.Skip(iprot, field.Type);
                    break;
                }
                iprot.ReadFieldEnd();
            }
            iprot.ReadStructEnd();
        }
コード例 #4
0
ファイル: AdjacencyTable.cs プロジェクト: And-G/Magellan
 public void ReadFrom( BinaryReader reader )
 {
     id = (ushort)(reader.ReadInt32());
     type = (AdjacencyType)(reader.ReadInt32());
     reader.ReadInt32(); // Unused int
 }
コード例 #5
0
ファイル: AdjacencyTable.cs プロジェクト: And-G/Magellan
 public Adjacent( ushort id, AdjacencyType type )
 {
     this.id = id;
     this.type = type;
 }
コード例 #6
0
ファイル: Map.cs プロジェクト: jtheis85/GoT
 /// Region adjacency by type, order-independent
 /// <summary>
 /// Determines whether a pair of regions are adjacent with a specific 
 /// adjacency type. Order-independent
 /// </summary>
 /// <param name="adjacencyType">The type of adjacency between the regions</param>
 /// <param name="firstRegionID">The first region ID</param>
 /// <param name="secondRegionID">The second region ID</param>
 /// <returns>Whether they are adjacent by the given type</returns>
 public bool AreAdjacentBy(AdjacencyType adjacencyType, int firstRegionID, int secondRegionID)
 {
     return adjacency.Contains(new RegionAdjacency() { FirstRegion = firstRegionID, SecondRegion = secondRegionID, AdjacencyType = adjacencyType });
 }
コード例 #7
0
ファイル: Adjacent.cs プロジェクト: And-G/Magellan
        public Adjacent( Stream stream )
        {
            byte[] buffer = new byte[12];
            // Read only 8 bytes, the last 4 don't matter
            stream.Read( buffer, 0, 12 );

            this.id = (ushort)(buffer[0] + (buffer[1] << 8));
            this.type = (AdjacencyType)buffer[4];
        }