RoconDescription.java
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  * Copyright (c) 2013, Yujin Robot.
00005  *
00006  * All rights reserved.
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted provided that the following conditions
00009  * are met:
00010  *
00011  *  * Redistributions of source code must retain the above copyright
00012  *    notice, this list of conditions and the following disclaimer.
00013  *  * Redistributions in binary form must reproduce the above
00014  *    copyright notice, this list of conditions and the following
00015  *    disclaimer in the documentation and/or other materials provided
00016  *    with the distribution.
00017  *  * Neither the name of Willow Garage, Inc. nor the names of its
00018  *    contributors may be used to endorse or promote products derived
00019  *    from this software without specific prior written permission.
00020  *   
00021  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  * POSSIBILITY OF SUCH DAMAGE.
00033  */
00034 
00035 package com.github.rosjava.android_remocons.common_tools.master;
00036 
00037 import java.util.Date;
00038 import java.util.List;
00039 
00046 public class RoconDescription extends MasterDescription implements java.io.Serializable {
00047     private static final long serialVersionUID = -4705526306056241179L;
00048 
00049     private String description;
00050     private String[] userRoles;
00051     private int currentRole = -1;
00052     private String interactionsNamespace;
00053 
00054     public static RoconDescription create(MasterDescription master) {
00055         RoconDescription cd = new RoconDescription(master.getMasterId(), master.getMasterName(),
00056                                                        null, null, null, new Date());
00057         cd.setMasterIconFormat(master.getMasterIconFormat());
00058         cd.setMasterIconData(master.getMasterIconData());
00059         return cd;
00060     }
00061 
00062     public static RoconDescription createUnknown(MasterId masterId) {
00063         return new RoconDescription(masterId, NAME_UNKNOWN, null, null, null, new Date());
00064     }
00065 
00069     public RoconDescription() {
00070     }
00071 
00072     public RoconDescription(MasterId masterId, String concertName, String description,
00073                             rocon_std_msgs.Icon concertIcon, String interactionsNamespace,
00074                             Date timeLastSeen) {
00075         super(masterId, concertName, "Rocon concert", concertIcon, "", timeLastSeen);
00076 
00077         this.description = description;
00078         this.interactionsNamespace = interactionsNamespace;
00079     }
00080 
00081     public void copyFrom(RoconDescription other) {
00082         super.copyFrom(other);
00083 
00084         this.userRoles = other.userRoles.clone();
00085         this.description = other.description;
00086         this.interactionsNamespace = other.interactionsNamespace;
00087     }
00088 
00089     public String getInteractionsNamespace() { return this.interactionsNamespace; }
00090 
00091     public String[] getUserRoles()  {
00092         return userRoles;
00093     }
00094 
00095     public String getCurrentRole()  {
00096         if (userRoles != null && currentRole >= 0 && currentRole <  userRoles.length)
00097             return userRoles[currentRole];
00098         else
00099             return null;
00100     }
00101 
00102     public void setInteractionsNamespace(String namespace) {
00103         this.interactionsNamespace = namespace;
00104     }
00105 
00106     public void setUserRoles(List<String> roles)
00107     {
00108         userRoles = new String[roles.size()];
00109         roles.toArray(userRoles);
00110     }
00111     public void setCurrentRole(int role) {
00112         currentRole = role;
00113     }
00114 }


android_remocons
Author(s): Daniel Stonier, Kazuto Murase
autogenerated on Sat Jun 8 2019 19:32:24