Changeset 279:00c9a8bc3962 in finroc_tools_finstruct-java


Ignore:
Timestamp:
20.08.2019 08:01:44 (5 weeks ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
default
Phase:
public
Tags:
tip
Message:

Adapts to changes in finroc_core-java (URI authority handling updates)

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • SmartConnecting.java

    r278 r279  
    3131import java.util.Set; 
    3232 
    33 import org.finroc.core.FrameworkElement; 
    3433import org.finroc.core.FrameworkElementFlags; 
    3534import org.finroc.core.datatype.DataTypeReference; 
     
    4847import org.finroc.tools.finstruct.actions.ConnectAction; 
    4948import org.finroc.tools.finstruct.actions.FinstructAction; 
     49import org.rrlib.finroc_core_utils.jc.container.SafeConcurrentlyIterableList; 
    5050import org.rrlib.serialization.Register; 
    5151import org.rrlib.serialization.rtti.DataTypeBase; 
     
    807807 
    808808    /** 
    809      * @param runtime Runtime to check 
    810      * @return Generic Protocol Runtime Object if provided runtime has such 
    811      */ 
    812     public static org.finroc.core.net.generic_protocol.RemoteRuntime getRuntimeElement(RemoteRuntime runtime) { 
    813         for (RemotePort port : runtime.getRemotePorts()) { 
    814             if (port.getPort() != null) { 
    815                 FrameworkElement candidateRuntime = port.getPort().getParentWithFlags(FrameworkElementFlags.ALTERNATIVE_LINK_ROOT); 
    816                 if (candidateRuntime instanceof org.finroc.core.net.generic_protocol.RemoteRuntime) { 
    817                     return (org.finroc.core.net.generic_protocol.RemoteRuntime)candidateRuntime; 
    818                 } 
    819             } 
    820         } 
    821         return null; 
    822     } 
    823  
    824     /** 
    825809     * @param runtime Runtime whose URI alternatives to obtain 
    826810     * @param sourceRuntime Runtime from which to obtain URI alternatives 
    827811     * @return List with alternatives for URI authorities to use 
    828812     */ 
    829     public static List<String> getUriAuthorityAlternatives(RemoteRuntime runtime, RemoteRuntime sourceRuntime) { 
    830         org.finroc.core.net.generic_protocol.RemoteRuntime runtimeElement = getRuntimeElement(runtime); 
    831         org.finroc.core.net.generic_protocol.RemoteRuntime sourceRuntimeElement = getRuntimeElement(sourceRuntime); 
     813    public static SafeConcurrentlyIterableList<String> getUriAuthorityAlternatives(RemoteRuntime runtime, RemoteRuntime sourceRuntime) { 
     814        org.finroc.core.net.generic_protocol.RemoteRuntime runtimeElement = runtime.getRuntimeElement(); 
     815        org.finroc.core.net.generic_protocol.RemoteRuntime sourceRuntimeElement = sourceRuntime.getRuntimeElement(); 
    832816 
    833817        if (runtimeElement != null) { 
    834818            boolean sameHost = sourceRuntimeElement != null && runtimeElement.hasSameHost(sourceRuntimeElement); 
     819            //System.out.println("Same Host " + sameHost + " " + runtimeElement.getName() + " " + sourceRuntimeElement.getName()); 
    835820            return runtimeElement.getUriAuthorityAlternatives(sameHost); 
    836821        } 
    837822 
    838         ArrayList<String> result = new ArrayList<String>(); 
    839         result.add(runtime.uuid); 
     823        SafeConcurrentlyIterableList<String> result = new SafeConcurrentlyIterableList<String>(1, 1); 
     824        result.add(runtime.uuid, true); 
    840825        return result; 
    841826    } 
  • dialogs/CreateConnectorOptionsDialog.java

    r278 r279  
    5353import org.finroc.tools.gui.commons.Util; 
    5454import org.finroc.tools.gui.util.gui.MDialog; 
     55import org.rrlib.finroc_core_utils.jc.ArrayWrapper; 
    5556import org.rrlib.serialization.Serialization; 
    5657import org.rrlib.serialization.StringInputStream; 
     
    164165 
    165166            if (runtimes.size() == 2) { 
    166                 List<String> authorityOptions = SmartConnecting.getUriAuthorityAlternatives(actionBatches.get(0).destinationRuntime, actionBatches.get(0).sourceRuntime); 
     167                ArrayList<String> authorityOptions = new ArrayList<String>(); 
     168                ArrayWrapper<String> authorityOptionsArray = SmartConnecting.getUriAuthorityAlternatives(runtimes.get(1), runtimes.get(0)).getIterable(); 
     169                for (int i = 0, n = authorityOptionsArray.size(); i < n; i++) { 
     170                    if (authorityOptionsArray.get(i) != null) { 
     171                        authorityOptions.add(authorityOptionsArray.get(i)); 
     172                    } 
     173                } 
    167174                authorityOptions.add(0, ANY_URI_AUTHORITY); 
    168175                JPanel host = new JPanel(); 
Note: See TracChangeset for help on using the changeset viewer.