Changeset 8926 in josm


Ignore:
Timestamp:
2015-10-22T02:01:00+02:00 (9 years ago)
Author:
Don-vip
Message:

javadoc fixes

Location:
trunk
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/DownloadAlongAction.java

    r8509 r8926  
    1010import java.util.Collection;
    1111import java.util.List;
     12import java.util.concurrent.CancellationException;
     13import java.util.concurrent.ExecutionException;
    1214import java.util.concurrent.Future;
    1315
     
    9193     * This functions calculates the rectangles, asks the user to continue and downloads
    9294     * the areas if applicable.
     95     *
     96     * @param a download area hull
     97     * @param maxArea maximum area size for a single download
     98     * @param osmDownload Set to true if OSM data should be downloaded
     99     * @param gpxDownload Set to true if GPX data should be downloaded
     100     * @param title the title string for the confirmation dialog
     101     * @param progressMonitor the progress monitor
    93102     */
    94103    protected static void confirmAndDownloadAreas(Area a, double maxArea, boolean osmDownload, boolean gpxDownload, String title,
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r8919 r8926  
    930930
    931931    /**
    932      * This is a method splits way into smaller parts, using the prepared nodes list as split points.
     932     * This is a method that splits way into smaller parts, using the prepared nodes list as split points.
    933933     * Uses {@link SplitWayAction#splitWay} for the heavy lifting.
     934     * @param way way to split
     935     * @param nodes split points
    934936     * @return list of split ways (or original ways if no splitting is done).
    935937     */
     
    11421144     * This method checks if polygons have several touching parts and splits them in several polygons.
    11431145     * @param polygons the polygons to process.
     1146     * @return the resulting list of polygons
    11441147     */
    11451148    public static List<AssembledPolygon> fixTouchingPolygons(List<AssembledPolygon> polygons) {
  • trunk/src/org/openstreetmap/josm/actions/OrthogonalizeAction.java

    r8855 r8926  
    245245     *      - The same for vertical segments.
    246246     *  5. Rotate back.
    247      *
     247     * @throws InvalidUserInputException if selected ways have an angle different from 90 or 180 degrees
    248248     **/
    249249    private static Collection<Command> orthogonalize(List<WayData> wayDataList, List<Node> headingNodes) throws InvalidUserInputException {
     
    536536     * Recognize angle to be approximately 0, 90, 180 or 270 degrees.
    537537     * returns an integral value, corresponding to a counter clockwise turn:
     538     * @throws RejectedAngleException in case of invalid angle
    538539     */
    539540    private static int angleToDirectionChange(double a, double deltaMax) throws RejectedAngleException {
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r8924 r8926  
    837837    /**
    838838     * Called after every put. In case of a problem, do nothing but output the error in log.
     839     * @throws IOException if any I/O error occurs
    839840     */
    840841    public void save() throws IOException {
  • trunk/src/org/openstreetmap/josm/gui/ConditionalOptionPaneUtil.java

    r8836 r8926  
    113113     *
    114114     * @return the option selected by user. {@link JOptionPane#CLOSED_OPTION} if the dialog was closed.
     115     * @throws HeadlessException if <code>GraphicsEnvironment.isHeadless</code> returns <code>true</code>
    115116     */
    116117    public static int showOptionDialog(String preferenceKey, Component parent, Object message, String title, int optionType,
     
    153154     *
    154155     * @return true, if the selected option is equal to <code>trueOption</code>, otherwise false.
     156     * @throws HeadlessException if <code>GraphicsEnvironment.isHeadless</code> returns <code>true</code>
    155157     *
    156158     * @see JOptionPane#INFORMATION_MESSAGE
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPreset.java

    r8863 r8926  
    198198    /**
    199199     * Called from the XML parser to set the types this preset affects.
     200     * @throws SAXException if any SAX error occurs
    200201     */
    201202    public void setType(String types) throws SAXException {
  • trunk/src/org/openstreetmap/josm/io/BoundingBoxDownloader.java

    r8846 r8926  
    128128    /**
    129129     * Parse the given input source and return the dataset.
     130     * @throws IllegalDataException if an error was found while parsing the OSM data
    130131     *
    131132     * @see OsmReader#parseDataSet(InputStream, ProgressMonitor)
  • trunk/src/org/openstreetmap/josm/io/CacheCustomContent.java

    r8840 r8926  
    6060     * executed in the current thread.
    6161     * @return the data to cache
     62     * @throws T a {@link Throwable}
    6263     */
    6364    protected abstract byte[] updateData() throws T;
     
    175176    /**
    176177     * Tries to load the data using the given ident from disk. If this fails, data will be updated, unless run in offline mode
     178     * @throws T a {@link Throwable}
    177179     */
    178180    private void loadFromDisk() throws T {
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r8846 r8926  
    877877    }
    878878
    879     /** Method for parsing API responses for operations on individual notes */
     879    /**
     880     * Method for parsing API responses for operations on individual notes
     881     * @param xml the API response as XML data
     882     * @return the resulting Note
     883     * @throws OsmTransferException if the API response cannot be parsed
     884     */
    880885    private Note parseSingleNote(String xml) throws OsmTransferException {
    881886        try {
  • trunk/src/org/openstreetmap/josm/io/OsmImporter.java

    r8855 r8926  
    8484     * @param associatedFile filename of data (layer name will be generated from name of file)
    8585     * @param pm handler for progress monitoring and canceling
     86     * @throws IllegalDataException if an error was found while parsing the OSM data
    8687     */
    8788    protected void importData(InputStream in, final File associatedFile, ProgressMonitor pm) throws IllegalDataException {
     
    112113     * @param layerName name of generated layer
    113114     * @param progressMonitor handler for progress monitoring and canceling
     115     * @throws IllegalDataException if an error was found while parsing the OSM data
    114116     */
    115117    public OsmImporterData loadLayer(InputStream in, final File associatedFile, final String layerName, ProgressMonitor progressMonitor)
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r8846 r8926  
    398398     * This is basically the same code as parseUnknown(), except for the warnings, which
    399399     * are displayed for inner elements and not at top level.
     400     * @throws XMLStreamException if there is an error processing the underlying XML source
    400401     */
    401402    private void jumpToEnd(boolean printWarning) throws XMLStreamException {
     
    430431    /**
    431432     * Read out the common attributes and put them into current OsmPrimitive.
     433     * @throws XMLStreamException if there is an error processing the underlying XML source
    432434     */
    433435    private void readCommon(PrimitiveData current) throws XMLStreamException {
  • trunk/src/org/openstreetmap/josm/io/UTFInputStreamReader.java

    r8510 r8926  
    1616     * Creates a new {@link InputStreamReader} from the {@link InputStream} with UTF-8 as default encoding.
    1717     * @return A reader with the correct encoding. Starts to read after the BOM.
     18     * @throws IOException if any I/O error occurs
    1819     * @see #create(java.io.InputStream, String)
    1920     */
     
    2627     * @param defaultEncoding Used, when no BOM was recognized. Can be null.
    2728     * @return A reader with the correct encoding. Starts to read after the BOM.
     29     * @throws IOException if any I/O error occurs
    2830     */
    2931    public static UTFInputStreamReader create(InputStream input, String defaultEncoding) throws IOException {
  • trunk/src/org/openstreetmap/josm/io/remotecontrol/RemoteControlHttpsServer.java

    r8840 r8926  
    134134     * @param algorithm the signing algorithm, eg "SHA256withRSA"
    135135     * @param san SubjectAlternativeName extension (optional)
     136     * @return the self-signed X.509 Certificate
     137     * @throws GeneralSecurityException if any security error occurs
     138     * @throws IOException if any I/O error occurs
    136139     */
    137140    private static X509Certificate generateCertificate(String dn, KeyPair pair, int days, String algorithm, String san)
    138141            throws GeneralSecurityException, IOException {
    139         PrivateKey privkey = pair.getPrivate();
    140142        X509CertInfo info = new X509CertInfo();
    141143        Date from = new Date();
     
    193195
    194196        // Sign the cert to identify the algorithm that's used.
     197        PrivateKey privkey = pair.getPrivate();
    195198        X509CertImpl cert = new X509CertImpl(info);
    196199        cert.sign(privkey, algorithm);
  • trunk/src/org/openstreetmap/josm/io/session/SessionLayerExporter.java

    r5391 r8926  
    66import java.util.Collection;
    77
    8 import org.w3c.dom.Element;
    9 
    108import org.openstreetmap.josm.gui.layer.Layer;
    119import org.openstreetmap.josm.io.session.SessionWriter.ExportSupport;
     10import org.w3c.dom.Element;
    1211
    1312public interface SessionLayerExporter {
     
    1514    /**
    1615     * Return the Layers, this Layer depends on.
     16     * @return the layer dependencies
    1717     */
    1818    Collection<Layer> getDependencies();
     
    2020    /**
    2121     * The GUI for exporting this layer.
     22     * @return the export panel
    2223     */
    2324    Component getExportPanel();
    2425
    2526    /**
    26      * Return true, if the layer should be included in the
    27      * list of exported layers.
     27     * Return true, if the layer should be included in the list of exported layers.
    2828     *
    2929     * The user can veto this in the export panel.
     30     * @return {@code true} if the layer should be included in the list of exported layers, {@code false} otherwise.
    3031     */
    3132    boolean shallExport();
    3233
    3334    /**
    34      * Return true, if some data needs to be included in
    35      * the zip archive. This decision depends on the user
     35     * Return true, if some data needs to be included in the zip archive. This decision depends on the user
    3636     * selection in the export panel.
    3737     *
    38      * If any layer requires zip, the user can only save as
    39      * .joz. Otherwise both .jos and .joz are possible.
     38     * If any layer requires zip, the user can only save as .joz. Otherwise both .jos and .joz are possible.
     39     * @return {@code true} if some data needs to be included in the zip archive, {@code false} otherwise.
    4040     */
    4141    boolean requiresZip();
     
    4444     * Save meta data to the .jos file. Return a layer XML element.
    4545     * Use <code>support</code> to save files in the zip archive as needed.
     46     * @param support support class providing export utilities
     47     * @return the resulting XML element
     48     * @throws IOException  if any I/O error occurs
    4649     */
    4750    Element export(ExportSupport support) throws IOException;
    48 
    4951}
    50 
  • trunk/src/org/openstreetmap/josm/io/session/SessionLayerImporter.java

    r4668 r8926  
    44import java.io.IOException;
    55
    6 import org.w3c.dom.Element;
    7 
    86import org.openstreetmap.josm.gui.layer.Layer;
    97import org.openstreetmap.josm.gui.progress.ProgressMonitor;
    108import org.openstreetmap.josm.io.IllegalDataException;
    119import org.openstreetmap.josm.io.session.SessionReader.ImportSupport;
     10import org.w3c.dom.Element;
    1211
    1312public interface SessionLayerImporter {
     13
    1414    /**
    1515     * Load the layer from xml meta-data.
     16     * @param elem XML element
     17     * @param support support class providing import utilities
     18     * @param progressMonitor progress monitor
     19     * @return the resulting layer
     20     * @throws IOException if any I/O error occurs
     21     * @throws IllegalDataException if invalid data is read
    1622     */
    1723    Layer load(Element elem, ImportSupport support, ProgressMonitor progressMonitor) throws IOException, IllegalDataException;
  • trunk/src/org/openstreetmap/josm/io/session/SessionReader.java

    r8850 r8926  
    196196         * Returns null if the URI points to a file inside the zip archive.
    197197         * In this case, inZipPath will be set to the corresponding path.
     198         * @param uriStr the URI as string
     199         * @return the resulting File
     200         * @throws IOException if any I/O error occurs
    198201         */
    199202        public File getFile(String uriStr) throws IOException {
  • trunk/src/org/openstreetmap/josm/io/session/SessionWriter.java

    r8836 r8926  
    142142         * @return the OutputStream you can write to. Never close the returned
    143143         * output stream, but make sure to flush buffers.
     144         * @throws IOException if any I/O error occurs
    144145         */
    145146        public OutputStream getOutputStreamZip(String zipPath) throws IOException {
  • trunk/src/org/openstreetmap/josm/tools/Diff.java

    r8840 r8926  
    8383    along with this program; if not, write to the Free Software
    8484    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    85 
    8685 */
    87 
    8886public class Diff {
    8987
     
    9492      be needed again later to print the results of the comparison as
    9593      an edit script, if desired.
     94     * @param a first array
     95     * @param b second array
    9696     */
    9797    public Diff(Object[] a, Object[] b) {
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r8924 r8926  
    222222
    223223    /**
    224      * return the modulus in the range [0, n)
     224     * Return the modulus in the range [0, n)
     225     * @param a dividend
     226     * @param n divisor
     227     * @return modulo (remainder of the Euclidian division of a by n)
    225228     */
    226229    public static int mod(int a, int n) {
  • trunk/src/org/openstreetmap/josm/tools/template_engine/TemplateParser.java

    r8811 r8926  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.tools.template_engine;
    3 
    43
    54import static org.openstreetmap.josm.tools.I18n.tr;
     
    1514import org.openstreetmap.josm.tools.template_engine.Tokenizer.TokenType;
    1615
    17 
     16/**
     17 * Template parser.
     18 */
    1819public class TemplateParser {
    1920    private final Tokenizer tokenizer;
     
    2223    private static final Collection<TokenType> CONDITION_WITH_APOSTROPHES_END_TOKENS = Arrays.asList(TokenType.APOSTROPHE);
    2324
     25    /**
     26     * Constructs a new {@code TemplateParser}.
     27     * @param template template to parse
     28     */
    2429    public TemplateParser(String template) {
    2530        this.tokenizer = new Tokenizer(template);
     
    3439    }
    3540
     41    /**
     42     * Parse the template.
     43     * @return the resulting template entry
     44     * @throws ParseError if the template cannot be parsed
     45     */
    3646    public TemplateEntry parse() throws ParseError {
    3747        return parseExpression(EXPRESSION_END_TOKENS);
     
    91101                    result.getEntries().add(new SearchExpressionCondition(
    92102                            SearchCompiler.compile(searchExpression.getText()), condition));
    93                 } catch (org.openstreetmap.josm.actions.search.SearchCompiler.ParseError e) {
     103                } catch (SearchCompiler.ParseError e) {
    94104                    throw new ParseError(searchExpression.getPosition(), e);
    95105                }
     
    121131                Match match = SearchCompiler.compile(searchExpression.getText());
    122132                result = new ContextSwitchTemplate(match, template, searchExpression.getPosition());
    123             } catch (org.openstreetmap.josm.actions.search.SearchCompiler.ParseError e) {
     133            } catch (SearchCompiler.ParseError e) {
    124134                throw new ParseError(searchExpression.getPosition(), e);
    125135            }
     
    129139        return result;
    130140    }
    131 
    132141}
  • trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java

    r8510 r8926  
    1010import java.io.File;
    1111import java.io.FileInputStream;
     12import java.io.FileNotFoundException;
    1213import java.io.FileOutputStream;
    1314import java.io.IOException;
     
    174175    /**
    175176     * Setup test.
     177     * @throws IOException if any I/O error occurs
     178     * @throws IllegalDataException if an error was found while parsing the OSM data
     179     * @throws FileNotFoundException if the dataset file cannot be found
    176180     */
    177181    @Before
    178     public void setUp() throws IOException, IllegalDataException {
     182    public void setUp() throws IOException, IllegalDataException, FileNotFoundException {
    179183        File f = new File(System.getProperty("java.io.tmpdir"), MultiFetchServerObjectReaderTest.class.getName() + ".dataset");
    180184        logger.info(MessageFormat.format("reading cached dataset ''{0}''", f.toString()));
  • trunk/test/functional/org/openstreetmap/josm/io/OsmServerBackreferenceReaderTest.java

    r8540 r8926  
    1010import java.io.File;
    1111import java.io.FileInputStream;
     12import java.io.FileNotFoundException;
    1213import java.io.FileOutputStream;
    1314import java.io.IOException;
     
    130131     * @param ds the data set
    131132     * @throws OsmTransferException if something goes wrong
     133     * @throws CyclicUploadDependencyException if a cyclic dependency is detected
    132134     */
    133135    public static void createDataSetOnServer(APIDataSet ds) throws OsmTransferException, CyclicUploadDependencyException {
     
    144146    static DataSet testDataSet;
    145147
     148    /**
     149     * Setup test.
     150     * @throws OsmTransferException if something goes wrong
     151     * @throws CyclicUploadDependencyException if a cyclic dependency is detected
     152     */
    146153    @BeforeClass
    147     public static void init() throws OsmTransferException, CyclicUploadDependencyException {
     154    public static void setUpBeforeClass() throws OsmTransferException, CyclicUploadDependencyException {
    148155        logger.info("initializing ...");
    149156
     
    195202    /**
    196203     * Setup test.
     204     * @throws IOException if any I/O error occurs
     205     * @throws IllegalDataException if an error was found while parsing the OSM data
     206     * @throws FileNotFoundException if the dataset file cannot be found
    197207     */
    198208    @Before
    199     public void setUp() throws IOException, IllegalDataException {
     209    public void setUp() throws IOException, IllegalDataException, FileNotFoundException {
    200210        File f = new File(System.getProperty("java.io.tmpdir"), MultiFetchServerObjectReaderTest.class.getName() + ".dataset");
    201211        logger.info(MessageFormat.format("reading cached dataset ''{0}''", f.toString()));
  • trunk/test/performance/org/openstreetmap/josm/data/osm/OsmDataGenerator.java

    r8655 r8926  
    111111        /**
    112112         * Create a random node and add it to the dataset.
     113         * @param ds the data set
    113114         * @return a random node
    114115         */
  • trunk/test/unit/org/openstreetmap/josm/data/validation/tests/UnconnectedWaysTest.java

    r7937 r8926  
    66
    77import java.io.FileInputStream;
     8import java.io.FileNotFoundException;
     9import java.io.IOException;
    810import java.io.InputStream;
    911
     
    1315import org.openstreetmap.josm.data.osm.DataSet;
    1416import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
     17import org.openstreetmap.josm.io.IllegalDataException;
    1518import org.openstreetmap.josm.io.OsmReader;
    1619
     20/**
     21 * Unit tests of {@code UnconnectedWays} class.
     22 */
    1723public class UnconnectedWaysTest {
    1824
    19     UnconnectedWays bib;
     25    private UnconnectedWays bib;
    2026
    2127    /**
    2228     * Setup test.
     29     * @throws Exception if the test cannot be initialized
    2330     */
    2431    @Before
     
    3037    }
    3138
     39    /**
     40     * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/6313">Bug #6313</a>.
     41     * @throws IOException if any I/O error occurs
     42     * @throws IllegalDataException if the OSM data cannot be parsed
     43     * @throws FileNotFoundException if the data file cannot be found
     44     */
    3245    @Test
    33     public void testTicket6313() throws Exception {
     46    public void testTicket6313() throws IOException, IllegalDataException, FileNotFoundException {
    3447        try (InputStream fis = new FileInputStream("data_nodist/UnconnectedWaysTest.osm")) {
    3548            final DataSet ds = OsmReader.parseDataSet(fis, NullProgressMonitor.INSTANCE);
  • trunk/test/unit/org/openstreetmap/josm/tools/template_engine/TemplateEngineTest.java

    r8857 r8926  
    3030    }
    3131
     32    /**
     33     * Test to parse an empty string.
     34     * @throws ParseError if the template cannot be parsed
     35     */
    3236    @Test
    3337    public void testEmpty() throws ParseError {
     
    3640    }
    3741
     42    /**
     43     * Test to parse a variable.
     44     * @throws ParseError if the template cannot be parsed
     45     */
    3846    @Test
    3947    public void testVariable() throws ParseError {
     
    4351    }
    4452
     53    /**
     54     * Test to parse a condition with whitespaces.
     55     * @throws ParseError if the template cannot be parsed
     56     */
    4557    @Test
    4658    public void testConditionWhitespace() throws ParseError {
     
    5365    }
    5466
     67    /**
     68     * Test to parse a condition without whitespace.
     69     * @throws ParseError if the template cannot be parsed
     70     */
    5571    @Test
    5672    public void testConditionNoWhitespace() throws ParseError {
     
    6379    }
    6480
    65     private static Match compile(String expression) throws org.openstreetmap.josm.actions.search.SearchCompiler.ParseError {
     81    private static Match compile(String expression) throws SearchCompiler.ParseError {
    6682        return SearchCompiler.compile(expression);
    6783    }
    6884
    69     @Test
    70     public void testConditionSearchExpression() throws Exception {
     85    /**
     86     * Test to parse a search expression condition.
     87     * @throws ParseError if the template cannot be parsed
     88     * @throws SearchCompiler.ParseError if an error has been encountered while compiling
     89     */
     90    @Test
     91    public void testConditionSearchExpression() throws ParseError, SearchCompiler.ParseError {
    7192        TemplateParser parser = new TemplateParser("?{ admin_level = 2 'NUTS 1' | admin_level = 4 'NUTS 2' |  '{admin_level}'}");
    7293        Condition condition = new Condition();
     
    108129    };
    109130
    110     @Test
    111     public void testFilling() throws Exception {
     131    /**
     132     * Test to fill a template.
     133     * @throws ParseError if the template cannot be parsed
     134     */
     135    @Test
     136    public void testFilling() throws ParseError {
    112137        TemplateParser parser = new TemplateParser("{name} u{unknown}u i{number}i");
    113138        TemplateEntry entry = parser.parse();
     
    117142    }
    118143
    119     @Test
    120     public void testFillingSearchExpression() throws Exception {
     144    /**
     145     * Test to parse a search expression.
     146     * @throws ParseError if the template cannot be parsed
     147     */
     148    @Test
     149    public void testFillingSearchExpression() throws ParseError {
    121150        TemplateParser parser = new TemplateParser("?{ admin_level = 2 'NUTS 1' | admin_level = 4 'NUTS 2' |  '{admin_level}'}");
    122151        TemplateEntry templateEntry = parser.parse();
     
    134163    }
    135164
    136     @Test
    137     public void testPrintAll() throws Exception {
     165    /**
     166     * Test to print all.
     167     * @throws ParseError if the template cannot be parsed
     168     */
     169    @Test
     170    public void testPrintAll() throws ParseError {
    138171        TemplateParser parser = new TemplateParser("{special:everything}");
    139172        TemplateEntry entry = parser.parse();
     
    143176    }
    144177
    145     @Test
    146     public void testPrintMultiline() throws Exception {
     178    /**
     179     * Test to print on several lines.
     180     * @throws ParseError if the template cannot be parsed
     181     */
     182    @Test
     183    public void testPrintMultiline() throws ParseError {
    147184        TemplateParser parser = new TemplateParser("{name}\\n{number}");
    148185        TemplateEntry entry = parser.parse();
     
    152189    }
    153190
    154     @Test
    155     public void testSpecialVariable() throws Exception {
     191    /**
     192     * Test to print special variables.
     193     * @throws ParseError if the template cannot be parsed
     194     */
     195    @Test
     196    public void testSpecialVariable() throws ParseError {
    156197        TemplateParser parser = new TemplateParser("{name}u{special:localName}u{special:special:key}");
    157198        TemplateEntry templateEntry = parser.parse();
     
    169210    }
    170211
    171     @Test
    172     public void testSwitchContext() throws Exception {
     212    /**
     213     * Test to switch context.
     214     * @throws ParseError if the template cannot be parsed
     215     */
     216    @Test
     217    public void testSwitchContext() throws ParseError {
    173218        TemplateParser parser = new TemplateParser("!{parent() type=parent2 '{name}'}");
    174219        DatasetFactory ds = new DatasetFactory();
     
    208253        parent1.addMember(new RelationMember("", child2));
    209254        parent2.addMember(new RelationMember("", child2));
    210 
    211255
    212256        StringBuilder sb = new StringBuilder();
Note: See TracChangeset for help on using the changeset viewer.