root/trunk/CodeTemplate
| Revision 5390, 3.6 kB (checked in by jburel, 7 months ago) | |
|---|---|
|
|
| Line | |
|---|---|
| 1 | /* |
| 2 | * org.openmicroscopy.package.ClassName |
| 3 | * |
| 4 | *------------------------------------------------------------------------------ |
| 5 | * Copyright (C) 2006, 2008 University of Dundee. All rights reserved. |
| 6 | * |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License along |
| 18 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | *------------------------------------------------------------------------------ |
| 22 | */ |
| 23 | |
| 24 | //the above license blurb is required |
| 25 | |
| 26 | |
| 27 | package org.openmicroscopy.package.ClassName; |
| 28 | |
| 29 | //follow the pattern below for imports |
| 30 | |
| 31 | //Java imports |
| 32 | import java.lang.reflect.*; //avoid *, specify actual classes if possible |
| 33 | import javax.swing.Action; //follow alphabetical order |
| 34 | import javax.swing.JFrame; |
| 35 | |
| 36 | //Third-party libraries |
| 37 | import org.open.source.ClassX; |
| 38 | import org.open.source.lib.ClassY; |
| 39 | |
| 40 | //Application-internal dependencies |
| 41 | import org.openmicroscopy.pkg.ClassX; |
| 42 | |
| 43 | //REMEMBER: |
| 44 | // * line lenght is 80 chars (may be more occasionally for long string litterals) |
| 45 | // * tabs are 4 spaces |
| 46 | |
| 47 | /** |
| 48 | * Put class description here. |
| 49 | * Format descriptions using (basic) HTML as needed. |
| 50 | * Use {@link target name} to reference fields and methods. |
| 51 | * Use the "code" tag to enclose any symbol that is contained in the source |
| 52 | * code and that is not to be referenced -- for example, a keyword or a |
| 53 | * variable name. |
| 54 | * |
| 55 | * Excluding the author clause, which is optional, all other clauses |
| 56 | * below are required. Just cut and paste. The second line below is |
| 57 | * automatically handled by CVS, never modify it. |
| 58 | * |
| 59 | * @author Your Name, <a href="mailto:your@email">your@email</a> |
| 60 | * @version 2.2 |
| 61 | * <small> |
| 62 | * (<b>Internal version:</b> $Revision$ $Date$) |
| 63 | * </small> |
| 64 | * @since OME2.2 |
| 65 | */ |
| 66 | public abstract class Template |
| 67 | extends BaseClass |
| 68 | implements Interface |
| 69 | { |
| 70 | |
| 71 | /** One-line description may have this style. */ |
| 72 | public static final int A_CONSTANT = 1; |
| 73 | |
| 74 | /** |
| 75 | * If you need more than one line to describe a member field, use |
| 76 | * this common style. |
| 77 | */ |
| 78 | private int aMemberField; |
| 79 | private String anotherField; //use tabs to nicely align field names |
| 80 | |
| 81 | /** |
| 82 | * Put method description here. |
| 83 | * Method signature is described following the order below: |
| 84 | * |
| 85 | * @param param1 A tab before description. |
| 86 | * @param param2 A tab before description. |
| 87 | * @return Object A tab before description. |
| 88 | * @throws MyException A tab before description |
| 89 | */ |
| 90 | public Object aMethod(String param1, int param2) //a space after commas |
| 91 | throws MyException //throws clause on next line |
| 92 | { |
| 93 | int k = 0; //a space between each symbol pair, no space before semicolon |
| 94 | //optional line after vars declaration |
| 95 | while (k < 10) { //a space between keywords and parentheses |
| 96 | if (k == 3 || k == -1) { //a space between condition and operator |
| 97 | byte x = (byte) k++; //a space between cast and symbols |
| 98 | break; |
| 99 | } else { |
| 100 | k = methodX(par1, par2, par3); //a space after commas |
| 101 | } //brackets may be omitted if just one statement is enclosed |
| 102 | } |
| 103 | try { |
| 104 | //some more code... |
| 105 | } catch (Exception e) { |
| 106 | //exception handling code... |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | } |
Note: See TracBrowser
for help on using the browser.
