1 /*******************************************************************************
\r
2 * Copyright (c) 2010 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.databoard.accessor.interestset;
14 import org.simantics.databoard.annotations.Optional;
\r
15 import org.simantics.databoard.type.OptionalType;
\r
18 * Interest set of an Optional Type.
21 * @author Toni Kalajainen <toni.kalajainen@vtt.fi>
23 public class OptionalInterestSet extends InterestSet {
25 public static final OptionalInterestSet MONITOR_EVERYTHING = new OptionalInterestSet(true, true, null);
27 /** Interested in the notification of value assignment (excludes the value) */
28 public boolean notification = true;
29 /** Interested in the value (includes change) */
30 public boolean value = true;
31 /** Component intersts, null if no specific interest */
32 public @Optional InterestSet componentInterest;
34 public OptionalInterestSet(boolean notification, boolean value, InterestSet componentInterest) {
35 this.notification = notification;
37 this.componentInterest = componentInterest;
41 * Returns true, if interested in the value or notification
43 * @return true, if interested in the value
45 public boolean inValues() {
46 return value | (componentInterest!=null);
50 * Returns true, if interested in notification of new value assignments.
52 * @return true, if interested in notification
54 public boolean inNotifications() {
55 return notification | value | (componentInterest!=null);
59 * Returns component interest or <code>null</code>
61 * @return interest of component or <code>null</code>
63 public InterestSet getComponentInterest() {
64 return componentInterest;