Package mikera.vectorz.impl

Source Code of mikera.vectorz.impl.BaseIndexedVector

package mikera.vectorz.impl;

import mikera.vectorz.util.VectorzException;

/**
* Abstract base class for vectors that index into other sources
* @author Mike
*/
@SuppressWarnings("serial")
abstract class BaseIndexedVector extends ASizedVector {
  protected final int[] indexes;

  protected BaseIndexedVector(int length) {
    super(length);
   
    indexes=new int[length];
  }
 
  public BaseIndexedVector(int[] indexes) {
    super(indexes.length);
    this.indexes=indexes;
  }
 
  @Override
  public boolean isView() {
    return true;
  }
 
  @Override
  public void validate() {
    if (length!=indexes.length) throw new VectorzException("Wrong index length");
    super.validate();
  }
}
TOP

Related Classes of mikera.vectorz.impl.BaseIndexedVector

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.