interface

How to use ArrayList to store some data using ICollection

I want to store few strings into an array using ArrayList. How can I store all the strings at once without using Add function every time. Is it somewhat related to interface ICollection in anyway. Can I use ICollection to store my array. If yes How. ArrayList _1019=new ArrayList("TEN","ELEVEN","TWELVE","THIRTEEN","FOURTEEN","FIFTEEN"...

How to implement an interface class using the non-virtual interface idiom in C++?

Hi all, In C++ an interface can be implemented by a class with all its methods pure virtual. Such a class could be part of a library to describe what methods an object should implement to be able to work with other classes in the library: class Lib::IFoo { public: virtual void method() = 0; }; : class Lib::Bar { p...

PHP SOAP problems with response

Hello everybody, since a few days I am experiencing problems with my developed php soap (php soap extension, NOT nusoap) search interface to the PubMed literature service using their eutils wsdl service (Entrez Utils). Before the problems arised I used the returned array from the low level function __soapcall(), it worked well, extrac...

Ruby - Switching dynamically between protocols (with modules)

Hi, I would like to allow a person object (instanced from a Person class) to speak a language (which is a collection of public methods stored in Language module): class Person attr_accessor :current_language def quit # Unselect the current language, if any: @current_language = nil end end Suppose that languages are the...

The Java interface doesn't declare any exception. How to manage checked exceptions of the implementation?

Let's say I have the following Java interface that I may not modify: public interface MyInterface { public void doSomething(); } And now the class implementing it is like this: class MyImplementation implements MyInterface { public void doSomething() { try { // read file } catch (IOException e) { // what to do...

Where does INumeric come from?

I see kudos to INumeric and blog posts that state how to simulate the features in its absence from a language (e.g. this post ) But in what language/s does this INumeric goodness originate from? In other words in what languages would I find examples of INumeric? I Googled its name and didn't come up with useful results about origin ...

@MustOverride annotation?

In .NET, one can specify a "mustoverride" attribute to a method in a particular superclass to ensure that subclasses override that particular method. I was wondering whether anybody has a custom java annotation that could achieve the same effect. Essentially what i want is to push for subclasses to override a method in a superclass that...

Java generic Interface performance

Simple question, but tricky answer I guess. Does using Generic Interfaces hurts performance? Example: public interface Stuff<T> { void hello(T var); } vs public interface Stuff { void hello(Integer var); <---- Integer used just as an example } My first thought is that it doesn't. Generics are just part of the language ...

Why do some APIs provide mostly interfaces, not classes?

Some Java APIs provide a large number of interfaces and few classes. For example, the Stellent/Oracle UCM API is composed of roughly 80% interfaces/20% classes, and many of the classes are just exceptions. What is the technical reason for preferring interfaces to classes? Is it just an effort to minimize coupling? To improve encapsul...

Java: why is declaration not sufficient in interface?

Big class contains Format-interfcase and Format-class. The Format-class contains the methods and the interface has the values of the fields. I could have the fields in the class Format but the goal is with Interface. So do I just create dummy-vars to get the errors away, design issue or something ELSE? KEY: Declaration VS Initialisation...

C# BinarySearch breaks when inheriting from something that implements IComparable<T>?

In .NET the BinarySearch algorithm (in Lists, Arrays, etc.) appears to fail if the items you are trying to search inherit from an IComparable instead of implementing it directly: List<B> foo = new List<B>(); // B inherits from A, which implements IComparable<A> foo.Add(new B()); foo.BinarySearch(new B()); // InvalidOperationException,...

TMS320C64x Quick start reference for programmers

Hello Is thare any quickstart guide for programmers for writing DSP-accelerated appliations for TMS320C64x? I have a program with custom algorythm (not the fft, or usial filtering) and I want to accelerate it using multi-DSP coprocessor. So, how should I modify source to move computation from main CPU to DSPs? What limitations are ther...

Is there a way to declare a variable that implements multiple interfaces in .Net?

Similar to this Java question. I would like to specify that a variable implements multiple interfaces. For instance private {IFirstInterface, ISecondInterface} _foo; public void SetFoo({IFirstInterface, ISecondInterface} value) { _foo = value; } Requirements: I don't have the ability to add an interface to most type that would ...

Implicit and Explicit implementation of interface.

While working on a upgrade i happened to come across a code like this. interface ICustomization { IMMColumnsDefinition GetColumnsDefinition(); } class Customization : ICustomization { private readonly ColumnDefinition _columnDefinition; //More code here. public ColumnsDefinition GetColu...

Do PHP interfaces have properties?

Do interfaces have properties or only methods? Thanks ...

What is the point of interfaces in a weakly-typed language like PHP?

I've never been able to figure this out. If your language doesn't type-check, what benefits do interfaces provide you? ...

Did Java invent interfaces?

I know about C++ pure virtual classes, but Java went one step further and created a first-class (no pun intended) concept for multiple-interface (not implementation) inheritance, the interface. It's now a staple of major statically-typed languages. Did Java invent the interface concept? Or did it appear in older languages also as a first...

Python modules not updating after restarting the main module.

I've recently come back to a project having had to stop for about 6 months, and after reinstalling my operating system and coming back to it I'm having all kinds of crazy things happen. I made sure to install the same version(2.6) of python that I was using before. It started by giving me strange tkinter error that I hadn't had trouble ...

c# - what approach can I use to extend a group of classes that include implemented methods? (see description for more detail)

Hi, I want to create an extendible package I am writing that has Topology, Node & Relationship classes. The idea is these base classes would have the various methods in them necessary to base graph traversal methods etc. I would then like to be able to reuse this by extending the package. For example the base requirements might see ...

AS3: How can I require a method argument to implement multiple interfaces?

The argument to my method func() must implement the two unrelated interfaces IFoo and IBar. Is there a better way of doing this than declaring another interface only for this purpose that inherits from IFoo and IBar and using that interface as the argument type? public interface IFooBar extends IFoo, IBar { } public function func(arg:I...