Skip to content

Commit

Permalink
Add API documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
urbic committed Sep 8, 2024
1 parent 14b20dd commit ed8797f
Show file tree
Hide file tree
Showing 24 changed files with 180 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ public interface PsyAdditive<T extends PsyAdditive>
*
* @return a {@code boolean} indicating whether this object represents a zero value.
*/
public PsyBoolean psyIsZero();
default public PsyBoolean psyIsZero()
{
return PsyBoolean.of(isZero());
}

/**
* Returns a {@code boolean} indicating whether this object represents a non-zero value.
Expand All @@ -55,10 +58,13 @@ default public PsyBoolean psyNonZero()
return psyIsZero().psyNot();
}

public boolean isZero();

/**
* Context action of the {@code add} operator.
*/
@OperatorType("add")
@SuppressWarnings("unchecked")
public static final ContextAction PSY_ADD
=ContextAction.<PsyAdditive, PsyAdditive>ofBiFunction(PsyAdditive::psyAdd);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@
public class PsyConcurrentModificationException
extends PsyErrorException
{
/**
* Constructs a new {@code exception} object with null as its detail message.
*/
public PsyConcurrentModificationException()
{
super();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,11 @@ public void repl()

public void handleExecutionStack(final int level);

/**
* Interprets the Psylla code from the {@code reader} object.
*
* @param oReader the {@code reader} object.
*/
public void interpret(final PsyReader oReader);

public void interpretBraced(final PsyReader oReader)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@ abstract public class PsyErrorException
extends Exception
implements PsyExecutable
{

/**
* Constructs a new {@code exception} object with null as its detail message.
*/
public PsyErrorException()
{
super();
}

/**
* Constructs a new {@code exception} object with the specified detail message.
*
* @param message the detail message.
*/
public PsyErrorException(final String message)
{
super(message);
}

@Override
public void invoke(final PsyContext oContext)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@
public class PsyFileAccessDeniedException
extends PsyErrorException
{
/**
* Constructs a new {@code exception} object with null as its detail message.
*/
public PsyFileAccessDeniedException()
{
super();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ default public PsyFormalStream<T> psyStream()
}

/**
* Returns the count of elements in this {@code formalstream}.
*
* @return a count
* {@return the count of elements in this {@code formalstream}}
*/
default public PsyInteger psyCount()
throws PsyInvalidStateException
Expand Down Expand Up @@ -88,11 +86,10 @@ public Stream<T> stream()
}

/**
* Returns a {@code formalstream} consisting of the remaining elements of this {@code
* formalstream} after discarding the first oCount elements of the stream.
* {@return a {@code formalstream} consisting of the remaining elements of this {@code
* formalstream} after discarding the first oCount elements of the stream}
*
* @param oCount the number of leading elements to skip.
* @return a skipped stream.
* @throws PsyRangeCheckException when oCount is negative.
*/
default public PsyFormalStream<T> psySkipped(final PsyInteger oCount)
Expand All @@ -112,11 +109,10 @@ public Stream<T> stream()
}

/**
* Returns a {@code formalstream} consisting of the elements of this
* {@code formalstream}, truncated to be no longer than oCount in length.
* {@return a {@code formalstream} consisting of the elements of this {@code formalstream},
* truncated to be no longer than oCount in length}
*
* @param oCount the number of elements the stream should be limited to.
* @return a limited stream.
* @throws PsyRangeCheckException when oCount is negative.
*/
default public PsyFormalStream<T> psyLimited(final PsyInteger oCount)
Expand Down Expand Up @@ -149,11 +145,10 @@ public Stream<T> stream()
}

/**
* Returns a stream over elements of this stream that satisfies the given predicate.
* {@return a stream over elements of this stream that satisfies the given predicate}
*
* @param oPredicate a predicate.
* @param oContext a context in which a predicate is called.
* @return a filtered stream.
* @throws PsyErrorException TODO
*/
default public PsyFormalStream<T> psyFiltered(final PsyExecutable oPredicate, final PsyContext oContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@

import coneforest.psylla.runtime.*;

/**
* The representation of the {@code ioerror} error thrown when I/O exception of some sort has
* occurred.
*/
@ErrorType("ioerror")
public class PsyIOErrorException
extends PsyErrorException
{
/**
* Constructs a new {@code exception} object with null as its detail message.
*/
public PsyIOErrorException()
{
super();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@
public class PsyLimitCheckException
extends PsyErrorException
{
/**
* Constructs a new {@code exception} object with null as its detail message.
*/
public PsyLimitCheckException()
{
super();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,25 @@
public interface PsyMultiplicative<T extends PsyMultiplicative>
extends PsyObject
{
/**
* {@return the multiplicative inverse of this object}
*
* @throws PsyUndefinedResultException if this object is zero.
*/
public T psyReciprocal()
throws PsyUndefinedResultException;

/**
* Returns a result of arithmetic multiplication of given object by this object.
* {@return a result of arithmetic multiplication of this number by given object}
*
* @param oMultiplicative a given object.
* @return a product.
* @param oMultiplicative a given number.
*/
public T psyMul(final T oMultiplicative);

/**
* Returns a result of arithmetic division of this object by given object.
* {@return a result of arithmetic division of this object by given object}
*
* @param oMultiplicative a given object.
* @return a fraction.
* @throws PsyUndefinedResultException when the result of division is not defined.
*/
public T psyDiv(final T oMultiplicative)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@
public class PsyNotDirectoryException
extends PsyErrorException
{
/**
* Constructs a new {@code exception} object with null as its detail message.
*/
public PsyNotDirectoryException()
{
super();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@
public class PsyNotImplementedException
extends PsyErrorException
{
/**
* Constructs a new {@code exception} object with null as its detail message.
*/
public PsyNotImplementedException()
{
super();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@

import coneforest.psylla.runtime.*;

/**
* The representation of {@code notlink} error thrown when a file system operation, intended
* for a symlink, fails because the file is not a symlink.
*/
@ErrorType("notlink")
public class PsyNotLinkException
extends PsyErrorException
{
/**
* Constructs a new {@code exception} object with null as its detail message.
*/
public PsyNotLinkException()
{
super();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,124 +11,90 @@ public sealed interface PsyNumeric
permits PsyComplex, PsyRealNumeric
{
/**
* Returns the real part of this object.
*
* @return the real part.
* {@return the real part of this object}
*/
public double realValue();

/**
* Returns the real part of this object.
*
* @return the imaginary part.
* {@return the imaginary part of this object}
*/
public double imagValue();

/**
* Returns the {@code numeric} absolute value of this object.
*
* @return the {@code numeric} absolute value.
* {@return the {@code numeric} absolute value of this object}
*/
public PsyRealNumeric psyAbs();


/**
* Returns the {@code numeric} signum of this object.
*
* @return the {@code numeric} signum.
* {@return the {@code numeric} signum of this object}
*/
public PsyNumeric psySignum();

public PsyNumeric psyPow(final PsyNumeric oNumeric);

/**
* Returns the {@code numeric} exponent of this object.
*
* @return the {@code numeric} exponent.
* {@return the {@code numeric} exponent of this object}
*/
public PsyNumeric psyExp();

/**
* Returns the {@code numeric} cosine of this object.
*
* @return the {@code numeric} cosine.
* {@return the {@code numeric} cosine of this object}
*/
public PsyNumeric psyCos();

/**
* Returns the {@code numeric} sine of this object.
*
* @return the {@code numeric} sine.
* {@return the {@code numeric} sine of this object}
*/
public PsyNumeric psySin();

/**
* Returns the {@code numeric} tangent of this object.
*
* @return the {@code numeric} tangent.
* {@return the {@code numeric} tangent of this object}
*/
public PsyNumeric psyTan();

/**
* Returns the {@code numeric} natural logarithm of this object.
*
* @return the {@code numeric} natural logarithm.
* {@return the {@code numeric} natural logarithm of this object}
*/
public PsyNumeric psyLog();

/**
* Returns the {@code numeric} arc cosine of this object.
*
* @return the {@code numeric} arc cosine.
* {@return the {@code numeric} arc cosine of this object}
*/
public PsyNumeric psyAcos();

/**
* Returns the {@code numeric} arc sine of this object.
*
* @return the {@code numeric} arc sine.
* {@return the {@code numeric} arc sine of this object}
*/
public PsyNumeric psyAsin();

/**
* Returns the {@code numeric} arc tangent of this object.
*
* @return the {@code numeric} arc tangent.
* {@return the {@code numeric} arc tangent of this object}
*/
public PsyNumeric psyAtan();

/**
* Returns the {@code numeric} square root of this object.
*
* @return the {@code numeric} square root.
* {@return the {@code numeric} square root of this object}
*/
public PsyNumeric psySqrt();

/**
* Returns the {@code numeric} cubic root of this object.
*
* @return the {@code numeric} cubic root.
* {@return the {@code numeric} cubic root of this object}
*/
public PsyNumeric psyCbrt();

/**
* Returns the {@code numeric} hyperbolic cosine of this object.
*
* @return the {@code numeric} hyperbolic cosine.
* {@return the {@code numeric} hyperbolic cosine of this object}
*/
public PsyNumeric psyCosh();

/**
* Returns the {@code numeric} hyperbolic sine of this object.
*
* @return the {@code numeric} hyperbolic sine.
* {@return the {@code numeric} hyperbolic sine of this object}
*/
public PsyNumeric psySinh();

/**
* Returns the {@code numeric} hyperbolic tangent of this object.
*
* @return the {@code numeric} hyperbolic tangent.
* {@return the {@code numeric} hyperbolic tangent of this object}
*/
public PsyNumeric psyTanh();

Expand Down
Loading

0 comments on commit ed8797f

Please sign in to comment.