public TransformationStepRecorder()
        {
            var steps = new List<ITransformationStep>(16);

            this.steps = steps;
            this.readonlySteps = steps.AsReadOnly();
        }
Example #2
0
        public AstMissingMethod(string name, IList<IAstTypeReference> parameterTypes)
        {
            Argument.RequireNotNullAndNotEmpty("name", name);
            Argument.RequireNotNullNotEmptyAndNotContainsNull("parameterTypes", parameterTypes);

            this.Name = name;
            this.ParameterTypes = parameterTypes.AsReadOnly();
        }
Example #3
0
        public TermExpression(IList<TermExpression> terms)
        {
            if (terms == null || terms.Count == 0)
                throw new CqlLinqException("Empty lists are not allowed");

            _type = typeof(IList<>).MakeGenericType(terms[0].Type);
            _terms = terms.AsReadOnly();
            _termType = CqlExpressionType.List;
        }
Example #4
0
 public BlameResult(Uri webRootUrl, ReadOnlyCollection<Block> blocks, IList<Line> lines, Dictionary<string, Commit> commits)
 {
     m_webRootUrl = webRootUrl;
     m_blocks = blocks;
     m_lines = lines;
     m_linesReadOnly = m_lines.AsReadOnly();
     m_commits = commits;
     m_commitsReadOnly = m_commits.Values.ToList().AsReadOnly();
 }
Example #5
0
 public GrantViewModel(
     string albumID,
     HashSet<IUserGroup> grantedUserGroups,
     IList<UserGroupViewModel> allUserGroups
     )
 {
     this.AlbumID = albumID;
     this.grantedUserGroups = grantedUserGroups;
     this.AllUserGroups = allUserGroups.AsReadOnly();
 }
Example #6
0
        internal void SetData(IList<Block> blocks, IList<Line> lines, Dictionary<string, Commit> commits)
        {
            m_blocks = blocks.AsReadOnly();
            m_lines = lines;
            m_linesReadOnly = lines.AsReadOnly();
            m_commits = commits;
            m_commitsReadOnly = m_commits.Values.ToList().AsReadOnly();

            RaisePropertyChanged(null);
        }
        /// <summary>
        /// Create the option by giving it all the data.
        /// </summary>
        /// <param name="timestampType">The timestamp option type.</param>
        /// <param name="overflow">The number of IP modules that cannot register timestamps due to lack of space. Maximum value is 15.</param>
        /// <param name="pointedIndex">The index in the timestamp that points to the for next timestamp.</param>
        /// <param name="timedRoute">The pairs of addresses and timestamps where each timestamp time passed since midnight UT.</param>
        public IpV4OptionTimestampAndAddress(IpV4OptionTimestampType timestampType, byte overflow, byte pointedIndex, IList<IpV4OptionTimedAddress> timedRoute)
            : base(timestampType, overflow, pointedIndex)
        {
            if (timestampType != IpV4OptionTimestampType.AddressAndTimestamp &&
                timestampType != IpV4OptionTimestampType.AddressPrespecified)
            {
                throw new ArgumentException("Illegal timestamp type " + timestampType, "timestampType");
            }

            _addressesAndTimestamps = timedRoute.AsReadOnly();
        }
Example #8
0
 public GalleryViewModel(
     AlbumViewModel currentUserAlbum,
     IList<AlbumViewModel> otherPeopleAlbums,
     AlbumListViewModel standardAlbums,
     AlbumViewModel selected
     )
 {
     this.CurrentUserAlbum = currentUserAlbum;
     this.OtherPeopleAlbums = otherPeopleAlbums.AsReadOnly();
     this.StandardAlbums = standardAlbums;
     this.Selected = selected;
 }
        public AstGenericMethodWithTypeArguments(IAstMethodReference actual, IList<IAstTypeReference> typeArguments, GenericTypeHelper genericHelper)
        {
            Argument.RequireNotNull("actual", actual);
            Argument.RequireNotNull("typeArguments", typeArguments);

            this.Actual = actual;
            this.GenericArgumentTypes = typeArguments.AsReadOnly();

            var genericParameterTypes = actual.GetGenericParameterTypes().ToArray();
            this.ParameterTypes = actual.ParameterTypes.Select(t => ApplyArgumentTypes(genericHelper, t, genericParameterTypes)).ToArray().AsReadOnly();
            this.ReturnType = ApplyArgumentTypes(genericHelper, actual.ReturnType, genericParameterTypes);
        }
        public SelectStatementExpression(Type type, SelectClauseExpression selectClause, string tableName,
                                         IList<RelationExpression> whereClause, IList<OrderingExpression> orderBy,
                                         int? limit, bool allowFiltering)
        {
            if (type == null)
                throw new ArgumentNullException("type");

            if (selectClause == null)
                throw new ArgumentNullException("selectClause");

            if (tableName == null)
                throw new ArgumentNullException("tableName");

            _type = type;
            _selectClause = selectClause;
            _tableName = tableName;
            _whereClause = whereClause.AsReadOnly();
            _orderBy = orderBy.AsReadOnly();
            _limit = limit;
            _allowFiltering = allowFiltering;
        }
 /// <summary>
 /// Create the option by giving it all the data.
 /// </summary>
 /// <param name="overflow">The number of IP modules that cannot register timestamps due to lack of space. Maximum value is 15.</param>
 /// <param name="pointedIndex">The index in the timestamp that points to the for next timestamp.</param>
 /// <param name="timestamps">The timestamps as time passed since midnight UT.</param>
 public IpV4OptionTimestampOnly(byte overflow, byte pointedIndex, IList<IpV4TimeOfDay> timestamps)
     : base(IpV4OptionTimestampType.TimestampOnly, overflow, pointedIndex)
 {
     _timestamps = timestamps.AsReadOnly();
 }
