From 777b590f307663b285e09361dc2f41a699a30f05 Mon Sep 17 00:00:00 2001 From: besson Date: Sat, 14 Jan 2023 18:37:22 +0100 Subject: [PATCH] =?UTF-8?q?Transf=C3=A9rer=20les=20fichiers=20vers=20'src/?= =?UTF-8?q?JsonInspector'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/JsonInspector/Node.java | 34 +++++++++++++++++++++++++++++++ src/JsonInspector/Parameters.java | 2 ++ 2 files changed, 36 insertions(+) diff --git a/src/JsonInspector/Node.java b/src/JsonInspector/Node.java index 8c71554..7f89e64 100644 --- a/src/JsonInspector/Node.java +++ b/src/JsonInspector/Node.java @@ -1,5 +1,6 @@ package JsonInspector; +import java.awt.*; import java.util.ArrayList; @@ -44,6 +45,39 @@ public class Node { } + public boolean isObject() { + return type == Type.OBJECT; + } + + + public boolean isArray() { + return type == Type.ARRAY; + } + + + public boolean isElement() { + return type == Type.ELEMENT; + } + + + public boolean isPair() { + return type == Type.PAIR; + } + + + public boolean isArrayObjectElement() { + boolean array = type == Type.ARRAY; + boolean object = type == Type.OBJECT; + boolean element = type == Type.ELEMENT; + + if (array || object || element) { + return true; + } + + return false; + } + + @Override public String toString() { String string = name + " : "; diff --git a/src/JsonInspector/Parameters.java b/src/JsonInspector/Parameters.java index 786e7a1..0f07e10 100644 --- a/src/JsonInspector/Parameters.java +++ b/src/JsonInspector/Parameters.java @@ -6,6 +6,8 @@ public class Parameters { public static final Font FILE_FONT = new Font(Font.SANS_SERIF, Font.PLAIN, 18); public static final String IHM_INDENTATION = " "; public static final String CONSOLE_INDENTATION = " "; + public static final String ARRAY_CLOSING = "...]"; + public static final String OBJECT_ELEMENT_CLOSING = "...}"; public static final Color IHM_COLOR = new Color(70, 70, 70); public static final Color KEY_COLOR = new Color(70, 189, 204);