From 71beb7eef6bceb6d32f5cd0de1440362bdd9b30c Mon Sep 17 00:00:00 2001 From: Kevin Glynn Date: Thu, 7 Apr 2011 10:51:52 +0200 Subject: [PATCH] KeyCollection and CopyTo method --- .../Collections/Generic/KeyCollection'1.xml | 64 +++++++++++++++++++ .../Generic/KeyCollectionSupport.java | 53 +++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 CS2JLibrary/NetFramework/System/Collections/Generic/KeyCollection'1.xml create mode 100644 CS2JLibrary/src/CS2JNet/System/Collections/Generic/KeyCollectionSupport.java diff --git a/CS2JLibrary/NetFramework/System/Collections/Generic/KeyCollection'1.xml b/CS2JLibrary/NetFramework/System/Collections/Generic/KeyCollection'1.xml new file mode 100644 index 0000000..b6d21f6 --- /dev/null +++ b/CS2JLibrary/NetFramework/System/Collections/Generic/KeyCollection'1.xml @@ -0,0 +1,64 @@ + + + + + + Set*[${T}]* + + System.Collections.Generic.KeyCollection + + T + + + + + + T + ${expr} + + + + + CS2JNet.System.Collections.Generic.KeyCollectionSupport + + KeyCollectionSupport.CopyTo(${this}, ${array}, ${index}) + + + T[] + array + + + System.Int32 + index + + + CopyTo + System.Void + + + + + + ${this:16}.size() + System.Int32 + Count + ${this:16}.size() + + + + + + + + + + + +rUong3D9EauJhCA+cIiWlGuXn08=esb0vH9iEN6TefBNnLiampoglnuOe2oggi0NVh+r9eoUKf6vzAQCfNGubdlKaf8IausdKZ3wS212MtQtXkJ8TFKPjK+gOpmoVhFKd/6rPnT5xt89+N7s5cByTPW8epjPNnAH7pEiRbzk5+JpH/xKeNCCoGoADV4L/E0TIsZRCH4= diff --git a/CS2JLibrary/src/CS2JNet/System/Collections/Generic/KeyCollectionSupport.java b/CS2JLibrary/src/CS2JNet/System/Collections/Generic/KeyCollectionSupport.java new file mode 100644 index 0000000..a3ce32a --- /dev/null +++ b/CS2JLibrary/src/CS2JNet/System/Collections/Generic/KeyCollectionSupport.java @@ -0,0 +1,53 @@ +/* + Copyright 2010,2011 Kevin Glynn (kevin.glynn@twigletsoftware.com) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + Author(s): + + Kevin Glynn (kevin.glynn@twigletsoftware.com) +*/ + +package CS2JNet.System.Collections.Generic; + +import java.util.Set; + + +/** + * @author kevin.glynn@twigletsoftware.com + * + */ +public class KeyCollectionSupport { + + + public static void CopyTo(Set keys, T[] array, int index) { + if (keys == null) + throw new NullPointerException("keys"); + if (array == null) + throw new NullPointerException("array"); + + if (index < 0 || index + keys.size() > array.length) + throw new IllegalArgumentException("index"); + + int i = 0; + for (T k : keys) { + array[index + i] = k; + i++; + } + if (index + i < array.length) { + array[index+i] = null; + } + + } + +}