All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sarl.api.probing.Probe.sarl Maven / Gradle / Ivy

The newest version!
/*
 * $Id$
 *
 * SARL is an general-purpose agent programming language.
 * More details on http://www.sarl.io
 *
 * Copyright (C) 2014-2023 SARL.io, the Original Authors and Main Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package io.sarl.api.probing

import java.net.URI

/** 
 * Probe implementation.
 * 
 * @param  the type of value that is obtained by the probe.
 * @author Stéphane Galland
 * @version api.probing 0.13.0 20230919-093058
 * @mavengroupid io.sarl.sdk
 * @mavenartifactid api.probing
 * @since 0.12
 */
interface Probe {


	/** Replies the name of the probe
	 */
	@Pure
	def getName : String

	/** Replies the probed component.
	 */
	@Pure
	def getUri : URI
	
	/** Replies the probed value.
	 */
	@Pure
	def getValue : T

	/** The type of the value.
	 */
	@Pure
	def getType : Class

	/** Change the probed value.
	 *
	 * @param v the new value.
	 */
	def setValue(v : T)

	/** Force the synchronization of the probed value.
	 *
	 * 

The synchronization does nothing if the probe is {@link #isActive() inactive}. * * @param forceReading indicates if the reading of the probed value must be forced from the probed element. * By default, the value of this parameter is {@code true}. * @param forceIfInactiveObject indicates if the synchronization must be done even if the probe is inactive; * By default, the value of this parameter is {@code false}. */ def sync(forceReading : boolean = true, forceIfInactiveObject : boolean = false) /** Releases any resource associated to the probe. */ def release /** Add listener on probe changes. */ def addProbeListener(listener : IProbeListener) /** Remove listener on probe changes. */ def removeProbeListener(listener : IProbeListener) /** Add listener on probe release. */ def addProbeReleaseListener(listener : IProbeReleaseListener) /** Remove listener on probe release. */ def removeProbeReleaseListener(listener : IProbeReleaseListener) /** Replies if this probe is active. When a probe is active, it could * be synchronized to the probed element. * * @return {@code true} if the probe is active. */ @Pure def isActive : boolean /** Replies if this probe is invalid. When a probe is invalid, * the exhibited value may not corresponds to the probed element's value. * * @return {@code true} if the probe is invalid. */ @Pure def isInvalid : boolean }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy