$darkmode
DENOPTIM
AttachmentPointQuery.java
Go to the documentation of this file.
1/*
2 * DENOPTIM
3 * Copyright (C) 2026 Marco Foscato <marco.foscato@uib.no>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package denoptim.graph;
20
25{
29 private Long apID = null;
30
34 private Integer apIndex = null;
35
39 private APClass apClass = null;
40
44 private VertexQuery vertexQuery = null;
45
49 private EdgeQuery edgeQuery = null;
50
56
57//------------------------------------------------------------------------------
58
63 {
64 }
65
66//------------------------------------------------------------------------------
67
80 {
81 this.apID = apID;
82 this.apIndex = apIndex;
83 this.apClass = apClass;
84 this.vertexQuery = vertexQuery;
85 this.edgeQuery = edgeQuery;
86 this.linkedAPQuery = linkedAPQuery;
87 }
88
89//------------------------------------------------------------------------------
90
98 public boolean matches(AttachmentPoint ap)
99 {
100 if (apID != null && ap.getID() != apID)
101 {
102 return false;
103 }
104
105 if (apIndex != null
106 && ap.getIndexInOwner() != apIndex)
107 {
108 return false;
109 }
110
111 if (apClass != null)
112 {
113 if (ap.getAPClass() == null || !ap.getAPClass().equals(apClass))
114 {
115 return false;
116 }
117 }
118
119 if (vertexQuery != null)
120 {
121 Vertex owner = ap.getOwner();
122 if (owner == null
123 || !vertexQuery.matches(owner))
124 {
125 return false;
126 }
127 }
128
129 if (edgeQuery != null)
130 {
131 Edge user = ap.getEdgeUser();
132 if (user == null || !edgeQuery.matches(user))
133 {
134 return false;
135 }
136 }
137
138 if (linkedAPQuery != null)
139 {
140 AttachmentPoint linkedAP = ap.getLinkedAP();
141 if (linkedAP == null || !linkedAPQuery.matches(linkedAP))
142 {
143 return false;
144 }
145 }
146 return true;
147 }
148
149//------------------------------------------------------------------------------
150}
boolean equals(Object o)
Definition: APClass.java:516
An attachment point (AP) is a possibility to attach a Vertex onto the vertex holding the AP (i....
AttachmentPoint getLinkedAP()
Gets the attachment point (AP) that is connected to this AP via the edge user.
APClass getAPClass()
Returns the Attachment Point class.
int getID()
Returns a unique integer that is used to sort list of attachment points.
Edge getEdgeUser()
Gets the edge that is using this AP, or null if no edge is using this AP.
Query for searching AttachmentPoints.
APClass apClass
Query on the APClass of the target attachment point, or null.
Integer apIndex
Query on the index of the target attachment point, or null.
VertexQuery vertexQuery
Query on vertex owning the target attachment point, or null.
AttachmentPointQuery()
Constructor for an empty query.
Long apID
Query on the unique identifier of the target attachment point, or null.
EdgeQuery edgeQuery
Query on the Edge using the target attachment point, or null.
AttachmentPointQuery(Long apID, Integer apIndex, APClass apClass, VertexQuery vertexQuery, EdgeQuery edgeQuery, AttachmentPointQuery linkedAPQuery)
Constructor from individual criteria.
AttachmentPointQuery linkedAPQuery
Query defining the attachment point linked by an edge to the target attachment point,...
boolean matches(AttachmentPoint ap)
Tests whether the given attachment point satisfies all non-null criteria in this query.
This class represents the edge between two vertices.
Definition: Edge.java:38
A query for edges: a list of properties that target edges should possess in order to match this query...
Definition: EdgeQuery.java:28
boolean matches(Edge e)
Tests whether the given edge satisfies this query.
Definition: EdgeQuery.java:97
A vertex is a data structure that has an identity and holds a list of AttachmentPoints.
Definition: Vertex.java:61
Query for searching vertices.
boolean matches(Vertex v)
Tests whether the given vertex satisfies all non-null criteria in this query.