FNode.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import "FPath.h"
  17. #import "FTypedefs_Private.h"
  18. #import <Foundation/Foundation.h>
  19. @protocol FIndex;
  20. @protocol FNode <NSObject>
  21. - (BOOL)isLeafNode;
  22. - (id<FNode>)getPriority;
  23. - (id<FNode>)updatePriority:(id<FNode>)priority;
  24. - (id<FNode>)getImmediateChild:(NSString *)childKey;
  25. - (id<FNode>)getChild:(FPath *)path;
  26. - (NSString *)predecessorChildKey:(NSString *)childKey;
  27. - (id<FNode>)updateImmediateChild:(NSString *)childKey
  28. withNewChild:(id<FNode>)newChildNode;
  29. - (id<FNode>)updateChild:(FPath *)path withNewChild:(id<FNode>)newChildNode;
  30. - (BOOL)hasChild:(NSString *)childKey;
  31. - (BOOL)isEmpty;
  32. - (int)numChildren;
  33. - (id)val;
  34. - (id)valForExport:(BOOL)exp;
  35. - (NSString *)dataHash;
  36. - (NSComparisonResult)compare:(id<FNode>)other;
  37. - (BOOL)isEqual:(id<FNode>)other;
  38. - (void)enumerateChildrenUsingBlock:(void (^)(NSString *key, id<FNode> node,
  39. BOOL *stop))block;
  40. - (void)enumerateChildrenReverse:(BOOL)reverse
  41. usingBlock:(void (^)(NSString *key, id<FNode> node,
  42. BOOL *stop))block;
  43. - (NSEnumerator *)childEnumerator;
  44. @end