Example #12
0
        private static IList<IList<string>> GetEntryNames( XmlNode sectionsNode, XmlNode templatesNode )
        {
            int sectionCount = Int32.Parse( sectionsNode.Attributes["count"].InnerText );
            IList<IList<string>> result = new IList<string>[sectionCount];

            for ( int i = 0; i < sectionCount; i++ )
            {
                XmlNode currentNode = sectionsNode.SelectSingleNode( string.Format( "Section[@value='{0}']", i ) );
                int currentCount = Int32.Parse( currentNode.Attributes["entries"].InnerText );
                XmlNode emptyNode = currentNode.Attributes["empty"];
                bool empty = emptyNode != null && Boolean.Parse( emptyNode.InnerText );
                if ( empty )
                {
                    result[i] = new string[currentCount].AsReadOnly();
                }
                else
                {
                    string[] currentSection = new string[currentCount];
                    foreach ( XmlNode entryNode in currentNode.SelectNodes( "entry" ) )
                    {
                        int index = Int32.Parse( entryNode.Attributes["value"].InnerText );
                        currentSection[index] = entryNode.Attributes["name"].InnerText;
                    }
                    foreach ( XmlNode includeNode in currentNode.SelectNodes( "include" ) )
                    {
                        XmlNode included = templatesNode.SelectSingleNode( includeNode.Attributes["name"].InnerText );
                        int start = Int32.Parse( includeNode.Attributes["start"].InnerText );
                        int end = Int32.Parse( includeNode.Attributes["end"].InnerText );
                        int offset = Int32.Parse( includeNode.Attributes["offset"].InnerText );
                        for ( int j = start; j <= end; j++ )
                        {
                            currentSection[j + offset] = included.SelectSingleNode( string.Format( "entry[@value='{0}']", j ) ).Attributes["name"].InnerText;
                        }
                    }

                    result[i] = currentSection.AsReadOnly();
                }
            }

            return result.AsReadOnly();
        }
Example #13
0
        private static void GetDisallowedEntries( XmlNode node, int numSections, out IList<IList<int>> disallowed, out IList<IDictionary<int,string>> staticEntries )
        {
            IList<IList<int>> result = new IList<int>[numSections];
            IList<IDictionary<int, string>> ourStatic = new IDictionary<int, string>[numSections];
            XmlNode disallowedNode = node.SelectSingleNode( "DisallowedEntries" );
            if ( disallowedNode != null )
            {
                foreach ( XmlNode node2 in disallowedNode.SelectNodes( "Section" ) )
                {
                    int sec = Int32.Parse( node2.Attributes["value"].InnerText );
                    List<int> ourResult = new List<int>();
                    Dictionary<int, string> ourDict = new Dictionary<int, string>();
                    foreach ( XmlNode ent in node2.SelectNodes( "entry" ) )
                    {
                        int idx = Int32.Parse(ent.InnerText);
                        ourResult.Add( idx);
                        XmlAttribute stat = ent.Attributes["staticValue"];
                        if ( stat != null )
                        {
                            ourDict[idx] = stat.InnerText;
                        }
                        else
                        {
                            ourDict[idx] = string.Empty;
                        }
                    }
                    result[sec] = ourResult.AsReadOnly();
                    ourStatic[sec] = new ReadOnlyDictionary<int, string>( ourDict );
                }
            }
            for ( int i = 0; i < result.Count; i++ )
            {
                if ( result[i] == null )
                {
                    result[i] = new int[0].AsReadOnly();
                }
                if ( ourStatic[i] == null )
                {
                    ourStatic[i] = new ReadOnlyDictionary<int, string>( new Dictionary<int, string>( 0 ) );
                }
            }

            disallowed = result.AsReadOnly();
            staticEntries = ourStatic.AsReadOnly();
        }
 public DbExpressionSet(IList<Expression> expressions)
     : base(DbExpressionType.Block, 
         expressions[expressions.Count - 1].Type)
 {
     _expressions = expressions.AsReadOnly();
 }
 /// <summary>
 /// Creates an instance from a list of requests.
 /// </summary>
 /// <param name="requests">The requests types and options.</param>
 public IpV6MobilityOptionContextRequest(IList<IpV6MobilityOptionContextRequestEntry> requests)
     : this(requests.AsReadOnly())
 {
 }
 /// <summary>
 /// Creates an instance from a list of flow identifiers.
 /// </summary>
 /// <param name="flowIdentifiers">
 /// Indicating a registered FID.
 /// One or more FID fields can be included in this option.
 /// </param>
 public IpV6MobilityOptionFlowSummary(IList<ushort> flowIdentifiers)
     : this(flowIdentifiers.AsReadOnly())
 {
 }
 /// <summary>
 /// Creates an instance from next header, checksum, home agent addresses and options.
 /// </summary>
 /// <param name="nextHeader">Identifies the type of header immediately following this extension header.</param>
 /// <param name="checksum">
 /// Contains the checksum of the Mobility Header.
 /// The checksum is calculated from the octet string consisting of a "pseudo-header"
 /// followed by the entire Mobility Header starting with the Payload Proto field.
 /// The checksum is the 16-bit one's complement of the one's complement sum of this string.
 /// </param>
 /// <param name="homeAgentAddresses">A list of alternate home agent addresses for the mobile node.</param>
 /// <param name="options">Zero or more TLV-encoded mobility options.</param>
 public IpV6ExtensionHeaderMobilityHomeAgentSwitchMessage(IpV4Protocol? nextHeader, ushort checksum, IList<IpV6Address> homeAgentAddresses, IpV6MobilityOptions options)
     : this(nextHeader, checksum, (ReadOnlyCollection<IpV6Address>)homeAgentAddresses.AsReadOnly(), options)
 {
 }
