TopologyAPI provides the functionality to access, manage and store device topologies.

Overview

TopologyAPI

Providing the functionality to access, manage and store device topologies, given different json files each includes one topology, storing them in desk and applying different queries.

Description

  • A topology is a set of electronic and electerical components that are connected together to form a device with some functionality.
  • The API supports the following operations:
    1. Read topology from JSON file and store it in memory.
    2. Write topology into a JSON file and store it in disk.
    3. Query the list of topologies stored in memory.
    4. Query the components of a certain topology.
    5. Query the components that are conneted to each other through a given node in a certain topology.
    6. Delete topology from memory.

Why JAVA is used as the programming language

  • Java is Class based, Object-Oriented Language. So it's a good choice to be used to model the API in an appropriate way.
  • Java is supported by powerful Serialization and Deserialization JSON parsers like GSON, Jackson and JSON.simple.

Used Technologies

TopologyAPI Documentation

TopologyAPI is modeled by three classes as follows:

  • TopologyManager Class: Provides the user with the main functionality to manipulate the topologies through its methods.
  • JsonReadWriteHelper Class: Provides TopologyManager with helper methods to manipulate JSON files, its visibility modifier is default as it's only needed by ToplogyManager to handle JSON files.
  • DataBase Class: Represents the memory source that the TopologyManager uses to store the read topologies, its visibilty modifier is default to make it visible only for the classes in TopologyAPI package, so it's granteed that the user of this package cannot access it.

Notes: If the API supports access to database, DataBase may contain the methods used to store, retrieve and manipulate topologies from database.

The UML Diagram of TopologyManager and JsonReadWriteHelper Class:

picture alt

The UML Diagram of DataBase Class:

picture alt

TopologyManager Documentation:

readJSON(String jsonFilePath):

  • Description: read topology from the given JSON file.
  • Parameters:
    1. jsonFilePath: the path of the given JSON file.
  • Return: void.
  • Throw:
    1. IOException if the path is wrong or no such a file in this path.

writeJSON(String topologyID, String filePath):

  • Description: writes the given topology in a JSON file.
  • Parameters:
    1. topologyID: the ID of the topology that wanted to be written into disk as a JSON file.
    2. filePath: the path of the file that the topology will be written into.
  • Return: void.
  • Throw:
    1. IOException if the path is in wrong.
    2. TopologyIDNotFoundException if there's no topology with the given ID in memory.

queryTopologies():

  • Description: gives the user a copy of the list of topologies currently stored in memory.
  • Parameters: void.
  • Return: ArrayList<Topology>.

queryDevices(String topologyID):

  • Description: gives the user a copy of the list of the components of the given device.
  • Parameters:
    1. topologyID: the ID of the topology to query its components.
  • Return: ArrayList<Device>.
  • Throw:
    1. TopologyIDNotFoundException if there's no topology with the given ID in memory.

queryDevicesWithNetListNode(String topologyID, String node):

  • Description: gives the user a copy of the list of components that are conneted to the given node.
  • Parameters:
    1. topologyID: the ID of the topology.
    2. node: the given node to query components connected to it.
  • Return: ArrayList<Device>.
  • Throw:
    1. TopologyIDNotFoundException if there's no topology with the given ID in memory.

deleteTopology(String topologyID):

  • Description: delete the given topology from the memory.
  • Parameters:
    1. topologyID: the ID of the topology that will be deleted.
  • Return: void.
  • Throw:
    1. TopologyIDNotFoundException if there's no topology with the given ID in memory.

Classes Documentation

The topologies stored in memory is modeled with the following classes:

  • Topology Class: It models the topology as an ID and an array of devices, each element in this array is of type Device.
  • Device Class: It models the device as an ID, type, characteristics and net list.
  • Limit Class: It models the characteristics of each device as a default, minimum, maximum value of (resistance, voltage, etc...).
  • TopologyIDNotFoundException Class: Defines a user-defined-exception to be thrown if the user tried to manipulate a topology in memory while it's not actually stored yet.

The UML Diagram of Topology, Device, and Limit Class: picture alt

Note: The UML Diagram of these classes shows the composition relation between them.

Usage

import TopologyAPI.*;

Testing

  • Unit tests is provided by TestTopologyAPI class which is defined here.
  • TestTopologyAPI contains test methods for all TopologyManager methods.
  • You can run the whole TestTopologyAPI class or run individual methods.
  • Output of Junit5 testing process from IntelliJ:

picture alt

You might also like...

A modern and lightweight library for working with email addresses in Java

JMail A modern, fast, zero-dependency library for working with email addresses and performing email address validation in Java. Built for Java 8 and u

