interface

Java: general function X->Y interface

Hi, I need an interface like: interface Function<X,Y> { Y eval(X obj); } Is there something like this in Java already or do I need to define my own? ...

extract interface and adaptor from 3rd party libraries

I'm looking for a tool for .NET libraries that: given: a 3rd party library with only concrete implementations of classes produces: extracts an interface from the 3rd party library and creates an adapter to the concrete implementation I have some pretty big 3rd party tools... doing it by hand looks like a pain. I'm hoping to be able t...

Adding a navigationController to a xib file in interace File

Hi all, I have a existing xib file, it's a simple uiviewcontroller, but now I want a put a navigation controller in this xib file, because this view is modal, so the navigation controller in the mainWindow don't work. So, if I put a navigationController in my xib file, what is the view that I must link with the file owners..? ...

Why aren't _AddRef and _Release called on my Delphi object?

I'm really confused. // initial class type TTestClass = class( TInterfacedObject) end; {...} // test procedure procedure testMF(); var c1, c2 : TTestClass; begin c1 := TTestClass.Create(); // create, addref c2 := c1; // addref c1 := nil; // refcount - 1 MessageBox( 0, pchar( inttostr( c2.refcount...

why interface can not implement another interface in java?

What I mean, interface B; interface A extends B; allowed interface A implements B; not allowed I googled it and I found this -> Implements denotes defining an implementation for the methods of an interface. However interfaces have no implementation so that's not possible. http://www.coderanch.com/t/410331/java/java/interface-imple...

How to specify exceptions to be thrown by an implementor of an interface

I'm currently developing a solution and have designed it in a way such that it strongly implements the strategy/provider pattern. As such the solution exposes a number of interfaces and contains default implementations of these interfaces which can be replaced via a DI type methodology. Where the host application uses a number of these...

Do We Inherit a Interface or Implements an Interface?

Well till now I knew we implement interfaces , but today some body (you know who , i guess)) told me that If I write a interface then we implement it in class , but if it is a system Interface , Let's say INotifyPropertyChanged , the we call it Class A inherits Interface INotifyPropertyChanged. Though I feel right , I am not sure and un...

Programming against interfaces & Entity Framework 4.0

I'm trying to figure out if it would be possible to stick to the mantra "Program against an interface, not an implementation." while using the Entity Framework 4.0. While I found a page explaining how to stick to aforementioned rule while using Linq-to-SQL (look here) I'm very keen to know if it would be possible to do that with the Ent...

Interfaces and restraints

Considering the following setup, how can I restrain IConnection to only contain IPort of the same ConnectionType in Ports? Maybe I am overlooking something obvious here: Enum ConnectionType { Undefined, Type1, Type2 } IConnection { ConnectionType ConnectionType {get;set} IEnumerable<IPort> Ports {get;set;} } IPort...

Creating a Interface for Insering Google Maps

I am trying to create a site that has option to add maps to the site using google maps api. I found hundreds of tutorial and blog posts on embeding map in the site. But what I actually want is a way to give the user choose a place on the map and add marker. Then get the co-ordinates of the marker and store it in the database of retrievin...

Extension method on generic list

I'm quite new to C#, and have two questions regarding generic lists and extension methods. Sorry if the questions are a bit stupid.. What is the difference between: public static IObjectWithTempID FindByTempID (this ObservableCollection<IObjectWithTempID > list, long tempID) and public static IObjectWithTempID FindByTempID< E ...

Java Class Design - Graphs

Hey there, I'm fairly new to Java, and I need some help figuring out a good class hierarchy and overall design for an assignment we've been given (i'm studying CS). The assignment is graph-theory related, so we were asked to create interfaces for 2 types of graphs, simple graphs and multi-graphs (which are allowed to have parallel edge...

Interface is forceing abstract class to implement its functions

I have got a abstract class which is implementing 3 interfaces. public abstract class ServiceBaseCore<Entity, EntityKey> : MarshalByRefObject, IComponentService, IEntityProvider<Entity, EntityKey> where Entity : IEntityId<EntityKey>, new() where EntityKey : IEntityKey, new() { // Provided functionality/body to some methods of...

Private interface vs. private method - objective c

Hi, What is the difference between a private method and a private interface? For example, I know that if you define a method in an implementation and its interface does not mention it, it is considered a private method. I have also seen things such as: @interface Collector() @property (readonly) NSMutableDictionary *count; @end Insid...

PHP: Path of interface

Hi! I need to know the path of a file in which an interface is defined. I know the name and the interface is available (the file was included at another location in the code). I know things like __FILE__, etc. but the point is, it's only an interface, i do not have an instance. Ironically, i need the path to find a suitable implementati...

How do you call identically named properties on different types which don't share an interface?

I have a DataTemplate that needs to set the IsSelected property on an ItemsControl's container (such as TreeViewItem, ListViewItem or ComboBoxItem). However, it doesn't know the type of the container until it's passed in to it. Since IsSelected isn't part of a common base class or interface, nor is it a common dependency property regis...

Why is implementing a generic interface so counter intuitive?

interface Foo<T extends Number>{ } class Bar<T extends Number> implements Foo<T>{ } Why does the class have to be written that way instead of: class Bar<T extends Number> implements Foo<T extends Number>{ } Surely the second way is clearer. ...

This appears to create an object from an interface; how does it work?

interface Int { public void show(); } public class Test { public static void main(String[] args) { Int t1 = new Int() { public void show() { System.out.println("message"); } }; t1.show(); } } ...

When IEnumerator.Reset() method is called ?

let's have this code : class MyList : IEnumerable, IEnumerator { int[] A = { 1, 2, 3, 4, 5 }; int i = -1; #region IEnumerator Members public object Current { get { return A[i]; } } public bool MoveNext() { i++; return i < 5; } public void Reset() { i = -1; ...

Search in LinkedList<T>

Let's have this code : class student :IComparable , IComparable<student> { public string name = ""; public override string ToString() { return name; } #region IComparable Members public int CompareTo(object obj) { if (this.name.Equals(((student)obj).name ) ) return 0 ; ...