mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-23 00:24:11 -08:00
Implement AtomicBoolean and String.toLowerCase/toUpperCase(Locale)
This commit is contained in:
parent
6d5b4a67e5
commit
389b55be91
|
@ -26,6 +26,7 @@ import org.teavm.classlib.java.util.TArrays;
|
||||||
import org.teavm.classlib.java.util.TComparator;
|
import org.teavm.classlib.java.util.TComparator;
|
||||||
import org.teavm.classlib.java.util.TFormatter;
|
import org.teavm.classlib.java.util.TFormatter;
|
||||||
import org.teavm.classlib.java.util.THashMap;
|
import org.teavm.classlib.java.util.THashMap;
|
||||||
|
import org.teavm.classlib.java.util.TLocale;
|
||||||
import org.teavm.classlib.java.util.TMap;
|
import org.teavm.classlib.java.util.TMap;
|
||||||
import org.teavm.classlib.java.util.regex.TPattern;
|
import org.teavm.classlib.java.util.regex.TPattern;
|
||||||
|
|
||||||
|
@ -597,6 +598,10 @@ public class TString extends TObject implements TSerializable, TComparable<TStri
|
||||||
return new TString(codePoints, 0, codePointCount);
|
return new TString(codePoints, 0, codePointCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TString toLowerCase(TLocale locale) {
|
||||||
|
return toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
public TString toUpperCase() {
|
public TString toUpperCase() {
|
||||||
if (isEmpty()) {
|
if (isEmpty()) {
|
||||||
return this;
|
return this;
|
||||||
|
@ -616,6 +621,10 @@ public class TString extends TObject implements TSerializable, TComparable<TStri
|
||||||
return new TString(codePoints, 0, codePointCount);
|
return new TString(codePoints, 0, codePointCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TString toUpperCase(TLocale locale) {
|
||||||
|
return toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
public TString intern() {
|
public TString intern() {
|
||||||
TString interned = pool.get(this);
|
TString interned = pool.get(this);
|
||||||
if (interned == null) {
|
if (interned == null) {
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2017 Alexey Andreev.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.teavm.classlib.java.util.concurrent.atomic;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class TAtomicBoolean implements Serializable {
|
||||||
|
private boolean value;
|
||||||
|
|
||||||
|
public TAtomicBoolean(boolean initialValue) {
|
||||||
|
value = initialValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TAtomicBoolean() {
|
||||||
|
this(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean get() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean compareAndSet(boolean expect, boolean update) {
|
||||||
|
if (value == expect) {
|
||||||
|
value = update;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean weakCompareAndSet(boolean expect, boolean update) {
|
||||||
|
return compareAndSet(expect, update);
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void set(boolean newValue) {
|
||||||
|
value = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final void lazySet(boolean newValue) {
|
||||||
|
value = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean getAndSet(boolean newValue) {
|
||||||
|
boolean result = value;
|
||||||
|
value = newValue;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return Boolean.toString(value);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user