/* Copyright 2011-2016 Google Inc. All Rights Reserved. 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. */ package com.google.security.zynamics.binnavi.debug.models.targetinformation; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * Collection class that stores the register values of all threads of a target process. */ public final class RegisterValues implements Iterable<ThreadRegisters> { /** * List of all threads and their register values. */ private final ImmutableList<ThreadRegisters> threads; /** * Creates a new register values object. * * @param threads List of all threads and their register values. * * @throws IllegalArgumentException Thrown if the threads argument is null. */ public RegisterValues(final List<ThreadRegisters> threads) { Preconditions.checkNotNull(threads, "IE01035: Threads argument can not be null"); this.threads = ImmutableList.<ThreadRegisters>copyOf(threads); } /** * Returns a list of all threads and their register values. * * @return A list of all threads and their register values. */ public List<ThreadRegisters> getThreads() { return new ArrayList<>(threads); } @Override public Iterator<ThreadRegisters> iterator() { return threads.iterator(); } }