Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2F88359A5 for ; Tue, 10 May 2011 07:06:48 +0000 (UTC) Received: (qmail 50446 invoked by uid 500); 10 May 2011 07:06:47 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 50215 invoked by uid 500); 10 May 2011 07:06:47 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 50199 invoked by uid 99); 10 May 2011 07:06:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 May 2011 07:06:45 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 May 2011 07:06:42 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 37C42C9397 for ; Tue, 10 May 2011 07:06:03 +0000 (UTC) Date: Tue, 10 May 2011 07:06:03 +0000 (UTC) From: =?utf-8?Q?Arne_Pl=C3=B6se_=28JIRA=29?= To: issues@commons.apache.org Message-ID: <1682251069.34125.1305011163225.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1429529368.32442.1304950683151.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (MATH-571) make FieldVector generic MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/MATH-571?page=3Dcom.atlassian.j= ira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D130310= 66#comment-13031066 ]=20 Arne Pl=C3=B6se commented on MATH-571: --------------------------------- copy was just an example ... this change goes for all methods that generate= s an Fieldvector as output i.e. ebeMultiply ... > make FieldVector generic > ------------------------ > > Key: MATH-571 > URL: https://issues.apache.org/jira/browse/MATH-571 > Project: Commons Math > Issue Type: Improvement > Affects Versions: 3.0 > Reporter: Arne Pl=C3=B6se > Priority: Minor > > make FieldVector generic, so one can extend i.e. ArrayVieldVector to ArrayComplexVector an introduce new methoids (getReal())... > if one has an equation complexvector.copy the original type ArrayComplexV= ector is lost thus access to getReal() is not possible. > solution: > public class InheritationTest { > public static interface FieldVector, R exte= nds FieldVector> { > R copy(); > } > public abstract static class ArrayFieldVectorExtendable, R extends FieldVector> implements FieldVector, Serializ= able { > protected T[] data; > @Override > public R copy() { > return createVector(data); > } > abstract protected R createVector(T[] data); > } > public static class ArrayFieldVector> exten= ds ArrayFieldVectorExtendable { > @Override > protected ArrayFieldVector createVector(T[] data) { > ArrayFieldVector result =3D new ArrayFieldVector(); > result.data =3D data; > return result; > } > } > public static class ArrayComplexVector extends ArrayFieldVectorExtend= able { > @Override > protected ArrayComplexVector createVector(Complex[] data) { > ArrayComplexVector result =3D new ArrayComplexVector(); > result.data =3D data; > return result; > } > public double[] getReal() { > return null; > } > public double[] getImaginary() { > return null; > } > } > public void test() { > ArrayComplexVector v =3D new ArrayComplexVector(); > ArrayComplexVector v1 =3D v.copy(); // FiledVector type survives= ... > } > } -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira