ADD week 5
This commit is contained in:
		
							
								
								
									
										43
									
								
								02-Easy5/E5/sources/kotlin/properties/Delegates.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								02-Easy5/E5/sources/kotlin/properties/Delegates.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,43 @@ | ||||
| package kotlin.properties; | ||||
|  | ||||
| import kotlin.Metadata; | ||||
| import kotlin.Unit; | ||||
| import kotlin.jvm.functions.Function3; | ||||
| import kotlin.jvm.internal.Intrinsics; | ||||
| import kotlin.reflect.KProperty; | ||||
|  | ||||
| /* compiled from: Delegates.kt */ | ||||
| @Metadata(d1 = {"\u00002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u0002\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\bÆ\u0002\u0018\u00002\u00020\u0001B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u001e\u0010\u0003\u001a\u0010\u0012\u0006\u0012\u0004\u0018\u00010\u0001\u0012\u0004\u0012\u0002H\u00050\u0004\"\b\b\u0000\u0010\u0005*\u00020\u0001J\u0080\u0001\u0010\u0006\u001a\u0010\u0012\u0006\u0012\u0004\u0018\u00010\u0001\u0012\u0004\u0012\u0002H\u00050\u0004\"\u0004\b\u0000\u0010\u00052\u0006\u0010\u0007\u001a\u0002H\u00052Q\b\u0004\u0010\b\u001aK\u0012\u0017\u0012\u0015\u0012\u0002\b\u00030\n¢\u0006\f\b\u000b\u0012\b\b\f\u0012\u0004\b\b(\r\u0012\u0013\u0012\u0011H\u0005¢\u0006\f\b\u000b\u0012\b\b\f\u0012\u0004\b\b(\u000e\u0012\u0013\u0012\u0011H\u0005¢\u0006\f\b\u000b\u0012\b\b\f\u0012\u0004\b\b(\u000f\u0012\u0004\u0012\u00020\u00100\tH\u0086\bø\u0001\u0000¢\u0006\u0002\u0010\u0011J\u0080\u0001\u0010\u0012\u001a\u0010\u0012\u0006\u0012\u0004\u0018\u00010\u0001\u0012\u0004\u0012\u0002H\u00050\u0004\"\u0004\b\u0000\u0010\u00052\u0006\u0010\u0007\u001a\u0002H\u00052Q\b\u0004\u0010\b\u001aK\u0012\u0017\u0012\u0015\u0012\u0002\b\u00030\n¢\u0006\f\b\u000b\u0012\b\b\f\u0012\u0004\b\b(\r\u0012\u0013\u0012\u0011H\u0005¢\u0006\f\b\u000b\u0012\b\b\f\u0012\u0004\b\b(\u000e\u0012\u0013\u0012\u0011H\u0005¢\u0006\f\b\u000b\u0012\b\b\f\u0012\u0004\b\b(\u000f\u0012\u0004\u0012\u00020\u00130\tH\u0086\bø\u0001\u0000¢\u0006\u0002\u0010\u0011\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006\u0014"}, d2 = {"Lkotlin/properties/Delegates;", "", "()V", "notNull", "Lkotlin/properties/ReadWriteProperty;", "T", "observable", "initialValue", "onChange", "Lkotlin/Function3;", "Lkotlin/reflect/KProperty;", "Lkotlin/ParameterName;", "name", "property", "oldValue", "newValue", "", "(Ljava/lang/Object;Lkotlin/jvm/functions/Function3;)Lkotlin/properties/ReadWriteProperty;", "vetoable", "", "kotlin-stdlib"}, k = 1, mv = {1, 8, 0}, xi = 48) | ||||
| /* loaded from: classes.dex */ | ||||
| public final class Delegates { | ||||
|     public static final Delegates INSTANCE = new Delegates(); | ||||
|  | ||||
|     private Delegates() { | ||||
|     } | ||||
|  | ||||
|     public final <T> ReadWriteProperty<Object, T> notNull() { | ||||
|         return new NotNullVar(); | ||||
|     } | ||||
|  | ||||
|     public final <T> ReadWriteProperty<Object, T> observable(final T initialValue, final Function3<? super KProperty<?>, ? super T, ? super T, Unit> onChange) { | ||||
|         Intrinsics.checkNotNullParameter(onChange, "onChange"); | ||||
|         return new ObservableProperty<T>(initialValue) { // from class: kotlin.properties.Delegates$observable$1 | ||||
|             @Override // kotlin.properties.ObservableProperty | ||||
|             protected void afterChange(KProperty<?> property, T oldValue, T newValue) { | ||||
|                 Intrinsics.checkNotNullParameter(property, "property"); | ||||
|                 onChange.invoke(property, oldValue, newValue); | ||||
|             } | ||||
|         }; | ||||
|     } | ||||
|  | ||||
|     public final <T> ReadWriteProperty<Object, T> vetoable(final T initialValue, final Function3<? super KProperty<?>, ? super T, ? super T, Boolean> onChange) { | ||||
|         Intrinsics.checkNotNullParameter(onChange, "onChange"); | ||||
|         return new ObservableProperty<T>(initialValue) { // from class: kotlin.properties.Delegates$vetoable$1 | ||||
|             @Override // kotlin.properties.ObservableProperty | ||||
|             protected boolean beforeChange(KProperty<?> property, T oldValue, T newValue) { | ||||
|                 Intrinsics.checkNotNullParameter(property, "property"); | ||||
|                 return onChange.invoke(property, oldValue, newValue).booleanValue(); | ||||
|             } | ||||
|         }; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user