forked from gephi/gephi
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'legend' of github.com:eduramiba/gephi into legend
- Loading branch information
Showing
5 changed files
with
64 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,54 @@ | ||
/* | ||
Copyright 2008-2010 Gephi | ||
Authors : Mathieu Bastian <[email protected]>, Martin Škurla <[email protected]> | ||
Website : http://www.gephi.org | ||
This file is part of Gephi. | ||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | ||
Copyright 2011 Gephi Consortium. All rights reserved. | ||
The contents of this file are subject to the terms of either the GNU | ||
General Public License Version 3 only ("GPL") or the Common | ||
Development and Distribution License("CDDL") (collectively, the | ||
"License"). You may not use this file except in compliance with the | ||
License. You can obtain a copy of the License at | ||
http://gephi.org/about/legal/license-notice/ | ||
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the | ||
specific language governing permissions and limitations under the | ||
License. When distributing the software, include this License Header | ||
Notice in each file and include the License files at | ||
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the | ||
License Header, with the fields enclosed by brackets [] replaced by | ||
your own identifying information: | ||
"Portions Copyrighted [year] [name of copyright owner]" | ||
If you wish your version of this file to be governed by only the CDDL | ||
or only the GPL Version 3, indicate your decision by adding | ||
"[Contributor] elects to include this software in this distribution | ||
under the [CDDL or GPL Version 3] license." If you do not indicate a | ||
single choice of license, a recipient has the option to distribute | ||
your version of this file under either the CDDL, the GPL Version 3 or | ||
to extend the choice of license to its licensees as provided above. | ||
However, if you add GPL Version 3 code and therefore, elected the GPL | ||
Version 3 license, then the option applies only if the new code is | ||
made subject to such option by the copyright holder. | ||
Contributor(s): | ||
Portions Copyrighted 2011 Gephi Consortium. | ||
Copyright 2008-2010 Gephi | ||
Authors : Mathieu Bastian <[email protected]>, Martin Škurla <[email protected]> | ||
Website : http://www.gephi.org | ||
This file is part of Gephi. | ||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. | ||
Copyright 2011 Gephi Consortium. All rights reserved. | ||
The contents of this file are subject to the terms of either the GNU | ||
General Public License Version 3 only ("GPL") or the Common | ||
Development and Distribution License("CDDL") (collectively, the | ||
"License"). You may not use this file except in compliance with the | ||
License. You can obtain a copy of the License at | ||
http://gephi.org/about/legal/license-notice/ | ||
or /cddl-1.0.txt and /gpl-3.0.txt. See the License for the | ||
specific language governing permissions and limitations under the | ||
License. When distributing the software, include this License Header | ||
Notice in each file and include the License files at | ||
/cddl-1.0.txt and /gpl-3.0.txt. If applicable, add the following below the | ||
License Header, with the fields enclosed by brackets [] replaced by | ||
your own identifying information: | ||
"Portions Copyrighted [year] [name of copyright owner]" | ||
If you wish your version of this file to be governed by only the CDDL | ||
or only the GPL Version 3, indicate your decision by adding | ||
"[Contributor] elects to include this software in this distribution | ||
under the [CDDL or GPL Version 3] license." If you do not indicate a | ||
single choice of license, a recipient has the option to distribute | ||
your version of this file under either the CDDL, the GPL Version 3 or | ||
to extend the choice of license to its licensees as provided above. | ||
However, if you add GPL Version 3 code and therefore, elected the GPL | ||
Version 3 license, then the option applies only if the new code is | ||
made subject to such option by the copyright holder. | ||
Contributor(s): | ||
Portions Copyrighted 2011 Gephi Consortium. | ||
*/ | ||
package org.gephi.data.attributes; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import org.gephi.data.attributes.api.AttributeTable; | ||
import org.gephi.data.attributes.api.AttributeColumn; | ||
import org.gephi.data.attributes.api.AttributeEvent; | ||
import org.gephi.data.attributes.api.AttributeOrigin; | ||
import org.gephi.data.attributes.api.AttributeTable; | ||
import org.gephi.data.attributes.api.AttributeType; | ||
import org.gephi.data.attributes.event.ColumnEvent; | ||
import org.gephi.data.attributes.spi.AttributeValueDelegateProvider; | ||
|
@@ -126,9 +126,9 @@ private synchronized AttributeColumnImpl addColumn(String id, String title, Attr | |
} | ||
AttributeColumnImpl column = new AttributeColumnImpl(this, columns.size(), id, title, type, origin, defaultValue, attributeValueDelegateProvider); | ||
columns.add(column); | ||
columnsMap.put(id, column); | ||
columnsMap.put(id.toLowerCase(), column); | ||
if (title != null && !title.equals(id)) { | ||
columnsMap.put(title, column); | ||
columnsMap.put(title.toLowerCase(), column); | ||
} | ||
columnsSet.put(column, column); | ||
|
||
|
@@ -155,9 +155,9 @@ public synchronized void removeColumn(AttributeColumn column) { | |
} | ||
//Remove from collections | ||
columns.remove((AttributeColumnImpl) column); | ||
columnsMap.remove(column.getId()); | ||
columnsMap.remove(column.getId().toLowerCase()); | ||
if (column.getTitle() != null && !column.getTitle().equals(column.getId())) { | ||
columnsMap.remove(column.getTitle()); | ||
columnsMap.remove(column.getTitle().toLowerCase()); | ||
} | ||
columnsSet.remove(column); | ||
|
||
|
@@ -174,24 +174,24 @@ public synchronized AttributeColumn replaceColumn(AttributeColumn source, Attrib | |
return null; | ||
} | ||
//Remove from collections | ||
columnsMap.remove(source.getId()); | ||
columnsMap.remove(source.getId().toLowerCase()); | ||
if (source.getTitle() != null && !source.getTitle().equals(source.getId())) { | ||
columnsMap.remove(source.getTitle()); | ||
columnsMap.remove(source.getTitle().toLowerCase()); | ||
} | ||
columnsSet.remove(source); | ||
|
||
//Add | ||
targetImpl.index = index; | ||
columns.set(index, targetImpl); | ||
columnsMap.put(targetImpl.id, targetImpl); | ||
columnsMap.put(targetImpl.id.toLowerCase(), targetImpl); | ||
if (targetImpl.title != null && !targetImpl.title.equals(targetImpl.id)) { | ||
columnsMap.put(targetImpl.title.toLowerCase(), targetImpl); | ||
} | ||
columnsSet.put(targetImpl, targetImpl); | ||
|
||
model.fireAttributeEvent( | ||
new ColumnEvent(AttributeEvent.EventType.REPLACE_COLUMN, (AttributeColumnImpl) source)); | ||
|
||
//Version | ||
version++; | ||
return targetImpl; | ||
|
@@ -221,11 +221,7 @@ public synchronized AttributeColumnImpl getColumn(int index) { | |
} | ||
|
||
public synchronized AttributeColumnImpl getColumn(String id) { | ||
AttributeColumnImpl col = columnsMap.get(id); | ||
if (col == null) { | ||
return columnsMap.get(id.toLowerCase()); | ||
} | ||
return col; | ||
return columnsMap.get(id.toLowerCase()); | ||
} | ||
|
||
public synchronized AttributeColumnImpl getColumn(String title, AttributeType type) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters