<?php
require_once('../../../Data/Types/Type.php');
require_once('../../../Data/Types/Restrictions.php');
require_once('../../../Data/Types/Set.php');
require_once('../../../Data/Types/UnorderedNode.php');
require_once('../../../Data/Types/Resource/VertexInterface.php');
use Falcraft\Data\Types;
use Falcraft\Data\Types\Type;
echo "Falcraft\\Data\\Types\\UnorderedNode.php Test\n";
echo "------------------------------------------\n\n";
echo "Instantiation -> \n";
$success = true;
echo " parentNode, rightNode, leftNode, offsideNode, auxiliaryNode\n";
$parentNode = $rightNode = $leftNode = $offsideNode = $auxiliaryNode = null;
$testRestrictions = $complexNode = null;
try {
$parentNode = new Types\UnorderedNode();
echo " parentNode identifier - " . $parentNode->getIdentifier() . "\n";
$rightNode = new Types\UnorderedNode();
echo " rightNode identifier - " . $rightNode->getIdentifier() . "\n";
$leftNode = new Types\UnorderedNode();
echo " leftNode identifier - " . $leftNode->getIdentifier() . "\n";
$offsideNode = new Types\UnorderedNode();
echo " offsideNode identifier - " . $offsideNode->getIdentifier() . "\n";
$auxiliaryNode = new Types\UnorderedNode();
echo " auxiliaryNode identifier - " . $auxiliaryNode->getIdentifier() . "\n";
$testRestrictions = new Types\Restrictions(
array(Type::TYPED_OBJECT),
array('Falcraft\\Data\\Types\\Resource\\VertexInterface'));
$complexNode = new Types\UnorderedNode(
new Types\RestrictedSet(array($parentNode), $testRestrictions),
new Types\RestrictedSet(array($rightNode, $leftNode), $testRestrictions),
new Types\RestrictedSet(array($offsideNode), $testRestrictions));
echo " complexNode identifier - " . $complexNode->getIdentifier() . "\n";
} catch (\Exception $e) {
$success = false;
}
if ($success) {
echo "Success!\n";
} else {
echo "Failure...\n";
}
echo "Take Stock of Complex Node -- \n";
echo " NOTE: Mutual Connections Are Not Made in Constructor\n";
echo " Complex Node - " . $complexNode->getIdentifier() . "\n";
echo " (CN) Incoming: \n\n";
var_dump($complexNode->getIncomingArrayIdentifierS());
echo "\n (CN) Mutual: \n\n";
var_dump($complexNode->getMutualArrayIdentifiers());
echo "\n (CN) Outgoing: \n\n";
var_dump($complexNode->getOutgoingArrayIdentifiers());
echo "\n Parent Node - " . $parentNode->getIdentifier() . "\n";
echo " (PN) Incoming: \n\n";
var_dump($parentNode->getIncomingArrayIdentifierS());
echo "\n (PN) Mutual: \n\n";
var_dump($parentNode->getMutualArrayIdentifiers());
echo "\n (PN) Outgoing: \n\n";
var_dump($parentNode->getOutgoingArrayIdentifiers());
echo "\n Left Node - " . $leftNode->getIdentifier() . "\n";
echo " (LN) Incoming: \n\n";
var_dump($leftNode->getIncomingArrayIdentifierS());
echo "\n (LN) Mutual: \n\n";
var_dump($leftNode->getMutualArrayIdentifiers());
echo "\n (LN) Outgoing: \n\n";
var_dump($leftNode->getOutgoingArrayIdentifiers());
echo "\n Right Node - " . $rightNode->getIdentifier() . "\n";
echo " (RN) Incoming: \n\n";
var_dump($rightNode->getIncomingArrayIdentifierS());
echo "\n (RN) Mutual: \n\n";
var_dump($rightNode->getMutualArrayIdentifiers());
echo "\n (RN) Outgoing: \n\n";
var_dump($rightNode->getOutgoingArrayIdentifiers());
echo "\n Offside Node - " . $offsideNode->getIdentifier() . "\n";
echo " (ON) Incoming: \n\n";
var_dump($offsideNode->getIncomingArrayIdentifierS());
echo "\n (RN) Mutual: \n\n";
var_dump($offsideNode->getMutualArrayIdentifiers());
echo "\n (RN) Outgoing: \n\n";
var_dump($offsideNode->getOutgoingArrayIdentifiers());
echo "\nAdd Mutual Node -> ";
$success = true;
try {
$complexNode->connectMutual($auxiliaryNode);
} catch (\Exception $e) {
$success = false;
}
if ($success) {
echo "Success!\n";
} else {
echo "Failure...\n";
}
echo "Take Stock of Complex Node -- \n";
echo " Complex Node - " . $complexNode->getIdentifier() . "\n";
echo " (CN) Incoming: \n\n";
var_dump($complexNode->getIncomingArrayIdentifierS());
echo "\n (CN) Mutual: \n\n";
var_dump($complexNode->getMutualArrayIdentifiers());
echo "\n (CN) Outgoing: \n\n";
echo "\n Auxiliary Node - " . $auxiliaryNode->getIdentifier() . "\n";
echo " (AN) Incoming: \n\n";
var_dump($auxiliaryNode->getIncomingArrayIdentifiers());
echo "\n (AN) Mutual: \n\n";
var_dump($auxiliaryNode->getMutualArrayIdentifiers());
echo "\n (AN) Outgoing: \n\n";
var_dump($auxiliaryNode->getOutgoingArrayIdentifiers());
echo "\nGraph Construction And Integrity -- \n";
echo " Resetting Nodes -> ";
$success = true;
$parentNode = $leftNode = $rightNode = $offsideNode = $auxiliaryNode = $complexNode = null;
try {
$parentNode = new Types\UnorderedNode();
echo " parentNode identifier - " . $parentNode->getIdentifier() . "\n";
$rightNode = new Types\UnorderedNode();
echo " rightNode identifier - " . $rightNode->getIdentifier() . "\n";
$leftNode = new Types\UnorderedNode();
echo " leftNode identifier - " . $leftNode->getIdentifier() . "\n";
$offsideNode = new Types\UnorderedNode();
echo " offsideNode identifier - " . $offsideNode->getIdentifier() . "\n";
$auxiliaryNode = new Types\UnorderedNode();
echo " auxiliaryNode identifier - " . $auxiliaryNode->getIdentifier() . "\n";
$complexNode = new Types\UnorderedNode();
echo " complexNode identifier - " . $complexNode->getIdentifier() . "\n";
} catch (\Exception $e) {
$success = false;
}
if ($success) {
echo "Success!\n";
} else {
echo "Failure...\n";
}
echo " Connecting parentNode to leftNode -> ";
$success = true;
try {
$parentNode->connectOutgoing($leftNode);
$leftNode->connectIncoming($parentNode);
} catch (\Exception $e) {
$success = false;
}
if ($success) {
echo "Success!\n\n";
echo "Node Internals -- \n\n";
echo " Parent Node - " . $parentNode->getIdentifier() . "\n";
echo " (PN) Incoming: \n\n";
var_dump($parentNode->getIncomingArrayIdentifierS());
echo "\n (PN) Mutual: \n\n";
var_dump($parentNode->getMutualArrayIdentifiers());
echo "\n (PN) Outgoing: \n\n";
var_dump($parentNode->getOutgoingArrayIdentifiers());
echo "\n Left Node - " . $leftNode->getIdentifier() . "\n";
echo " (LN) Incoming: \n\n";
var_dump($leftNode->getIncomingArrayIdentifierS());
echo "\n (LN) Mutual: \n\n";
var_dump($leftNode->getMutualArrayIdentifiers());
echo "\n (LN) Outgoing: \n\n";
var_dump($leftNode->getOutgoingArrayIdentifiers());
echo "\n";
} else {
echo "Failure...\n";
}
echo " Connecting parentNode to rightNode -> ";
$success = true;
try {
$parentNode->connectOutgoing($rightNode);
$rightNode->connectIncoming($parentNode);
} catch (\Exception $e) {
$success = false;
}
if ($success) {
echo "Success!\n\n";
echo "Node Internals -- \n\n";
echo " Parent Node - " . $parentNode->getIdentifier() . "\n";
echo " (PN) Incoming: \n\n";
var_dump($parentNode->getIncomingArrayIdentifierS());
echo "\n (PN) Mutual: \n\n";
var_dump($parentNode->getMutualArrayIdentifiers());
echo "\n (PN) Outgoing: \n\n";
var_dump($parentNode->getOutgoingArrayIdentifiers());
echo "\n Right Node - " . $rightNode->getIdentifier() . "\n";
echo " (RN) Incoming: \n\n";
var_dump($rightNode->getIncomingArrayIdentifierS());
echo "\n (RN) Mutual: \n\n";
var_dump($rightNode->getMutualArrayIdentifiers());
echo "\n (RN) Outgoing: \n\n";
var_dump($rightNode->getOutgoingArrayIdentifiers());
echo "\n";
} else {
echo "Failure...\n";
}
echo " Connecting offsideNode to leftNode -> ";
$success = true;
try {
$offsideNode->connectMutual($leftNode);
} catch (\Exception $e) {
$success = false;
}
if ($success) {
echo "Success!\n\n";
echo "Node Internals -- \n\n";
echo " Offside Node - " . $offsideNode->getIdentifier() . "\n";
echo " (ON) Incoming: \n\n";
var_dump($offsideNode->getIncomingArrayIdentifierS());
echo "\n (ON) Mutual: \n\n";
var_dump($offsideNode->getMutualArrayIdentifiers());
echo "\n (ON) Outgoing: \n\n";
var_dump($offsideNode->getOutgoingArrayIdentifiers());
echo "\n Left Node - " . $leftNode->getIdentifier() . "\n";
echo " (LN) Incoming: \n\n";
var_dump($leftNode->getIncomingArrayIdentifierS());
echo "\n (LN) Mutual: \n\n";
var_dump($leftNode->getMutualArrayIdentifiers());
echo "\n (LN) Outgoing: \n\n";
var_dump($leftNode->getOutgoingArrayIdentifiers());
echo "\n";
} else {
echo "Failure...\n";
}
echo " Disconnecting parentNode from rightNode -> ";
$success = true;
try {
$parentNode->disconnectOutgoing($rightNode);
$rightNode->disconnectIncoming($parentNode);
} catch (\Exception $e) {
$success = false;
}
if ($success) {
echo "Success!\n\n";
echo "Node Internals -- \n\n";
echo " Parent Node - " . $parentNode->getIdentifier() . "\n";
echo " (PN) Incoming: \n\n";
var_dump($parentNode->getIncomingArrayIdentifierS());
echo "\n (PN) Mutual: \n\n";
var_dump($parentNode->getMutualArrayIdentifiers());
echo "\n (PN) Outgoing: \n\n";
var_dump($parentNode->getOutgoingArrayIdentifiers());
echo "\n Right Node - " . $rightNode->getIdentifier() . "\n";
echo " (RN) Incoming: \n\n";
var_dump($rightNode->getIncomingArrayIdentifierS());
echo "\n (RN) Mutual: \n\n";
var_dump($rightNode->getMutualArrayIdentifiers());
echo "\n (RN) Outgoing: \n\n";
var_dump($rightNode->getOutgoingArrayIdentifiers());
echo "\n";
} else {
echo "Failure...\n";
}
echo "Disconnect leftNode from offsideNode -> ";
$success = true;
try {
$leftNode->disconnectMutual($offsideNode);
} catch (\Exception $e) {
$success = false;
}
if ($success) {
echo "Success!\n\n";
echo "Node Internals -- \n\n";
echo " Offside Node - " . $offsideNode->getIdentifier() . "\n";
echo " (ON) Incoming: \n\n";
var_dump($offsideNode->getIncomingArrayIdentifierS());
echo "\n (ON) Mutual: \n\n";
var_dump($offsideNode->getMutualArrayIdentifiers());
echo "\n (ON) Outgoing: \n\n";
var_dump($offsideNode->getOutgoingArrayIdentifiers());
echo "\n Left Node - " . $leftNode->getIdentifier() . "\n";
echo " (LN) Incoming: \n\n";
var_dump($leftNode->getIncomingArrayIdentifierS());
echo "\n (LN) Mutual: \n\n";
var_dump($leftNode->getMutualArrayIdentifiers());
echo "\n (LN) Outgoing: \n\n";
var_dump($leftNode->getOutgoingArrayIdentifiers());
echo "\n";
} else {
echo "Failure...\n";
}
|