dynamic_cstr.d.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. export declare enum Axis {
  2. DOMAIN = "domain",
  3. STYLE = "style",
  4. LOCALE = "locale",
  5. TOPIC = "topic",
  6. MODALITY = "modality"
  7. }
  8. export type AxisProperties = {
  9. [key: string]: string[];
  10. };
  11. export type AxisOrder = Axis[];
  12. export type AxisMap = {
  13. [key: string]: string;
  14. };
  15. export declare class DynamicProperties {
  16. private properties;
  17. protected order: AxisOrder;
  18. static createProp(...cstrList: string[][]): DynamicProperties;
  19. constructor(properties: AxisProperties, order?: AxisOrder);
  20. getProperties(): AxisProperties;
  21. getOrder(): AxisOrder;
  22. getAxes(): AxisOrder;
  23. getProperty(key: Axis): string[];
  24. updateProperties(props: AxisProperties): void;
  25. allProperties(): string[][];
  26. toString(): string;
  27. }
  28. export declare class DynamicCstr extends DynamicProperties {
  29. static DEFAULT_ORDER: AxisOrder;
  30. static BASE_LOCALE: string;
  31. static DEFAULT_VALUE: string;
  32. static DEFAULT_VALUES: AxisMap;
  33. private components;
  34. static createCstr(...cstrList: string[]): DynamicCstr;
  35. static defaultCstr(): DynamicCstr;
  36. static validOrder(order: AxisOrder): boolean;
  37. constructor(components_: AxisMap, order?: AxisOrder);
  38. getComponents(): AxisMap;
  39. getValue(key: Axis): string;
  40. getValues(): string[];
  41. allProperties(): string[][];
  42. toString(): string;
  43. equal(cstr: DynamicCstr): boolean;
  44. }
  45. export declare class DynamicCstrParser {
  46. private order;
  47. constructor(order: AxisOrder);
  48. parse(str: string): DynamicCstr;
  49. }
  50. export interface Comparator {
  51. getReference(): DynamicCstr;
  52. setReference(cstr: DynamicCstr, opt_props?: DynamicProperties): void;
  53. match(cstr: DynamicCstr): boolean;
  54. compare(cstr1: DynamicCstr, cstr2: DynamicCstr): number;
  55. }
  56. export declare class DefaultComparator implements Comparator {
  57. private reference;
  58. private fallback;
  59. private order;
  60. constructor(reference: DynamicCstr, fallback?: DynamicProperties);
  61. getReference(): DynamicCstr;
  62. setReference(cstr: DynamicCstr, props?: DynamicProperties): void;
  63. match(cstr: DynamicCstr): boolean;
  64. compare(cstr1: DynamicCstr, cstr2: DynamicCstr): 0 | 1 | -1;
  65. toString(): string;
  66. }