Skip to content

Commit

Permalink
[Codeathon]Fix errors on javadoc generation on core-util see
Browse files Browse the repository at this point in the history
issue #2795
  • Loading branch information
katysaintin committed Aug 31, 2023
1 parent db9a3e1 commit 600ea57
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

import java.io.File;

/**
* Class FileExtensionUtil
*/
public class FileExtensionUtil {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* Helper class for calculating the index name for time based indices.
* @author Evan Smith
*/
@SuppressWarnings("nls")
public class IndexNameHelper
{
private String baseIndexName;
Expand Down Expand Up @@ -66,9 +65,9 @@ public IndexNameHelper(final String baseIndexName, final boolean useDatedIndexNa
}

/**
* Return a time based index name for the given time. If the dateSpanValue is 0 then returns the base index name.
* @param time
* @return index_name
* Return a time based index name for the given time
* @param time given time
* @return index_name If the dateSpanValue is 0 then returns the base index name
*/
public String getIndexName(Instant time)
{
Expand Down Expand Up @@ -136,11 +135,13 @@ private String parseCurrentDateSpan()
return fullDate.split(DELIMITER)[0];
}

/** @return current date span start */
public Instant getCurrentDateSpanStart()
{
return spanStart;
}

/** @return current date span end */
public Instant getCurrentDateSpanEnd()
{
return spanEnd;
Expand Down
12 changes: 8 additions & 4 deletions core/util/src/main/java/org/phoebus/util/shell/CommandShell.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
*
* @author Kay Kasemir
*/
@SuppressWarnings("nls")
public class CommandShell
{
public interface CommandHandler
/**
* interface CommandHandler */
public interface CommandHandler
{
/** Invoked when user entered a command
* @param args Entered command, split at spaces, or <code>null</code> when user entered 'Ctrl-D' to close shell
Expand Down Expand Up @@ -64,13 +65,16 @@ public void stop()
thread.interrupt();
}

/** Get the prompt string. */
/** @return the prompt string. */
public String getPrompt()
{
return prompt;
}

/** Set the prompt string. */
/**
* Set the prompt string
* @param newPrompt the new prompt
*/
public void setPrompt(final String newPrompt)
{
this.prompt = newPrompt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,15 @@
*/
public class CompareNatural
{
public static final Comparator<String> INSTANCE = (a, b) -> compareTo(a, b);

/** Singleton */
public static final Comparator<String> INSTANCE = (a, b) -> compareTo(a, b);

/**
* Compare two string
* @param s1 string 1
* @param s2 string 2
* @return result of comparison
*/
public static int compareTo(final String s1, final String s2)
{
// Skip all identical characters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public class SecondsParser
* Special cases:
* One overall '-' is allowed to specify negative seconds.
*
* @param text time in string
* @return The seconds parsed from the string.
* @throws Exception on parse error.
*/
@SuppressWarnings("nls")
public static double parseSeconds(String text) throws Exception
{
final char sep = ':';
Expand Down
12 changes: 9 additions & 3 deletions core/util/src/main/java/org/phoebus/util/time/TimeDuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,20 @@ public class TimeDuration {
private TimeDuration() {
}

/**
* Create a Duration
* @param sec seconds
* @param nanoSec nanoseconds
* @return duration
*/
public static Duration createDuration(long sec, int nanoSec) {
return Duration.ofSeconds(sec).plusNanos(nanoSec);
}

/**
* A new duration in hours.
* A new duration in days.
*
* @param hour hours
* @param day day
* @return a new duration
*/
public static Duration ofDays(double day) {
Expand Down Expand Up @@ -109,7 +115,7 @@ public static double toSecondsDouble(Duration duration){
/**
* The number of seconds concatenated with the number of nanoseconds (12.500000000
* for 12.5 seconds).
*
* @param duration the duration
* @return the string representation
*/
public static String toSecondString(Duration duration){
Expand Down
9 changes: 4 additions & 5 deletions core/util/src/main/java/org/phoebus/util/time/TimeParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
*
* @author shroffk
*/
@SuppressWarnings("nls")
public class TimeParser {
/** Text for the relative {@link TemporalAmount} of size 0 */
public static final String NOW = "now";
Expand Down Expand Up @@ -74,7 +73,7 @@ public static Instant getInstant(String time) {

/**
* Return a {@link TimeInterval} between this instant represented by the string and NOW
* @param time
* @param time in string
* @return TimeInterval
*/
@Deprecated
Expand All @@ -99,8 +98,8 @@ public static TimeInterval getTimeInterval(String time) {
*
* e.g. parseDuraiton("5h 3min 34s");
*
* @param string
* @return
* @param string time in string
* @return duration
* @deprecated use {@link #parseTemporalAmount(String)}
*/
@Deprecated
Expand Down Expand Up @@ -368,7 +367,7 @@ else if (period.getDays() > 0)
}

/** Try to parse text as absolute or relative time
* @param text
* @param text temporal amount
* @return {@link Instant}, {@link TemporalAmount} or <code>null</code>
*/
public static Object parseInstantOrTemporalAmount(final String text)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
*
* @author carcassi, shroffk
*/
@SuppressWarnings("nls")
public class TimeRelativeInterval {

private final Object start;
Expand Down Expand Up @@ -229,6 +228,10 @@ public Optional<TemporalAmount> getRelativeEnd() {
}
}

/**
* @param reference time
* @return absolute interval
*/
public TimeInterval toAbsoluteInterval(Instant reference) {
Instant absoluteStart;
Instant absoluteEnd;
Expand Down Expand Up @@ -288,6 +291,7 @@ public TimeInterval toAbsoluteInterval(Instant reference) {
return TimeInterval.between(absoluteStart, absoluteEnd);
}

/** @return time interval */
public TimeInterval toAbsoluteInterval() {
return toAbsoluteInterval(Instant.now());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
/**
* Contains basic common classes to handle time at nanosecond precision.
* <h3>JSR 310 compatibility</h3>
* JSR 310 compatibility
* Java 8 has introduced a better time definition that is going to be very
* similar to these class. The plan is to phase out this package
* and use the standard where possible.
Expand Down

0 comments on commit 600ea57

Please sign in to comment.