X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scenegraph.profile%2Fsrc%2Forg%2Fsimantics%2Fscenegraph%2Fprofile%2FEvaluationContext.java;fp=bundles%2Forg.simantics.scenegraph.profile%2Fsrc%2Forg%2Fsimantics%2Fscenegraph%2Fprofile%2FEvaluationContext.java;h=96b99552331b4fcac571d8613b7356b5dc517d8f;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/EvaluationContext.java b/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/EvaluationContext.java new file mode 100644 index 000000000..96b995523 --- /dev/null +++ b/bundles/org.simantics.scenegraph.profile/src/org/simantics/scenegraph/profile/EvaluationContext.java @@ -0,0 +1,92 @@ +/******************************************************************************* + * Copyright (c) 2007, 2011 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.scenegraph.profile; + +import org.simantics.db.Resource; +import org.simantics.scenegraph.INode; +import org.simantics.scenegraph.g2d.G2DSceneGraph; + +/** + * @author Antti Villberg + * + * @see ProfileKeys + */ +public interface EvaluationContext extends Observer { + + /** + * @return the runtime resource this evaluation context is attached to (i.e. + * runtime diagram resource) + */ + Resource getResource(); + + /** + * @return the scene graph this profile evaluation context is attached to + */ + G2DSceneGraph getSceneGraph(); + + /** + * Get a constant data item attached to the evaluation context by the + * evaluation system. + * + * @param key + * @return + * @see ProfileKeys + */ + T getConstant(String key); + + /** + * Get the specified temporary property for the specified node. Temporary + * properties are removed between each round of application of currently + * active profile entries. + * + * @param node node to get the property for + * @param key key of property to get + * @return null if property is not set for the specified node + */ + T getTemporaryProperty(INode node, String key); + + /** + * Set value of temporary property for the evaluation process where this + * evaluation context is used. Temporary properties are removed between each + * round of application of currently active profile entries. + * + * @param node node to set the property for + * @param key key of property to set + * @param value value of the property to set + */ + void setTemporaryProperty(INode node, String key, T value); + + /** + * Get the specified (persistent) property for the specified node. These + * properties stay available through the lifetime of the evaluation context + * i.e. the lifetime of the runtime diagram it is associated with. + * + * @param node node to get the property for + * @param key key of property to get + * @return null if property is not set for the specified node + */ + T getProperty(INode node, String key); + + /** + * Set value of temporary property for the evaluation process where this + * evaluation context is used. These properties stay available through the + * lifetime of the evaluation context i.e. the lifetime of the runtime + * diagram it is associated with. + * + * @param node node to set the property for + * @param key key of property to set + * @param value value of the property to set + * @return previous value of property + */ + T setProperty(INode node, String key, T value); + +}