/* ------------------------------------------------------------ */ /// <summary>Match channel IDs with wildcard support</summary> /// <param name="name"> /// </param> /// <returns> true if this channelID matches the passed channel ID. If this channel is wild, then matching is wild. /// If the passed channel is wild, then it is the same as an equals call. /// </returns> public bool matches(ChannelId name) { if (name.Wild) { return(Equals(name)); } switch (_wild) { case 0: return(Equals(name)); case 1: if (name._segments.Length != _segments.Length) { return(false); } for (int i = _segments.Length - 1; i-- > 0;) { if (!_segments[i].Equals(name._segments[i])) { return(false); } } return(true); case 2: if (name._segments.Length < _segments.Length) { return(false); } for (int i = _segments.Length - 1; i-- > 0;) { if (!_segments[i].Equals(name._segments[i])) { return(false); } } return(true); } return(false); }
/* ------------------------------------------------------------ */ public bool isParentOf(ChannelId id) { if (Wild || depth() != id.depth() - 1) return false; for (int i = _segments.Length; i-- > 0; ) { if (!_segments[i].Equals(id._segments[i])) return false; } return true; }
/* ------------------------------------------------------------ */ /// <summary>Match channel IDs with wildcard support</summary> /// <param name="name"> /// </param> /// <returns> true if this channelID matches the passed channel ID. If this channel is wild, then matching is wild. /// If the passed channel is wild, then it is the same as an equals call. /// </returns> public bool matches(ChannelId name) { if (name.Wild) return Equals(name); switch (_wild) { case 0: return Equals(name); case 1: if (name._segments.Length != _segments.Length) return false; for (int i = _segments.Length - 1; i-- > 0; ) if (!_segments[i].Equals(name._segments[i])) return false; return true; case 2: if (name._segments.Length < _segments.Length) return false; for (int i = _segments.Length - 1; i-- > 0; ) if (!_segments[i].Equals(name._segments[i])) return false; return true; } return false; }
public BayeuxClientChannel(BayeuxClient bayeuxClient, ChannelId channelId) : base(channelId) { this.bayeuxClient = bayeuxClient; }
protected override AbstractSessionChannel newChannel(ChannelId channelId) { return new BayeuxClientChannel(this, channelId); }
/* ------------------------------------------------------------ */ protected abstract AbstractSessionChannel newChannel(ChannelId channelId);
/* ------------------------------------------------------------ */ public AbstractSessionChannel(ChannelId id) { _id = id; }