6 import java.io.BufferedReader;
7 import java.io.PrintWriter;
8 import java.io.IOException;
14 public MFVec2f(
float[] vec2fs) {
15 this(vec2fs.length, vec2fs);
18 public MFVec2f(
int size,
float[] vec2fs) {
19 for (
int i = 0; i < size; i += 2)
20 __vect.addElement(
new ConstSFVec2f(vec2fs[i], vec2fs[i+1]));
23 public MFVec2f(
float[][] vec2fs) {
24 for (
int i = 0; i < vec2fs.length; i++)
25 __vect.addElement(
new ConstSFVec2f(vec2fs[i][0], vec2fs[i][1]));
28 public void getValue(
float[] vec2fs) {
30 int size = __vect.size();
31 for (
int i = 0; i < size; i++) {
33 vec2fs[2*i+0] = sfVec2f.x;
34 vec2fs[2*i+1] = sfVec2f.y;
38 public void getValue(
float[][] vec2fs) {
40 int size = __vect.size();
41 for (
int i = 0; i < size; i++)
42 ((
ConstSFVec2f) __vect.elementAt(i)).getValue(vec2fs[i]);
45 public void get1Value(
int index,
float[] vec2fs) {
47 ((
ConstSFVec2f) __vect.elementAt(index)).getValue(vec2fs);
50 public void get1Value(
int index,
SFVec2f sfVec2f) {
52 sfVec2f.setValue((
ConstSFVec2f) __vect.elementAt(index));
55 public void setValue(
float[] vec2fs) {
56 setValue(vec2fs.length, vec2fs);
59 public void setValue(
int size,
float[] vec2fs) {
61 for (
int i = 0; i < size; i += 2)
62 __vect.addElement(
new ConstSFVec2f(vec2fs[i], vec2fs[i+1]));
66 public void set1Value(
int index,
float x,
float y) {
70 public void set1Value(
int index,
SFVec2f sfVec2f) {
71 sfVec2f.__updateRead();
72 __set1Value(index,
new ConstSFVec2f(sfVec2f.x, sfVec2f.y));
76 __set1Value(index, sfVec2f);
79 public void addValue(
float x,
float y) {
83 public void addValue(
SFVec2f sfVec2f) {
84 sfVec2f.__updateRead();
92 public void insertValue(
int index,
float x,
float y) {
96 public void insertValue(
int index,
SFVec2f sfVec2f) {
97 sfVec2f.__updateRead();
98 __insertValue(index,
new ConstSFVec2f(sfVec2f.x, sfVec2f.y));
101 public void insertValue(
int index,
ConstSFVec2f sfVec2f) {
102 __insertValue(index, sfVec2f);
105 public String toString() {
107 StringBuffer sb =
new StringBuffer(
"[");
108 int size = __vect.size();
109 for (
int i = 0; i < size; i++) {
110 if (i > 0) sb.append(
", ");
111 sb.append(__vect.elementAt(i));
113 return sb.append(
"]").toString();
116 public void __fromPerl(BufferedReader in)
throws IOException {
118 String lenline = in.readLine();
121 int len = Integer.parseInt(lenline);
122 for (
int i = 0; i < len; i++) {
125 __vect.addElement(sf);
129 public void __toPerl(PrintWriter out)
throws IOException {
130 StringBuffer sb =
new StringBuffer(
"");
131 int size = __vect.size();
133 for (
int i = 0; i < size; i++) {
135 if (i != (size-1)) out.print (
", ");