-
Notifications
You must be signed in to change notification settings - Fork 85
/
PhysicalLinkSource.java
40 lines (35 loc) · 1.27 KB
/
PhysicalLinkSource.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*******************************************************************************
* Copyright (c) 2023 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 - initial API and implementation
*******************************************************************************/
package org.polarsys.capella.core.semantic.queries.basic.queries;
import java.util.Collections;
import java.util.List;
import org.polarsys.capella.common.helpers.query.IQuery;
import org.polarsys.capella.core.data.cs.PhysicalLink;
import org.polarsys.capella.core.data.helpers.cs.services.PhysicalLinkExt;
import org.polarsys.capella.core.data.information.Port;
/**
* return source @Port of a given @PhysicalLink
*/
public class PhysicalLinkSource implements IQuery {
@Override
public List<Object> compute(Object object) {
if (object instanceof PhysicalLink) {
PhysicalLink link = (PhysicalLink) object;
Port port = PhysicalLinkExt.getSourcePort(link);
if (null != port) {
return Collections.singletonList(port);
}
}
return Collections.emptyList();
}
}