11/*
2- Encapsule/jsgraph/src/digraph.js
3-
4- Copyright (C) 2014-2015 Christopher D. Russell
2+ Copyright (C) 2014-2016 Christopher D. Russell
53
64 This library is published under the MIT License and is part of the
75 Encapsule Project System in Cloud (SiC) open service architecture.
1412// http://www.boost.org/doc/libs/1_55_0/libs/graph/doc/index.html
1513// http://en.wikipedia.org/wiki/Directed_graph
1614
17- var helperFunctions = require ( './helper-functions ' ) ;
18- var digraphParams = require ( './digraph-in-parameters ' ) ;
19- var digraphImport = require ( './digraph-json-import ' ) ;
20- var digraphExport = require ( './digraph-json-export ' ) ;
15+ var helperFunctions = require ( './arc_core_graph_util ' ) ;
16+ var digraphParams = require ( './arc_core_digraph_in_params ' ) ;
17+ var digraphImport = require ( './arc_core_digraph_import ' ) ;
18+ var digraphExport = require ( './arc_core_digraph_export ' ) ;
2119
2220( function ( ) {
2321 var __bind = function ( method , scope ) { return function ( ) { return method . apply ( scope , arguments ) ; } ; } ;
@@ -43,7 +41,7 @@ var digraphExport = require('./digraph-json-export');
4341 this . inEdges = __bind ( this . inEdges , this ) ;
4442 this . outDegree = __bind ( this . outDegree , this ) ;
4543 this . outEdges = __bind ( this . outEdges , this ) ;
46-
44+
4745 // Edge-scope methods
4846 this . isEdge = __bind ( this . isEdge , this ) ;
4947 this . addEdge = __bind ( this . addEdge , this ) ;
@@ -52,7 +50,7 @@ var digraphExport = require('./digraph-json-export');
5250 this . setEdgeProperty = __bind ( this . setEdgeProperty , this ) ;
5351 this . hasEdgeProperty = __bind ( this . hasEdgeProperty , this ) ;
5452 this . clearEdgeProperty = __bind ( this . clearEdgeProperty , this ) ;
55-
53+
5654 // Digraph-scope methods
5755 this . verticesCount = __bind ( this . verticesCount , this ) ;
5856 this . getVertices = __bind ( this . getVertices , this ) ;
@@ -62,8 +60,9 @@ var digraphExport = require('./digraph-json-export');
6260 this . getRootVertices = __bind ( this . getRootVertices , this ) ;
6361 this . leafVerticesCount = __bind ( this . leafVerticesCount , this ) ;
6462 this . getLeafVertices = __bind ( this . getLeafVertices , this ) ;
65- this . toObject = __bind ( this . toObject , this ) ;
6663 this . toJSON = __bind ( this . toJSON , this ) ;
64+ this . toObject = __bind ( this . toObject , this ) ;
65+ this . stringify = __bind ( this . stringify , this ) ;
6766 this . fromObject = __bind ( this . fromObject , this ) ;
6867 this . fromJSON = __bind ( this . fromJSON , this ) ;
6968
@@ -96,7 +95,7 @@ var digraphExport = require('./digraph-json-export');
9695 if ( helperFunctions . JSType ( string_ ) === '[object String]' ) {
9796 this . _private . name = string_ ;
9897 response . result = true ;
99- } else {
98+ } else {
10099 response . error = "Invalid graph name specified. Expected '[object String]'." ;
101100 }
102101 return response ;
@@ -111,7 +110,7 @@ var digraphExport = require('./digraph-json-export');
111110 if ( helperFunctions . JSType ( string_ ) === '[object String]' ) {
112111 this . _private . description = string_ ;
113112 response . result = true ;
114- } else {
113+ } else {
115114 response . error = "Invalid graph name specified. Expected '[object String]'." ;
116115 }
117116 return response ;
@@ -127,7 +126,7 @@ var digraphExport = require('./digraph-json-export');
127126 var vertex = this . _private . vertexMap [ vertexId_ ] ;
128127 return ( vertex !== null ) && vertex && true || false ;
129128 } ;
130-
129+
131130 /*
132131 request = {
133132 u: vertex ID string
@@ -512,18 +511,22 @@ var digraphExport = require('./digraph-json-export');
512511 return leafVertices ;
513512 } ;
514513
515- DirectedGraph . prototype . toObject = function ( ) {
514+ // toJSON and toObject are identical delegations to digraphExport.exportObject.
515+ DirectedGraph . prototype . toJSON = function ( ) {
516+ return digraphExport . exportObject ( this ) ;
517+ } ;
518+ DirectedGraph . prototype . toObject = function ( ) {
516519 return digraphExport . exportObject ( this ) ;
517520 } ;
518521
519- DirectedGraph . prototype . toJSON = function ( replacer_ , space_ ) {
522+ DirectedGraph . prototype . stringify = function ( replacer_ , space_ ) {
520523 return digraphExport . exportJSON ( this , replacer_ , space_ ) ;
521524 } ;
522525
523526 DirectedGraph . prototype . fromObject = function ( object_ ) {
524527 return digraphImport ( this , object_ ) ;
525528 } ;
526-
529+
527530 DirectedGraph . prototype . fromJSON = function ( json_ ) {
528531 return digraphImport ( this , json_ ) ;
529532 } ;
0 commit comments