|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface MultiShadyCommonAPI
MultiShady API subset that is shared between the simulator and the hardware.
A MultiShady is a set of one or more MemberShadys (see MemberShadyCommonAPI). The number of MemberShadys (numMembers())
can be changed at runtime (addMember(shady.common.multi.MemberShadyCommonAPI), removeLastMember(),
clearMembers()).
This API is not designed for MT use: it is expected that only a single thread makes calls to any of the MemberShady's APIs, or that external synchronization is performed. A synchronization convention is that any thread wishing to perform an atomic bulk operation on one or more members should synchronize on the MultiShady object.
Copyright (C) 2006 Marsette A. Vona, III
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
| Nested Class Summary | |
|---|---|
static interface |
MultiShadyCommonAPI.MemberProcessor
A processor for members. |
| Field Summary | |
|---|---|
static java.lang.String |
cvsid
CVS id. |
| Method Summary | |
|---|---|
int |
addMember(MemberShadyCommonAPI newMember)
Add a member at the end of the list. |
int |
addMember(ShadyPose pose)
Make and add a new member at the end of the list. |
void |
clearMembers()
Remove all members. |
void |
exec(java.util.Collection operations)
Atomically execute the specified BoundOperations, in order. |
void |
forEachMember(MultiShadyCommonAPI.MemberProcessor processor)
Atomically process all members. |
void |
forMembers(java.util.Collection keys,
MultiShadyCommonAPI.MemberProcessor processor)
Atomically process a subset of the members. |
vona.time.Clock |
getClock()
Get the clock this MultiShady is using. |
MemberShadyCommonAPI |
getMember(int index)
Get a member by index. |
MemberShadyCommonAPI |
getMember(java.lang.Integer index)
Get a member by index. |
MemberShadyCommonAPI |
getMember(java.lang.String name)
Get a member by name. |
java.util.Set |
getMembers()
Get an unmodifiable view of the set of MemberShadys in this MultiShady. |
int |
getNumActiveActuators()
Get sum of ShadyCommonAPI.getNumActiveActuators() over all
members. |
MemberShadyCommonAPI |
makeMember(ShadyPose pose)
Make and a new member but don't add it. |
int |
numMembers()
Get the number of MemberShadys in this MultiShady. |
MemberShadyCommonAPI |
removeLastMember()
Remove the last member. |
void |
reset()
ShadyCommonAPI.reset() all members. |
void |
stop(boolean estop)
ShadyCommonAPI.stop(boolean) all members. |
| Field Detail |
|---|
static final java.lang.String cvsid
CVS id.
| Method Detail |
|---|
int numMembers()
Get the number of MemberShadys in this MultiShady.
java.util.Set getMembers()
Get an unmodifiable view of the set of MemberShadys in this MultiShady.
MemberShadyCommonAPI getMember(int index)
Get a member by index.
index - the index of the member to get, zero-basedMemberShadyCommonAPI getMember(java.lang.Integer index)
Get a member by index.
index - the index of the member to get, zero-basedMemberShadyCommonAPI getMember(java.lang.String name)
Get a member by name.
name - the name of the member to getint addMember(MemberShadyCommonAPI newMember)
Add a member at the end of the list.
newMember has its index and MultiShady reference set, and
has its name set iff it was not previously set.
newMember - the new member to add
int addMember(ShadyPose pose)
Make and add a new member at the end of the list.
Calls makeMember(shady.common.ShadyPose) and then addMember(MemberShadyCommonAPI).
pose - the pose of the new member
MemberShadyCommonAPI makeMember(ShadyPose pose)
Make and a new member but don't add it.
pose - the pose of the new member
MemberShadyCommonAPI removeLastMember()
Remove the last member.
By the convention defined in the class header doc, implementations should be synchronized.
The removed member has its index set to -1 and its MultiShady reference nulled, but does not have its name changed.
void clearMembers()
Remove all members.
By the convention defined in the class header doc, implementations should be synchronized.
void forEachMember(MultiShadyCommonAPI.MemberProcessor processor)
Atomically process all members.
By the convention defined in the class header doc, implementations should be synchronized.
The extra parameter of MultiShadyCommonAPI.MemberProcessor.process(shady.common.multi.MemberShadyCommonAPI, java.lang.Object)
will be set null by default.
processor - the non-null processor to call for each member
void forMembers(java.util.Collection keys,
MultiShadyCommonAPI.MemberProcessor processor)
Atomically process a subset of the members.
By the convention defined in the class header doc, implementations should be synchronized.
The extra parameter of MultiShadyCommonAPI.MemberProcessor.process(shady.common.multi.MemberShadyCommonAPI, java.lang.Object)
will be set to the corresponding key.
keys - a non-null collection of MemberShadyCommonAPI, String,
or Integer identifying members directly, by name, or by index,
respectively. If multiple keys resolve to the same member the member will
be processed multiple times.processor - the non-null processor to call for each member
corresponding to each keyvoid exec(java.util.Collection operations)
Atomically execute the specified BoundOperations, in order.
By the convention defined in the class header doc, implementations should be synchronized.
operations - the BoundOperations to execute, in iterator order, not
nullvoid stop(boolean estop)
ShadyCommonAPI.stop(boolean) all members.
By the convention defined in the class header doc, implementations should be synchronized.
void reset()
ShadyCommonAPI.reset() all members.
By the convention defined in the class header doc, implementations should be synchronized.
int getNumActiveActuators()
Get sum of ShadyCommonAPI.getNumActiveActuators() over all
members.
By the convention defined in the class header doc, implementations should be synchronized.
vona.time.Clock getClock()
Get the clock this MultiShady is using.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||