Skip to content
Snippets Groups Projects

Tanguy

2 files
+ 49
17
Compare changes
  • Side-by-side
  • Inline

Files

@@ -35,10 +35,10 @@ final public class Vector {
}
public int len() {
throw new UnsupportedOperationException("This feature isn't implemented yet");
//throw new UnsupportedOperationException("This feature isn't implemented yet");
return this.lstVector.size();
}
//assertEquals(v1.toString(), "Vector[1.0, 2.0, 3.0]");
//assertEquals(v1.add(v2),v3);
public double get(int i) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
@@ -58,11 +58,23 @@ final public class Vector {
}
public Vector mul(double m) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
//throw new UnsupportedOperationException("This feature isn't implemented yet");
Vector v = new Vector();
for(int i=0;i<this.lstVector.size();i++)//a ameliorer avec for(e:element)
{
v.lstVector.add(this.lstVector.get(i)*m);
}
return v;
}
public Vector sub(Vector that) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
Vector v = new Vector();
for(int i=0;i<this.lstVector.size();i++)//a ameliorer avec for(e:element)
{
v.lstVector.add(this.lstVector.get(i)-that.lstVector.get(i));
}
return v;
//throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public double norm() {
@@ -116,7 +128,9 @@ final public class Vector {
}
public static Vector empty() {
throw new UnsupportedOperationException("This feature isn't implemented yet");
Vector v = new Vector();
return v;
//throw new UnsupportedOperationException("This feature isn't implemented yet");
}
public static Vector fill(int nb, double value) {
@@ -155,7 +169,7 @@ final public class Vector {
// Apply formatting to the string if necessary
strings.add(d.toString());
}
if(this instanceof Vector)
if(this instanceof ch.hepia.numeric.Vector)
{
return "Vector"+String.valueOf(strings);
}
@@ -166,8 +180,27 @@ final public class Vector {
//throw new UnsupportedOperationException("This feature isn't implemented yet");
}
/*
@Override
public boolean equals(Object obj) {
throw new UnsupportedOperationException("This feature isn't implemented yet");
if(this instanceof ch.hepia.numeric.Vector)
{
for(int i=0;i<this.lstVector.size();i++)//a ameliorer avec for(e:element)
{
if(((Vector)obj).lstVector.get(i)!=this.lstVector.get(i))
{
return false;
}
}
return true;
}
else
{
//a ecrire
return true;
}
//throw new UnsupportedOperationException("boolean This feature isn't implemented yet");
}
*/
}
Loading