/// <summary> /// Initializes a new instance of the <see cref="SmallDocumentBlockList"/> class. /// </summary> /// <param name="blocks">a list of SmallDocumentBlock instances</param> public SmallDocumentBlockList(IList blocks) { SmallDocumentBlock[] array = new SmallDocumentBlock[blocks.Count]; blocks.CopyTo(array, 0); ListManagedBlock[] tmp = (ListManagedBlock[])array; this.SetBlocks(ref tmp); }
internal SignatureAnalysis(string text, int paramIndex, IList<ISignature> signatures, string lastKeywordArgument = null) { _text = text; _paramIndex = paramIndex; _signatures = new ISignature[signatures.Count]; signatures.CopyTo(_signatures, 0); _lastKeywordArgument = lastKeywordArgument; Array.Sort(_signatures, (x, y) => x.Parameters.Count - y.Parameters.Count); }
internal SignatureAnalysis(string text, int paramIndex, IList<ISignature> signatures) { _text = text; _paramIndex = paramIndex; _signatures = new ISignature[signatures.Count]; signatures.CopyTo(_signatures, 0); Array.Sort(_signatures, (x, y) => x.Parameters.Count - y.Parameters.Count); }
// Initialize for searching a list of values public InElement(ExpressionElement operand, IList listElements) { MyOperand = operand; ExpressionElement[] arr = new ExpressionElement[listElements.Count]; listElements.CopyTo(arr, 0); MyArguments = new List<ExpressionElement>(arr); this.ResolveForListSearch(); }
public PersonArray(IList<Person> mdos) { if (mdos == null || mdos.Count <= 0) { return; } Person[] ary = new Person[mdos.Count]; mdos.CopyTo(ary, 0); setProps(ary); }
public UserArray(IList<User> mdo) { if (mdo == null || mdo.Count == 0) { return; } User[] userAry = new User[mdo.Count]; mdo.CopyTo(userAry, 0); buildArray(userAry); }
private ReactiveDownloader (IList<OneSongHeader> Songs, String UserAgent, String FolderPath, Boolean GenerateNewFilenames, String FilenameTemplate) { this._songs = new OneSongHeader[Songs.Count]; Songs.CopyTo(this._songs, 0); this._userAgent = UserAgent; this._folderPath = FolderPath; this._generateNewFilenames = GenerateNewFilenames; this._filenameTemplate = FilenameTemplate; }
private string[] ListToArray(IList<string> stringList) { if (null == stringList) { return null; } string[] stringArray = new string[stringList.Count]; stringList.CopyTo(stringArray, 0); return stringArray; }
public void Contain_All_The_Same_Items(IList<int> inputData) { int[] initialData = new int[inputData.Count]; inputData.CopyTo(initialData, 0); inputData.RandomShuffle(); foreach (var initialItem in initialData) { Assert.That(inputData, Contains.Item(initialItem)); } }
public DataPointSelectionChangedEventArgs(IList<DataPoint> removedItems, IList<DataPoint> addedItems) { if (addedItems != null) { this._addedItems = new DataPoint[addedItems.Count]; addedItems.CopyTo(this._addedItems, 0); } if (removedItems == null) return; this._removedItems = new DataPoint[removedItems.Count]; removedItems.CopyTo(this._removedItems, 0); }
internal Reduction(Rule rule, IList<Token> tokens): base() { if (rule == null) { throw new ArgumentNullException("rule"); } if (tokens == null) { throw new ArgumentNullException("tokens"); } this.rule = rule; Token[] tokenArray = new Token[tokens.Count]; tokens.CopyTo(tokenArray, 0); this.tokens = Array.AsReadOnly(tokenArray); }
private XmlNodeList GetAttributesFrom(XmlNode node, IList<string> arguments, bool warnIfEmpty) { string[] array = new string[arguments.Count]; arguments.CopyTo(array, 0); string xpath = "@" + string.Join("|@", array); XmlNodeList xmlNodeList = node.SelectNodes(xpath); if (xmlNodeList.Count == 0 && warnIfEmpty && arguments.Count == 1) this.Log.LogWarning("Argument '{0}' did not match any attributes", new object[1] { (object) arguments[0] }); return xmlNodeList; }
internal static bool FindBestConstructor(Type t, IList<object> parameters, out ConstructorInfo constructorInfo, out object[] convertedParameters) { MethodBase methodBase; object[] parameterObjects = new object[parameters.Count]; parameters.CopyTo(parameterObjects, 0); if (ReflectionHelper.FindBestMember(t.GetConstructors(), parameterObjects, out methodBase, out convertedParameters)) { constructorInfo = (ConstructorInfo) methodBase; return true; } constructorInfo = null; return false; }
public async Task<int> ThinkAsync(IList<char> gameBoard) { // Copy the contents of the IList to a string. char[] arrayTmp = new char[9]; gameBoard.CopyTo(arrayTmp, 0); string board = new String(arrayTmp); // Frequently take the center square if the board is empty. System.Random random = new System.Random((int)System.DateTime.Now.Ticks); if (random.Next() % 2 == 0 && gameBoard.All<char>((ch) => ch == m_emptySymbol.Symbol)) { return 4; } // Approximate counts of iterations the algorithm makes for each number of available moves at the root level. uint[] allIterations = { 0u, 2u, 5u, 15u, 50u, 200u, 930u, 7300u, 60000u, 550000u }; var moves = MiniMax.AvailableMoves(board, m_emptySymbol.Symbol); uint totalIterations = allIterations[moves.Length - 1]; // Report every 1%. uint nextReportIter = totalIterations / 100; uint iterBy = nextReportIter; // This is called on every iteration of the minimax algorithm. MiniMax.CallBackFn callback = /*[total_iterations, &next_report_iter, iter_by, reporter]*/(int iter_count) => { if (iter_count == nextReportIter) { double progress = 100.0 * iter_count / totalIterations; //reporter.report(Math.Min(progress, 100.0)); nextReportIter += iterBy; } }; // Run the minimax algorithm in parallel if there are enough iterations. // Otherwise, run it serially, as the overhead of parallelism may not benefit. int iterCount = 0; System.Tuple<int, int> t; //if (totalIterations > 500) //{ // t = parallel_minimax(board, m_symbol, m_opponentSymbol, m_emptySymbol, m_symbol, iterCount, callback); //} //else //{ t = await MiniMax.Minimax(board, m_symbol.Symbol, m_opponentSymbol.Symbol, m_emptySymbol.Symbol, m_symbol.Symbol, iterCount, callback); //} // Return the index part. return t.Item1; }
public object?End() { try { if (_enumerable != null) { return(null); } object?value; if (_isArray) { var arr = Array.CreateInstance( Argument.CheckResult(_listType?.GetElementType(), "Initialization Error"), _list?.Count ?? 0); _list?.CopyTo(arr, 0); value = arr; } else { value = _list; } return(value); } finally { _list = null; _enumerable = null; } }
public TaggedAppointmentArray(string tag, IList<Appointment> mdos) { if (mdos == null || mdos.Count == 0) { this.count = 0; return; } Appointment[] appts = new Appointment[mdos.Count]; mdos.CopyTo(appts, 0); initialize(tag, appts); }
/// <summary> /// Lists all subscribers for the specified message types /// </summary> /// <param name="messageTypes"></param> /// <returns></returns> public IList<string> GetSubscribersForMessage(IList<string> messageTypes) { var mt = new string[messageTypes.Count]; messageTypes.CopyTo(mt, 0); using (var session = sessionSource.CreateSession()) { return session.CreateCriteria(typeof(Subscription)) .Add(Restrictions.In("MessageType", mt)) .SetProjection(Projections.Property("SubscriberEndpoint")) .SetResultTransformer(new DistinctRootEntityResultTransformer()) .List<string>(); } }
public SelectionChangedEventArgs(RoutedEvent id, IList removedItems, IList addedItems) : base(id) { if (removedItems == null) throw new ArgumentNullException("removedItems"); if (addedItems == null) throw new ArgumentNullException("addedItems"); RemovedItems = new object[removedItems.Count]; removedItems.CopyTo((Array) RemovedItems, 0); AddedItems = new object[addedItems.Count]; addedItems.CopyTo((Array) AddedItems, 0); }
/// <summary> /// Initializes a new instance of a SelectionChangedEventArgs class. /// </summary> /// <param name="removedItems">The items that were unselected during this event.</param> /// <param name="addedItems">The items that were selected during this event.</param> public SelectionChangedEventArgs(IList removedItems, IList addedItems) { if (null == removedItems) { throw new ArgumentNullException("removedItems"); } if (null == addedItems) { throw new ArgumentNullException("addedItems"); } _removedItems = new object[removedItems.Count]; removedItems.CopyTo(_removedItems, 0); _addedItems = new object[addedItems.Count]; addedItems.CopyTo(_addedItems, 0); }
private XmlNodeList GetAttributesFrom(XmlNode node, IList<string> arguments, bool warnIfEmpty) { string[] array = new string[arguments.Count]; arguments.CopyTo(array, 0); string xpath = String.Concat("@", String.Join("|@", array)); XmlNodeList attributes = node.SelectNodes(xpath); if (attributes.Count == 0 && warnIfEmpty) { Debug.Assert(arguments.Count == 1, "Should only call warnIfEmpty==true with one argument"); if (arguments.Count == 1) { Log.LogWarning(SR.XMLTRANSFORMATION_TransformArgumentFoundNoAttributes, arguments[0]); } } return attributes; }
public SelectionChangedEventArgs(IList removedItems, IList addedItems) { if (removedItems == null) { throw new ArgumentNullException("removedItems"); } if (addedItems == null) { throw new ArgumentNullException("addedItems"); } this.removedItems = new object[removedItems.Count]; removedItems.CopyTo(this.removedItems, 0); this.addedItems = new object[addedItems.Count]; addedItems.CopyTo(this.addedItems, 0); }
public object InstantiateElement(IParserContext context, string typeName, IList<object> parameters) { try { Type t = GetElementType(typeName); object[] parameterObjects = new object[parameters.Count]; parameters.CopyTo(parameterObjects, 0); return Activator.CreateInstance(t, parameterObjects); } catch (Exception e) { if (e is XamlParserException) throw; throw new XamlParserException("Error creating element type '{0}'", e, typeName); } }
/// <summary> /// Creates a new Program /// </summary> /// <param name="processor">the processor for this program</param> /// <param name="instructions">the program instructions</param> /// <param name="debugInfo">optional program debug information</param> public Program(Processor processor, IList<IInstruction> instructions, ProgramDebugInfo debugInfo = null) { this.DebugInfo = debugInfo; this.Processor = processor; // Check instructions size if (instructions.Count > processor.RomSize) { throw new ArgumentException("Number of instructions > size of instruction ROM"); } // Create new readonly instructions array IInstruction[] instructionArray = new IInstruction[processor.RomSize]; instructions.CopyTo(instructionArray, 0); this.Instructions = new ReadOnlyCollection<IInstruction>(instructionArray); }
public void SetSteps(Transform chess, IList t) { Chess = chess; tower = GetClosetChess(Chess); cPass = Chess.GetComponent<CharacterPassive>(); chessModel = chess.FindChild("Models"); if(chessModel.GetComponent<AnimVault>()!=null){ //chessModel.GetComponent<AnimVault>().CurrentState = AnimVault.AnimState.run; currentSelect.AnimStateNetWork(chess, AnimVault.AnimState.run); } int len = t.Count; pathList = new Transform[len]; t.CopyTo(pathList,0); Step = pathList.Length-1; if(Step>0){ SetDestination(); } }
/// <summary> /// Sets header info for this branch. /// </summary> internal void SetHeaderInfo(IList childBranchList, TreeGridDesignerColumnDescriptor[] columns) { if (childBranchList == null) { throw new ArgumentNullException("childBranchList"); } _childBranchArray = new ChildBranchInfo[childBranchList.Count]; childBranchList.CopyTo(_childBranchArray, 0); _columns = columns; _currentBranches = new List<ChildBranchInfo>(_childBranchArray.Length); for (var i = 0; i < _childBranchArray.Length; i++) { _currentBranches.Add(_childBranchArray[i]); } }
private AllSprites( Context context, AllSpriteAttributes attrs, SpriteFileLocations locs, IList<Sprite> otherSprites ) { Count = attrs.Count + otherSprites.Count; sprites = new Sprite[Count]; IList<string> spriteNames = context == Context.US_PSP ? PSPResources.Lists.SpriteFiles : PSXResources.Lists.SpriteFiles; for (int i = 0; i < attrs.Count; i++) { sprites[i] = new CharacterSprite( context, string.Format( "{0:X2} - {1}", i+1, spriteNames[i] ), attrs[i], locs[i] ); } otherSprites.CopyTo( sprites, attrs.Count ); this.attrs = attrs; this.locs = locs; Dictionary<Sprite, IList<int>> sharedSPRs = new Dictionary<Sprite, IList<int>>(); for (int i = 0; i < sprites.Count; i++) { sharedSPRs.Add( sprites[i], new List<int>() ); } for (int i = 0; i < attrs.Count; i++) { for (int j = i + 1; j < attrs.Count; j++) { if (locs[i].Sector == locs[j].Sector) { sharedSPRs[sprites[i]].Add( j ); sharedSPRs[sprites[j]].Add( i ); } } } for (int i = 0; i < sprites.Count; i++) { sharedSPRs[sprites[i]].Sort(); sharedSPRs[sprites[i]] = sharedSPRs[sprites[i]].AsReadOnly(); } SharedSPRs = new ReadOnlyDictionary<Sprite, IList<int>>( sharedSPRs ); }
/// <summary> /// The constructor for selection changed args /// </summary> /// <param name="id">The event ID for the event about to fire -- should probably be Selector.SelectionChangedEvent</param> /// <param name="removedItems">The items that were unselected during this event</param> /// <param name="addedItems">The items that were selected during this event</param> public SelectionChangedEventArgs( RoutedEvent id, IList removedItems, IList addedItems) { if (id == null) throw new ArgumentNullException("id"); if (removedItems == null) throw new ArgumentNullException("removedItems"); if (addedItems == null) throw new ArgumentNullException("addedItems"); RoutedEvent = id; _removedItems = new object[removedItems.Count]; removedItems.CopyTo(_removedItems, 0); _addedItems = new object[addedItems.Count]; addedItems.CopyTo(_addedItems, 0); }
protected AbstractFile( GenericCharMap charmap, FFTPatcher.TextEditor.FFTTextFactory.FileInfo layout, string fileComments, IList<string> sectionComments, bool compressible ) { System.Diagnostics.Debug.Assert( sectionComments.Count == layout.SectionNames.Count ); FileComments = fileComments ?? string.Empty; SectionComments = new string[sectionComments.Count]; sectionComments.CopyTo( SectionComments, 0 ); NumberOfSections = layout.SectionLengths.Count; Layout = layout; CharMap = charmap; SelectedTerminator = layout.AllowedTerminators[0]; EntryNames = layout.EntryNames.AsReadOnly(); SectionLengths = layout.SectionLengths.AsReadOnly(); SectionNames = layout.SectionNames.AsReadOnly(); HiddenEntries = layout.Hidden.AsReadOnly(); DisplayName = layout.DisplayName; Compressible = compressible; CompressionAllowed = layout.CompressionAllowed.AsReadOnly(); DteAllowed = layout.DteAllowed.AsReadOnly(); }
// Handles the lists of elements. protected CombinatorialBase(IList listObjects, int nKlass ) { // Check the validity of the arguments DoArgumentCheck(listObjects.Count, nKlass); m_nKlass = nKlass; // Always takes the ZERO (FIRST) dimension of the array. There is no // problem in manipulation multidimensional arrays. m_nMaxIndex = listObjects.Count - 1; m_arrayIndeces = new int[m_nKlass]; m_arrayIndecesDummy = new int[m_nKlass]; m_arrayCurrentObj = new Object[m_nKlass]; // Make a shallow copy of the source array. // m_arrayObj = Array.CreateInstance(listObjects[0].GetType(), listObjects.Count); m_arrayObj = Array.CreateInstance(Type.GetType("System.Object"), listObjects.Count); listObjects.CopyTo(m_arrayObj, 0); }
static void BuildInputHelper(int column, IList<object> data, ref List<object[]> input) { if (column == data.Count) { object[] items= new object[data.Count]; data.CopyTo(items,0); input.Add(items); return; } var list = data[column] as System.Collections.IList; if (list != null) { foreach (var item in list) { data[column] = item; BuildInputHelper(column + 1, data, ref input); } data[column] = list; } else BuildInputHelper(column + 1, data, ref input); }
public void CopyTo(T[] array, int index) { list.CopyTo(array, index); }
/// <summary> /// /// </summary> /// <param name="array"></param> /// <param name="index"></param> public void CopyTo(Array array, int index) { _currentPageList.CopyTo(array, index); }
public void CopyTo(T[] array, int arrayIndex) { lock (root) list.CopyTo(array, arrayIndex); }
/// <summary> /// CopyTo /// </summary> /// <param name="array">IActiveDirectory</param> /// <param name="arrayIndex">int</param> public void CopyTo(IActiveDirectory[] array, int arrayIndex) { _entries.CopyTo(array, arrayIndex); }
public void CopyTo(T[] array, int arrayIndex) => _listImplementation.CopyTo(array, arrayIndex);
/// <summary> /// Copies the entire <see cref="EquatableList{T}"/> to a compatible one-dimensional array, /// starting at the specified index of the target array. /// </summary> /// <param name="array">The one-dimensional <see cref="Array"/> that is the /// destination of the elements copied from <see cref="EquatableList{T}"/>. /// The Array must have zero-based indexing.</param> /// <param name="arrayIndex">The zero-based index in <paramref name="array"/> at which copying begins.</param> public virtual void CopyTo(T[] array, int arrayIndex) { list.CopyTo(array, arrayIndex); }
public void CopyTo(T[] array, int arrayIndex) { AssertAll(); _source.CopyTo(array, arrayIndex); }
public void CopyTo(Worksheet[] array, int arrayIndex) { worksheets.CopyTo(array, arrayIndex); }
public void CopyTo(T[] array, int arrayIndex) { Data.CopyTo(array, arrayIndex); }
private IStateChange[] GetStateChangeHooks(IList list) { IStateChange[] ret = new IStateChange [list.Count]; list.CopyTo(ret, 0); return(ret); }
public void CopyTo(ICard[] array, int arrayIndex) { cards.CopyTo(array, arrayIndex); }
private void SetCollectionValues(Array a, IList listValue) { try { if (collection != null) { collection.Locked = true; } // now we have to copy the value into each property. object[] values = new object[listValue.Count]; listValue.CopyTo(values, 0); for (int i = 0; i < descriptors.Length; i++) { IList propList = descriptors[i].GetValue(GetPropertyOwnerForComponent(a, i)) as IList; if (propList == null) { continue; } propList.Clear(); foreach (object val in values) { propList.Add(val); } } } finally { if (collection != null) { collection.Locked = false; } } }
private static DerObjectIdentifier[] ToOidArray(IList oids) { DerObjectIdentifier[] oidArray = new DerObjectIdentifier[oids.Count]; oids.CopyTo(oidArray, 0); return(oidArray); }
/// <summary> /// Copies the elements of the <see cref="T:System.Collections.Generic.ICollection`1"/> to an <see cref="T:System.Array"/>, starting at a particular <see cref="T:System.Array"/> index. /// </summary> public void CopyTo(T[] array, int arrayIndex) { using (_lock.Read()) _store.CopyTo(array, arrayIndex); }
/// <summary> /// Copies the elements of the ArrayCollection to an Array, starting at a particular Array index. /// </summary> /// <param name="array">The one-dimensional Array that is the destination of the elements copied from ArrayCollection. The Array must have zero-based indexing.</param> /// <param name="index">The zero-based index in array at which copying begins.</param> public void CopyTo(Array array, int index) { _list.CopyTo(array, index); }
internal void DispatchSharedObjectMessage(SharedObjectMessage message) { #if !(NET_1_1) List <ASObject> changeList = null; List <ASObject> notifications = null; List <SendMessageEventArgs> messages = null; #else ArrayList changeList = null; ArrayList notifications = null; ArrayList messages = null; #endif bool raiseOnConnect = false; foreach (ISharedObjectEvent sharedObjectEvent in message.Events) { switch (sharedObjectEvent.Type) { case dotFlex.Messaging.Rtmp.SO.SharedObjectEventType.CLIENT_INITIAL_DATA: if (message.Version > 0) { _version = message.Version; } _attributes.Clear(); _initialSyncReceived = true; //Delay the connection notification until the attribute store has been populated //RaiseOnConnect(); raiseOnConnect = true; break; case dotFlex.Messaging.Rtmp.SO.SharedObjectEventType.CLIENT_UPDATE_DATA: case dotFlex.Messaging.Rtmp.SO.SharedObjectEventType.CLIENT_UPDATE_ATTRIBUTE: { ASObject infoObject = new ASObject(); infoObject["code"] = "change"; infoObject["name"] = sharedObjectEvent.Key; infoObject["oldValue"] = this.GetAttribute(sharedObjectEvent.Key); //Do not update the attribute store if this is a notification that the SetAttribute is accepted if (sharedObjectEvent.Type != dotFlex.Messaging.Rtmp.SO.SharedObjectEventType.CLIENT_UPDATE_ATTRIBUTE) { _attributes[sharedObjectEvent.Key] = sharedObjectEvent.Value; } if (changeList == null) #if !(NET_1_1) { changeList = new List <ASObject>(); } #else { changeList = new ArrayList(); } #endif changeList.Add(infoObject); } break; case dotFlex.Messaging.Rtmp.SO.SharedObjectEventType.CLIENT_CLEAR_DATA: { ASObject infoObject = new ASObject(); infoObject["code"] = "clear"; if (changeList == null) #if !(NET_1_1) { changeList = new List <ASObject>(); } #else { changeList = new ArrayList(); } #endif changeList.Add(infoObject); _attributes.Clear(); } break; case dotFlex.Messaging.Rtmp.SO.SharedObjectEventType.CLIENT_DELETE_ATTRIBUTE: case dotFlex.Messaging.Rtmp.SO.SharedObjectEventType.CLIENT_DELETE_DATA: { _attributes.Remove(sharedObjectEvent.Key); ASObject infoObject = new ASObject(); infoObject["code"] = "delete"; infoObject["name"] = sharedObjectEvent.Key; if (changeList == null) #if !(NET_1_1) { changeList = new List <ASObject>(); } #else { changeList = new ArrayList(); } #endif changeList.Add(infoObject); } break; case dotFlex.Messaging.Rtmp.SO.SharedObjectEventType.CLIENT_STATUS: { ASObject infoObject = new ASObject(); infoObject["level"] = sharedObjectEvent.Value; infoObject["code"] = sharedObjectEvent.Key; if (notifications == null) #if !(NET_1_1) { notifications = new List <ASObject>(); } #else { notifications = new ArrayList(); } #endif notifications.Add(infoObject); } break; case dotFlex.Messaging.Rtmp.SO.SharedObjectEventType.CLIENT_SEND_MESSAGE: case dotFlex.Messaging.Rtmp.SO.SharedObjectEventType.SERVER_SEND_MESSAGE: { string handler = sharedObjectEvent.Key; IList arguments = sharedObjectEvent.Value as IList; MethodInfo mi = MethodHandler.GetMethod(this.GetType(), handler, arguments); if (mi != null) { ParameterInfo[] parameterInfos = mi.GetParameters(); object[] args = new object[parameterInfos.Length]; arguments.CopyTo(args, 0); TypeHelper.NarrowValues(args, parameterInfos); try { InvocationHandler invocationHandler = new InvocationHandler(mi); object result = invocationHandler.Invoke(this, args); } catch (Exception exception) { #if !SILVERLIGHT log.Error("Error while invoking method " + handler + " on shared object", exception); #endif } } else { if (messages == null) #if !(NET_1_1) { messages = new List <SendMessageEventArgs>(); } #else { messages = new ArrayList(); } #endif messages.Add(new SendMessageEventArgs(handler, arguments)); } } break; default: break; } } if (raiseOnConnect) { RaiseOnConnect(); } if (changeList != null && changeList.Count > 0) { #if !(NET_1_1) RaiseSync(changeList.ToArray()); #else RaiseSync(changeList.ToArray(typeof(ASObject)) as ASObject[]); #endif } if (notifications != null) { foreach (ASObject infoObject in notifications) { RaiseNetStatus(infoObject); } } if (messages != null) { foreach (SendMessageEventArgs e in messages) { RaiseSendMessage(e); } } }
public Sequence CreateSequence(string clientId, IList result, IList parameters, DataServiceTransaction dataServiceTransaction) { Sequence sequence = null; Identity[] identities = new Identity[result.Count]; lock (_objLock) { for (int i = 0; i < identities.Length; i++) { if (result[i] != null) { Identity identity = Identity.GetIdentity(result[i], _dataDestination); identities[i] = identity; if (!_itemIdToItemHash.ContainsKey(identity)) { _itemIdToItemHash.Add(identity, new ItemWrapper(result[i])); } else { ItemWrapper itemWrapper = _itemIdToItemHash[identity] as ItemWrapper; itemWrapper.Instance = result[i]; } } } //Lookup existing sequence if (parameters != null) { if (_parametersToSequenceIdHash.Contains(parameters)) { sequence = _parametersToSequenceIdHash[parameters] as Sequence; } } else { IDictionary sequenceIdMap = _itemIdToSequenceIdMapHash[identities[0]] as IDictionary; if (sequenceIdMap != null) { foreach (Sequence sequenceTmp in sequenceIdMap.Values) { if (sequenceTmp.Parameters == null) { sequence = sequenceTmp; break; } } } } //if (parameters == null) // parameters = new ArrayList(); if (sequence == null) { sequence = new Sequence(); sequence.Id = sequence.GetHashCode(); object[] parametersArray = null; if (parameters != null) { parametersArray = new object[parameters.Count]; parameters.CopyTo(parametersArray, 0); sequence.Parameters = parametersArray; _parametersToSequenceIdHash[parameters] = sequence; } for (int i = 0; i < identities.Length; i++) { Identity identity = identities[i]; AddIdentityToSequence(sequence, identity, dataServiceTransaction); } _sequenceIdToSequenceHash[sequence.Id] = sequence; if (log.IsDebugEnabled) { log.Debug(__Res.GetString(__Res.SequenceManager_CreateSeq, sequence.Id, clientId)); } } else { for (int i = 0; i < identities.Length; i++) { Identity identity = identities[i]; Identity existingIdentity = null; if (i < sequence.Count) { existingIdentity = sequence[i]; } if (!identity.Equals(existingIdentity)) { //Identity not found in sequence if (!sequence.Contains(identity)) { int position = AddIdentityToSequence(sequence, identity, dataServiceTransaction); } } } } sequence.AddSubscriber(clientId); ArrayList sequences; if (_clientIdToSequenceHash.Contains(clientId)) { sequences = _clientIdToSequenceHash[clientId] as ArrayList; } else { sequences = new ArrayList(); _clientIdToSequenceHash[clientId] = sequences; } if (!sequences.Contains(sequence)) { sequences.Add(sequence); } } return(sequence); }
public virtual void CopyTo(IPAddress [] array, int offset) { list.CopyTo(array, offset); }
public void CopyTo(Array ary, int index) { m_items.CopyTo(ary, index); }
public virtual void CopyTo(WebPair[] parameters, int arrayIndex) { _parameters.CopyTo(parameters, arrayIndex); }
void ICollection <T> .CopyTo(T[] array, int arrayIndex) { EnsureLoaded(); _entries.CopyTo(array, arrayIndex); }
/// <inheritdoc/> public void CopyTo(SqlStatement[] array, int arrayIndex) { statements.CopyTo(array, arrayIndex); }
public void CopyTo(Relationship[] array, int arrayIndex) { _items.CopyTo(array, arrayIndex); }
public override void CopyTo(Array array, int index) { l.CopyTo(array, index); }
public void CopyTo(T[] array, int index) { items.CopyTo(array, index); }
public void CopyTo(T[] array, int arrayIndex) { CheckRead(); baseList.CopyTo(array, arrayIndex); }
/// <summary> /// IList转成List<T> /// </summary> /// <typeparam name="T"></typeparam> /// <param name="list"></param> /// <returns></returns> public static List <T> IListToList <T>(IList list) { T[] array = new T[list.Count]; list.CopyTo(array, 0); return(new List <T>(array)); }
public void CopyTo(IWindow[] array, int arrayIndex) { _windows.CopyTo(array, arrayIndex); }
public void CopyTo(TElement[] array, int arrayIndex) { mElements.CopyTo(array, arrayIndex); }
/// <inheritdoc/> public void CopyTo(IActuator[] array, int arrayIndex) { m_Actuators.CopyTo(array, arrayIndex); }