mirror of
https://github.com/alibaba/Tangram-Android.git
synced 2026-10-26 11:09:59 +08:00
add tangram op
This commit is contained in:
@@ -790,6 +790,15 @@ public class TangramEngine extends BaseTangramEngine<JSONArray, Card, BaseCell>
|
||||
|
||||
}
|
||||
|
||||
public Consumer<Object> asReplaceCardConsumer() {
|
||||
return new Consumer<Object>() {
|
||||
@Override
|
||||
public void accept(Object o) throws Exception {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Make engine as a consumer to accept data to append at the end of list
|
||||
|
||||
@@ -91,7 +91,7 @@ public class BusSupport implements IDispatcherDelegate {
|
||||
|
||||
/**
|
||||
* Post an event to the bus, called by event sender
|
||||
* @param event Event object
|
||||
* @param event TangramOp1 object
|
||||
* @return Return true if the event is successfully enqueued into the event queue.
|
||||
*/
|
||||
public boolean post(@NonNull Event event) {
|
||||
@@ -100,7 +100,7 @@ public class BusSupport implements IDispatcherDelegate {
|
||||
|
||||
/**
|
||||
* Post a list of events to the bus, called by event sender
|
||||
* @param eventList Event object list
|
||||
* @param eventList TangramOp1 object list
|
||||
* @return Return true if the events are successfully enqueued into the event queue.
|
||||
*/
|
||||
public boolean post(@NonNull List<Event> eventList) {
|
||||
@@ -109,7 +109,7 @@ public class BusSupport implements IDispatcherDelegate {
|
||||
|
||||
/**
|
||||
* Dispatch event to a subscriber, you should not call this method directly.
|
||||
* @param event Event object
|
||||
* @param event TangramOp1 object
|
||||
*/
|
||||
@Override
|
||||
public synchronized void dispatch(@NonNull Event event) {
|
||||
@@ -138,12 +138,12 @@ public class BusSupport implements IDispatcherDelegate {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type Event type to identify an event.
|
||||
* @param sourceId Event sender's unique id. If sourceId is empty, the event would be dispatched to any
|
||||
* @param type TangramOp1 type to identify an event.
|
||||
* @param sourceId TangramOp1 sender's unique id. If sourceId is empty, the event would be dispatched to any
|
||||
* subscribers which is registered to receive events with 'type'. Otherwise, the event would be
|
||||
* dispatched to any subscribers which is registered to receive events with 'type' and this 'sourceId'.
|
||||
* @param args Event args, may be null.
|
||||
* @param eventContext Event context, see {@link EventContext}, may by null.
|
||||
* @param args TangramOp1 args, may be null.
|
||||
* @param eventContext TangramOp1 context, see {@link EventContext}, may by null.
|
||||
* @return An event object from recycler pool. It is suggested to use this method to obtain an event object. The
|
||||
* returned object's field is filled provided params.
|
||||
*/
|
||||
@@ -162,7 +162,7 @@ public class BusSupport implements IDispatcherDelegate {
|
||||
* @param type The event type subcriber is interested.
|
||||
* @param producer The event source id subscriber is interested.
|
||||
* @param subscriber Original subscriber object.
|
||||
* @param action The name of callback method with parameter 'Event'. If empty, the subscribe must provide a handler method named 'execute'. See {@link ReflectedActionFinder}
|
||||
* @param action The name of callback method with parameter 'TangramOp1'. If empty, the subscribe must provide a handler method named 'execute'. See {@link ReflectedActionFinder}
|
||||
* @return An EventHandlerWrapper wrapping a subscriber and used to registered into event bus.
|
||||
*/
|
||||
public static EventHandlerWrapper wrapEventHandler(@NonNull String type, String producer, @NonNull Object subscriber,
|
||||
|
||||
@@ -32,17 +32,17 @@ import android.support.v4.util.ArrayMap;
|
||||
public class Event {
|
||||
|
||||
/**
|
||||
* Event type
|
||||
* TangramOp1 type
|
||||
*/
|
||||
public String type;
|
||||
|
||||
/**
|
||||
* Event producer's Id
|
||||
* TangramOp1 producer's Id
|
||||
*/
|
||||
public String sourceId;
|
||||
|
||||
/**
|
||||
* Event args
|
||||
* TangramOp1 args
|
||||
*/
|
||||
public ArrayMap<String, String> args;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class Event {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Event{" +
|
||||
return "TangramOp1{" +
|
||||
"args=" + args +
|
||||
", sourceId='" + sourceId + '\'' +
|
||||
", type=" + type +
|
||||
|
||||
@@ -30,7 +30,7 @@ import android.support.v4.util.Pools;
|
||||
/**
|
||||
* Created by longerian on 16/4/26.
|
||||
*
|
||||
* Event pool to recycle consumed event.
|
||||
* TangramOp1 pool to recycle consumed event.
|
||||
*/
|
||||
class EventPool {
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
import com.tmall.wireless.tangram.dataparser.concrete.Card;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class AppendGroupOp extends TangramOp1<Card> {
|
||||
public AppendGroupOp(Card arg1) {
|
||||
super(OP_TYPE.APPEND_GROUP, arg1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.tmall.wireless.tangram.dataparser.concrete.Card;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class AppendGroupsOp extends TangramOp1<List<Card>> {
|
||||
public AppendGroupsOp(List<Card> arg1) {
|
||||
super(OP_TYPE.APPEND_GROUP_LIST, arg1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.tmall.wireless.tangram.structure.BaseCell;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class InsertCellListOp extends TangramOp2<Integer, List<BaseCell>> {
|
||||
public InsertCellListOp(Integer arg1, List<BaseCell> arg2) {
|
||||
super(OP_TYPE.INSERT_CELL_LIST, arg1, arg2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
import com.tmall.wireless.tangram.structure.BaseCell;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class InsertCellOp extends TangramOp2<Integer, BaseCell> {
|
||||
|
||||
public InsertCellOp(int arg1, BaseCell arg2) {
|
||||
super(OP_TYPE.INSERT_CELL, arg1, arg2);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
import com.tmall.wireless.tangram.dataparser.concrete.Card;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class InsertGroupOp extends TangramOp2<Integer, Card> {
|
||||
public InsertGroupOp(Integer arg1, Card arg2) {
|
||||
super(OP_TYPE.INSERT_GROUP, arg1, arg2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.tmall.wireless.tangram.dataparser.concrete.Card;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class InsertGroupsOp extends TangramOp2<Integer, List<Card>> {
|
||||
public InsertGroupsOp(Integer arg1, List<Card> arg2) {
|
||||
super(OP_TYPE.INSERT_GROUP_LIST, arg1, arg2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
import com.tmall.wireless.tangram.structure.BaseCell;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class RemoveCellOp extends TangramOp1<BaseCell> {
|
||||
public RemoveCellOp(BaseCell arg1) {
|
||||
super(OP_TYPE.REMOVE_CELL, arg1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class RemoveCellPositionOp extends TangramOp1<Integer> {
|
||||
public RemoveCellPositionOp(Integer arg1) {
|
||||
super(OP_TYPE.REMOVE_CELL_POSITION, arg1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
import com.tmall.wireless.tangram.dataparser.concrete.Card;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class RemoveGroupIdxOp extends TangramOp1<Integer> {
|
||||
public RemoveGroupIdxOp(Integer arg1) {
|
||||
super(OP_TYPE.REMOVE_GROUP_IDX, arg1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
import com.tmall.wireless.tangram.dataparser.concrete.Card;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class RemoveGroupOp extends TangramOp1<Card> {
|
||||
public RemoveGroupOp(Card arg1) {
|
||||
super(OP_TYPE.REMOVE_GROUP, arg1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
import com.tmall.wireless.tangram.structure.BaseCell;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class ReplaceCellOp extends TangramOp2<BaseCell, BaseCell> {
|
||||
public ReplaceCellOp(BaseCell arg1, BaseCell arg2) {
|
||||
super(OP_TYPE.REPLACE_CELL, arg1, arg2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.tmall.wireless.tangram.dataparser.concrete.Card;
|
||||
import com.tmall.wireless.tangram.structure.BaseCell;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class ReplaceGroupContentOp extends TangramOp2<Card, List<BaseCell>> {
|
||||
public ReplaceGroupContentOp(Card arg1, List<BaseCell> arg2) {
|
||||
super(OP_TYPE.REPLACE_GROUP_CONTENT, arg1, arg2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.tmall.wireless.tangram.dataparser.concrete.Card;
|
||||
import com.tmall.wireless.tangram.structure.BaseCell;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class ReplaceGroupOp extends TangramOp2<Card, Card> {
|
||||
public ReplaceGroupOp(Card arg1, Card arg2) {
|
||||
super(OP_TYPE.REPLACE_GROUP, arg1, arg2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class TangramOp1<V1> {
|
||||
|
||||
public TangramOp1(int type, V1 arg1) {
|
||||
mType = type;
|
||||
this.arg1 = arg1;
|
||||
}
|
||||
|
||||
public static class OP_TYPE {
|
||||
public static final int INSERT_CELL = 0;
|
||||
public static final int INSERT_CELL_LIST = 1;
|
||||
public static final int INSERT_GROUP = 2;
|
||||
public static final int INSERT_GROUP_LIST = 3;
|
||||
public static final int APPEND_GROUP = 4;
|
||||
public static final int APPEND_GROUP_LIST = 5;
|
||||
public static final int REMOVE_CELL_POSITION = 6;
|
||||
public static final int REMOVE_CELL = 7;
|
||||
public static final int REMOVE_GROUP_IDX = 8;
|
||||
public static final int REMOVE_GROUP = 9;
|
||||
public static final int REPLACE_CELL = 10;
|
||||
public static final int REPLACE_GROUP_CONTENT = 11;
|
||||
public static final int REPLACE_GROUP = 12;
|
||||
public static final int UPDATE_CELL = 13;
|
||||
}
|
||||
|
||||
private final int mType;
|
||||
|
||||
private final V1 arg1;
|
||||
|
||||
public int getType() {
|
||||
return mType;
|
||||
}
|
||||
|
||||
public V1 getArg1() {
|
||||
return arg1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class TangramOp2<V1, V2> extends TangramOp1<V1> {
|
||||
|
||||
private final V2 arg2;
|
||||
|
||||
public TangramOp2(int type, V1 arg1, V2 arg2) {
|
||||
super(type, arg1);
|
||||
this.arg2 = arg2;
|
||||
}
|
||||
|
||||
public V2 getArg2() {
|
||||
return arg2;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2018 Alibaba Group
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package com.tmall.wireless.tangram.op;
|
||||
|
||||
import com.tmall.wireless.tangram.structure.BaseCell;
|
||||
|
||||
/**
|
||||
* Created by longerian on 2018/3/23.
|
||||
*
|
||||
* @author longerian
|
||||
* @date 2018/03/23
|
||||
*/
|
||||
|
||||
public class UpdateCellOp extends TangramOp1<BaseCell> {
|
||||
public UpdateCellOp(BaseCell arg1) {
|
||||
super(OP_TYPE.UPDATE_CELL, arg1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user