Modified: pivot/trunk/core/src/org/apache/pivot/functional/monad/Failure.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/monad/Failure.java?rev=1913470&r1=1913469&r2=1913470&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/functional/monad/Failure.java 
(original)
+++ pivot/trunk/core/src/org/apache/pivot/functional/monad/Failure.java Tue Oct 
31 19:15:47 2023
@@ -1,86 +1,86 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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.apache.pivot.functional.monad;
-
-/**
- * Generic container, to hold the unsuccessful result of a computation (a 
RuntimeException).
- */
-public class Failure<T> extends Try<T> {
-    protected final RuntimeException value;
-
-    /**
-     * Default constructor, do not use because it set null as invariant value 
to hold.
-     */
-    public Failure() {
-        value = new IllegalArgumentException("failure exception set to null.");
-    }
-
-    /**
-     * Constructor with a value to set.
-     * @param val the RuntimeException to set
-     */
-    public Failure(final RuntimeException val) {
-        this.value = val;
-    }
-
-    @Override
-    public final boolean isSuccess() {
-        return false;
-    }
-
-    @Override
-    public final T getValue() {
-        throw value;
-    }
-
-    @Override
-    public String toString() {
-        return "Failure(" + ((value != null) ? value.toString() : "null") + 
")";
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((value == null) ? 0 : value.hashCode());
-        return result;
-    }
-
-    @SuppressWarnings("rawtypes")
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (!(obj instanceof Failure)) {
-            return false;
-        }
-        Failure other = (Failure) obj;
-        if (value == null) {
-            if (other.value != null) {
-                return false;
-            }
-        } else if (!value.equals(other.value)) {
-            return false;
-        }
-        return true;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.apache.pivot.functional.monad;
+
+/**
+ * Generic container, to hold the unsuccessful result of a computation (a 
RuntimeException).
+ */
+public class Failure<T> extends Try<T> {
+    protected final RuntimeException value;
+
+    /**
+     * Default constructor, do not use because it set null as invariant value 
to hold.
+     */
+    public Failure() {
+        value = new IllegalArgumentException("failure exception set to null.");
+    }
+
+    /**
+     * Constructor with a value to set.
+     * @param val the RuntimeException to set
+     */
+    public Failure(final RuntimeException val) {
+        this.value = val;
+    }
+
+    @Override
+    public final boolean isSuccess() {
+        return false;
+    }
+
+    @Override
+    public final T getValue() {
+        throw value;
+    }
+
+    @Override
+    public String toString() {
+        return "Failure(" + ((value != null) ? value.toString() : "null") + 
")";
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((value == null) ? 0 : value.hashCode());
+        return result;
+    }
+
+    @SuppressWarnings("rawtypes")
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof Failure)) {
+            return false;
+        }
+        Failure other = (Failure) obj;
+        if (value == null) {
+            if (other.value != null) {
+                return false;
+            }
+        } else if (!value.equals(other.value)) {
+            return false;
+        }
+        return true;
+    }
+
+}

