/**
* For a given key and depth, returns how much the depth should be incremented by when
* resolving a keypath to children.
*
* This can be 0 or 2 when there is a globstar and the next key either matches or doesn't match
* the current key.
*/
@RestrictTo(RestrictTo.Scope.LIBRARY)
public int incrementDepthBy(String key, int depth) {
if (isContainer(key)) {
// If it's a container then we added programatically and it isn't a part of the keypath.
return 0;
}
if (!keys.get(depth).equals("**")) {
// If it's not a globstar then it is part of the keypath.
return 1;
}
if (depth == keys.size() - 1) {
// The last key is a globstar.
return 0;
}
if (keys.get(depth + 1).equals(key)) {
// We are a globstar and the next key is our current key so consume both.
return 2;
}
return 0;
}
KeyPath.java 文件源码
java
阅读 36
收藏 0
点赞 0
评论 0
项目:lottie-android
作者:
评论列表
文章目录