-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
\#2873 fix state query for activated elements
Change-Id: I25f3b0e7bdc0a33f147a3b439aa2a3638f0b0b04 Signed-off-by: Anita Matei Gabriel <[email protected]>
- Loading branch information
1 parent
3167b13
commit f268993
Showing
3 changed files
with
70 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 44 additions & 44 deletions
88
...larsys/capella/core/semantic/queries/basic/queries/AbstractStateParentActiveElements.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,44 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2019, 2020 THALES GLOBAL SERVICES. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Thales Global Services - initial API and implementation | ||
*******************************************************************************/ | ||
package org.polarsys.capella.core.semantic.queries.basic.queries; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.polarsys.capella.common.helpers.query.IQuery; | ||
import org.polarsys.capella.core.data.capellacommon.State; | ||
import org.polarsys.capella.core.model.helpers.StateExt; | ||
|
||
public class AbstractStateParentActiveElements implements IQuery { | ||
|
||
/** | ||
* Constructor. | ||
*/ | ||
public AbstractStateParentActiveElements() { | ||
} | ||
|
||
@Override | ||
public List<Object> compute(Object object) { | ||
List<Object> result = new ArrayList<Object>(); | ||
if (object instanceof State) { | ||
State state = (State) object; | ||
|
||
List<Object> subStates = StateExt.getRecursiveSubStates(state); | ||
for (Object obj : subStates) { | ||
result.addAll(StateExt.getActiveElements((State) obj)); | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
} | ||
/******************************************************************************* | ||
* Copyright (c) 2019, 2020 THALES GLOBAL SERVICES. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Thales Global Services - initial API and implementation | ||
*******************************************************************************/ | ||
package org.polarsys.capella.core.semantic.queries.basic.queries; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.polarsys.capella.common.helpers.query.IQuery; | ||
import org.polarsys.capella.core.data.capellacommon.State; | ||
import org.polarsys.capella.core.model.helpers.StateExt; | ||
|
||
public class AbstractStateParentActiveElements implements IQuery { | ||
|
||
/** | ||
* Constructor. | ||
*/ | ||
public AbstractStateParentActiveElements() { | ||
} | ||
|
||
@Override | ||
public List<Object> compute(Object object) { | ||
List<Object> result = new ArrayList<Object>(); | ||
if (object instanceof State) { | ||
State state = (State) object; | ||
|
||
List<State> subStates = StateExt.getNonPseudoRecursiveSubStates(state); | ||
for (Object obj : subStates) { | ||
result.addAll(StateExt.getActiveElements((State) obj)); | ||
} | ||
} | ||
|
||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters