Package org.eolang

Class PhSafe

  • All Implemented Interfaces:
    Atom, Data, Phi

    public final class PhSafe
    extends Object
    implements Phi, Atom
    An object with coordinates (line and position) and a safe processing of any runtime errors.

    It is used to wrap any object and provide a safe processing of any runtime errors. It is used in the EO runtime to provide a safe processing of any runtime errors in the EO code. If, in any method invocation, a runtime error occurs, it is caught and wrapped into EOerror.ExError with the location of the error in the EO code.

    Since:
    0.21
    • Constructor Detail

      • PhSafe

        public PhSafe​(Phi phi)
        Ctor.
        Parameters:
        phi - The object
      • PhSafe

        public PhSafe​(Phi phi,
                      String prg,
                      int lne,
                      int pos)
        Ctor.
        Parameters:
        phi - The object
        prg - Name of the program
        lne - Line
        pos - Position
      • PhSafe

        public PhSafe​(Phi phi,
                      String prg,
                      int lne,
                      int pos,
                      String loc)
        Ctor.
        Parameters:
        phi - The object
        prg - Name of the program
        lne - Line
        pos - Position
        loc - Location
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • copy

        public Phi copy()
        Description copied from interface: Phi
        Make a copy, leaving it at the same parent.
        Specified by:
        copy in interface Phi
        Returns:
        A copy
      • hasRho

        public boolean hasRho()
        Description copied from interface: Phi
        Returns true if object has bound rho attribute.
        Specified by:
        hasRho in interface Phi
        Returns:
        True if object has rho bound attribute
      • take

        public Phi take​(String name)
        Description copied from interface: Phi
        Take object by name of the attribute.
        Specified by:
        take in interface Phi
        Parameters:
        name - The name of the attribute
        Returns:
        The object
      • put

        public void put​(int pos,
                        Phi object)
        Description copied from interface: Phi
        Put object by position of the attribute.
        Specified by:
        put in interface Phi
        Parameters:
        pos - The position of the attribute.
        object - The object to put
      • put

        public void put​(String nme,
                        Phi object)
        Description copied from interface: Phi
        Put object by name of the attribute.
        Specified by:
        put in interface Phi
        Parameters:
        nme - The name of the attribute.
        object - The object to put
      • locator

        public String locator()
        Description copied from interface: Phi
        Get code locator of the phi.
        Specified by:
        locator in interface Phi
        Returns:
        String containing code locator
      • forma

        public String forma()
        Description copied from interface: Phi
        Get forma of the phi.
        Specified by:
        forma in interface Phi
        Returns:
        Forma of it as String.
      • delta

        public byte[] delta()
        Description copied from interface: Data
        Take the data.
        Specified by:
        delta in interface Data
        Returns:
        The data
      • lambda

        public Phi lambda()
        Description copied from interface: Atom
        Executes λ function and calculates object.
        Specified by:
        lambda in interface Atom
        Returns:
        Object calculated from λ function.