$darkmode
DENOPTIM
Node.java
Go to the documentation of this file.
1/*
2 * DENOPTIM
3 * Copyright (C) 2019 Vishwesh Venkatraman <vishwesh.venkatraman@ntnu.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.simplified;
20
21import denoptim.graph.AttachmentPoint;
22import denoptim.graph.Vertex;
23
31public class Node
32{
36 private Vertex vertex = null;
37
41 public String invariant = null;
42
47 public static final String REFTOVERTEXKERNEL = "REFTOVERTEXKERNEL";
48
49//------------------------------------------------------------------------------
50
51 public Node(Vertex v) {
52 this.vertex = v;
54 if (v.isRCV())
55 this.invariant = v.getClass().getSimpleName() + "RCV";
56 else
57 this.invariant = v.getClass().getSimpleName();
58 }
59
60//------------------------------------------------------------------------------
61
62 public Node(AttachmentPoint ap) {
63 this.vertex = null;
64 this.invariant = ap.getAPClass().toString();
65 }
66
67//------------------------------------------------------------------------------
68
70 {
71 return vertex;
72 }
73
74//------------------------------------------------------------------------------
75
76 public int compare(Node other)
77 {
78 if (this.vertex==null && other.vertex!=null)
79 return -1;
80 else if (this.vertex!=null && other.vertex==null)
81 return +1;
82
83 return this.invariant.compareTo(other.invariant);
84 }
85
86//------------------------------------------------------------------------------
87
88 @Override
89 public String toString()
90 {
91 return invariant;
92 }
93
94//------------------------------------------------------------------------------
95
96}
String toString()
Do not use this to make SDF representations.
Definition: APClass.java:352
An attachment point (AP) is a possibility to attach a Vertex onto the vertex holding the AP (i....
APClass getAPClass()
Returns the Attachment Point class.
A vertex is a data structure that has an identity and holds a list of AttachmentPoints.
Definition: Vertex.java:61
void setProperty(Object key, Object property)
Definition: Vertex.java:1148
This class represents a subgraph feature that defined the structure of a graph.
Definition: Node.java:32
int compare(Node other)
Definition: Node.java:76
static final String REFTOVERTEXKERNEL
Property if Vertex used to store the reference to the corresponding Node.
Definition: Node.java:47
Vertex vertex
Reference to the vertex we might be representing.
Definition: Node.java:36
String invariant
Invariant representation used to compare.
Definition: Node.java:41
Node(AttachmentPoint ap)
Definition: Node.java:62