result.addElement(ld/rd);\r
}\r
return result;\r
- } else throw new UnsupportedOperationException();\r
+ } else if(left instanceof Array && right instanceof Double) {\r
+ Array la = (Array)left;\r
+ double rd = (Double)right;\r
+ Collection<Object> lae = la.elements();\r
+ Iterator<Object> li = lae.iterator();\r
+ Array result = new Array();\r
+ for(int i=0;i<lae.size();i++) {\r
+ double ld = (Double)li.next();\r
+ result.addElement(ld/rd);\r
+ }\r
+ return result;\r
+ } else {\r
+ throw new UnsupportedOperationException();\r
+ }\r
}\r
\r
@Override\r
result.addElement(ld*rd);\r
}\r
return result;\r
- } else throw new UnsupportedOperationException();\r
+ } else if (left instanceof Array && right instanceof Double) {\r
+ Array la = (Array)left;\r
+ Double rd = (Double)right;\r
+ Collection<Object> lae = la.elements();\r
+ Iterator<Object> li = lae.iterator();\r
+ Array result = new Array();\r
+ for(int i=0;i<lae.size();i++) {\r
+ double ld = (Double)li.next();\r
+ result.addElement(ld*rd);\r
+ }\r
+ return result;\r
+ } else {\r
+ throw new UnsupportedOperationException();\r
+ }\r
}\r
\r
@Override\r