473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

jython/java inheritance question?

G'day,

Hi, I've got a java class called ChannelIteratorAlgorithm which
extends SampledChannelGroupIteratorAlgorithm.
SampledChannelGroupIteratorAlgorithm has a stub method
processSampledChannelGroup(Object[] in, Object[] out) that is
overridden by a method in the ChannelIteratorAlgorithm class.

Now, I've got a jython script that contains a class that extends the
ChannelIteratorAlgorithm class ( are you having fun yet? ) and it's
got a processSampledChannelGroup method that looks like this:

class testalg(ChannelIteratorAlgorithm):
def processSampledChannelGroup(self, inGroups, outGroups):
if (self.samplesToPass!=0):
print "samples left: %d" % self.samplesToPass
ChannelIteratorAlgorithm.processSampledChannelGrou p(self,
inGroups,
outGroups)

However, each time I try to run this script I get this exception:

2003-10-29 05:26:29 ERROR:: spigot_1.handleData() encountered a fatal
Exception:Traceback (innermost last):
File "<string>", line 187, in processSampledChannelGroup
AttributeError: class
'gov.nasa.gsfc.irc.algorithms.ChannelIteratorAlgor ithm' has no
attribute 'processSampledChannelGroup'

What?!?!?! Why an attribute and not a method? And why, given that
yes there is an implementation of processSampledChannelGroup in the
ChannelIteratorAlgorithm class and yes it really looks like:

protected void processSampledChannelGroup
(Object[] inputChannelDataBuffersForGroup,
Object[] outputChannelDataBuffersForGroup)

would there be an issue?

Is this a feature that I'm unaware of?

Thanks for any suggestions,

Matt Newcomb
Yerkes Observatory
Williams Bay, WI 53191
Jul 18 '05 #1
1 1503
Matt Newcomb wrote:
I've got a jython script that contains a class that extends the
ChannelIteratorAlgorithm class ( are you having fun yet? ) and it's
got a processSampledChannelGroup method that looks like this:

class testalg(ChannelIteratorAlgorithm):
def processSampledChannelGroup(self, inGroups, outGroups):
if (self.samplesToPass!=0):
print "samples left: %d" % self.samplesToPass
ChannelIteratorAlgorithm.processSampledChannelGrou p(self,
inGroups,
outGroups)

However, each time I try to run this script I get this exception:

2003-10-29 05:26:29 ERROR:: spigot_1.handleData() encountered a fatal
Exception:Traceback (innermost last):
File "<string>", line 187, in processSampledChannelGroup
AttributeError: class
'gov.nasa.gsfc.irc.algorithms.ChannelIteratorAlgor ithm' has no
attribute 'processSampledChannelGroup'

What?!?!?! Why an attribute and not a method? And why, given that
yes there is an implementation of processSampledChannelGroup in the
ChannelIteratorAlgorithm class and yes it really looks like:

protected void processSampledChannelGroup
(Object[] inputChannelDataBuffersForGroup,
Object[] outputChannelDataBuffersForGroup)

would there be an issue?


Yes: The method is protected, meaning that you cannot call it directly
as you are trying to above. See the following jython doc page for more
information

http://www.jython.org/docs/subclassing.html

This might work

#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

class testalg(ChannelIteratorAlgorithm):

def processSampledChannelGroup(self, inGroups, outGroups):

if (self.samplesToPass!=0):
print "samples left: %d" % self.samplesToPass
self.super__processSampledChannelGroup(inGroups, outGroups)

#-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

HTH,

--
alan kennedy
-----------------------------------------------------
check http headers here: http://xhaus.com/headers
email alan: http://xhaus.com/mailto/alan
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Tennessee James Leeuwenburg | last post by:
Hi all, Sorry for the newb question, but Googling and FAQing didn't work. Is it correct that Jython can only access Java classes which are inside JAR archives in the JYTHON_HOME directory? IT...
4
by: Michael Chermside | last post by:
Ype writes: > For the namespaces in Jython this 'Python internal thread safety' > is handled by the Java class: > > http://www.jython.org/docs/javadoc/org/python/core/PyStringMap.html > > which...
3
by: Thomas Weholt | last post by:
Hi, Is it at all possible to use python to make apps on cellular/mobile phones, using something like Jython etc. ? Hm ... ?? Thomas
4
by: angel | last post by:
A java runtime environment includes jvm and java class (for example classes.zip in sun jre). Of course jython need jvm,but does it need java class. Thanx
1
by: Mark Fink | last post by:
Hi there, unfortunately I am new to Jython and my "Jython Essentials" book is still in the mail. I looked into the Jython API Doc but could not find the information. I am porting a Python...
12
by: Mark Fink | last post by:
I wrote a Jython class that inherits from a Java class and (thats the plan) overrides one method. Everything should stay the same. If I run this nothing happens whereas if I run the Java class it...
3
by: donkeyboy | last post by:
All, I'm having issues installing Jython on Windows XP. I've looked on the web and this newsgroup but to no avail. Any suggestions? The shell listing is below: NB I've got Cygwin installed,...
2
by: donkeyboy | last post by:
All, I've tried the jythonc compiler to try and create an applet to see how it works, but I get a number of Java compile errors that are way above my knowledge. Does anyone know what any of the...
5
by: sarup26 | last post by:
Hello .. I would like to know more about Python and Jython? What is the difference between both of them? What is the future for Jython and which are the areas where it is used? Swot
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.