Package com.graphs.utils.graph
Class GraphProducer<T>
java.lang.Object
com.graphs.utils.graph.GraphProducer<T>
- Type Parameters:
T
- the bounding type stored in given graphs.
This utility class produce instances of
Graph
.- Since:
- 2.0
- Version:
- JDK 1.7
- Author:
- Ćukasz Malara
-
Field Summary
Modifier and TypeFieldDescriptionThis field stores names of available files inFileFinder.RESOURCES_PATH
directory.private final GraphPrinter<T>
This field stores instance ofGraphPrinter
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionnewCompleteGraph
(int startIndex, int size) This method returns a complete graph and prints feedback message.This method returns an empty graph and prints feedback message.newGraphFromFile
(String file) This method returns an optional graph based on a structure defined in a file given as a parameter.
-
Field Details
-
graphPrinter
This field stores instance ofGraphPrinter
- Since:
- 2.0
-
AVAILABLE_FILES
This field stores names of available files inFileFinder.RESOURCES_PATH
directory.- Since:
- 1.0
-
-
Constructor Details
-
GraphProducer
public GraphProducer()
-
-
Method Details
-
newGraphFromFile
This method returns an optional graph based on a structure defined in a file given as a parameter.- Parameters:
file
- name of a file containing graph structure definition.- Returns:
- optional of graph
- Throws:
NegativeVertexIndexException
- if file contains negative number(s).- Since:
- 1.0
-
newEmptyGraph
This method returns an empty graph and prints feedback message.- Returns:
- empty graph
- Since:
- 1.0
-
newCompleteGraph
This method returns a complete graph and prints feedback message.- Parameters:
startIndex
- least index of vertex in returned graphsize
- size of returned graph- Returns:
- complete graph
- Since:
- 1.0
-