Changeset 58:62de30f3b623 in finroc_core-java


Ignore:
Timestamp:
10.12.2010 13:48:36 (9 years ago)
Author:
Max Reichardt <reichardt@…>
Branch:
default
Phase:
public
Convert:
svn:fc394f53-5a1c-4f87-a64a-968f46d709a5/trunk@59
Message:

Reverted order of first two parameters ("name" and "parent") in framework element constructors

Location:
org/finroc/core
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • org/finroc/core/FrameworkElement.java

    r37 r58  
    246246    public static final LogDomain edgeLog = LogDefinitions.finroc.getSubDomain("edges"); 
    247247 
    248     @JavaOnly public FrameworkElement(@Const @Ref String description, @Ptr FrameworkElement parent) { 
    249         this(description, parent, CoreFlags.ALLOWS_CHILDREN, -1); 
     248    @JavaOnly public FrameworkElement(@Ptr FrameworkElement parent, @Const @Ref String description) { 
     249        this(parent, description, CoreFlags.ALLOWS_CHILDREN, -1); 
    250250    } 
    251251 
     
    260260        "children(getFlag(CoreFlags::ALLOWS_CHILDREN) ? 4 : 0, getFlag(CoreFlags::ALLOWS_CHILDREN) ? 4 : 0)" 
    261261    }) 
    262     public FrameworkElement(@Const @Ref @CppDefault("\"\"") String description_, @Ptr @CppDefault("NULL") FrameworkElement parent_, 
     262    public FrameworkElement(@Ptr @CppDefault("NULL") FrameworkElement parent_, @Const @Ref @CppDefault("\"\"") String description_, 
    263263                            @CppDefault("CoreFlags::ALLOWS_CHILDREN") int flags_, @CppDefault("-1") int lockOrder_) { 
    264264        createrThreadUid = ThreadUtil.getCurrentThreadId(); 
     
    316316 
    317317    @JavaOnly public FrameworkElement(@Const @Ref String description) { 
    318         this(description, null); 
     318        this(null, description); 
    319319    } 
    320320 
    321321    @JavaOnly public FrameworkElement() { 
    322         this("", null); 
     322        this(null, ""); 
    323323    } 
    324324 
  • org/finroc/core/RuntimeEnvironment.java

    r56 r58  
    4747import org.finroc.jc.container.SimpleListWithMutex; 
    4848import org.finroc.jc.stream.ChunkedBuffer; 
    49 import org.finroc.jc.thread.ThreadUtil; 
    5049import org.finroc.log.LogLevel; 
    5150 
     
    228227 
    229228        // add uninitialized child 
    230         instance.unrelated = new FrameworkElement("Unrelated", instance); 
     229        instance.unrelated = new FrameworkElement(instance, "Unrelated"); 
    231230        @SuppressWarnings("unused") 
    232231        @CppUnused 
     
    290289    //@Init("deleteLastList(new util::SimpleList<finroc::util::Object*>())") 
    291290    private RuntimeEnvironment() { 
    292         super("Runtime", null, CoreFlags.ALLOWS_CHILDREN | CoreFlags.IS_RUNTIME, LockOrderLevels.RUNTIME_ROOT); 
     291        super(null, "Runtime", CoreFlags.ALLOWS_CHILDREN | CoreFlags.IS_RUNTIME, LockOrderLevels.RUNTIME_ROOT); 
    293292        assert instance == null; 
    294293        instance = this; 
  • org/finroc/core/admin/AdminServer.java

    r46 r58  
    322322                            ci.close(); 
    323323                        } 
    324                         FrameworkElement created = cma.createModule(name.toString(), parent, params); 
     324                        FrameworkElement created = cma.createModule(parent, name.toString(), params); 
    325325                        created.setFinstructed(cma, params); 
    326326                        created.init(); 
  • org/finroc/core/finstructable/FinstructableGroup.java

    r47 r58  
    8282        new StandardCreateModuleAction<FinstructableGroup>("Finstructable Group", FinstructableGroup.class); 
    8383 
    84     public FinstructableGroup(@Const @Ref String name, FrameworkElement parent) { 
    85         super(name, parent, CoreFlags.FINSTRUCTABLE_GROUP | CoreFlags.ALLOWS_CHILDREN, -1); 
     84    public FinstructableGroup(FrameworkElement parent, @Const @Ref String name) { 
     85        super(parent, name, CoreFlags.FINSTRUCTABLE_GROUP | CoreFlags.ALLOWS_CHILDREN, -1); 
    8686        addAnnotation(new StructureParameterList(xmlFile)); 
    8787    } 
     
    9494     */ 
    9595    public FinstructableGroup(@Const @Ref String name, FrameworkElement parent, @Const @Ref String xmlFile) { 
    96         this(name, parent); 
     96        this(parent, name); 
    9797        try { 
    9898            this.xmlFile.set(xmlFile); 
     
    204204                spl.deserialize(constructorParams); 
    205205            } 
    206             created = action.createModule(name, parent, spl); 
     206            created = action.createModule(parent, name, spl); 
    207207            created.setFinstructed(action, spl); 
    208208            created.init(); 
  • org/finroc/core/finstructable/Group.java

    r47 r58  
    2828import org.finroc.core.plugin.StandardCreateModuleAction; 
    2929import org.finroc.core.port.EdgeAggregator; 
     30import org.finroc.jc.annotation.Const; 
    3031import org.finroc.jc.annotation.PassByValue; 
     32import org.finroc.jc.annotation.Ref; 
    3133 
    3234/** 
     
    4547        new StandardCreateModuleAction<Group>("Group", Group.class); 
    4648 
    47     public Group(String description, FrameworkElement parent) { 
    48         super(description, parent, 0); 
     49    public Group(FrameworkElement parent, @Const @Ref String description) { 
     50        super(parent, description, 0); 
    4951        addAnnotation(new StructureParameterList(ports)); 
    5052        ports.getValue().initialSetup(this, 0, true); 
  • org/finroc/core/finstructable/GroupInterface.java

    r47 r58  
    3131import org.finroc.core.port.EdgeAggregator; 
    3232import org.finroc.core.port.PortFlags; 
     33import org.finroc.jc.annotation.Const; 
    3334import org.finroc.jc.annotation.CppType; 
    3435import org.finroc.jc.annotation.IncludeClass; 
    3536import org.finroc.jc.annotation.PassByValue; 
     37import org.finroc.jc.annotation.Ref; 
    3638 
    3739/** 
     
    7072     * @param parent Parent element 
    7173     */ 
    72     public GroupInterface(String description, FrameworkElement parent) { 
    73         super(description, parent, EdgeAggregator.IS_INTERFACE); 
     74    public GroupInterface(FrameworkElement parent, @Const @Ref String description) { 
     75        super(parent, description, EdgeAggregator.IS_INTERFACE); 
    7476        addAnnotation(new StructureParameterList(ports)); 
    7577        ports.getValue().initialSetup(this, 0, true); 
     
    8789     * @return flags for these parameters 
    8890     */ 
    89     public GroupInterface(String description, FrameworkElement parent, DataClassification dataClass, PortDirection portDir, boolean shared, boolean uniqueLink) { 
    90         super(description, parent, computePortFlags(dataClass, portDir, shared, uniqueLink)); 
     91    public GroupInterface(FrameworkElement parent, @Const @Ref String description, DataClassification dataClass, PortDirection portDir, boolean shared, boolean uniqueLink) { 
     92        super(parent, description, computePortFlags(dataClass, portDir, shared, uniqueLink)); 
    9193        addAnnotation(new StructureParameterList(ports)); 
    9294        ports.getValue().initialSetup(this, 0, portDir == PortDirection.BOTH); 
  • org/finroc/core/plugin/ConstructorCreateModuleAction.java

    r55 r58  
    243243        Class<?>[] ps = c.getParameterTypes(); 
    244244        String[] psn2 = paramNames.split(","); 
    245         assert(String.class.equals(ps[0])) : "First parameter must be name"; 
    246         assert(FrameworkElement.class.equals(ps[1])) : "Second parameter must be parent"; 
     245        assert(String.class.equals(ps[1])) : "Second parameter must be name"; 
     246        assert(FrameworkElement.class.equals(ps[0])) : "First parameter must be parent"; 
    247247        Class<?>[] ps2 = new Class[13]; 
    248248        String[] psn = new String[13]; 
     
    284284 
    285285    @Override 
    286     public FrameworkElement createModule(String name, FrameworkElement parent, ConstructorParameters params) throws Exception { 
     286    public FrameworkElement createModule(FrameworkElement parent, String name, ConstructorParameters params) throws Exception { 
    287287        Object[] os = new Object[getParameterTypes().size()]; 
    288288        Class<?>[] ps = constructor.getParameterTypes(); 
  • org/finroc/core/plugin/CreateModuleAction.java

    r47 r58  
    4949     * @return Created Module (or Group) 
    5050     */ 
    51     @ConstMethod public FrameworkElement createModule(String name, FrameworkElement parent, @CppDefault("NULL") ConstructorParameters params) throws Exception; 
     51    @ConstMethod public FrameworkElement createModule(FrameworkElement parent, String name, @CppDefault("NULL") ConstructorParameters params) throws Exception; 
    5252 
    5353    /** 
  • org/finroc/core/plugin/ExternalConnection.java

    r31 r58  
    7474     */ 
    7575    public ExternalConnection(String description, String defaultAddress) { 
    76         super(description, RuntimeEnvironment.getInstance(), CoreFlags.ALLOWS_CHILDREN | CoreFlags.NETWORK_ELEMENT, LockOrderLevels.LEAF_GROUP); 
     76        super(RuntimeEnvironment.getInstance(), description, CoreFlags.ALLOWS_CHILDREN | CoreFlags.NETWORK_ELEMENT, LockOrderLevels.LEAF_GROUP); 
    7777        StructureParameterList.getOrCreate(this).add(autoConnectTo); 
    7878        lastAddress = defaultAddress; 
  • org/finroc/core/plugin/StandardCreateModuleAction.java

    r48 r58  
    8383        //JavaOnlyBlock 
    8484        try { 
    85             constructor = moduleClass.getConstructor(String.class, FrameworkElement.class); 
     85            constructor = moduleClass.getConstructor(FrameworkElement.class, String.class); 
    8686        } catch (Exception e) { 
    8787            throw new RuntimeException(e); 
     
    9292 
    9393    /*Cpp 
    94     static FrameworkElement* createModuleImpl(const util::String& name, FrameworkElement* parent) { 
    95         return new T(name, parent); 
     94    static FrameworkElement* createModuleImpl(FrameworkElement* parent, const util::String& name) { 
     95        return new T(parent, name); 
    9696    } 
    9797     */ 
    9898 
    9999    @Override 
    100     @InCpp("return createModuleImpl(name, parent);") 
    101     public FrameworkElement createModule(String name, FrameworkElement parent, ConstructorParameters params) throws Exception { 
    102         return constructor.newInstance(name, parent); 
     100    @InCpp("return createModuleImpl(parent, name);") 
     101    public FrameworkElement createModule(FrameworkElement parent, String name, ConstructorParameters params) throws Exception { 
     102        return constructor.newInstance(parent, name); 
    103103    } 
    104104 
  • org/finroc/core/port/AbstractPort.java

    r35 r58  
    156156    //     "edgesDest((util::SafeConcurrentlyIterableList<AbstractPort*>)edgesDest_)"}) 
    157157    public AbstractPort(PortCreationInfo pci) { 
    158         super(pci.description, pci.parent, processFlags(pci), pci.lockOrder < 0 ? LockOrderLevels.PORT : pci.lockOrder); 
     158        super(pci.parent, pci.description, processFlags(pci), pci.lockOrder < 0 ? LockOrderLevels.PORT : pci.lockOrder); 
    159159 
    160160        // init types 
  • org/finroc/core/port/EdgeAggregator.java

    r35 r58  
    6464 
    6565    /** see FrameworkElement for parameter description */ 
    66     public EdgeAggregator(@Const @Ref @CppDefault("\"\"") String description_, @Ptr @CppDefault("NULL") FrameworkElement parent_, @CppDefault("0") int flags_) { 
    67         super(description_, parent_, flags_ | CoreFlags.ALLOWS_CHILDREN | CoreFlags.EDGE_AGGREGATOR, parent_ == null ? LockOrderLevels.LEAF_GROUP : -1); 
     66    public EdgeAggregator(@Ptr @CppDefault("NULL") FrameworkElement parent_, @Const @Ref @CppDefault("\"\"") String description_, @CppDefault("0") int flags_) { 
     67        super(parent_, description_, flags_ | CoreFlags.ALLOWS_CHILDREN | CoreFlags.EDGE_AGGREGATOR, parent_ == null ? LockOrderLevels.LEAF_GROUP : -1); 
    6868    } 
    6969 
  • org/finroc/core/setting/Settings.java

    r31 r58  
    118118            return; 
    119119        } 
    120         portRoot = new FrameworkElement(description, parent); 
     120        portRoot = new FrameworkElement(parent, description); 
    121121        for (int i = 0, n = settings.size(); i < n; i++) { 
    122122            Setting set = settings.get(i); 
  • org/finroc/core/test/Peer2PeerTest.java

    r1 r58  
    4848 
    4949        // Create two ports 
    50         FrameworkElement linkTest = new FrameworkElement("linkTest"); 
     50        FrameworkElement linkTest = new FrameworkElement(null, "linkTest"); 
    5151        NumberPort output = new NumberPort(new PortCreationInfo("testOut", PortFlags.SHARED_OUTPUT_PORT)); 
    5252        output.link(linkTest, "linkTestPort"); 
  • org/finroc/core/thread/ThreadContainer.java

    r57 r58  
    2929import org.finroc.core.parameter.StructureParameterList; 
    3030import org.finroc.core.plugin.StandardCreateModuleAction; 
     31import org.finroc.jc.annotation.Const; 
    3132import org.finroc.jc.annotation.PassByValue; 
     33import org.finroc.jc.annotation.Ref; 
    3234import org.finroc.jc.thread.ThreadUtil; 
    3335import org.finroc.log.LogLevel; 
     
    6264     * @param parent parent 
    6365     */ 
    64     public ThreadContainer(String description, FrameworkElement parent) { 
    65         super(description, parent); 
     66    public ThreadContainer(FrameworkElement parent, @Const @Ref String description) { 
     67        super(parent, description); 
    6668        StructureParameterList.getOrCreate(this).add(rtThread); 
    6769        addAnnotation(new ExecutionControl(this)); 
Note: See TracChangeset for help on using the changeset viewer.