Making a template

I want to make a template for a kind of class. But I don't just want to specify the interface--I want to control 80% of the action of the class. Specifically I want to
1. Specify an abstract constructor or something like it. The best I've come up with on this so far is making the constructor always throw an exception unless it's overridden.
2. Specify some static final fields. My best effort on this so far is making some abstract functions that are intended to return only constants, but I have no way to enforce that they return only constants and it seems like a bad solution.
3. I'd like to have an abstract nested class within this template, with an abstract function inside the nested class to be implemented by concrete subclasses of the outer class. But when I try to do this, it (eclipse) doesn't give me an error if I don't implement the nested class when I make a concrete subclass.
What would be best is if I could make it so Eclipse says a concrete subclass has a syntax error until all the things I want implemented about this class, actually are implemented.

Being more specific, this is the class I have so far:
package machines;
import java.util.Vector;
* Provides the format for a single tile on the ground
public abstract class Tile
     /**Neighbors of the Tile.  Subclasses of Tile should
      * define final ints that name the indices of this vector
      * from 0 to NEIGHBORS - 1, e.g. NORTH SOUTH EAST WEST
     Vector<Tile> neighbors;
     private boolean initialized = false;
     /** Specified number of neighbors*/
     private Vector<Ant> antsOnTile;
     private Vector<Message> messageSet;
     public Tile(){}
      * @return the number of neighbors this tile should have
     protected abstract int numNeighbors();
     public void intializeTile(Vector<Tile> neighbors) throws TileException
          if(neighbors == null || neighbors.size() != numNeighbors() || neighbors.indexOf(null) >= 0 || initialized == true)
               throw new TileException();
          this.neighbors = neighbors;
          initialized = true;
     public void receiveAnt(Ant a)
          antsOnTile.add(a);
     public void sendAnt(int neighbor) throws TileException
          if(neighbor > numNeighbors() || neighbor < 0)
               throw new TileException();
          Ant a = antsOnTile.remove(0);
          if(a == null)
               throw new TileException();
          neighbors.get(neighbor).receiveAnt(a);
     public void receiveMessage(Message a)
          messageSet.add(a);
     public void sendMessage(int neighbor, Message m) throws TileException
          if(neighbor > numNeighbors() || neighbor < 0)
               throw new TileException();
          neighbors.get(neighbor).receiveMessage(m);
     public class TileException extends Exception
          static final long SerialVersionUID = 2L;
     public class Message
          String name;
          public Message(String name)
               this.name = name;
     public abstract class FiniteStateMachine
          class State
               String name = new String();
               public String toString()
                    return name;
          /** the output of a step of the FSM */
          class Output
               State q;
               Vector<Message> m;
               // ants contains true at index i iff this fsm is sending
               // an ant to neighbor i this step
               Vector<Boolean> ants;
          final Vector<State> Q;
          State q;
           * Always throws a tile exception
           * a subclass should override this to specify
           * the set of states Q and a start state
           * @throws TileException
          public FiniteStateMachine() throws TileException
               Q = null;
               q = null;
               throw new TileException();
               // this must be filled in by the user
               // Initialize all states
               // Initialize the start state
           * The next state function for the FSM
           * @param qi the current state
           * @param m the current queued messages
           * @return an Output object containing the new state and new messages
          abstract Output lambda(State qi, Vector<Message> m);
          public void update() throws TileException
               if(messageSet == null || messageSet.size() != numNeighbors() || messageSet.indexOf(null) >= 0)
                    throw new TileException();
               Output o = lambda(q, messageSet);
               messageSet = null;
               q = o.q;
               if(o.m == null || o.m.size() != numNeighbors() || o.m.indexOf(null) >= 0)
                    throw new TileException();
               if(o.ants == null || o.ants.size() != numNeighbors() || o.ants.indexOf(null) >= 0)
                    throw new TileException();
               for(int i = 0; i < numNeighbors(); i++)
                    sendMessage(i, o.m.get(i));
                    if(o.ants.get(i).booleanValue())
                         sendAnt(i);
}I want someone subclassing it to have to fill in Tile.FiniteStateMachine.lambda(), specify a number of neighbors (optimally a static final int, but as you see what I have is a function), and specify a constructor for FiniteStateMachine that fills in Q and initializes q to a member of Q. Everything else I want to have fixed, and if they don't do those three things I want it to show an error.

