From: <rad...@us...> - 2007-02-27 07:21:10
|
Revision: 580 http://svn.sourceforge.net/magicmap/?rev=580&view=rev Author: radetzki09 Date: 2007-02-26 23:21:09 -0800 (Mon, 26 Feb 2007) Log Message: ----------- made the search for clients by its mac in the (I)NodeModel possible. Modified Paths: -------------- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java 2007-02-26 20:46:14 UTC (rev 579) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/INodeModel.java 2007-02-27 07:21:09 UTC (rev 580) @@ -133,6 +133,20 @@ public abstract boolean accessPointExists(String mac); /** + * + * @param mac + * @return + */ + public abstract ClientNode findClient(String mac); + + /** + * Abfrage ob ein Client mit einer mac existiert. + * @param mac the mac address of the client + * @return true if the model contains client with the given mac. + */ + public abstract boolean clientExists(String mac); + + /** * Liefert alle Knoten des Models. * @return alle Knoten des Models. */ Modified: trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java =================================================================== --- trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2007-02-26 20:46:14 UTC (rev 579) +++ trunk/magicmapclient/src/net/sf/magicmap/client/model/node/NodeModel.java 2007-02-27 07:21:09 UTC (rev 580) @@ -38,6 +38,7 @@ private final Map<String, Node> nodes; private final Map<String, AccessPointNode> accesspoints; + private final Map<String, ClientNode> clients; private final List<NodeModelListener> listeners; private final Map<String, MapNode> mapMap; @@ -52,6 +53,7 @@ public NodeModel() { this.nodes = Collections.synchronizedMap(new HashMap<String, Node>()); this.accesspoints = Collections.synchronizedMap(new HashMap<String, AccessPointNode>()); + this.clients = Collections.synchronizedMap(new HashMap<String, ClientNode>()); this.listeners = Collections.synchronizedList(new ArrayList<NodeModelListener>()); mapMap = Collections.synchronizedMap(new HashMap<String, MapNode>()); setNodePlacer(new JungNodePlacer()); @@ -70,6 +72,9 @@ // special handling for APs if (node.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT) // Wenn AccessPoint, dann nach MAC-Adresse extra hashen this.accesspoints.put(((AccessPointNode) node).getMacAddress(), (AccessPointNode) node); + // special handling for Clients + if (node.getType() == NodeModelConstants.NODETYPE_CLIENT) // Wenn Client, dann nach MAC-Adresse extra hashen + this.clients.put(((ClientNode) node).getMacAddress(), (ClientNode) node); if (MapNode.class.equals(node.getClass())) { MapNode map = (MapNode) node; @@ -97,6 +102,9 @@ if (node.getType() == NodeModelConstants.NODETYPE_ACCESSPOINT) { this.accesspoints.remove(((AccessPointNode) node).getMacAddress()); } + if (node.getType() == NodeModelConstants.NODETYPE_CLIENT) { + this.clients.remove(((ClientNode) node).getMacAddress()); + } // aus dem layout entfernen! this.placer.deleteNode(node); @@ -215,6 +223,19 @@ } /** + * Finds client with the given mac + * @param mac the mac to search for + * @return clientNode or null + */ + public ClientNode findClient(String mac){ + return this.clients.get(mac); + } + + public boolean clientExists(String mac){ + return this.clients.containsKey(mac); + } + + /** * Finds an access point with the given mac * @param mac the mac to search for * @return an ap or null This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |