From a21003fa78091ecea6b057a19af959d5c8382176 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 14 Sep 2018 16:13:29 +0800 Subject: [PATCH] add PsychomatrixDescriptions JSONSchema, en_US pre-descriptions and default simple descriptions system --- .../domain/entities/CeilDescription.kt | 3 +- .../CeilDescriptionResolver.kt | 17 ++++ .../models/CeilCharacteristic.kt | 3 + .../models/CeilDescriptionConfig.kt | 25 +++++ .../models/CeilsDescriptionsRoot.kt | 17 ++++ .../PsychomatrixBase/utils/FilesLoader.kt | 8 ++ src/main/res/PsychomatrixDescriptions.json | 54 +++++++++++ src/main/res/characteristics/en_US.json | 96 +++++++++++++++++++ 8 files changed, 222 insertions(+), 1 deletion(-) create mode 100644 src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/CeilDescriptionResolver.kt create mode 100644 src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/models/CeilCharacteristic.kt create mode 100644 src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/models/CeilDescriptionConfig.kt create mode 100644 src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/models/CeilsDescriptionsRoot.kt create mode 100644 src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/FilesLoader.kt create mode 100644 src/main/res/PsychomatrixDescriptions.json create mode 100644 src/main/res/characteristics/en_US.json diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/entities/CeilDescription.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/entities/CeilDescription.kt index b0f807d..c87ec6f 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/entities/CeilDescription.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/domain/entities/CeilDescription.kt @@ -3,5 +3,6 @@ package com.github.insanusmokrassar.PsychomatrixBase.domain.entities data class CeilDescription( val title: String, val description: String, - val characteristicDescription: String + val characteristicDescription: String, + val note: String? ) diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/CeilDescriptionResolver.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/CeilDescriptionResolver.kt new file mode 100644 index 0000000..5c6d1ad --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/CeilDescriptionResolver.kt @@ -0,0 +1,17 @@ +package com.github.insanusmokrassar.PsychomatrixBase.utils.CeilDescriptions + +import com.github.insanusmokrassar.PsychomatrixBase.utils.CeilDescriptions.models.CeilsDescriptionsRoot +import com.github.insanusmokrassar.PsychomatrixBase.utils.load +import com.google.gson.Gson +import com.google.gson.GsonBuilder +import java.io.InputStreamReader + +const val characteristicsFolder = "characteristics" + +private val gson: Gson = GsonBuilder().create() + +fun resolveCeilsDescriptionsByLanguage(language: String = "en_US"): CeilsDescriptionsRoot { + return load("$characteristicsFolder/$language.json").let { + gson.fromJson(InputStreamReader(it), CeilsDescriptionsRoot::class.java) + } +} diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/models/CeilCharacteristic.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/models/CeilCharacteristic.kt new file mode 100644 index 0000000..a179727 --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/models/CeilCharacteristic.kt @@ -0,0 +1,3 @@ +package com.github.insanusmokrassar.PsychomatrixBase.utils.CeilDescriptions.models + +typealias CeilCharacteristic = String diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/models/CeilDescriptionConfig.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/models/CeilDescriptionConfig.kt new file mode 100644 index 0000000..94d2c84 --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/models/CeilDescriptionConfig.kt @@ -0,0 +1,25 @@ +package com.github.insanusmokrassar.PsychomatrixBase.utils.CeilDescriptions.models + +import com.github.insanusmokrassar.PsychomatrixBase.domain.entities.CeilDescription + +data class CeilDescriptionConfig( + val title: String = "", + val description: String = "", + val note: String? = null, + val characteristics: List = emptyList() +) { + fun toCeilDescription(countOfCharacteristic: Int): CeilDescription { + return CeilDescription( + title, + description, + countOfCharacteristic.let { + if (characteristics.size <= it) { + characteristics.lastOrNull() ?: description + } else { + characteristics[it] + } + }, + note + ) + } +} diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/models/CeilsDescriptionsRoot.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/models/CeilsDescriptionsRoot.kt new file mode 100644 index 0000000..6f15c48 --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/CeilDescriptions/models/CeilsDescriptionsRoot.kt @@ -0,0 +1,17 @@ +package com.github.insanusmokrassar.PsychomatrixBase.utils.CeilDescriptions.models + +import com.github.insanusmokrassar.PsychomatrixBase.domain.entities.CeilDescription +import com.github.insanusmokrassar.PsychomatrixBase.domain.entities.PsychomatrixCeilInfo + +data class CeilsDescriptionsRoot( + val language: String? = "en_US", + private val descriptionsList: List> = emptyList() +) { + fun resolveCeilDescription( + psychomatrixCeilInfo: PsychomatrixCeilInfo + ): CeilDescription { + return descriptionsList[psychomatrixCeilInfo.x][psychomatrixCeilInfo.y].toCeilDescription( + psychomatrixCeilInfo.count ?: 0 + ) + } +} diff --git a/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/FilesLoader.kt b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/FilesLoader.kt new file mode 100644 index 0000000..bdea213 --- /dev/null +++ b/src/main/kotlin/com/github/insanusmokrassar/PsychomatrixBase/utils/FilesLoader.kt @@ -0,0 +1,8 @@ +package com.github.insanusmokrassar.PsychomatrixBase.utils + +import java.io.FileInputStream +import java.io.InputStream + +fun load(filename: String) : InputStream { + return (ClassLoader.getSystemResourceAsStream(filename) ?: FileInputStream(filename)) +} diff --git a/src/main/res/PsychomatrixDescriptions.json b/src/main/res/PsychomatrixDescriptions.json new file mode 100644 index 0000000..485ce47 --- /dev/null +++ b/src/main/res/PsychomatrixDescriptions.json @@ -0,0 +1,54 @@ +{ + "properties": { + "language": { + "title": "language", + "pattern": "[a-z]{2}_[A-Z]{2}", + "type": "string" + }, + "descriptionsList": { + "title": "descriptionsColumns", + "$id": "columns", + "type": "array", + "maxItems": 4, + "minItems": 4, + "items": { + "title": "descriptionsRows", + "$id": "rows", + "type": "array", + "maxItems": 5, + "minItems": 5, + "items": { + "type": "object", + "properties": { + "title": { + "title": "title", + "type": "string", + "maxLength": 150 + }, + "description": { + "title": "description", + "type": "string", + "maxLength": 900 + }, + "note": { + "title": "note", + "type": "string" + }, + "characteristics": { + "title": "characteristics", + "type": "array", + "minItems": 1, + "items": { + "type": "string" + } + } + }, + "required": [ + "title", + "description" + ] + } + } + } + } +} \ No newline at end of file diff --git a/src/main/res/characteristics/en_US.json b/src/main/res/characteristics/en_US.json new file mode 100644 index 0000000..be4d1be --- /dev/null +++ b/src/main/res/characteristics/en_US.json @@ -0,0 +1,96 @@ +{ + "language": "en_US", + "descriptionsList": [ + [ + {}, + { + "title": "Temperament and persistence of person", + "description": "The nature of person, his strong will, the desire for sway, the ability to defend his views." + }, + { + "title": "Energy", + "description": "Energy of interaction with other people", + "note": "Issues of vampirism and the donation always refers specifically to the energy, which is responsible for number 2. Can we say that there are people-vampires and people-donors? In the conventional form they are not. This is due to the fact that at certain moments of life, each of us can behave like a vampire (illness, fatigue, hunger, pain, fear, anger) and as a donor (help the other, after eating, in a good mood). It is necessary to understand that at any conversation one person takes a position of the donor, then another — the vampire. How to determine who took what position, especially since the roles can change at any time. That will serve as a donor who begins to speak in the interests of another (about he/she). The person who is talking (or he/she starts talking about himself, his interests), becomes a vampire. Way to protect against such vampirism is very simple: it is necessary to start talking about yourself and the other person will lose interest in you. If you want to continue the conversation, always talk about the your interlocutor, about his problems — then he gets energy and will always be ready to support the conversation further. Anyone can get energy from food, drink, air, dialogue, intimacy, qigong exercises, yoga, u-Shu. Especially active inflow of energy — wine and drugs, which is why people are drawn to them, but they suppress and kill the body." + }, + { + "title": "Interest to environment", + "description": "Interest in exact Sciences and engineering or (oppositely) - humanities", + "note": "When you begin to evaluate this number in the psychomatrix, do not forget that it is included in several lines — the first column, the ascending diagonal and the third row. This is very important to know and remember when determining the impact of the number 3.\nThe fact is that not all people can clearly reveal themselves in the Sciences. This is due to the fact that this requires a certain set of numbers: 22, 55, 9 (or more), 33 (or more), when it comes to the exact Sciences. But if a person is interested in the Humanities, the presence of numbers is not necessary, while the count of numbers should be at least two.\nIf a person does not have a lot of 5 or 9, then science classes become problematic, which invariably affects the interests of the person, since the number 3 is responsible for the interest of the person in general to anything. To finally decide what is this interest, it is necessary to identify which line of the three entered the number 3." + }, + { + "title": "Self-rating", + "description": "The desire to stand out from the crowd, to seem a brighter personality (mind, conversation, clothing, cosmetics, etc.).", + "note": "Very often in the literature on numerology, the first column is attributed to the quality of egoism. It is understood that the individual's self-esteem is not selfishness with nothing to do, especially because of the selfishness of man will answer another characteristic of Pythagoras. It is necessary to understand that without a sufficiently high self-esteem can not take place any talented, intelligent and gifted person. If someone can't wait to call this as selfishness, I suggest to add a clarification: healthy (normal) selfishness." + } + ], + [ + {}, + { + "title": "Health", + "description": "Very common characteristic which give opportunity to understand just common state of person health", + "note": "Assessing the health of a person by the number of numbers 4, it is necessary to make a comparison with what is actually. If you observe a very sick person who can not solve their problems associated with this disease, then you should identify the causes of his illness (this may not be a medical problem). How to find out the causes of the disease? There are several reasons for the onset of the disease, which is not caused by the disease, but more serious phenomena. For example, a transition of 8 -> 11 or 7 -> 6 that may require usage of 4 (health) to overcome itself." + }, + { + "title": "Logic and intuition", + "description": "It determines the ability of a person to make plans and analyze the situation, to understand the exact Sciences and technology.", + "note": "Have an affect for second column, second row and bot diagonal lines. You must remember that opportunity to solve different tasks can be conditioned by a lot of 9 (opportunity to remember more situations and replay them in different new environment)." + }, + { + "title": "Propensity to physical labor and sway", + "description": "In most cases it is just a propensity to physical labor, but if person try to get the sway by some dishonest ways, his 6 will move him forward to get more sway." + }, + { + "title": "The desire to support a family", + "description": "According to this characteristic person will (or will not) desire to work (and overwork) and do other things for support his/her family." + } + ], + [ + {}, + { + "title": "Luck and uniqueness", + "description": "By simple words it is just luck and uniqueness. But it is assumed that availability of 7 in person psychomatrix say that this person has Nature mark and contain his own part of true knowledge about world." + }, + { + "title": "Kindness, sense of duty to the family, tolerance", + "description": "It is one of most important psychomatrix numbers. Has effect to relationship to family and other environment people." + }, + { + "title": "Mind, memory, clairvoyance", + "description": "This characteristic show the quality of memory of person, his opportunity to remember and replay some scenes, events and other different things", + "note": "Foresee any situation can be the person in whose head has accumulated a lot of experience, which allows you to make an advanced forecast based on a comparison of the conditions of an event with what has already been." + }, + { + "title": "Talent", + "description": "Responsible for what potential is contained in a person", + "note": "Remember: if person want to disclosure he/she self - he/she must put a lot of effort to achieve the result. That means that ALL characteristics are important in correct interpretation of this characteristic." + } + ], + [ + { + "title": "Human intimate life", + "description": "Temperament and need for intimacy.", + "note": "Most often leads to the collapse of the family incompatibility in temperament." + }, + { + "title": "Person determination", + "description": "Human determination, the ability to defend their views, set goals and objectives. This characteristic determine common opportunity to set proposals", + "note": "Be careful, if this characteristic will be overloaded - person will set up overestimated purposes or more purposes that he can realise." + }, + { + "title": "The desire to have a family and be in it", + "description": "In two words - desire of person to create the family and to be in it", + "note": "Difference with 8 in control word \"desire\". That means that person can have desire to create family but if he/she will have no 8 - he will not support it. And opposite with this - if characteristic equal 2 or 3 and contains 88 - person will try hard for family, but will not harry up in creating of it." + }, + { + "title": "Stability", + "description": "Characteristic reflects the human desire for stability and unwillingness to change anything", + "note": "Remember that excessive pursuit of stability can prevent person growing up and moving forward." + }, + { + "title": "Spirituality", + "description": "Human spirituality and the pursuit of something high.", + "note": "If this line contains more than five numbers (6 and more), then we will talk about the overload of quality, which most often leads to human fanaticism and idolatry, when all human norms begin to distort beyond recognition, taking their complete opposite, which is more like a lack of spirituality." + } + ] + ] +} \ No newline at end of file