Dec 22, 2022

SoupPvP core, with kits, guilds, configurability and more.

SoupPvP Wiki Before you read any of this, most/all of this information and even more can be found on the wiki. The wiki states all information that yo

Jul 21, 2022

for people who doesn't know how to left click and right click at mach 10 speed.

AutoSignKick | pretty much useless for someone who know what mouse is a chinese module that helps you left click and right click at mach 10 speed How

Dec 2, 2022

Core classes for Skija, JWM and HumbleUI

Core types for Skija, JWM and HumbleUI Dependency Key Value groupId io.github.humbleui artifactId types version Building from source Prerequisites: Sh

Apr 24, 2022

✔️ Simple, pretty and powerful logger for android

✔️ Simple, pretty and powerful logger for android

Logger Simple, pretty and powerful logger for android Setup Download implementation 'com.orhanobut:logger:2.2.0' Initialize Logger.addLogAdapter(new A

Jan 5, 2023

Generate getter and setter on Java with ease! PS: Intended to use for labs where typing them are still the norm!!

Generate getter and setter on Java with ease! PS: Intended to use for labs where typing them are still the norm!!

GenerateGetterSetter Generate getter and setter on Java with ease! PS: Intended to use for labs where typing them are still the norm!! How to use Clon

Jan 4, 2022

A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back

A universal types-preserving Java serialization library that can convert arbitrary Java Objects into JSON and back, with a transparent support of any kind of self-references and with a full Java 9 compatibility.

Dec 30, 2021

JBehave is a BDD framework for Java and all JVM languages

JBehave is a BDD framework for Java and all JVM languages (Groovy, Kotlin, Ruby, Scala).

Oct 26, 2022

Framework for serialization to Json, XML, Byte and Excel, therefore an oviparous wool milk sow J

Framework for serialization to Json, XML, Byte and Excel, therefore an oviparous wool milk sow J

NetworkParser Framework for serialization from Java objects to Json, XML and Byte. NetworkParser is a simple framework for serializing complex model s

Nov 18, 2020
Owner
Islam Walid
Computer Science and Engineering student
Islam Walid
Android processing and secured library for managing SharedPreferences as key-value elements efficiently and structurally.

Memo Android processing and secured library for managing SharedPreferences as key-value elements efficiently and structurally. 1. Depend on our librar

ZeoFlow 18 Jun 30, 2022
A JSON Transmission Protocol and an ORM Library for automatically providing APIs and Docs.

?? 零代码、热更新、全自动 ORM 库,后端接口和文档零代码,前端(客户端) 定制返回 JSON 的数据和结构。 ?? A JSON Transmission Protocol and an ORM Library for automatically providing APIs and Docs.

Tencent 14.4k Dec 31, 2022
Weld, including integrations for Servlet containers and Java SE, examples and documentation

Weld Weld is the reference implementation of CDI: Contexts and Dependency Injection for the Java EE Platform which is the Java standard for dependency

Weld 345 Oct 28, 2022
A Java serialization/deserialization library to convert Java Objects into JSON and back

Gson Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to a

Google 21.7k Jan 8, 2023
Set of support modules for Java 8 datatypes (Optionals, date/time) and features (parameter names)

Overview This is a multi-module umbrella project for Jackson modules needed to support Java 8 features, especially with Jackson 2.x that only requires

FasterXML, LLC 372 Dec 23, 2022
Screaming fast JSON parsing and serialization library for Android.

#LoganSquare The fastest JSON parsing and serializing library available for Android. Based on Jackson's streaming API, LoganSquare is able to consiste

BlueLine Labs 3.2k Dec 18, 2022
A modern JSON library for Kotlin and Java.

Moshi Moshi is a modern JSON library for Android and Java. It makes it easy to parse JSON into Java objects: String json = ...; Moshi moshi = new Mos

Square 8.7k Dec 31, 2022
JSON query and transformation language

JSLT JSLT is a complete query and transformation language for JSON. The language design is inspired by jq, XPath, and XQuery. JSLT can be used as: a q

Schibsted Media Group 510 Dec 30, 2022
Generate Java types from JSON or JSON Schema and annotates those types for data-binding with Jackson, Gson, etc

jsonschema2pojo jsonschema2pojo generates Java types from JSON Schema (or example JSON) and can annotate those types for data-binding with Jackson 2.x

Joe Littlejohn 5.9k Jan 5, 2023
A JSON Schema validation implementation in pure Java, which aims for correctness and performance, in that order

Read me first The current version of this project is licensed under both LGPLv3 (or later) and ASL 2.0. The old version (2.0.x) was licensed under LGP

Java Json Tools 1.5k Jan 4, 2023