Example #18
0
 public GroupableSet( string group, IList<int> indices, int originalCost )
 {
     Group = group;
     Indices = indices.AsReadOnly();
     OriginalCost = originalCost;
     hashCode = group.GetHashCode();
 }
 /// <summary>
 /// Creates an instance from a list of binding ids.
 /// </summary>
 /// <param name="bindingIds">
 /// Indicates the BIDs that the mobile node wants to associate with the flow identification option.
 /// One or more BID fields can be included in this sub-option.
 /// </param>
 public IpV6FlowIdentificationSubOptionBindingReference(IList<ushort> bindingIds)
     : this((ReadOnlyCollection<ushort>)bindingIds.AsReadOnly())
 {
 }
Example #20
0
        private static IList<IList<string>> GetEntryNames( XmlNode sectionsNode, XmlNode templatesNode )
        {
            int sectionCount = Int32.Parse( sectionsNode.Attributes["count"].InnerText );
            IList<IList<string>> result = new IList<string>[sectionCount];

            for ( int i = 0; i < sectionCount; i++ )
            {
                XmlNode currentNode = sectionsNode.SelectSingleNode( string.Format( "Section[@value='{0}']", i ) );
                int currentCount = Int32.Parse( currentNode.Attributes["entries"].InnerText );
                XmlNode emptyNode = currentNode.Attributes["empty"];
                bool empty = emptyNode != null && Boolean.Parse( emptyNode.InnerText );
                if ( empty )
                {
                    result[i] = new string[currentCount].AsReadOnly();
                }
                else
                {
                    string[] currentSection = new string[currentCount];
                    foreach ( XmlNode entryNode in currentNode.SelectNodes( "entry" ) )
                    {
                        int index = Int32.Parse( entryNode.Attributes["value"].InnerText );
                        currentSection[index] = entryNode.Attributes["name"].InnerText;
                    }

                    foreach ( XmlNode includeNode in currentNode.SelectNodes( "includeResource" ) )
                    {
                        int start = Int32.Parse( includeNode.Attributes["start"].InnerText );
                        int end = Int32.Parse( includeNode.Attributes["end"].InnerText );
                        int offset = Int32.Parse( includeNode.Attributes["offset"].InnerText );
                        string fullName = includeNode.Attributes["name"].InnerText;
                        XmlAttribute formatNode = includeNode.Attributes["format"];
                        string format = formatNode != null ? formatNode.InnerText.Replace( "\\n", Environment.NewLine ) : "{0}";

                        if ( !cachedResources.ContainsKey( fullName ) )
                        {
                            cachedResources[fullName] = PatcherLib.ResourcesClass.GetResourceByName( fullName );
                        }

                        IList<string> resourceList = cachedResources[fullName];
                        for ( int j = start; j <= end; j++ )
                        {
                            if ( string.IsNullOrEmpty( resourceList[j] ) )
                            {
                                currentSection[j + offset] = string.Empty;
                            }
                            else
                            {
                                currentSection[j + offset] = string.Format( format, resourceList[j] );
                            }
                        }
                    }

                    foreach ( XmlNode includeNode in currentNode.SelectNodes( "include" ) )
                    {
                        XmlNode included = templatesNode.SelectSingleNode( includeNode.Attributes["name"].InnerText );
                        int start = Int32.Parse( includeNode.Attributes["start"].InnerText );
                        int end = Int32.Parse( includeNode.Attributes["end"].InnerText );
                        int offset = Int32.Parse( includeNode.Attributes["offset"].InnerText );
                        for ( int j = start; j <= end; j++ )
                        {
                            currentSection[j + offset] = included.SelectSingleNode( string.Format( "entry[@value='{0}']", j ) ).Attributes["name"].InnerText;
                        }
                    }

                    result[i] = currentSection.AsReadOnly();
                }
            }

            return result.AsReadOnly();
        }