Propchange: pivot/trunk/core/src/org/apache/pivot/functional/monad/Failure.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: pivot/trunk/core/src/org/apache/pivot/functional/monad/Monad.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/monad/Monad.java?rev=1913470&r1=1913469&r2=1913470&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/functional/monad/Monad.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/functional/monad/Monad.java Tue Oct 
31 19:15:47 2023
@@ -1,44 +1,44 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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.apache.pivot.functional.monad;
-
-/**
- * Definition of a generic Monad, which is a type that wraps another type and
- * gives some form of quality to the underlying type (see
- * <a href="https://en.wikipedia.org/wiki/Monad_(functional_programming)">
- * https://en.wikipedia.org/wiki/Monad_(functional_programming)</a>).
- *
- * @param <T> The underlying type wrapped by this Monad.
- */
-public abstract class Monad<T> implements MonadicOperations<T> {
-
-    /**
-     * Default constructor.
-     */
-    protected Monad() {
-        // no-op
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return "Monad(" + getClass().getTypeParameters()[0].getName() + ")";
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.apache.pivot.functional.monad;
+
+/**
+ * Definition of a generic Monad, which is a type that wraps another type and
+ * gives some form of quality to the underlying type (see
+ * <a href="https://en.wikipedia.org/wiki/Monad_(functional_programming)">
+ * https://en.wikipedia.org/wiki/Monad_(functional_programming)</a>).
+ *
+ * @param <T> The underlying type wrapped by this Monad.
+ */
+public abstract class Monad<T> implements MonadicOperations<T> {
+
+    /**
+     * Default constructor.
+     */
+    protected Monad() {
+        // no-op
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return "Monad(" + getClass().getTypeParameters()[0].getName() + ")";
+    }
+
+}

Propchange: pivot/trunk/core/src/org/apache/pivot/functional/monad/Monad.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
pivot/trunk/core/src/org/apache/pivot/functional/monad/MonadicOperations.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/monad/MonadicOperations.java?rev=1913470&r1=1913469&r2=1913470&view=diff
==============================================================================
--- 
pivot/trunk/core/src/org/apache/pivot/functional/monad/MonadicOperations.java 
(original)
+++ 
pivot/trunk/core/src/org/apache/pivot/functional/monad/MonadicOperations.java 
Tue Oct 31 19:15:47 2023
@@ -1,29 +1,29 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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.apache.pivot.functional.monad;
-
-/**
- * Definition of generic Monadic methods.
- * <p> For future development: check on adding other abstract (generic, 
typical of Monads:
- * apply, unit, map, flatten, etc) methods here and see what to implement in 
Option and in Try ...)
- *
- * @param <T> The wrapped type to which this operation is to be applied.
- */
-@SuppressWarnings("unused")
-public interface MonadicOperations<T> {
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.apache.pivot.functional.monad;
+
+/**
+ * Definition of generic Monadic methods.
+ * <p> For future development: check on adding other abstract (generic, 
typical of Monads:
+ * apply, unit, map, flatten, etc) methods here and see what to implement in 
Option and in Try ...)
+ *
+ * @param <T> The wrapped type to which this operation is to be applied.
+ */
+@SuppressWarnings("unused")
+public interface MonadicOperations<T> {
+
+}

Propchange: 
pivot/trunk/core/src/org/apache/pivot/functional/monad/MonadicOperations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: pivot/trunk/core/src/org/apache/pivot/functional/monad/None.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/monad/None.java?rev=1913470&r1=1913469&r2=1913470&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/functional/monad/None.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/functional/monad/None.java Tue Oct 31 
19:15:47 2023
@@ -1,70 +1,70 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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.apache.pivot.functional.monad;
-
-import java.util.NoSuchElementException;
-
-/**
- * Container for an immutable no-value, derived from Option.
- */
-@SuppressWarnings({"unchecked", "rawtypes"})
-public final class None<T> extends Option<T> {
-    private static final None INSTANCE = new None<>();
-
-    /**
-     * Get the static instance.
-     * @param <T> The type of this no-value object.
-     * @return the static instance
-     */
-    public static final <T> None<T> getInstance() {
-        return INSTANCE;
-    }
-
-    /**
-     * Default constructor, does nothing.
-     */
-    public None() {
-        // super(null);
-        // no-op
-    }
-
-    @Override
-    public boolean hasValue() {
-        return false;
-    }
-
-    @Override
-    public T getValue() {
-        throw new NoSuchElementException("None does not contain a value");
-    }
-
-    @Override
-    public String toString() {
-        return "None()";
-    }
-
-    @Override
-    public boolean equals(Object other) {
-        return (other == null || other.getClass() != None.class) ? false : 
true;
-    }
-
-    @Override
-    public int hashCode() {
-        return -31;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.apache.pivot.functional.monad;
+
+import java.util.NoSuchElementException;
+
+/**
+ * Container for an immutable no-value, derived from Option.
+ */
+@SuppressWarnings({"unchecked", "rawtypes"})
+public final class None<T> extends Option<T> {
+    private static final None INSTANCE = new None<>();
+
+    /**
+     * Get the static instance.
+     * @param <T> The type of this no-value object.
+     * @return the static instance
+     */
+    public static final <T> None<T> getInstance() {
+        return INSTANCE;
+    }
+
+    /**
+     * Default constructor, does nothing.
+     */
+    public None() {
+        // super(null);
+        // no-op
+    }
+
+    @Override
+    public boolean hasValue() {
+        return false;
+    }
+
+    @Override
+    public T getValue() {
+        throw new NoSuchElementException("None does not contain a value");
+    }
+
+    @Override
+    public String toString() {
+        return "None()";
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        return (other == null || other.getClass() != None.class) ? false : 
true;
+    }
+
+    @Override
+    public int hashCode() {
+        return -31;
+    }
+
+}

Propchange: pivot/trunk/core/src/org/apache/pivot/functional/monad/None.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: pivot/trunk/core/src/org/apache/pivot/functional/monad/Option.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/monad/Option.java?rev=1913470&r1=1913469&r2=1913470&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/functional/monad/Option.java 
(original)
+++ pivot/trunk/core/src/org/apache/pivot/functional/monad/Option.java Tue Oct 
31 19:15:47 2023
@@ -1,142 +1,142 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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.apache.pivot.functional.monad;
-
-import java.util.Iterator;
-import org.apache.pivot.annotations.UnsupportedOperation;
-
-/**
- * Definition of a generic Option container, to hold an invariant value 
(derived from Monad).
- */
-public abstract class Option<T> extends Monad<T> implements Iterable<T> {
-    protected final T value;
-
-    /**
-     * Default constructor, do not use because it set null as invariant value 
to hold.
-     */
-    public Option() {
-        this(null);
-    }
-
-    /**
-     * Constructor with a value to set in the Option.
-     * @param val the value to set in the Option
-     */
-    public Option(final T val) {
-        this.value = val;
-    }
-
-    /**
-     * Tell if the value has been set in the Option.
-     * @return true if set, otherwise false
-     */
-    public abstract boolean hasValue();
-
-    /**
-     * Return the value contained in the Option.
-     * @return the value (if set)
-     */
-    public abstract T getValue();
-
-    /**
-     * Return the value contained in the Option, or an alternative value if 
not set.
-     * @param alternativeValue the value to return as alternative (if value 
wasn't set in the Option)
-     * @return value if set, otherwise alternativeValue
-     */
-    public T getValueOrElse(final T alternativeValue) {
-        return hasValue() ? getValue() : alternativeValue;
-    }
-
-    /**
-     * Return the value contained in the Option, or null if it hasn't a value 
set.
-     * @return value if set, otherwise null
-     */
-    public T getValueOrNull() {
-        return getValueOrElse(null);
-    }
-
-    @Override
-    public String toString() {
-        return "Option(" + ((value != null) ? value.toString() : "null") + ")";
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((value == null) ? 0 : value.hashCode());
-        return result;
-    }
-
-    @SuppressWarnings("rawtypes")
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (!(obj instanceof Option)) {
-            return false;
-        }
-        Option other = (Option) obj;
-        if (value == null) {
-            if (other.value != null) {
-                return false;
-            }
-        } else if (!value.equals(other.value)) {
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Return an Iterator over this option.
-     * @see java.lang.Iterable#iterator()
-     */
-    @Override
-    public Iterator<T> iterator() {
-        return new OptionIterator();
-    }
-
-
-    /**
-     * Immutable iterator on the value contained in the Option (if any).
-     */
-    private class OptionIterator implements Iterator<T> {
-        private int cursor = 0;
-
-        @Override
-        public boolean hasNext() {
-            return (hasValue() && cursor == 0);
-        }
-
-        @Override
-        public T next() {
-            cursor++;
-            return getValue();
-        }
-
-        @Override
-        @UnsupportedOperation
-        public void remove() {
-            throw new UnsupportedOperationException();
-        }
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.apache.pivot.functional.monad;
+
+import java.util.Iterator;
+import org.apache.pivot.annotations.UnsupportedOperation;
+
+/**
+ * Definition of a generic Option container, to hold an invariant value 
(derived from Monad).
+ */
+public abstract class Option<T> extends Monad<T> implements Iterable<T> {
+    protected final T value;
+
+    /**
+     * Default constructor, do not use because it set null as invariant value 
to hold.
+     */
+    public Option() {
+        this(null);
+    }
+
+    /**
+     * Constructor with a value to set in the Option.
+     * @param val the value to set in the Option
+     */
+    public Option(final T val) {
+        this.value = val;
+    }
+
+    /**
+     * Tell if the value has been set in the Option.
+     * @return true if set, otherwise false
+     */
+    public abstract boolean hasValue();
+
+    /**
+     * Return the value contained in the Option.
+     * @return the value (if set)
+     */
+    public abstract T getValue();
+
+    /**
+     * Return the value contained in the Option, or an alternative value if 
not set.
+     * @param alternativeValue the value to return as alternative (if value 
wasn't set in the Option)
+     * @return value if set, otherwise alternativeValue
+     */
+    public T getValueOrElse(final T alternativeValue) {
+        return hasValue() ? getValue() : alternativeValue;
+    }
+
+    /**
+     * Return the value contained in the Option, or null if it hasn't a value 
set.
+     * @return value if set, otherwise null
+     */
+    public T getValueOrNull() {
+        return getValueOrElse(null);
+    }
+
+    @Override
+    public String toString() {
+        return "Option(" + ((value != null) ? value.toString() : "null") + ")";
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((value == null) ? 0 : value.hashCode());
+        return result;
+    }
+
+    @SuppressWarnings("rawtypes")
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof Option)) {
+            return false;
+        }
+        Option other = (Option) obj;
+        if (value == null) {
+            if (other.value != null) {
+                return false;
+            }
+        } else if (!value.equals(other.value)) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Return an Iterator over this option.
+     * @see java.lang.Iterable#iterator()
+     */
+    @Override
+    public Iterator<T> iterator() {
+        return new OptionIterator();
+    }
+
+
+    /**
+     * Immutable iterator on the value contained in the Option (if any).
+     */
+    private class OptionIterator implements Iterator<T> {
+        private int cursor = 0;
+
+        @Override
+        public boolean hasNext() {
+            return (hasValue() && cursor == 0);
+        }
+
+        @Override
+        public T next() {
+            cursor++;
+            return getValue();
+        }
+
+        @Override
+        @UnsupportedOperation
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+}

Propchange: pivot/trunk/core/src/org/apache/pivot/functional/monad/Option.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
pivot/trunk/core/src/org/apache/pivot/functional/monad/OptionCompanion.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/monad/OptionCompanion.java?rev=1913470&r1=1913469&r2=1913470&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/functional/monad/OptionCompanion.java 
(original)
+++ pivot/trunk/core/src/org/apache/pivot/functional/monad/OptionCompanion.java 
Tue Oct 31 19:15:47 2023
@@ -1,111 +1,111 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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.apache.pivot.functional.monad;
-
-import java.util.Objects;
-
-/**
- * Utility class for additional Option methods.
- */
-@SuppressWarnings({"unchecked", "rawtypes"})
-public final class OptionCompanion<T> {
-    private static final OptionCompanion INSTANCE = new OptionCompanion<>();
-
-    /**
-     * Get the static instance.
-     * @param <T> The type of this companion object.
-     * @return the static instance
-     */
-    public static final <T> OptionCompanion<T> getInstance() {
-        return INSTANCE;
-    }
-
-    /**
-     * Default constructor, not usable from outside.
-     */
-    private OptionCompanion() {
-        // no-op
-    }
-
-
-    /**
-     * Utility method to say if the given argument is an Option.
-     *
-     * @param val the value to test
-     * @return true if it's an Option, false otherwise
-     */
-    public final boolean isOption(final T val) {
-        return val instanceof Option;
-    }
-
-    /**
-     * Utility method to build an Option, depending on the value given.
-     * @param val the value to set
-     * @return Some(val) or None(), depending on the given value
-     */
-    public Option<T> fromValue(final T val) {
-        if (val != null) {
-            return new Some<>(val);
-        }
-
-        return None.getInstance();
-    }
-
-    /**
-     * Utility method to return the value contained in the given Option.
-     * @param o the Option
-     * @return the value if any, or null
-     */
-    public T toValue(final Option<T> o) {
-        Objects.requireNonNull(o);
-
-        if (!o.hasValue()) {
-            return null;
-        }
-
-        return o.getValue();
-    }
-
-    /**
-     * Utility method to return the value contained in the given Option,
-     * or an alternate value if not present.
-     * @param o the Option
-     * @param alternativeValue the alternative value (null could be used here)
-     * @return value if set, otherwise alternativeValue
-     */
-    public T toValueOrElse(final Option<T> o, final T alternativeValue) {
-        Objects.requireNonNull(o);
-
-        return o.getValueOrElse(alternativeValue);
-    }
-
-    /**
-     * Utility method that tell if the given Option has nested Option 
instances.
-     * @param o the Option to test
-     * @return true if it contains at least one nested Option, otherwise false
-     */
-    public boolean hasNestedOptions(final Option<T> o) {
-        Objects.requireNonNull(o);
-
-        if (o instanceof None) {
-            return false;
-        }
-
-        return o.getValue() instanceof Option;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.apache.pivot.functional.monad;
+
+import java.util.Objects;
+
+/**
+ * Utility class for additional Option methods.
+ */
+@SuppressWarnings({"unchecked", "rawtypes"})
+public final class OptionCompanion<T> {
+    private static final OptionCompanion INSTANCE = new OptionCompanion<>();
+
+    /**
+     * Get the static instance.
+     * @param <T> The type of this companion object.
+     * @return the static instance
+     */
+    public static final <T> OptionCompanion<T> getInstance() {
+        return INSTANCE;
+    }
+
+    /**
+     * Default constructor, not usable from outside.
+     */
+    private OptionCompanion() {
+        // no-op
+    }
+
+
+    /**
+     * Utility method to say if the given argument is an Option.
+     *
+     * @param val the value to test
+     * @return true if it's an Option, false otherwise
+     */
+    public final boolean isOption(final T val) {
+        return val instanceof Option;
+    }
+
+    /**
+     * Utility method to build an Option, depending on the value given.
+     * @param val the value to set
+     * @return Some(val) or None(), depending on the given value
+     */
+    public Option<T> fromValue(final T val) {
+        if (val != null) {
+            return new Some<>(val);
+        }
+
+        return None.getInstance();
+    }
+
+    /**
+     * Utility method to return the value contained in the given Option.
+     * @param o the Option
+     * @return the value if any, or null
+     */
+    public T toValue(final Option<T> o) {
+        Objects.requireNonNull(o);
+
+        if (!o.hasValue()) {
+            return null;
+        }
+
+        return o.getValue();
+    }
+
+    /**
+     * Utility method to return the value contained in the given Option,
+     * or an alternate value if not present.
+     * @param o the Option
+     * @param alternativeValue the alternative value (null could be used here)
+     * @return value if set, otherwise alternativeValue
+     */
+    public T toValueOrElse(final Option<T> o, final T alternativeValue) {
+        Objects.requireNonNull(o);
+
+        return o.getValueOrElse(alternativeValue);
+    }
+
+    /**
+     * Utility method that tell if the given Option has nested Option 
instances.
+     * @param o the Option to test
+     * @return true if it contains at least one nested Option, otherwise false
+     */
+    public boolean hasNestedOptions(final Option<T> o) {
+        Objects.requireNonNull(o);
+
+        if (o instanceof None) {
+            return false;
+        }
+
+        return o.getValue() instanceof Option;
+    }
+
+}

Propchange: 
pivot/trunk/core/src/org/apache/pivot/functional/monad/OptionCompanion.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: pivot/trunk/core/src/org/apache/pivot/functional/monad/Some.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/monad/Some.java?rev=1913470&r1=1913469&r2=1913470&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/functional/monad/Some.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/functional/monad/Some.java Tue Oct 31 
19:15:47 2023
@@ -1,71 +1,71 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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.apache.pivot.functional.monad;
-
-/**
- * Container for an immutable value, derived from Option.
- */
-public final class Some<T> extends Option<T> {
-
-    /**
-     * Default constructor, do not use here or an IllegalArgumentException will
-     * be thrown.
-     */
-    public Some() {
-        throw new IllegalArgumentException("Some must have a value in the 
constructor");
-    }
-
-    /**
-     * Constructor with a value to set here.
-     *
-     * @param val the value to set
-     */
-    public Some(T val) {
-        super(val);
-    }
-
-    @Override
-    public boolean hasValue() {
-        return true;
-    }
-
-    @Override
-    public T getValue() {
-        return value;
-    }
-
-    @Override
-    public String toString() {
-        return "Some(" + value.toString() + ")";
-    }
-
-    @Override
-    public boolean equals(Object other) {
-        if (other == null || other.getClass() != Some.class) {
-            return false;
-        }
-        Some<?> otherAsSome = (Some<?>) other;
-        Object otherAsSomeValue = otherAsSome.getValue();
-        return value.equals(otherAsSomeValue);
-    }
-
-    @Override
-    public int hashCode() {
-        return 31 * ((value != null) ? value.hashCode() : 0);
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.apache.pivot.functional.monad;
+
+/**
+ * Container for an immutable value, derived from Option.
+ */
+public final class Some<T> extends Option<T> {
+
+    /**
+     * Default constructor, do not use here or an IllegalArgumentException will
+     * be thrown.
+     */
+    public Some() {
+        throw new IllegalArgumentException("Some must have a value in the 
constructor");
+    }
+
+    /**
+     * Constructor with a value to set here.
+     *
+     * @param val the value to set
+     */
+    public Some(T val) {
+        super(val);
+    }
+
+    @Override
+    public boolean hasValue() {
+        return true;
+    }
+
+    @Override
+    public T getValue() {
+        return value;
+    }
+
+    @Override
+    public String toString() {
+        return "Some(" + value.toString() + ")";
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (other == null || other.getClass() != Some.class) {
+            return false;
+        }
+        Some<?> otherAsSome = (Some<?>) other;
+        Object otherAsSomeValue = otherAsSome.getValue();
+        return value.equals(otherAsSomeValue);
+    }
+
+    @Override
+    public int hashCode() {
+        return 31 * ((value != null) ? value.hashCode() : 0);
+    }
+
+}

Propchange: pivot/trunk/core/src/org/apache/pivot/functional/monad/Some.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: pivot/trunk/core/src/org/apache/pivot/functional/monad/Success.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/monad/Success.java?rev=1913470&r1=1913469&r2=1913470&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/functional/monad/Success.java 
(original)
+++ pivot/trunk/core/src/org/apache/pivot/functional/monad/Success.java Tue Oct 
31 19:15:47 2023
@@ -1,86 +1,86 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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.apache.pivot.functional.monad;
-
-/**
- * Generic container, to hold the successful result of a computation.
- */
-public class Success<T> extends Try<T> {
-    protected final T value;
-
-    /**
-     * Default constructor, do not use because it will throw an exception.
-     */
-    public Success() {
-        throw new IllegalArgumentException("Success must have a value in the 
constructor");
-    }
-
-    /**
-     * Constructor with a value to set.
-     * @param val the value to set
-     */
-    public Success(final T val) {
-        this.value = val;
-    }
-
-    @Override
-    public final boolean isSuccess() {
-        return true;
-    }
-
-    @Override
-    public final T getValue() {
-        return value;
-    }
-
-    @Override
-    public String toString() {
-        return "Success(" + ((value != null) ? value.toString() : "null") + 
")";
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + ((value == null) ? 0 : value.hashCode());
-        return result;
-    }
-
-    @SuppressWarnings("rawtypes")
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (!(obj instanceof Success)) {
-            return false;
-        }
-        Success other = (Success) obj;
-        if (value == null) {
-            if (other.value != null) {
-                return false;
-            }
-        } else if (!value.equals(other.value)) {
-            return false;
-        }
-        return true;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.apache.pivot.functional.monad;
+
+/**
+ * Generic container, to hold the successful result of a computation.
+ */
+public class Success<T> extends Try<T> {
+    protected final T value;
+
+    /**
+     * Default constructor, do not use because it will throw an exception.
+     */
+    public Success() {
+        throw new IllegalArgumentException("Success must have a value in the 
constructor");
+    }
+
+    /**
+     * Constructor with a value to set.
+     * @param val the value to set
+     */
+    public Success(final T val) {
+        this.value = val;
+    }
+
+    @Override
+    public final boolean isSuccess() {
+        return true;
+    }
+
+    @Override
+    public final T getValue() {
+        return value;
+    }
+
+    @Override
+    public String toString() {
+        return "Success(" + ((value != null) ? value.toString() : "null") + 
")";
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((value == null) ? 0 : value.hashCode());
+        return result;
+    }
+
+    @SuppressWarnings("rawtypes")
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (!(obj instanceof Success)) {
+            return false;
+        }
+        Success other = (Success) obj;
+        if (value == null) {
+            if (other.value != null) {
+                return false;
+            }
+        } else if (!value.equals(other.value)) {
+            return false;
+        }
+        return true;
+    }
+
+}

Propchange: pivot/trunk/core/src/org/apache/pivot/functional/monad/Success.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: pivot/trunk/core/src/org/apache/pivot/functional/monad/Try.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/monad/Try.java?rev=1913470&r1=1913469&r2=1913470&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/functional/monad/Try.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/functional/monad/Try.java Tue Oct 31 
19:15:47 2023
@@ -1,100 +1,100 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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.apache.pivot.functional.monad;
-
-import java.util.Iterator;
-import org.apache.pivot.annotations.UnsupportedOperation;
-
-/**
- * Definition of a generic Monad.
- */
-public abstract class Try<T> extends Monad<T> implements Iterable<T> {
-
-    /** Default constructor. */
-    protected Try() {
-        // no-op
-    }
-
-    /**
-     * Tell if it contains a successful value.
-     * @return true if it is s Success, otherwise false (it's a Failure)
-     */
-    public abstract boolean isSuccess();
-
-    /**
-     * Return the value contained.
-     * @return the value (if set)
-     */
-    public abstract T getValue();
-
-    /**
-     * Return the value contained in the Try if it is a successful value, or 
an alternative value.
-     * @param alternativeValue the value to return as alternative
-     * @return value if it is a successful value, otherwise alternativeValue
-     */
-    public T getValueOrElse(final T alternativeValue) {
-        return isSuccess() ? getValue() : alternativeValue;
-    }
-
-    /**
-     * Return the value contained in the Try, or null if it hasn't a value set.
-     * @return value if it is a successful value, otherwise null
-     */
-    public T getValueOrNull() {
-        return getValueOrElse(null);
-    }
-
-    @Override
-    public String toString() {
-        return "Try()";
-    }
-
-    /**
-     * Return an Iterator.
-     * @see java.lang.Iterable#iterator()
-     */
-    @Override
-    public Iterator<T> iterator() {
-        return new TryIterator();
-    }
-
-
-    /**
-     * Immutable iterator on the value contained in the Try (if any).
-     */
-    private class TryIterator implements Iterator<T> {
-        private int cursor = 0;
-
-        @Override
-        public boolean hasNext() {
-            return (isSuccess() && cursor == 0);
-        }
-
-        @Override
-        public T next() {
-            cursor++;
-            return getValue();
-        }
-
-        @Override
-        @UnsupportedOperation
-        public void remove() {
-            throw new UnsupportedOperationException();
-        }
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.apache.pivot.functional.monad;
+
+import java.util.Iterator;
+import org.apache.pivot.annotations.UnsupportedOperation;
+
+/**
+ * Definition of a generic Monad.
+ */
+public abstract class Try<T> extends Monad<T> implements Iterable<T> {
+
+    /** Default constructor. */
+    protected Try() {
+        // no-op
+    }
+
+    /**
+     * Tell if it contains a successful value.
+     * @return true if it is s Success, otherwise false (it's a Failure)
+     */
+    public abstract boolean isSuccess();
+
+    /**
+     * Return the value contained.
+     * @return the value (if set)
+     */
+    public abstract T getValue();
+
+    /**
+     * Return the value contained in the Try if it is a successful value, or 
an alternative value.
+     * @param alternativeValue the value to return as alternative
+     * @return value if it is a successful value, otherwise alternativeValue
+     */
+    public T getValueOrElse(final T alternativeValue) {
+        return isSuccess() ? getValue() : alternativeValue;
+    }
+
+    /**
+     * Return the value contained in the Try, or null if it hasn't a value set.
+     * @return value if it is a successful value, otherwise null
+     */
+    public T getValueOrNull() {
+        return getValueOrElse(null);
+    }
+
+    @Override
+    public String toString() {
+        return "Try()";
+    }
+
+    /**
+     * Return an Iterator.
+     * @see java.lang.Iterable#iterator()
+     */
+    @Override
+    public Iterator<T> iterator() {
+        return new TryIterator();
+    }
+
+
+    /**
+     * Immutable iterator on the value contained in the Try (if any).
+     */
+    private class TryIterator implements Iterator<T> {
+        private int cursor = 0;
+
+        @Override
+        public boolean hasNext() {
+            return (isSuccess() && cursor == 0);
+        }
+
+        @Override
+        public T next() {
+            cursor++;
+            return getValue();
+        }
+
+        @Override
+        @UnsupportedOperation
+        public void remove() {
+            throw new UnsupportedOperationException();
+        }
+    }
+
+}

Propchange: pivot/trunk/core/src/org/apache/pivot/functional/monad/Try.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
pivot/trunk/core/src/org/apache/pivot/functional/monad/TryCompanion.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/monad/TryCompanion.java?rev=1913470&r1=1913469&r2=1913470&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/functional/monad/TryCompanion.java 
(original)
+++ pivot/trunk/core/src/org/apache/pivot/functional/monad/TryCompanion.java 
Tue Oct 31 19:15:47 2023
@@ -1,129 +1,129 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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.apache.pivot.functional.monad;
-
-import java.util.Objects;
-
-/**
- * Utility class for additional Try methods.
- *
- * @param <T> The value type for this Try (on success).
- */
-@SuppressWarnings({"unchecked", "rawtypes"})
-public final class TryCompanion<T> {
-    /**
-     * The singleton (static) instance.
-     */
-    private static final TryCompanion INSTANCE = new TryCompanion<>();
-
-    /**
-     * Get the static instance.
-     * @param <T> The type of this companion object.
-     * @return the static instance
-     */
-    public static <T> TryCompanion<T> getInstance() {
-        return INSTANCE;
-    }
-
-    /**
-     * Default constructor, not usable from outside.
-     */
-    private TryCompanion() {
-        // no-op
-    }
-
-
-    /**
-     * Utility method to say if the given argument is a Try.
-     *
-     * @param val the value to test
-     * @return true if it's a Try, false otherwise
-     */
-    public boolean isTry(final T val) {
-        return val instanceof Try;
-    }
-
-    /**
-     * Utility method to build a Try instance, depending on the value given.
-     * @param val the value to set
-     * @return Success(val) or Failure(val), depending on the type of the 
given value
-     */
-    @SuppressWarnings("unchecked")
-    public Try<T> fromValue(final Object val) {
-        try {
-            // return new Success(val);
-            if (val == null || !(val instanceof RuntimeException)) {
-                return new Success(val);
-            }
-
-            return new Failure((RuntimeException) val);
-        } catch (RuntimeException re) {
-            return new Failure<>(re);
-        }
-    }
-
-    /**
-     * Utility method to return the value contained.
-     * @param t the try instance
-     * @return the Success instance containing the value, or the Failure 
instance containing the exception
-     */
-    public T toValue(final Try<T> t) {
-        Objects.requireNonNull(t);
-        return t.getValue();
-    }
-
-    /**
-     * Utility method to return the value contained,
-     * or an alternate value if not present.
-     * @param t the Try
-     * @param alternativeValue the alternative value (null could be used here)
-     * @return value if set, otherwise alternativeValue
-     */
-    public T toValueOrElse(final Try<T> t, final T alternativeValue) {
-        Objects.requireNonNull(t);
-        return t.getValueOrElse(alternativeValue);
-    }
-
-    /**
-     * Utility method that tell if the given Try has nested Try instances.
-     * @param t the Try to test
-     * @return true if it contains at least one nested Try, otherwise false
-     */
-    public boolean hasNestedOptions(final Try<T> t) {
-        Objects.requireNonNull(t);
-
-        if (t instanceof Failure) {
-            return false;
-        }
-
-        return t.getValue() instanceof Try;
-    }
-
-    /**
-     * Utility method to return the value contained in the Try, in a Option 
instance.
-     * @param t the Try
-     * @return an Option instance: Some(value) if success, None otherwise
-     */
-    @SuppressWarnings("unchecked")
-    public Option<T> toOption(final Try<T> t) {
-        Objects.requireNonNull(t);
-        if (t.isSuccess()) {
-            return (Option<T>) 
OptionCompanion.getInstance().fromValue(t.getValue());
-        }
-        return None.getInstance();
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.apache.pivot.functional.monad;
+
+import java.util.Objects;
+
+/**
+ * Utility class for additional Try methods.
+ *
+ * @param <T> The value type for this Try (on success).
+ */
+@SuppressWarnings({"unchecked", "rawtypes"})
+public final class TryCompanion<T> {
+    /**
+     * The singleton (static) instance.
+     */
+    private static final TryCompanion INSTANCE = new TryCompanion<>();
+
+    /**
+     * Get the static instance.
+     * @param <T> The type of this companion object.
+     * @return the static instance
+     */
+    public static <T> TryCompanion<T> getInstance() {
+        return INSTANCE;
+    }
+
+    /**
+     * Default constructor, not usable from outside.
+     */
+    private TryCompanion() {
+        // no-op
+    }
+
+
+    /**
+     * Utility method to say if the given argument is a Try.
+     *
+     * @param val the value to test
+     * @return true if it's a Try, false otherwise
+     */
+    public boolean isTry(final T val) {
+        return val instanceof Try;
+    }
+
+    /**
+     * Utility method to build a Try instance, depending on the value given.
+     * @param val the value to set
+     * @return Success(val) or Failure(val), depending on the type of the 
given value
+     */
+    @SuppressWarnings("unchecked")
+    public Try<T> fromValue(final Object val) {
+        try {
+            // return new Success(val);
+            if (val == null || !(val instanceof RuntimeException)) {
+                return new Success(val);
+            }
+
+            return new Failure((RuntimeException) val);
+        } catch (RuntimeException re) {
+            return new Failure<>(re);
+        }
+    }
+
+    /**
+     * Utility method to return the value contained.
+     * @param t the try instance
+     * @return the Success instance containing the value, or the Failure 
instance containing the exception
+     */
+    public T toValue(final Try<T> t) {
+        Objects.requireNonNull(t);
+        return t.getValue();
+    }
+
+    /**
+     * Utility method to return the value contained,
+     * or an alternate value if not present.
+     * @param t the Try
+     * @param alternativeValue the alternative value (null could be used here)
+     * @return value if set, otherwise alternativeValue
+     */
+    public T toValueOrElse(final Try<T> t, final T alternativeValue) {
+        Objects.requireNonNull(t);
+        return t.getValueOrElse(alternativeValue);
+    }
+
+    /**
+     * Utility method that tell if the given Try has nested Try instances.
+     * @param t the Try to test
+     * @return true if it contains at least one nested Try, otherwise false
+     */
+    public boolean hasNestedOptions(final Try<T> t) {
+        Objects.requireNonNull(t);
+
+        if (t instanceof Failure) {
+            return false;
+        }
+
+        return t.getValue() instanceof Try;
+    }
+
+    /**
+     * Utility method to return the value contained in the Try, in a Option 
instance.
+     * @param t the Try
+     * @return an Option instance: Some(value) if success, None otherwise
+     */
+    @SuppressWarnings("unchecked")
+    public Option<T> toOption(final Try<T> t) {
+        Objects.requireNonNull(t);
+        if (t.isSuccess()) {
+            return (Option<T>) 
OptionCompanion.getInstance().fromValue(t.getValue());
+        }
+        return None.getInstance();
+    }
+}

Propchange: 
pivot/trunk/core/src/org/apache/pivot/functional/monad/TryCompanion.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: pivot/trunk/core/src/org/apache/pivot/functional/monad/package.html
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/monad/package.html?rev=1913470&r1=1913469&r2=1913470&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/functional/monad/package.html 
(original)
+++ pivot/trunk/core/src/org/apache/pivot/functional/monad/package.html Tue Oct 
31 19:15:47 2023
@@ -1,23 +1,23 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-
-<html>
-<head></head>
-<body>
-<p>Contains a set of classes for implementing Monads (see FP).</p>
-</body>
-</html>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you 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.
+-->
+
+<html>
+<head></head>
+<body>
+<p>Contains a set of classes for implementing Monads (see FP).</p>
+</body>
+</html>

Propchange: pivot/trunk/core/src/org/apache/pivot/functional/monad/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: pivot/trunk/core/src/org/apache/pivot/functional/package.html
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/functional/package.html?rev=1913470&r1=1913469&r2=1913470&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/functional/package.html (original)
+++ pivot/trunk/core/src/org/apache/pivot/functional/package.html Tue Oct 31 
19:15:47 2023
@@ -1,23 +1,23 @@
-<!--
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to you 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.
--->
-
-<html>
-<head></head>
-<body>
-<p>Contains a set of classes for typical usage in Functional programming 
(FP).</p>
-</body>
-</html>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to you 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.
+-->
+
+<html>
+<head></head>
+<body>
+<p>Contains a set of classes for typical usage in Functional programming 
(FP).</p>
+</body>
+</html>

Propchange: pivot/trunk/core/src/org/apache/pivot/functional/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: pivot/trunk/core/src/org/apache/pivot/io/FileObjectList.java
URL: 
http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/io/FileObjectList.java?rev=1913470&r1=1913469&r2=1913470&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/io/FileObjectList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/io/FileObjectList.java Tue Oct 31 
19:15:47 2023
@@ -1,85 +1,85 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to you 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.apache.pivot.io;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-import org.apache.commons.vfs2.FileObject;
-import org.apache.pivot.annotations.UnsupportedOperation;
-import org.apache.pivot.collections.adapter.ListAdapter;
-
-/**
- * Collection representing a list of files. Each entry in the list is unique;
- * i.e. a single file can't be added to the list more than once.
- */
-public class FileObjectList extends ListAdapter<FileObject> {
-    private static final long serialVersionUID = 1327073299912864048L;
-
-    private static class FilePathComparator implements Comparator<FileObject>, 
Serializable {
-        private static final long serialVersionUID = -4470959470309721902L;
-
-        @Override
-        public int compare(FileObject file1, FileObject file2) {
-            String path1 = file1.getName().getPath();
-            String path2 = file2.getName().getPath();
-
-            return path1.compareTo(path2);
-        }
-    }
-
-    private static final FilePathComparator FILE_PATH_COMPARATOR = new 
FilePathComparator();
-
-    public FileObjectList() {
-        this(new java.util.ArrayList<FileObject>());
-    }
-
-    public FileObjectList(java.util.List<FileObject> files) {
-        super(files);
-
-        super.setComparator(FILE_PATH_COMPARATOR);
-    }
-
-    @Override
-    public int add(FileObject file) {
-        int index = indexOf(file);
-
-        if (index == -1) {
-            index = super.add(file);
-        }
-
-        return index;
-    }
-
-    @Override
-    @UnsupportedOperation
-    public void insert(FileObject file, int index) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    @UnsupportedOperation
-    public FileObject update(int index, FileObject file) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    @UnsupportedOperation
-    public void setComparator(Comparator<FileObject> comparator) {
-        throw new UnsupportedOperationException();
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you 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.apache.pivot.io;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+import org.apache.commons.vfs2.FileObject;
+import org.apache.pivot.annotations.UnsupportedOperation;
+import org.apache.pivot.collections.adapter.ListAdapter;
+
+/**
+ * Collection representing a list of files. Each entry in the list is unique;
+ * i.e. a single file can't be added to the list more than once.
+ */
+public class FileObjectList extends ListAdapter<FileObject> {
+    private static final long serialVersionUID = 1327073299912864048L;
+
+    private static class FilePathComparator implements Comparator<FileObject>, 
Serializable {
+        private static final long serialVersionUID = -4470959470309721902L;
+
+        @Override
+        public int compare(FileObject file1, FileObject file2) {
+            String path1 = file1.getName().getPath();
+            String path2 = file2.getName().getPath();
+
+            return path1.compareTo(path2);
+        }
+    }
+
+    private static final FilePathComparator FILE_PATH_COMPARATOR = new 
FilePathComparator();
+
+    public FileObjectList() {
+        this(new java.util.ArrayList<FileObject>());
+    }
+
+    public FileObjectList(java.util.List<FileObject> files) {
+        super(files);
+
+        super.setComparator(FILE_PATH_COMPARATOR);
+    }
+
+    @Override
+    public int add(FileObject file) {
+        int index = indexOf(file);
+
+        if (index == -1) {
+            index = super.add(file);
+        }
+
+        return index;
+    }
+
+    @Override
+    @UnsupportedOperation
+    public void insert(FileObject file, int index) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    @UnsupportedOperation
+    public FileObject update(int index, FileObject file) {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    @UnsupportedOperation
+    public void setComparator(Comparator<FileObject> comparator) {
+        throw new UnsupportedOperationException();
+    }
+}

Propchange: pivot/trunk/core/src/org/apache/pivot/io/FileObjectList.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to