IKVM11  11
Java SE 11 Virtual Machine for .NET
Loading...
Searching...
No Matches
JavaSimplePackageName.cs
Go to the documentation of this file.
1using System;
2
4
6{
7
11 readonly struct JavaSimplePackageName
12 {
13
14 public static JavaSimplePackageName Empty => new(ReadOnlyMemory<char>.Empty);
15
16 public static implicit operator string(JavaSimplePackageName typeName) => typeName.ToString();
17 public static implicit operator JavaSimplePackageName(string typeName) => new(typeName);
18
19 public static implicit operator ReadOnlyMemory<char>(JavaSimplePackageName typeName) => typeName.value;
20 public static implicit operator JavaSimplePackageName(ReadOnlyMemory<char> typeName) => new(typeName);
21
22 public static bool operator ==(JavaSimplePackageName a, JavaSimplePackageName b) => a.value.Span.Equals(b.value.Span, StringComparison.Ordinal);
23 public static bool operator !=(JavaSimplePackageName a, JavaSimplePackageName b) => a.value.Span.Equals(b.value.Span, StringComparison.Ordinal) == false;
24
25
26 readonly ReadOnlyMemory<char> value;
27
33 this(value.AsMemory())
34 {
35 if (value is null)
36 throw new ArgumentNullException(nameof(value));
37 }
38
43 public JavaSimplePackageName(ReadOnlyMemory<char> value)
44 {
45 this.value = value;
46 }
47
51 public ReadOnlyMemory<char> Value => value;
52
56 public bool IsEmpty => value.IsEmpty;
57
63 public bool Equals(JavaSimplePackageName other) => value.Span.Equals(other.value.Span, StringComparison.Ordinal);
64
70 public override bool Equals(object obj) => false;
71
76 public override int GetHashCode() => value.Span.GetHashCodeExtension();
77
82 public override string ToString() => value.Span.ToString();
83
84 }
85
86}
Provides methods to parse a Java class simple name.
static bool operator==(JavaSimplePackageName a, JavaSimplePackageName b)
bool IsEmpty
Returns true if this type name is empty.
override int GetHashCode()
Gets the hash code of this type name.
ReadOnlyMemory< char > Value
Gets the underlying value of this simple name.
override string ToString()
Returns a string instance of the type name.
JavaSimplePackageName(string value)
Initializes a new instance.
JavaSimplePackageName(ReadOnlyMemory< char > value)
Initializes a new instance.
bool Equals(JavaSimplePackageName other)
Returns true if the two objects are equal.
static bool operator!=(JavaSimplePackageName a, JavaSimplePackageName b)
override bool Equals(object obj)
Returns true if the two objects are equal.