Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object:
this < that => <0
this == that => 0
this > that => >0
This method may also be accessed via the <
<=
<=>
>=
and >
shortcut operators. If not overridden the default
implementation compares the toStr
representations. Also see docLang.
Examples:
3.compare(8) => -1
8.compare(3) => 1
8.compare(8) => 0
3 <=> 8 => -1 // shortcut for 3.compare(8)
Compare this object to the specified for equality. This
method may be accessed via the == and != shortcut operators.
If not overridden the default implementation compares for
reference equality using the === operator. If this method
is overridden, then hash() must also be overridden such that
any two objects which return true for equals() must return
the same value for hash(). This method must accept null
and
return false.
Return a unique hashcode for this object. If a class overrides hash() then it must ensure if equals() returns true for any two objects then they have same hash code.
Get an immutable representation of this instance or throw NotImmutableErr if this object cannot be represented as an immutable:
Return a string representation of this object.
Trap a dynamic call for handling. Dynamic calls are invoked with the -> shortcut operator:
a->x a.trap("x", null)
a->x() a.trap("x", null)
a->x = b a.trap("x", [b])
a->x(b) a.trap("x", [b])
a->x(b, c) a.trap("x", [b, c])
The default implementation provided by Obj attempts to use reflection. If name maps to a method, it is invoked with the specified arguments. If name maps to a field and args.size is zero, get the field. If name maps to a field and args.size is one, set the field and return args[0]. Otherwise throw UnknownSlotErr.
This method called whenever an it-block is applied to an
object. The default implementation calls the function with this
,
and then returns this
.
Static
addStatic
compareGiven two display strings, return 1, 0, or -1 if a is less than, equal to, or greater than b. The comparison is case insensitive and takes into account trailing digits so that a dis str such as "Foo-10" is greater than "Foo-2".
Static
dict0Empty dict singleton
Static
dict1Static
dict2Static
dict3Static
dict4Static
dict5Static
dict6Static
dictStatic
dictStatic
dictReturn if two dicts are equal with same name/value pairs. Value are compared via the sys::Obj.equals method. Ordering of the dict tags is not considered.
Static
dictStatic
dictConstruct an object which wraps a dict and is suitable to use for a hash key in a sys::Map. The key provides implementations of sys::Obj.hash and sys::Obj.equals based on the the name/value pairs in the dict. Hash keys do not support Dicts which contain anything but scalar values (nested lists, dicts, and grids are silently ignored for hash/equality purposes).
Static
dictStatic
dictStatic
dictStatic
dictStatic
dictStatic
dictStatic
dictStatic
dictsStatic
dictStatic
dictStatic
dictStatic
dictStatic
discreteIterate a discrete period string
formatted in base64. Call the iterator function for each
period where time
is offset in minutes from base timestamp
and dur
is duration of period in minutes (assuming a
minutely interval). This method may also be used discreteEnumPeriods()
in which case the dur
parameter will be the enum ordinal.
Static
echoWrite x.toStr
to standard output followed by newline. If x
is null then print "null". If no argument is provided then
print an empty line.
Optional
x: JsObjStatic
emptyGet the emtpy Dict instance.
Static
escapeEscape tag name into "__{utf-8 hex}" format
Static
gridStatic
isReturn if tag name starts with "__" as escaped name
Static
isReturn if the given string is a legal kind name:
a
- z
a
- z
, A
- Z
, 0
9
, or _
Static
isReturn if the given string is a legal tag name:
a
- z
or _
a
- z
,
A
- Z
, 0
- 9
, or _
Static
macroProcess macro pattern with given scope of variable name/value pairs. The pattern is a Unicode string with embedded expressions:
$tag
: resolve tag name from scope, variable name ends with
first non-tag character, see Etc.isTagName${tag}
: resolve tag name from scope$<pod::key>
: localization keyAny variables which cannot be resolved in the scope are
returned as-is (such $name
) in the result string.
If a tag resolves to Ref, then we use Ref.dis for string.
Static
macroStatic
makeStatic
makeStatic
makeStatic
makeStatic
makeStatic
makeStatic
makeStatic
makeStatic
makeStatic
makeStatic
makeStatic
makeStatic
makeStatic
makeStatic
makeStatic
makeStatic
makeStatic
relGet a relative display name. If the child display name starts with the parent, then we can strip that as the common suffix.
Static
tagGet the localized string for the given tag name for the current locale. See docSkySpark::Localization#tags.
Static
toCoerce an object to a DateSpan:
Func
: function which evaluates to date range (must be run in
a context)DateSpan
: return itselfDate
: one day rangeSpan
: return haystack::Span.toDateSpanStr
: evaluates to haystack::DateSpan.fromStrDate..Date
: starting and ending date (inclusive)Date..Number
: starting date and num of days (day unit
required)DateTime..DateTime
: use starting/ending dates; if end is
midnight, then use previous dateNumber
: convert as yearOptional
cx: HaystackContextStatic
toStatic
toCoerce a value to a Grid:
Static
toStatic
toStatic
toStatic
toCoerce a value to a record Dict:
Optional
cx: HaystackContextStatic
toCoerce a value to a list of record Dicts:
Optional
cx: HaystackContextStatic
toCoerce an object to a Span with optional timezone:
Span
: return itselfSpan+tz
: update timezone using same dates only if aligned to
midnightStr
: return haystack::Span.fromStr
using current timezoneStr+tz
: return haystack::Span.fromStr
using given timezoneDateTime..DateTime
: range of two DateTimesDate..DateTime
: start day for date until the end timestampDateTime..Date
: start timestamp to end of day for end dateDateTime
: span of a single timestampDateSpan
: anything accepted by toDateSpan
in current timezoneDateSpan+tz
: anything accepted by toDateSpan
using given timezoneOptional
tz: TimeZoneOptional
cx: HaystackContextStatic
toTake an arbitrary string and convert into a safe tag name. Do not assume any specific conversion algorithm as it might change in the future. The empty string is not supported.
Static
unescapeUnescape tag name from "__{utf-8 hex}" format
Etc is the utility methods for Haystack.