• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

rocs/RocsCore

  • sources
  • kde-4.12
  • kdeedu
  • rocs
  • RocsCore
  • DataStructures
  • Graph
GraphNode.cpp
Go to the documentation of this file.
1 /*
2  This file is part of Rocs,
3  Copyright 2011 Wagner Reck <wagner.reck@gmail.com>
4  Copyright 2012 Andreas Cord-Landwehr <cola@uni-paderborn.de>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Lesser General Public
8  License as published by the Free Software Foundation; either
9  version 2.1 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public
17  License along with this library. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #include "GraphNode.h"
21 #include "GraphStructure.h"
22 #include "Pointer.h"
23 
24 #include <KLocale>
25 
26 DataPtr GraphNode::create(DataStructurePtr parent, int uniqueIdentifier, int dataType)
27 {
28  return Data::create<GraphNode>(parent, uniqueIdentifier, dataType);
29 }
30 
31 GraphNode::GraphNode(DataStructurePtr parent, int uniqueIdentifier, int dataType) :
32  Data(parent, uniqueIdentifier, dataType)
33 {
34 }
35 
36 void GraphNode::setEngine(QScriptEngine* _engine)
37 {
38  Data::setEngine(_engine);
39 }
40 
41 GraphNode::~GraphNode()
42 {
43 }
44 
45 QScriptValue GraphNode::edges()
46 {
47  return edges(0);
48 }
49 
50 QScriptValue GraphNode::edges(int type)
51 {
52  return Data::adj_pointers(type);
53 }
54 
55 QScriptValue GraphNode::inEdges()
56 {
57  return Data::input_pointers();
58 }
59 
60 QScriptValue GraphNode::outEdges()
61 {
62  return outEdges(0);
63 }
64 
65 QScriptValue GraphNode::outEdges(int type)
66 {
67  return Data::output_pointers(type);
68 }
69 
70 QScriptValue GraphNode::inEdges(int type)
71 {
72  return Data::input_pointers(type);
73 }
74 
75 QScriptValue GraphNode::neighbors()
76 {
77  //TODO ensure that direction of edges is respected (this should already be the case but not unit-tested!
78  return Data::adj_data();
79 }
80 
81 QScriptValue GraphNode::edgesTo(Data* node)
82 {
83  if (node == 0) {
84  return QScriptValue();
85  }
86  return Data::connected_pointers(node);
87 }
88 
89 QScriptValue GraphNode::adj_nodes()
90 {
91  emit scriptError(i18n("The method \"%1\" is deprecated, please use \"%2\" instead.",
92  QString("adj_nodes()"),
93  QString("neighbors()")));
94  return Data::adj_data();
95 }
96 
97 QScriptValue GraphNode::adj_edges()
98 {
99  emit scriptError(i18n("The method \"%1\" is deprecated, please use \"%2\" instead.",
100  QString("adj_edges()"),
101  QString("edges()")));
102  return Data::adj_pointers();
103 }
104 
105 QScriptValue GraphNode::connected_edges(Data* n)
106 {
107  emit scriptError(i18n("The method \"%1\" is deprecated, please use \"%2\" instead.",
108  QString("connected_edges(node)"),
109  QString("edgesTo(node)")));
110  if (n == 0) {
111  return QScriptValue();
112  }
113  return Data::connected_pointers(n);
114 }
115 
116 QScriptValue GraphNode::input_edges()
117 {
118  emit scriptError(i18n("The method \"%1\" is deprecated, please use \"%2\" instead.",
119  QString("input_edges()"),
120  QString("inEdges()")));
121  return Data::input_pointers();
122 }
123 
124 QScriptValue GraphNode::output_edges()
125 {
126  emit scriptError(i18n("The method \"%1\" is deprecated, please use \"%2\" instead.",
127  QString("output_edges()"),
128  QString("outEdges()")));
129  return Data::output_pointers();
130 }
131 
132 QScriptValue GraphNode::overlay_edges(int overlay)
133 {
134  emit scriptError(i18n("The method \"%1\" is deprecated, please use \"%2\" instead.",
135  QString("edges(overlay)"),
136  QString("edges(type)")));
137  return Data::output_pointers(overlay);
138 }
GraphNode::outEdges
Q_INVOKABLE QScriptValue outEdges()
Definition: GraphNode.cpp:60
Data::adj_data
QScriptValue adj_data()
Definition: Data.cpp:513
Data::setEngine
virtual void setEngine(QScriptEngine *_engine)
Set script engine.
Definition: Data.cpp:476
GraphNode.h
DataStructurePtr
boost::shared_ptr< DataStructure > DataStructurePtr
Definition: CoreTypes.h:38
GraphNode::output_edges
QScriptValue output_edges()
Definition: GraphNode.cpp:124
GraphNode::overlay_edges
QScriptValue overlay_edges(int overlay)
Gives array of edges at specified overlay if present.
Definition: GraphNode.cpp:132
Data::dataType
int dataType() const
Definition: Data.cpp:387
GraphStructure.h
GraphNode::edgesTo
Q_INVOKABLE QScriptValue edgesTo(Data *node)
Definition: GraphNode.cpp:81
Data::connected_pointers
QScriptValue connected_pointers(Data *n)
Definition: Data.cpp:577
GraphNode::setEngine
virtual void setEngine(QScriptEngine *_engine)
Set script engine.
Definition: GraphNode.cpp:36
GraphNode::adj_edges
QScriptValue adj_edges()
Definition: GraphNode.cpp:97
GraphNode::create
static DataPtr create(DataStructurePtr parent, int uniqueIdentifier, int dataType)
Definition: GraphNode.cpp:26
GraphNode::~GraphNode
virtual ~GraphNode()
Definition: GraphNode.cpp:41
GraphNode::GraphNode
GraphNode(DataStructurePtr parent, int uniqueIdentifier, int dataType)
Definition: GraphNode.cpp:31
GraphNode::neighbors
Q_INVOKABLE QScriptValue neighbors()
Definition: GraphNode.cpp:75
Data::adj_pointers
QScriptValue adj_pointers()
Definition: Data.cpp:523
GraphNode::connected_edges
QScriptValue connected_edges(Data *n)
Definition: GraphNode.cpp:105
GraphNode::scriptError
void scriptError(const QString &message)
GraphNode::input_edges
QScriptValue input_edges()
Definition: GraphNode.cpp:116
Data::input_pointers
QScriptValue input_pointers()
Definition: Data.cpp:541
Pointer.h
DataPtr
boost::shared_ptr< Data > DataPtr
Definition: CoreTypes.h:34
GraphNode::inEdges
Q_INVOKABLE QScriptValue inEdges()
Definition: GraphNode.cpp:55
GraphNode::edges
Q_INVOKABLE QScriptValue edges()
Definition: GraphNode.cpp:45
Data
Definition: Data.h:40
GraphNode::adj_nodes
QScriptValue adj_nodes()
Definition: GraphNode.cpp:89
Data::output_pointers
QScriptValue output_pointers()
Definition: Data.cpp:559
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:42:25 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

rocs/RocsCore

Skip menu "rocs/RocsCore"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal