Skip to content

Commit d4cc3f5

Browse files
committed
More minor fixes, mainly naming and comments.
Signed-off-by: Alexander Lowey-Weber <alexander.weber@here.com>
1 parent 315b2d1 commit d4cc3f5

30 files changed

Lines changed: 110 additions & 247 deletions

File tree

here-naksha-cli/src/jvmMain/java/com/here/naksha/cli/storages/GeneratingSession.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public NakshaCatalog getMapById(@NotNull String mapId) {
115115

116116
@Nullable
117117
@Override
118-
public NakshaCatalog getMapByNumber(int mapNumber) {
118+
public NakshaCatalog getMapByNumber(int catalogNumber) {
119119
throw new NakshaException(NakshaError.UNSUPPORTED_OPERATION, "");
120120
}
121121

@@ -127,7 +127,7 @@ public NakshaCollection getCollectionById(@NotNull NakshaCatalog map, @NotNull S
127127

128128
@Nullable
129129
@Override
130-
public NakshaCollection getCollectionByNumber(@NotNull NakshaCatalog map, int collectionNumber) {
130+
public NakshaCollection getCollectionByNumber(@NotNull NakshaCatalog catalog, int collectionNumber) {
131131
throw new NakshaException(NakshaError.UNSUPPORTED_OPERATION, "");
132132
}
133133

here-naksha-lib-hub/src/jvmMain/java/com/here/naksha/lib/hub/storages/NHAdminStorageReader.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,12 @@ public Response executeParallel(@NotNull Request request) {
114114

115115
@Override
116116
public @Nullable NakshaCatalog getMapById(@NotNull String mapId) {
117-
return session.getMapById(mapId);
117+
return session.getCatalogById(mapId);
118118
}
119119

120120
@Override
121-
public @Nullable NakshaCatalog getMapByNumber(int mapNumber) {
122-
return session.getMapByNumber(mapNumber);
121+
public @Nullable NakshaCatalog getMapByNumber(int catalogNumber) {
122+
return session.getMapByNumber(catalogNumber);
123123
}
124124

125125
@Override
@@ -133,8 +133,8 @@ public void loadTuples(@NotNull List<? extends FeatureTuple> featureTuples, int
133133
}
134134

135135
@Override
136-
public @Nullable NakshaCollection getCollectionByNumber(@NotNull NakshaCatalog map, int collectionNumber) {
137-
return session.getCollectionByNumber(map, collectionNumber);
136+
public @Nullable NakshaCollection getCollectionByNumber(@NotNull NakshaCatalog catalog, int collectionNumber) {
137+
return session.getCollectionByNumber(catalog, collectionNumber);
138138
}
139139

140140
@Override

here-naksha-lib-hub/src/jvmMain/java/com/here/naksha/lib/hub/storages/NHSpaceStorageReader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ public Response executeParallel(@NotNull Request request) {
342342
}
343343

344344
@Override
345-
public @Nullable NakshaCatalog getMapByNumber(int mapNumber) {
345+
public @Nullable NakshaCatalog getMapByNumber(int catalogNumber) {
346346
throw NOT_SUPPORTED_ERROR;
347347
}
348348

@@ -357,7 +357,7 @@ public void loadTuples(@NotNull List<? extends FeatureTuple> featureTuples, int
357357
}
358358

359359
@Override
360-
public @Nullable NakshaCollection getCollectionByNumber(@NotNull NakshaCatalog map, int collectionNumber) {
360+
public @Nullable NakshaCollection getCollectionByNumber(@NotNull NakshaCatalog catalog, int collectionNumber) {
361361
throw NOT_SUPPORTED_ERROR;
362362
}
363363

here-naksha-lib-hub/src/jvmTest/java/com/here/naksha/lib/hub/mock/NHAdminReaderMock.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ public Response executeParallel(@NotNull Request request) {
284284
}
285285

286286
@Override
287-
public @Nullable NakshaCatalog getMapByNumber(int mapNumber) {
287+
public @Nullable NakshaCatalog getMapByNumber(int catalogNumber) {
288288
throw new NakshaException(new NakshaError(NakshaError.UNSUPPORTED_OPERATION, "Not supported by mock yet"));
289289
}
290290

@@ -294,7 +294,7 @@ public Response executeParallel(@NotNull Request request) {
294294
}
295295

296296
@Override
297-
public @Nullable NakshaCollection getCollectionByNumber(@NotNull NakshaCatalog map, int collectionNumber) {
297+
public @Nullable NakshaCollection getCollectionByNumber(@NotNull NakshaCatalog catalog, int collectionNumber) {
298298
throw new NakshaException(new NakshaError(NakshaError.UNSUPPORTED_OPERATION, "Not supported by mock yet"));
299299
}
300300

here-naksha-lib-jbon/src/commonMain/kotlin/naksha/jbon/IDictReader.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import kotlin.js.JsExport
99
* @since 3.0
1010
*/
1111
@JsExport
12+
@Deprecated("To be removed")
1213
interface IDictReader {
1314
/**
1415
* Retrieve the dictionary with the given identifier.

here-naksha-lib-model/src/commonMain/kotlin/naksha/model/ISession.kt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,44 +110,44 @@ interface ISession : AutoCloseable {
110110
/**
111111
* Returns the map for the given identifier.
112112
*
113-
* This method does only access the internal caching, and may not be up-to-date. If invoked on a [write session][IWriteSession] before committing changes, it will return maps that were created in the current session, but beware that these maps may eventually fail to commit.
114-
* @param mapId the map-id for which to return the latest HEAD state.
115-
* @return the map; _null_ if no such map exists.
113+
* This method does only access the internal caching, and may not be up-to-date. If invoked on a [write session][IWriteSession] before committing changes, it will return catalogs that were created in the current session, but beware that these catalogs may eventually fail to commit.
114+
* @param catalogId the catalog-id for which to return the latest HEAD state.
115+
* @return the catalog; _null_ if no such catalog exists.
116116
* @since 3.0
117117
*/
118-
fun getMapById(mapId: String): NakshaCatalog?
118+
fun getCatalogById(catalogId: String): NakshaCatalog?
119119

120120
/**
121-
* Returns the map for the given number.
121+
* Returns the catalog for the given number.
122122
*
123-
* This method does only access the internal caching, and may not be up-to-date. If invoked on a [write session][IWriteSession] before committing changes, it will return maps that were created in the current session, but beware that these maps may eventually fail to commit.
124-
* @param mapNumber the map-number for which to return the latest HEAD state.
125-
* @return the map; _null_ if no such map exists.
123+
* This method does only access the internal caching, and may not be up-to-date. If invoked on a [write session][IWriteSession] before committing changes, it will return catalogs that were created in the current session, but beware that these catalogs may eventually fail to commit.
124+
* @param catalogNumber the catalog-number for which to return the latest HEAD state.
125+
* @return the catalog; _null_ if no such catalog exists.
126126
* @since 3.0
127127
*/
128-
fun getMapByNumber(mapNumber: Int): NakshaCatalog?
128+
fun getMapByNumber(catalogNumber: Int): NakshaCatalog?
129129

130130
/**
131131
* Returns the collection for the given identifier.
132132
*
133-
* This method does only access the internal caching, and may not be up-to-date. If invoked on a [write session][IWriteSession] before committing changes, it will return maps that were created in the current session, but beware that these collections may eventually fail to commit.
134-
* @param map the map to query.
133+
* This method does only access the internal caching, and may not be up-to-date. If invoked on a [write session][IWriteSession] before committing changes, it will return collections that were created in the current session, but beware that these collections may eventually fail to commit.
134+
* @param catalog the catalog to query.
135135
* @param collectionId the collection-id for which to return the latest HEAD state.
136136
* @return the collection; _null_ if no such collection exists.
137137
* @since 3.0
138138
*/
139-
fun getCollectionById(map: NakshaCatalog, collectionId: String): NakshaCollection?
139+
fun getCollectionById(catalog: NakshaCatalog, collectionId: String): NakshaCollection?
140140

141141
/**
142142
* Returns the collection for the given number.
143143
*
144-
* This method does only access the internal caching, and may not be up-to-date. If invoked on a [write session][IWriteSession] before committing changes, it will return maps that were created in the current session, but beware that these collections may eventually fail to commit.
145-
* @param map the map to query.
144+
* This method does only access the internal caching, and may not be up-to-date. If invoked on a [write session][IWriteSession] before committing changes, it will return collections that were created in the current session, but beware that these collections may eventually fail to commit.
145+
* @param catalog the catalog to query.
146146
* @param collectionNumber the collection-number for which to return the latest HEAD state.
147147
* @return the collection; _null_ if no such collection exists.
148148
* @since 3.0
149149
*/
150-
fun getCollectionByNumber(map: NakshaCatalog, collectionNumber: Int): NakshaCollection?
150+
fun getCollectionByNumber(catalog: NakshaCatalog, collectionNumber: Int): NakshaCollection?
151151

152152
/**
153153
* Load all tuples into the given [feature-tuples][FeatureTuple].

here-naksha-lib-model/src/commonMain/kotlin/naksha/model/IStorage.kt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,4 @@ interface IStorage : IDictReader {
145145
val session = newReadSession(options)
146146
session.use { lambda.call(session) }
147147
}
148-
149-
/**
150-
* The best feature encoding for the given feature.
151-
*
152-
* - Throws [NakshaError.UNINITIALIZED], if the storage failed to initialize.
153-
* @param feature the feature to encode; _null_ if no specific one is available.
154-
* @param context the context in which the encoding happens (for example the [map][naksha.model.objects.NakshaCatalog] or [collection][naksha.model.objects.NakshaCollection]); _null_ if none is available.
155-
* @return best [DataEncoding] to use.
156-
* @since 3.0
157-
*/
158-
@Deprecated("Will be removed in a future release.")
159-
fun getDataEncoding(feature: Any?, context: Any? = null): DataEncoding
160148
}

here-naksha-lib-model/src/commonMain/kotlin/naksha/model/Naksha.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import kotlin.js.JsExport
1717
import kotlin.js.JsName
1818
import kotlin.js.JsStatic
1919
import kotlin.jvm.JvmField
20+
import kotlin.jvm.JvmOverloads
2021
import kotlin.jvm.JvmStatic
2122

2223
/**
@@ -140,14 +141,17 @@ class Naksha private constructor() {
140141
*
141142
* **Beware**: Identifiers must not contain upper-case letters, because many storages does not make a difference between upper- and lower-cased letters.
142143
* @param id the identifier.
144+
* @param internal if _true_, then extends the allowed character set to `[a-z_][a-z0-9_:-~$]{31}`.
143145
* @return _true_ if the identifier is valid; _false_ otherwise.
144146
* @since 3.0
145147
* @see [verifyId]
148+
* @see [verifyInternalId]
146149
* @see [MAX_ID_LENGTH]
147150
*/
148151
@JsStatic
149152
@JvmStatic
150-
fun isValidId(id: String?): Boolean {
153+
@JvmOverloads
154+
fun isValidId(id: String?, internal: Boolean = false): Boolean {
151155
if (id.isNullOrEmpty() || "naksha" == id || id.length > MAX_ID_LENGTH) return false
152156
var i = 0
153157
var c = id[i++]

here-naksha-lib-model/src/commonMain/kotlin/naksha/model/Tuple.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ data class Tuple @JvmOverloads constructor(
8484
globalBook: IBook?
8585
): Tuple {
8686
val members = collection.useMembers()
87-
val processors = session.processors()
87+
val processors = session.processors
8888

8989
// Update the tuple-number.
9090
val tnMember = collection.useMember(StandardMembers.Tn)

here-naksha-lib-model/src/commonMain/kotlin/naksha/model/objects/Member.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ import naksha.model.TupleNumber
1818
import kotlin.js.JsExport
1919
import kotlin.js.JsName
2020

21+
// TODO: We need an immutable version of this, because this actually allows mutation.
22+
2123
/**
2224
* A materialized part of a feature.
2325
*
@@ -191,6 +193,12 @@ open class Member() : AnyObject(), Comparator<Member> {
191193

192194
/**
193195
* Ensures that the given `other` member is the same as this.
196+
*
197+
* The purpose of the method is generally to do:
198+
* ```kotlin
199+
* val member = StandardMember.Id.asSame(someCustomMember)
200+
* ```
201+
* Which will return the given custom member, ensuring that it still is the standard `id` member, but allows different paths.
194202
* @param other The member to compare this with.
195203
* @param comparePath If the path must be the same as well, defaults to _false_.
196204
* @return The `other` member, if it is the same as this.

0 commit comments

Comments
 (0)