package io.github.teamdevintia.devathlon3.portal;

import org.bukkit.Location;
import org.bukkit.block.Block;

/**
 * A small tuple holding two locations
 *
 * @author MiniDigger
 */
public class LocationTuple {

    public Location loc1;
    public Location loc2;

    public LocationTuple( Block loc1, Block loc2 ) {
        this.loc1 = loc1.getLocation();
        this.loc2 = loc2.getLocation();
    }

    @Override
    public boolean equals( Object obj ) {
        if ( !( obj instanceof LocationTuple ) ) {
            return false;
        }

        LocationTuple tuple = (LocationTuple) obj;
        return ( loc1.equals( tuple.loc1 ) || loc1.equals( tuple.loc2 ) ) && ( loc2.equals( tuple.loc1 ) || loc2.equals( tuple.loc2 ) );
    }
}

@@ -104,16 +104,44 @@
 Block;%0A%0A
+import java.util.Iterator;%0A%0A
 /**%0A * A
@@ -230,16 +230,46 @@
 ionTuple
+ implements Iterable%3CLocation%3E
  %7B%0A%0A    
@@ -652,16 +652,16 @@
 e) obj;%0A
-
         
@@ -794,11 +794,712 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public Iterator%3CLocation%3E iterator() %7B%0A        Iterator%3CLocation%3E it = new Iterator%3CLocation%3E() %7B%0A            private int currentIndex = 0;%0A%0A            @Override%0A            public boolean hasNext() %7B%0A                return currentIndex %3C 2;%0A            %7D%0A%0A            @Override%0A            public Location next() %7B%0A                currentIndex++;%0A                if ( currentIndex == 1 ) %7B%0A                    return loc1;%0A                %7D else %7B%0A                    return loc2;%0A                %7D%0A            %7D%0A%0A            @Override%0A            public void remove() %7B%0A                throw new UnsupportedOperationException();%0A            %7D%0A        %7D;%0A        return it;%0A    %7D
 %0A%7D%0A

make location tuple iterable