Skip to content

Commit

Permalink
indentation de deux espaces
Browse files Browse the repository at this point in the history
  • Loading branch information
dpo committed Sep 8, 2019
1 parent 829061a commit dae135e
Show file tree
Hide file tree
Showing 3 changed files with 201 additions and 201 deletions.
24 changes: 12 additions & 12 deletions projet/phase1/graph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ abstract type AbstractGraph{T} end
Exemple :
node1 = Node("Joe", 3.14)
node2 = Node("Steve", exp(1))
node3 = Node("Jill", 4.12)
G = Graph("Ick", [node1, node2, node3])
node1 = Node("Joe", 3.14)
node2 = Node("Steve", exp(1))
node3 = Node("Jill", 4.12)
G = Graph("Ick", [node1, node2, node3])
Attention, tous les noeuds doivent avoir des données de même type.
"""
mutable struct Graph{T} <: AbstractGraph{T}
name::String
nodes::Vector{Node{T}}
name::String
nodes::Vector{Node{T}}
end

"""Ajoute un noeud au graphe."""
function add_node!(graph::Graph{T}, node::Node{T}) where T
push!(graph.nodes, node)
graph
push!(graph.nodes, node)
graph
end

# on présume que tous les graphes dérivant d'AbstractGraph
Expand All @@ -39,8 +39,8 @@ nb_nodes(graph::AbstractGraph) = length(graph.nodes)

"""Affiche un graphe"""
function show(graph::Graph)
println("Graph ", name(graph), " has ", nb_nodes(graph), " nodes.")
for node in nodes(graph)
show(node)
end
println("Graph ", name(graph), " has ", nb_nodes(graph), " nodes.")
for node in nodes(graph)
show(node)
end
end
6 changes: 3 additions & 3 deletions projet/phase1/node.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ Exemple:
"""
mutable struct Node{T} <: AbstractNode{T}
name::String
data::T
name::String
data::T
end

# on présume que tous les noeuds dérivant d'AbstractNode
Expand All @@ -28,5 +28,5 @@ data(node::AbstractNode) = node.data

"""Affiche un noeud."""
function show(node::AbstractNode)
println("Node ", name(node), ", data: ", data(node))
println("Node ", name(node), ", data: ", data(node))
end
Loading

0 comments on commit dae135e

Please sign in to comment.