edu.mines.jtk.opt.ArrayVect1fs Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of edu-mines-jtk Show documentation
Show all versions of edu-mines-jtk Show documentation
Java packages for science and engineering
/****************************************************************************
Copyright 2003, Landmark Graphics and others.
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 edu.mines.jtk.opt;
import edu.mines.jtk.util.Almost;
import java.io.IOException;
import java.util.logging.Logger;
/** Implements a Vect as a collection of ArrayVect1f's of fixed size.
@author W.S. Harlan
*/
public class ArrayVect1fs implements Vect {
static final long serialVersionUID = 1L;
/** Array of wrapped data */
protected ArrayVect1f[] _data = null;
private static final Logger LOG = Logger.getLogger("edu.mines.jtk.opt");
/** Wrap an array of ArrayVect1f's
@param data Wrap this array of ArrayVect1f's.
*/
public ArrayVect1fs(ArrayVect1f[] data) {init(data);}
/** To be used with init() */
public ArrayVect1fs() {}
/** Initialize class
@param data Wrap this collection of 1D arrays */
private void init(ArrayVect1f[] data) {_data = data;}
/** Return the size of the embedded array
@return size of embedded array
*/
public int getSize() {return _data.length;}
/** Get the embedded data
@return Same array as passed to constructor.
*/
public ArrayVect1f[] getData() {
return _data;
}
// Cloneable
@Override public ArrayVect1fs clone() {
try {
ArrayVect1fs result = (ArrayVect1fs) super.clone();
if (_data != null) {
ArrayVect1f[] data = _data.clone();
for (int i=0; i