Class ShareCall<S,T>
- java.lang.Object
-
- org.protelis.lang.interpreter.impl.AbstractProtelisAST<T>
-
- org.protelis.lang.interpreter.impl.AbstractPersistedTree<S,T>
-
- org.protelis.lang.interpreter.impl.ShareCall<S,T>
-
- Type Parameters:
S- superscript / export typeT- returned type
- All Implemented Interfaces:
java.io.Serializable,ProtelisAST<T>,WithBytecode
public final class ShareCall<S,T> extends AbstractPersistedTree<S,T>
Share construct. Supersedes the previous rep implementation. See publication at: https://lmcs.episciences.org/6816- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ShareCall(Metadata metadata, com.google.common.base.Optional<Reference> localName, com.google.common.base.Optional<Reference> fieldName, ProtelisAST<S> init, ProtelisAST<S> body, com.google.common.base.Optional<ProtelisAST<T>> yield)ShareCall(Metadata metadata, java.util.Optional<Reference> localName, java.util.Optional<Reference> fieldName, ProtelisAST<S> init, ProtelisAST<S> body, java.util.Optional<ProtelisAST<T>> yield)Convenience constructor withOptional.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tevaluate(ExecutionContext context)Evaluates this AST node.BytecodegetBytecode()java.lang.StringgetName()com.google.common.base.Optional<AbstractProtelisAST<T>>getYieldExpression()java.lang.StringtoString()-
Methods inherited from class org.protelis.lang.interpreter.impl.AbstractPersistedTree
loadState, saveState
-
Methods inherited from class org.protelis.lang.interpreter.impl.AbstractProtelisAST
branchesToString, branchesToString, eval, forEach, forEachWithIndex, getBranch, getBranches, getBranchesNumber, getMetadata, isNullable, stringFor
-
-
-
-
Constructor Detail
-
ShareCall
public ShareCall(@Nonnull Metadata metadata, @Nonnull java.util.Optional<Reference> localName, @Nonnull java.util.Optional<Reference> fieldName, @Nonnull ProtelisAST<S> init, @Nonnull ProtelisAST<S> body, @Nonnull java.util.Optional<ProtelisAST<T>> yield)Convenience constructor withOptional.- Parameters:
metadata- AMetadataobject containing information about the code that generated this AST node.localName- variable namefieldName- name of the field versioninit- initial valuebody- bodyyield- body
-
ShareCall
public ShareCall(@Nonnull Metadata metadata, @Nonnull com.google.common.base.Optional<Reference> localName, @Nonnull com.google.common.base.Optional<Reference> fieldName, @Nonnull ProtelisAST<S> init, @Nonnull ProtelisAST<S> body, @Nonnull com.google.common.base.Optional<ProtelisAST<T>> yield)- Parameters:
metadata- AMetadataobject containing information about the code that generated this AST node.localName- variable namefieldName- name of the field versioninit- initial valuebody- bodyyield- body
-
-
Method Detail
-
evaluate
public T evaluate(ExecutionContext context)
Description copied from class:AbstractProtelisASTEvaluates this AST node. This method can throw any exception,AbstractProtelisASTtakes care of storing the necessary metadata.- Specified by:
evaluatein classAbstractProtelisAST<T>- Parameters:
context- the execution context- Returns:
- the result of the evaluation
-
getName
public java.lang.String getName()
Description copied from class:AbstractProtelisAST- Specified by:
getNamein interfaceProtelisAST<S>- Overrides:
getNamein classAbstractProtelisAST<T>- Returns:
- The name of the operation
-
getYieldExpression
public com.google.common.base.Optional<AbstractProtelisAST<T>> getYieldExpression()
- Returns:
- an
Optionalcontaining theProtelisASTrepresenting the yield expression, or anOptional.absent()otherwise.
-
toString
public java.lang.String toString()
Description copied from class:AbstractPersistedTree- Specified by:
toStringin classAbstractPersistedTree<S,T>
-
-