0001 /* 0002 * 向量接口 0003 */ 0004 0005 package dsa; 0006 0007 public interface Vector { 0008 //返回向量中元素数目 0009 public int getSize(); 0010 0011 //判断向量是否为空 0012 public boolean isEmpty(); 0013 0014 //取秩为r的元素 0015 public Object getAtRank(int r) 0016 throws ExceptionBoundaryViolation; 0017 0018 //将秩为r的元素替换为obj 0019 public Object replaceAtRank(int r, Object obj) 0020 throws ExceptionBoundaryViolation; 0021 0022 //插入obj,作为秩为r的元素;返回该元素 0023 public Object insertAtRank(int r, Object obj) 0024 throws ExceptionBoundaryViolation; 0025 0026 //删除秩为r的元素 0027 public Object removeAtRank(int r) 0028 throws ExceptionBoundaryViolation; 0029 }