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