/// 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 })); }
/// <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; }
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(); }
public void ReadFrom( BinaryReader reader ) { id = (ushort)(reader.ReadInt32()); type = (AdjacencyType)(reader.ReadInt32()); reader.ReadInt32(); // Unused int }
public Adjacent( ushort id, AdjacencyType type ) { this.id = id; this.type = type; }
/// 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 }); }
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]; }