-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #441 from 1c-syntax/feature/optimize
Feature/optimize
- Loading branch information
Showing
13 changed files
with
627 additions
and
1,029 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ build/ | |
/.idea/sonar* | ||
|
||
/.idea/misc.xml | ||
Gradle_*.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,29 @@ | ||
/* | ||
* This file is a part of MDClasses. | ||
* | ||
* Copyright (c) 2019 - 2024 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* MDClasses is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* MDClasses is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with MDClasses. | ||
*/ | ||
package com.github._1c_syntax.bsl.mdo.storage; | ||
/* | ||
* This file is a part of MDClasses. | ||
* | ||
* Copyright (c) 2019 - 2024 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* MDClasses is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* MDClasses is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with MDClasses. | ||
*/ | ||
package com.github._1c_syntax.bsl.mdo.storage; | ||
|
||
import com.github._1c_syntax.bsl.mdo.support.RoleRight; | ||
import com.github._1c_syntax.bsl.reader.MDOReader; | ||
import com.github._1c_syntax.utils.GenericInterner; | ||
import lombok.Builder; | ||
import lombok.Builder.Default; | ||
import lombok.EqualsAndHashCode; | ||
|
@@ -46,6 +47,7 @@ | |
public class RoleData { | ||
|
||
public static final RoleData EMPTY = RoleData.builder().build(); | ||
public static final GenericInterner<Right> RIGHT_INTERNER = new GenericInterner<>(); | ||
|
||
/** | ||
* Устанавливать права для новых объектов | ||
|
@@ -97,8 +99,8 @@ public static class ObjectRight { | |
} | ||
|
||
@Value | ||
@ToString(of = {"name"}) | ||
@EqualsAndHashCode(of = {"name"}) | ||
@ToString(of = {"name", "value"}) | ||
@EqualsAndHashCode(of = {"name", "value"}) | ||
@Builder | ||
public static class Right { | ||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
/* | ||
* This file is a part of MDClasses. | ||
* | ||
* Copyright (c) 2019 - 2024 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* MDClasses is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* MDClasses is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with MDClasses. | ||
*/ | ||
package com.github._1c_syntax.bsl.mdo.support; | ||
/* | ||
* This file is a part of MDClasses. | ||
* | ||
* Copyright (c) 2019 - 2024 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* MDClasses is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* MDClasses is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with MDClasses. | ||
*/ | ||
package com.github._1c_syntax.bsl.mdo.support; | ||
|
||
import lombok.AllArgsConstructor; | ||
import com.github._1c_syntax.utils.StringInterner; | ||
import lombok.NonNull; | ||
import lombok.Value; | ||
|
||
|
@@ -34,22 +34,30 @@ | |
* Используется для хранения текстовой строки на разных языках | ||
*/ | ||
@Value | ||
@AllArgsConstructor | ||
public class MultiLanguageString { | ||
|
||
/** | ||
* Ссылка на пустой элемент | ||
*/ | ||
public static final MultiLanguageString EMPTY = new MultiLanguageString(Collections.emptyMap()); | ||
|
||
private static final StringInterner stringInterner = new StringInterner(); | ||
|
||
/** | ||
* Содержимое описания для каждого языка | ||
*/ | ||
Map<String, String> content; | ||
|
||
public MultiLanguageString(Map<String, String> source) { | ||
Map<String, String> newContent = new HashMap<>(); | ||
source.forEach( | ||
(langKey, text) -> newContent.put(stringInterner.intern(langKey), text)); | ||
content = newContent; | ||
} | ||
|
||
public MultiLanguageString(@NonNull MultiLanguageString first, @NonNull MultiLanguageString second) { | ||
var fullContent = new HashMap<>(first.getContent()); | ||
fullContent.putAll(second.getContent()); | ||
putContent(fullContent, second); | ||
content = fullContent; | ||
} | ||
|
||
|
@@ -68,7 +76,7 @@ public static MultiLanguageString of(@NonNull List<MultiLanguageString> strings) | |
return strings.get(0); | ||
} else { | ||
Map<String, String> content = new HashMap<>(); | ||
strings.forEach(string -> content.putAll(string.getContent())); | ||
strings.forEach(string -> putContent(content, string)); | ||
return new MultiLanguageString(content); | ||
} | ||
} | ||
|
@@ -103,4 +111,9 @@ public static MultiLanguageString of(@NonNull List<MultiLanguageString> strings) | |
public boolean isEmpty() { | ||
return this == EMPTY; | ||
} | ||
|
||
private static void putContent(Map<String, String> destination, MultiLanguageString source) { | ||
source.getContent().forEach( | ||
(langKey, text) -> destination.put(stringInterner.intern(langKey), text)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
/* | ||
* This file is a part of MDClasses. | ||
* | ||
* Copyright (c) 2019 - 2024 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* MDClasses is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* MDClasses is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with MDClasses. | ||
*/ | ||
package com.github._1c_syntax.bsl.mdo.support; | ||
/* | ||
* This file is a part of MDClasses. | ||
* | ||
* Copyright (c) 2019 - 2024 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* MDClasses is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* MDClasses is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with MDClasses. | ||
*/ | ||
package com.github._1c_syntax.bsl.mdo.support; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
@@ -96,7 +96,11 @@ public enum RoleRight implements EnumWithValue { | |
INTERACTIVE_EXECUTE("InteractiveExecute"), | ||
TECHNICAL_SPECIALIST_MODE("TechnicalSpecialistMode"), | ||
INTERACTIVE_START("InteractiveStart"), | ||
START("Start"); | ||
START("Start"), | ||
STANDARD_AUTHENTICATION_CHANGE("StandardAuthenticationChange"), | ||
SESSION_STANDARD_AUTHENTICATION_CHANGE("SessionStandardAuthenticationChange"), | ||
SESSION_OS_AUTHENTICATION_CHANGE("SessionOSAuthenticationChange") | ||
; | ||
|
||
@Accessors(fluent = true) | ||
private final String value; | ||
|
44 changes: 22 additions & 22 deletions
44
src/main/java/com/github/_1c_syntax/bsl/reader/FakeReader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
/* | ||
* This file is a part of MDClasses. | ||
* | ||
* Copyright (c) 2019 - 2024 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* MDClasses is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* MDClasses is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with MDClasses. | ||
*/ | ||
package com.github._1c_syntax.bsl.reader; | ||
/* | ||
* This file is a part of MDClasses. | ||
* | ||
* Copyright (c) 2019 - 2024 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* MDClasses is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* MDClasses is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with MDClasses. | ||
*/ | ||
package com.github._1c_syntax.bsl.reader; | ||
|
||
import com.github._1c_syntax.bsl.mdclasses.MDClass; | ||
import com.github._1c_syntax.bsl.mdclasses.MDClasses; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
/* | ||
* This file is a part of MDClasses. | ||
* | ||
* Copyright (c) 2019 - 2024 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* MDClasses is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* MDClasses is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with MDClasses. | ||
*/ | ||
package com.github._1c_syntax.bsl.reader; | ||
/* | ||
* This file is a part of MDClasses. | ||
* | ||
* Copyright (c) 2019 - 2024 | ||
* Tymko Oleg <[email protected]>, Maximov Valery <[email protected]> and contributors | ||
* | ||
* SPDX-License-Identifier: LGPL-3.0-or-later | ||
* | ||
* MDClasses is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Lesser General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 3.0 of the License, or (at your option) any later version. | ||
* | ||
* MDClasses is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public | ||
* License along with MDClasses. | ||
*/ | ||
package com.github._1c_syntax.bsl.reader; | ||
|
||
import com.github._1c_syntax.bsl.mdclasses.MDClass; | ||
import com.github._1c_syntax.bsl.reader.common.xstream.ExtendXStream; | ||
|
@@ -65,5 +65,4 @@ default Converter getReflectionConverter() { | |
MDClass readConfiguration(); | ||
|
||
MDClass readExternalSource(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.