Similar Messages

  • How can I change defaults by making a template

    I keep trying to change the defaults in Pages 2.0.1 (font and spacing for text, to Fixed on page and no extra space for shapes). I can't get the Shapes default changed to Fixed on page; the extra space has changed to 0). And sometimes I can't create a new define default text style (Format>Advance>). After making new settings I Save a Template and then change the Preference to open new documents with my template.
    Is it me or is it Pages? Any help greatly appreciated.
    Anne
    800 MHz PowerPC G4 with 1 GB SDRAM   Mac OS X (10.4.7)  

    Hullo Anne:
    Making a template allows you to define particular objects, and also styles, that you include in it. For example, you can define your body text, heading text, and etc. for it - using sufficient placeholder text or images to show what each template or page layout you include in it contains. It does not reset defaults, nor overcome a general deficiency still in Pages 2 to define them.
    Since this is clearly a nuisance to you, I suggest you detail your needs to:
    http://www.apple.com/feedback/pages.html
    Cheers.

  • Making custom templates and packaging them.

    I have done several DVD's for clients/parents of thier childs soccer team videos. I normally make a custom menu for them. My question is, if i wanted to make this template and save it to give to someone else to use is there a way to do it. I guess it would be like making one to sell, but i am not selling it:) If anyone knows of a tutorial or anything that can help me i would appreciate it greatly. I am thinking about making generic templates fo several sports.

    Hi Zack,
    My guess would be if you do these in Photoshop, Live Type or Motion (as I do) give them these plus all associated files. If you have save these in DVD SP they are in Library>application Support>DVD SP>Templates. Hope this helps.
    Jeff
    Dual G4 1 GIG, G4 1.25 Laptop Macbook Pro 2.0   Mac OS X (10.4.7)  

  • Making a Template for Adobe Contribute - without Dreamweaver

    Given  the task of making a web page that must exhibit regions editable with  Adobe Contribute CS5, and having only a plain text editor (not  Dreamweaver), exactly what needs to be done to the associated XHTML  file?  For example: 
    1.  Does the XHTML file need to be named with an extension other than ".html"?
    2.   When denoting an editable region within the XHTML, what is the exact  syntax of the "begin editable" and "end editable" tags?
    3.   Is a CSS file referenced within the XHTML in the typical fashion, or  must something special be done to reference a CSS file?
    Are there other changes that need to be made to an XHTML file in order for it to work properly with Adobe Cintribute CS5?
    Thank you in advance for your helpful responses.
    *** Please note that this question was posted earlier; perhaps errantly, in the Contribute forum.

    Template_Maker wrote:
    Given  the task of making a web page that must exhibit regions editable with  Adobe Contribute CS5, and having only a plain text editor (not  Dreamweaver), exactly what needs to be done to the associated XHTML  file?  For example: 
    1.  Does the XHTML file need to be named with an extension other than ".html"?
    The 'child' page can be named with any extension.
    2.   When denoting an editable region within the XHTML, what is the exact  syntax of the "begin editable" and "end editable" tags?
    <!-- InstanceBeginEditable name="editable_region_name" -->
    <!-- InstanceEndEditable -->
    3.   Is a CSS file referenced within the XHTML in the typical fashion, or  must something special be done to reference a CSS file?
    It's all just HTML - and needs to work properly on the server.  Nothing special needs to be done.
    Are there other changes that need to be made to an XHTML file in order for it to work properly with Adobe Cintribute CS5?
    No.
    I assume your client IS using Contribute.
    But - a word of skepticism.  This sounds like a project bound to fail.  I know templates like the back of my hand (liver spots and all) and would hesitate to take it on....

  • Making a template from the xml/xslt..what am I missing

    Ok... I am stumped.... May be I am just missing something...
    I am looking into making a new HTML template. I am following the instructions on John Nacks webs site. However, upon looking into the web templates folder all the templates are .LRTEMPLATE files. Just putting the demo folder into the lr web template folder does not make the xml accesable from Light room. So how does one go about transforming these files into an actual LR template?
    I am posting about this on my Blog as well:
    http://lrwebtemplates.blogspot.com/

    The .lrtemplate files are saved presets from the left panel of the Web Module. You want to create in the same Lightroom Folder as the /Web Templates folder a /Web Galleries Folder and put your demo folder there that has galleryMaker.xml and transprmer.xslt and what everelse. Then restart LR and whatever (demo in this case) the folder is named will appear in the Galley List on the right panel in the Web Module.
    Don
    Don Ricklin, MacBook 1.83Ghz Duo 2 Core running 10.4.8 & Win XP, Pentax *ist D
    http://donricklin.blogspot.com/

  • Making own Templates for iPhoto

    in iPhoto `08, when you export pictures as a website, you can choose either a default template or one with bordered images.
    I wondered if there wont be more templates with the time. As long I figured out where those Templates are stored. Depending on the localization you can find it i.e. in:
    Photo.app/Contents/Plugins/HTMLExporter.iPhotoExporter/Contents/Resources/German .lproj/Templates
    I tried to make an own template by modifying a copy of one of those templates. It works pretty fine. But there is one problem:
    iPhoto uses as variable stuff like <ipt_photo>, or <ipt_links>.
    I can change any html synthax I want in those templates, but when I set those iphoto synthax just on another place, iPhoto doesn't translate them anymore, when it proceedes to generate the html files.
    Anyone any idea???

    Why not use iWeb where you have 24 frames and 26 customizable page themes to use? Much more flexible than the limited web export from iPhoto and no hacking required.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 6 and 7 libraries and Tiger and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • AJAX tool for making JSP templates

    Hello, can you help me spread the word for some beta testers for a new open source HTML/CSS design tool?
    All you need is a Windows 98/2000/XP Computer (Mac version is still very buggy) and the latest Firefox browser (version 1.5).
    If you are interested, goto:
    http://www.arrowplain.com/
    and test out the program. It runs within the Firefox browser. The idea
    is to let you visually layout exactly the template you want and let the
    program generate proper HTML and CSS for you. It's like Dreamweaver
    only the code it produces is really clean, good for SEO HTML.
    Looking for bug reports / suggestions on how to make the program better. Please forward to any JSP people.
    Thanks!

    there is no real best one, they all have their ups and downs. It all depends on what you are planning to do with them.
    For me, I like scriptaculous the most because it for one has a nice example suite and the code internally is also easy to follow, making it possible to use the package even where documentation is lacking.Your mileage may vary.

  • Making Word template from DW code

    I know, I know, Office products are evil but bare with me. I work in a corporate setting and the CEO has asked that I create Word templates from the html email templates that I created for internal communications. The idea from the begining was that each support group would communicate to the internal masses via a custom email format (attached) instead of simply shooting out a standard email. The problem is, I have become the guy who has to format everyone's email since they can't code. I have better things to do.
    My question:
    In an effort to make this process as easy as composing an email, we thought about putting the html frame work into Word as a template and keep the main content area open for modification from the various users. How do i do this? I figure it can be done somehow since most of the junk email i get these days has some reference to MS Word within its code.
    Can anyone provide any direction?
    Thanks.
    David

    The best thing to do in your case is save the HTML in DW and then open the document in Word.  Word can open and edit .html documents with minor issues (if you send emails to Outlook 2007 you are aware of the quirks, if not --> http://msdn.microsoft.com/en-us/library/aa338200.aspx , read that article and get the DW plugin to validate pages).
    Then just save the document as a .dotx (if you have 2007 this is better because file sizes are smaller and there are more options available to an end-user).
    After that you should be set to go.

  • Making blank templates into my main Blog page (iWeb 1.1)

    How do I make a blank template into the welcome page where all the blog entries will show up.
    See I like the gazette template but I don't like the two collums on the blog page. I just want the one column on the page (I can delete the itims in one colum but it will still have that ugly stripe on the bakground). Well I can copy the things I want unto the blank template but how do I make that my welcome page so that when I make blog entries it will show up on that blank page?

    Sorry I think I am confusing everybody. And not having all the names right etc. it is very confusing explaining what happens.
    When you select Blog from a template. THat is what you will see when you visit somebodies site (if that is the only thing on there). We will call that the homepage. Well the Blog that I select (Gazette) has 3 colums. I only want 2. I don't want the colum all the way on the right side. I can delete all those entrie but it leaves a line there (that is the way that template works). But all my entries will show up with that line going through it.
    Now I thought let's get the blank template and copy everything I need from the Blog template unto the blank template. It looks awesome. Except now I can't put blog entries into that blank template because it will make those entry in my blog template.
    My question was if there is an easy way to make that blank template which looks like the blog template (with one less colum) my homepage which will include the new entries that I will make. Like somhow convert it to a blog template so it will have the arrow on the side which you can click and it will show you the entries and the archive.
    But I think that link will work. I will get a blog template. Clean it and make it blank. And copy the content from the gazette template unto the clean blank blog template (that will include the blog entries). That is what I want.
    So yes I think your link is the solution to my problem.

  • Making Custom Template in DVDSP

    I have a DVD set up with two menus, connections, and a script. When I try to save it as a custom template it will only save a single menu and track.
    Is it not possible to save a custom template with multiple assets? (menus, track place holders, and scripts)
    I am trying to make a custom template for essentially "drag and drop" use for multiple projects.
    Thanks in advance for the help and my version of DVDSP is whatever the most current is that came out with FC7.

    I'm wondering if someone can help me.
    I'm on SP 4.1.2, latest build of Leopard.
    When I creating my templates, which are just enhancements of the Filmstrip versions, Sp crashes on me. Spinning wheel!
    Using the filmstrip template, I end up having 2 pages.
    1. the main page
    2. the chapter selection pages (could be multiple of course)
    So I set my menus up, then I go to the first menu, cntrl-click or right click (using a logitech trackball) and choose create template. I give it a name then click the box for self-contained.
    When I press save, SP crashes hard, displaying the spinning wheel.
    I have to force quit and of course, not changes were made
    Any ideas?
    I've reset permissions etc.. so I don't know that the problems is.
    I do know this could save me some time. I could just use Apple's stock filmstrip project, but i don't like it enough. I transfer home videos for people and their DVDs are usually 12-18 chapters.
    I'd like to have various templates set up for 6, 9, 12, 15 and 18 (or more) chapters set up so I can just drop and drag to make all the connections.
    Cheers and thanks in advance for any help.
    Cheers,
    keebler

  • Block text when making a template

    When you select a template made by Apple, the paragraphs are selectable as a block that you can click on and erase, but when I make a template myself it's just normal text. Does anyone know how to set up a template with the same text blocks?

    Alexander
    Select the block of text:
    +Menu > Format > Advanced > Define as Placeholder Text+ or +option shift command t+
    Peter

  • Time lag making a template

    I just made a template in Pages on my computer, MBP/retina. I followed the directions according to Pages help. and waited twenty five minutes for tyhe template to show up in Pages on my iPad Mini/retina. I feel that is totally unacceptable. Is there something about the format/font that would cause that kind of delay?

    I just noticed I forgot to update the iOS version on my iPad that's showing on this site. I am running iOS8 on my iPad and OS 10.10, (Yosemite), on my mac.

  • Making a Template--lots of questions

    I can't seem to figure these items out--these are formatting items that work for me (pretty well) in Word, but I can't seem to figure out how to 'mimic' them in Pages:
    1. Each time I push 'return' I want the the cursor to move to the next line, but INTENDED (1 tab).
    2. If I push the 'return' button twice, I want it to skip the next 'indented' line and move to a new paragraph body, left justified.
    3. When I push the dash button twice, I want one long hyphen, not two (--).
    4. I want my spelling corrected FOR me while I type instead of the misspelled word underlined.
    Sorry for so many questions--I'm new to Mac.
    Steven

    teleios,
    1. This would have to be done with a style with indented first line:
    Select a paragraph, on the rule you will see a blue flat bar stacked on top of a downward pointing triangle. Drag this to the amount of 1st line indent you want. Save it as a style with whatever name you want.
    You can set this to be a following style after say a subhead.
    2. Again set a style with no 1st line indent. Rather than the method you suggested of hitting return twice (what if you actually want 2 returns?) make it a structured set of following styles as above.
    You can also make an F key a keyboard shortcut for the style which will let you quickly switch back and forth as you wish.
    3. Go to:
    *Menu > Pages > Preferences > Auto-Correction > tick "Symbol and text substitution" > + button at bottom > Type "--" in Replace column > Type command shift - (which is the character "—") in With column > close pane*
    4. When a word is flagged as misspelled you can hit *cmd :* and it will let you decide whether or not you want to actually correct it. Failing that have a look at some 3rd Party dictionaries available at:
    http://www.versiontracker.com/
    http://www.macupdate.com/
    or other shareware download sites.

  • Making templates with FLASH .swf's?

    Hi all,
    I'd like to have a common flash header (that loads only
    once). I originally wanted to use SSI, but my host does not support
    SSI on the [cheaper] plan that I am on.
    So, I tried making a template, but it doesn't load the flash
    header. It loads the images fine, but not the flash. Any help you
    can provide would be greatly appreciated.
    Blessings,
    -Davide

    I think that's about the size of it....
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "RisingSuns" <[email protected]> wrote in
    message
    news:ealojk$a4q$[email protected]..
    > Ok,
    > Well, it looks like I will be forced to use framesets
    for this mp3 player.
    > I
    > didn't want to use them, but after digging around the
    FLASH userbase for a
    > while (and coming up with nothing), it appears this is
    my only option.
    >
    > There is good news though. The prominent drawbacks of
    framesets will *not*
    > be
    > exeprienced on the setup that I will be using. There
    will be no possiblity
    > of
    > "black holes", since the navigation and content will be
    in the same
    > window. If
    > search engines link to my content, then the only
    possiblyefault will be
    > the
    > absense of the mp3 player, rather than the absense of
    navigation (since
    > the mp3
    > player will be in a frame by itself).
    >
    > I suppose the only nagging nusances left will be the
    bookmarking issue,
    > i.e.,
    > any bookmarked page will autmatically load the
    home/index page....which is
    > not
    > entirely that big of a deal (my site will be only 2
    levels, and <15 pages.
    > So
    > it won't be too much an an effort to return to a
    specified page).
    >
    > Am I forgetting anyting? Oh, printing. I will have to
    put a printing link
    > in
    > as well I guess.
    >
    > All in all, not too bad. I believe the benefit of having
    continous play,
    > in my
    > case, outweighs the hinderances.
    >
    > Thanks for the help guys.
    >
    > -Davide
    >

  • Making Template

    I want to make a template. I have outlined my template and completed all my paper work. Now I want to put my plan into action and create the template. Now problem is that I don’t have much knowledge to create a template, which is very much attractive. If any one have a perfect knowledge of making a template or anybody know any site which can help me then please guide me. It’s urgent.
    Thanks.

    Well as you have completed your entire outline and paper work now better you start implementing your ideas as soon as possible and start making a template. I would suggest you look for professional help. I found some creative and professional M.S. Word template provider at http://www.templatesforbusiness.us this may be very useful for you.

Maybe you are looking for

  • How can i load a VI from LABVIEW ver 6.0.1b3 to LABVIEW ver 6.1

    How can i load a VI from LABVIEW ver 6.0.1b3 to LABVIEW ver 6.1......I want to load a vi but i'm getting this error: LabVIEW load error code 9:VI version (6.1) is newer than LabVIEW version (6.0.1b3) My LabVIEW ver is 6.1 Please help ......it's impor

  • Installed fonts not showing in menu

    I'm sorry, I did a search and I know this question has been asked many times before but I've never seen it answered. I've got true type fonts exported from Mac to PC via Fontographer - Photoshop (CS1), Illustrator (CS1), and Quark (as old as v5) all

  • I cant put the code in doesnt allow me to put letters only numbers

    what should i do

  • How to copy the variants from one user to other user?

    Hi all, I have a list of variants(nearly 10 variants) for a report named 'ZONEORDER'. I need to copy all the variants to another user. Is it possible? If so, could anyone suggest the solution? Thanks in advance. Regards, Vijay.

  • Itunes library no working

    I accidently deleted my itunes library file, and emptied the trash. How can I get it back with all the playlists? I tried moving .xml file to the desktop and importing library, this didnt work. I can see a previous itunes library folder with some tha