com.xenoamess.cyan_potion.base.DataCenter Maven / Gradle / Ivy
Show all versions of cyan_potion_base Show documentation
// Generated by delombok at Sat May 02 07:05:56 CST 2020
/*
* MIT License
*
* Copyright (c) 2020 XenoAmess
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.xenoamess.cyan_potion.base;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xenoamess.commons.as_final_field.AsFinalField;
import com.xenoamess.cyan_potion.base.setting_file.GameSettings;
import com.xenoamess.multi_language.MultiLanguageStructure;
import com.xenoamess.x8l.X8lTree;
/**
* DataCenter class.
*
* @author XenoAmess
* @version 0.162.2
*/
public class DataCenter extends SubManager {
/**
* Constant MAIN_THREAD_NAME="main"
*/
@SuppressWarnings("unused")
public static final String MAIN_THREAD_NAME = "main";
/**
* Constant MAIN_THREAD_ID=1
*/
public static final long MAIN_THREAD_ID = 1;
/**
* ifMainThread.
*
* @return a boolean.
*/
public static boolean ifMainThread() {
return Thread.currentThread().getId() == MAIN_THREAD_ID;
}
/**
* Constant ALLOW_RUN_WITHOUT_STEAM=true
*/
public static final boolean ALLOW_RUN_WITHOUT_STEAM = true;
/**
* Constant DEFAULT_CONSOLE_PORT=13888
*/
public static final int DEFAULT_CONSOLE_PORT = 13888;
/**
* Constant SCALE=2
*/
public static final int SCALE = 2;
//---final ends---
/**
* the port used to receive console commands.
*/
private int consolePort = DEFAULT_CONSOLE_PORT;
/**
* If true, then will use JXInput
* (using DirectX directly, but can only run in windows.)
* to deal with controller.
*
* If false, then will use Jamepad
* (using SDL, can run on multi-platforms.)
* to deal with controller.
*
* At default it is set to false, meaing we just use Jamepad.
*/
private boolean usingJXInput = false;
private X8lTree patchSettingsTree;
private MultiLanguageStructure textStructure;
@AsFinalField
private GameSettings gameSettings;
/**
*
Constructor for DataCenter.
*
* @param gameManager gameManager
*/
public DataCenter(GameManager gameManager) {
super(gameManager);
}
@SuppressWarnings("unused")
@Override
public void init() {
//do nothing
}
@SuppressWarnings("unused")
@Override
public void update() {
//do nothing
}
@Override
public void close() {
//do nothing
}
@AsFinalField
private static ObjectMapper objectMapper;
/**
* Getter for the field objectMapper
.
*
* @return return
*/
public static ObjectMapper getObjectMapper() {
/*
* lazy init.
* we don't synchronize here,
* because it will not cause any big trouble,
* even if we have multiple objectMappers running at the same time.
*/
if (objectMapper == null) {
ObjectMapper localObjectMapper = new ObjectMapper();
localObjectMapper.enable(JsonParser.Feature.ALLOW_COMMENTS);
objectMapper = localObjectMapper;
}
return objectMapper;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof DataCenter)) return false;
final DataCenter other = (DataCenter) o;
if (!other.canEqual((java.lang.Object) this)) return false;
if (!super.equals(o)) return false;
if (this.getConsolePort() != other.getConsolePort()) return false;
if (this.isUsingJXInput() != other.isUsingJXInput()) return false;
final java.lang.Object this$patchSettingsTree = this.getPatchSettingsTree();
final java.lang.Object other$patchSettingsTree = other.getPatchSettingsTree();
if (this$patchSettingsTree == null ? other$patchSettingsTree != null : !this$patchSettingsTree.equals(other$patchSettingsTree)) return false;
final java.lang.Object this$textStructure = this.getTextStructure();
final java.lang.Object other$textStructure = other.getTextStructure();
if (this$textStructure == null ? other$textStructure != null : !this$textStructure.equals(other$textStructure)) return false;
final java.lang.Object this$gameSettings = this.getGameSettings();
final java.lang.Object other$gameSettings = other.getGameSettings();
if (this$gameSettings == null ? other$gameSettings != null : !this$gameSettings.equals(other$gameSettings)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
protected boolean canEqual(final java.lang.Object other) {
return other instanceof DataCenter;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int hashCode() {
final int PRIME = 59;
int result = super.hashCode();
result = result * PRIME + this.getConsolePort();
result = result * PRIME + (this.isUsingJXInput() ? 79 : 97);
final java.lang.Object $patchSettingsTree = this.getPatchSettingsTree();
result = result * PRIME + ($patchSettingsTree == null ? 43 : $patchSettingsTree.hashCode());
final java.lang.Object $textStructure = this.getTextStructure();
result = result * PRIME + ($textStructure == null ? 43 : $textStructure.hashCode());
final java.lang.Object $gameSettings = this.getGameSettings();
result = result * PRIME + ($gameSettings == null ? 43 : $gameSettings.hashCode());
return result;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "DataCenter(consolePort=" + this.getConsolePort() + ", usingJXInput=" + this.isUsingJXInput() + ", patchSettingsTree=" + this.getPatchSettingsTree() + ", textStructure=" + this.getTextStructure() + ", gameSettings=" + this.getGameSettings() + ")";
}
/**
* the port used to receive console commands.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int getConsolePort() {
return this.consolePort;
}
/**
* If true, then will use JXInput
* (using DirectX directly, but can only run in windows.)
* to deal with controller.
*
* If false, then will use Jamepad
* (using SDL, can run on multi-platforms.)
* to deal with controller.
*
* At default it is set to false, meaing we just use Jamepad.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public boolean isUsingJXInput() {
return this.usingJXInput;
}
/**
* If true, then will use JXInput
* (using DirectX directly, but can only run in windows.)
* to deal with controller.
*
* If false, then will use Jamepad
* (using SDL, can run on multi-platforms.)
* to deal with controller.
*
* At default it is set to false, meaing we just use Jamepad.
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setUsingJXInput(final boolean usingJXInput) {
this.usingJXInput = usingJXInput;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public X8lTree getPatchSettingsTree() {
return this.patchSettingsTree;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setPatchSettingsTree(final X8lTree patchSettingsTree) {
this.patchSettingsTree = patchSettingsTree;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public MultiLanguageStructure getTextStructure() {
return this.textStructure;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setTextStructure(final MultiLanguageStructure textStructure) {
this.textStructure = textStructure;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public GameSettings getGameSettings() {
return this.gameSettings;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setGameSettings(final GameSettings gameSettings) {
this.gameSettings = gameSettings;
}
}