|
|
|
/**
|
|
|
|
* Author: dkanus
|
|
|
|
* Home repo: https://www.insultplayers.ru/git/AcediaFramework/AcediaCore
|
|
|
|
* License: GPL
|
|
|
|
* Copyright 2023 Anton Tarasenko
|
|
|
|
*------------------------------------------------------------------------------
|
|
|
|
* This file is part of Acedia.
|
|
|
|
*
|
|
|
|
* Acedia is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Acedia 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Acedia. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
class JsonPointer extends BaseJsonPointer;
|
|
|
|
|
|
|
|
//! Immutable representation of a Json pointer as defined in
|
|
|
|
//! [RFC6901](https://tools.ietf.org/html/rfc6901).
|
|
|
|
|
|
|
|
public function JsonPointer IntoJsonPointer() {
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function bool IsEqual(Object other) {
|
|
|
|
local JsonPointer otherJsonPointer;
|
|
|
|
|
|
|
|
otherJsonPointer = JsonPointer(other);
|
|
|
|
if (otherJsonPointer == none) return false;
|
|
|
|
if (components.length != otherJsonPointer.components.length) return false;
|
|
|
|
if (!StartsWith(otherJsonPointer)) return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function int CalculateHashCode() {
|
|
|
|
local int i;
|
|
|
|
local int accumulator, nextValue;
|
|
|
|
|
|
|
|
if (components.length == 0) {
|
|
|
|
return 32894237;
|
|
|
|
}
|
|
|
|
if (components[0].textRepresentation != none) {
|
|
|
|
accumulator = components[0].textRepresentation.GetHashCode();
|
|
|
|
} else {
|
|
|
|
accumulator = components[0].numericRepresentation;
|
|
|
|
}
|
|
|
|
for (i = 1; i < components.length; i += 1) {
|
|
|
|
if (components[i].textRepresentation != none) {
|
|
|
|
nextValue = components[i].textRepresentation.GetHashCode();
|
|
|
|
} else {
|
|
|
|
nextValue = components[i].numericRepresentation;
|
|
|
|
}
|
|
|
|
accumulator = CombineHash(accumulator, nextValue);
|
|
|
|
}
|
|
|
|
return accumulator;
|
|
|
|
}
|
|
|
|
|
|
|
|
defaultproperties {
|
|
|
|
}
|