Paste Your Interface

Are you working on something right now that makes use of interfaces? Copy and paste an interface into the comments of this post (no need for code tags or anything)....

Actionscript:
  1. package app{
  2.    
  3.     import flash.events.IEventDispatcher;
  4.    
  5.     public interface IBaseModel extends IEventDispatcher{
  6.        
  7.         function set decimal(val:int):void;
  8.    
  9.         function get decimal():int ;
  10.        
  11.         function get stringValue():String;
  12.        
  13.         function get errorMessage():String;
  14.        
  15.         function set base(val:int):void;
  16.        
  17.         function get base():int;
  18.        
  19.         function startCounting(interval:Number, changeBy:Number):void;
  20.          
  21.         function stopCounting():void;
  22.     }
  23. }

This entry was posted in OOP, misc and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

14 Comments

  1. Posted November 4, 2009 at 6:58 pm | Permalink

    package bk.gallery.display {

    public interface IGalleryItem {

    function set props(props:Object) : void;

    function get props() : Object;

    function load() : void;

    function transitionIn() : void;

    function onTransitionInComplete() : void;

    function transitionOut() : void;

    function onTransitionOutComplete() : void;

    }

    }

  2. Posted November 4, 2009 at 7:06 pm | Permalink

    nice one ben…. I’m also working on something with an interface that has:

    transitionIn(), transitionOut() functions… huge timesaver especially if your using them with template method pattern so that your “abstract” class is doing any redundant work and your subclasses can focus on the different implementations for the transitions…

  3. Posted November 4, 2009 at 7:28 pm | Permalink

    package com.hapticdata.features.interfaces
    {
    import flash.display.Stage;
    import com.hapticdata.features.ColorPalette;

    /**
    * An interface to describe the necessary functionalities / communications between a feature and a controller
    * @author kphillips
    */
    public interface IFeature
    {
    function build(colors:ColorPalette,xmlSrc:String):void;
    function hide(transition:Boolean=true,callback:Function=null):void;
    function show(transition:Boolean=true,callback:Function=null):void;
    function get isHidden():Boolean;
    function kill():void;
    //an array of user-interaction instances, such as buttons
    function get interfaceOutlets():Array;
    }
    }

    I’m using this to loosely communicate between a master controller and separate .swf’s of different views.

  4. Posted November 4, 2009 at 8:25 pm | Permalink

    @kyle: Nice. It’s interesting how much can be inferred just from looking at an interface :)

  5. Posted November 4, 2009 at 11:24 pm | Permalink

    package ext {
    import flash.display.DisplayObject;

    public interface ITextureMaterial {
    function setTexture (t:DisplayObject):void;
    }
    }

  6. Posted November 4, 2009 at 11:25 pm | Permalink

    it was “set texture” originally but changed later because if type conflict.

  7. alex
    Posted November 5, 2009 at 3:59 am | Permalink

    package as3ui.framework.component
    {
    import as3ui.framework.IDisplayObject;

    public interface IBasicComponent extends IDisplayObject
    {
    function get componentInfo():BasicComponentInfo;

    function setData(data:Object):void;
    function show():void;
    function hide():void;
    function dispose():void;
    }
    }

  8. Posted November 5, 2009 at 4:26 am | Permalink

    package com.imarkahann.iagi.controls{
    import com.imarkahann.iagi.core.IGIDisplayObject;
    public interface IProgressBar extends IGIDisplayObject
    {
    function setProgress(nProgress:Number) : void
    }
    }

    //No need to lot of comments. It is just use to create progressbars in external swf

  9. Posted November 5, 2009 at 4:33 am | Permalink

    package com.nikitadudnik.minivideoplayer.model
    {
    import com.nikitadudnik.minivideoplayer.events.ICommand;
    import com.nikitadudnik.minivideoplayer.events.IMetadataHandler;
    import flash.media.Video;
    import flash.net.NetStream;

    /**
    * …
    * @author Nikita Dudnik
    */
    public interface IVideoStreamPlayer extends INetStreamProvider
    {
    function open(s:String):void;
    function close():void;
    function pause():void;
    function resume():void;

    function get opened():Boolean;
    function get playing():Boolean;
    function get paused():Boolean;

    function set stream_started(command:ICommand):void;
    function set stream_stopped(command:ICommand):void;
    function set metadata_handler(handler:IMetadataHandler):void;
    function set stream_not_found(command:ICommand):void;
    }

    }

  10. Niall
    Posted November 5, 2009 at 9:22 am | Permalink

    I don’t use an interface due to the fact I work mostly with AS2 and non-OOP related environments.

    SHUT UP ;_;

  11. Posted November 5, 2009 at 10:08 am | Permalink

    Niall, interfaces are still useful without OOP, like in my example it allows treatment of unrelated classes instances as if they were all of the same type. Basically, an interface is just a way to say “I know there is this function(s) in these codes, and it is safe to call it” :)

  12. Posted November 5, 2009 at 10:50 am | Permalink

    @Niall,
    The interface concept is very abstract, and i think it is very difficult to understand the real benefit without a concret case. If you like read i advice you this book : http://oreilly.com/catalog/9780596007126 (I have the french version “Design Patterns tête la première”). Examples are coded in Java but all concept are very interesting and wrote with finess and humor

  13. Posted November 6, 2009 at 10:46 am | Permalink

    public interface ILoadedContent extends IEventDispatcher
    {
    function get isInitialized() : Boolean;

    /**
    * Initializes the object.
    *
    * Dispatches an AsynchronousContentEvent on completion.
    */
    function initialize() : void;

    /**
    * Destroys the object.
    *
    * Dispatches an AsynchronousContentEvent on completion.
    */
    function destroy() : void;

    /**
    * Shows the object.
    *
    * Dispatches an AsynchronousContentEvent on completion.
    */
    function show() : void;

    /**
    * Hides the object.
    *
    * Dispatches an AsynchronousContentEvent on completion.
    */
    function hide() : void;
    }

  14. Logesh
    Posted July 21, 2011 at 4:52 am | Permalink

    package app{
       
        import flash.events.IEventDispatcher;
       
        public interface IBaseModel extends IEventDispatcher{
           
            function set decimal(val:int):void;
       
            function get decimal():int ;
           
            function get stringValue():String;
           
            function get errorMessage():String;
           
            function set base(val:int):void;
           
            function get base():int;
           
            function startCounting(interval:Number, changeBy:Number):void;
             
            function stopCounting():void;
        }
    }

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*