1
0
Fork 0

Merge branch '1.2' of github.com:triAGENS/ArangoDB into devel

This commit is contained in:
Frank Celler 2013-01-23 14:42:56 +01:00
commit 64ddbe1385
3 changed files with 44 additions and 0 deletions

View File

@ -74,6 +74,7 @@
/// <li>@ref JSModuleGraphVertexGetId "Vertex.getId"</li>
/// <li>@ref JSModuleGraphVertexGetInEdges "Vertex.getInEdges"</li>
/// <li>@ref JSModuleGraphVertexGetOutEdges "Vertex.getOutEdges"</li>
/// <li>@ref JSModuleGraphVertexGetEdges "Vertex.getEdges"</li>
/// <li>@ref JSModuleGraphVertexGetProperty "Vertex.getProperty"</li>
/// <li>@ref JSModuleGraphVertexGetPropertyKeys "Vertex.getPropertyKeys"</li>
/// <li>@ref JSModuleGraphVertexProperties "Vertex.properties"</li>
@ -173,6 +174,10 @@
/// @copydetails JSF_Vertex_prototype_getOutEdges
/// <hr>
///
/// @anchor JSModuleGraphVertexGetEdges
/// @copydetails JSF_Vertex_prototype_getEdges
/// <hr>
///
/// @anchor JSModuleGraphVertexGetProperty
/// @copydetails JSF_Vertex_prototype_getProperty
/// <hr>

View File

@ -537,6 +537,28 @@ Vertex.prototype.getOutEdges = function () {
return result;
};
////////////////////////////////////////////////////////////////////////////////
/// @brief in- or outbound edges with given label
///
/// @FUN{@FA{vertex}.getEdges(@FA{label}, ...)}
///
/// Returns a list of in- or outbound edges of the @FA{vertex} with given
/// label(s).
////////////////////////////////////////////////////////////////////////////////
Vertex.prototype.getEdges = function () {
var labels = Array.prototype.slice.call(arguments),
result = this.anybound();
if (labels.length > 0) {
result = result.filter(function (edge) {
return (labels.lastIndexOf(edge.getLabel()) > -1);
});
}
return result;
};
////////////////////////////////////////////////////////////////////////////////
/// @brief returns a property of a vertex
///
@ -609,6 +631,22 @@ Vertex.prototype.outbound = function () {
});
};
////////////////////////////////////////////////////////////////////////////////
/// @brief in- or outbound edges
///
/// @FUN{@FA{vertex}.anybound()}
///
/// Returns a list of in- or outbound edges of the @FA{vertex}.
////////////////////////////////////////////////////////////////////////////////
Vertex.prototype.anybound = function () {
var graph = this._graph;
return graph._edges.edges(this._id).map(function (result) {
return graph.constructEdge(result._id);
});
};
////////////////////////////////////////////////////////////////////////////////
/// @brief returns all properties of a vertex
///

View File

@ -417,6 +417,7 @@ function VertexSuite() {
assertEqual([], v2.getOutEdges());
assertEqual(edge.getId(), v1.edges()[0].getId());
assertEqual(edge.getId(), v2.edges()[0].getId());
assertEqual(1, v1.getEdges().length);
},
////////////////////////////////////////////////////////////////////////////////