use of java.util.Map.Entry in project tdi-studio-se by Talend.
the class JobletContainerFigure method refreshMRstatus.
public void refreshMRstatus() {
if (this.jobletContainer.getNode().isMapReduceStart()) {
Iterator<Entry<String, SimpleHtmlFigure>> ite = mrFigures.entrySet().iterator();
while (ite.hasNext()) {
Entry<String, SimpleHtmlFigure> entry = ite.next();
SimpleHtmlFigure value = entry.getValue();
for (Object obj : value.getChildren()) {
if (obj instanceof Figure) {
if (this.jobletContainer.getSubjobContainer() != null && this.jobletContainer.getSubjobContainer().isCollapsed()) {
((Figure) obj).setVisible(false);
} else {
((Figure) obj).setVisible(true);
}
}
}
}
}
}
use of java.util.Map.Entry in project tdi-studio-se by Talend.
the class WebServiceTableLiner method onXPathValueChanged.
public void onXPathValueChanged(Table sourceTable, Table targetTable, String oldValue, String newValue, String inComeName, int itemIndex) {
TableItem tabletraItem = targetTable.getItem(itemIndex);
boolean needAddLink = true;
TableItem[] items = sourceTable.getItems();
List<TableItem> itemList = new ArrayList<TableItem>();
for (int i = 0; i < items.length; i++) {
String columnLabel = null;
IMetadataColumn column = null;
ParameterInfo parame = null;
if (items[i].getData() instanceof IMetadataColumn) {
column = (IMetadataColumn) items[i].getData();
columnLabel = column.getLabel();
} else // }
if (items[i].getData() instanceof OutPutMappingData) {
parame = ((OutPutMappingData) items[i].getData()).getParameter();
if (!parame.getParameterInfos().isEmpty()) {
continue;
}
// columnLabel = parame.getName();
columnLabel = ((OutPutMappingData) items[i].getData()).getParameterName();
int m = columnLabel.lastIndexOf(".");
columnLabel = columnLabel.substring(m + 1);
}
if (newValue.contains(columnLabel)) {
// if (!pattern(columnLabel, newValue)) {
if (inComeName != null) {
WebServiceExpressionParser webParser = new WebServiceExpressionParser("\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*");
Map<String, String> itemNamemap = webParser.parseInTableEntryLocations(newValue);
Set<Entry<String, String>> set = itemNamemap.entrySet();
Iterator<Entry<String, String>> ite = set.iterator();
while (ite.hasNext()) {
Entry<String, String> entry = ite.next();
String columnValue = entry.getKey();
String rowValue = entry.getValue();
if (!isPatternWord(inComeName + "." + columnLabel, rowValue + "." + columnValue)) {
linksManager.removeLinksFromDataItem2(tabletraItem.getData());
if (tabletraItem.getData() instanceof InputMappingData) {
InputMappingData data = (InputMappingData) tabletraItem.getData();
List<IMetadataColumn> list = data.getMetadataColumnList();
if (column != null) {
list.remove(column);
}
}
needAddLink = false;
for (TableItem item : itemList) {
addLinks(item, item.getData(), targetTable, tabletraItem.getData(), "INPUTMAPPING");
}
getBackgroundRefresher().refreshBackground();
// return;
}
}
} else {
WebServiceExpressionParser webParser = new WebServiceExpressionParser("\\s*\\w+(\\[\\d+?\\])?\\s*");
Set<String> set = webParser.parseOutTableEntryLocations(newValue);
Iterator<String> ite = set.iterator();
while (ite.hasNext()) {
String columnValue = ite.next();
// if (columnValue.equals(columnLabel)) {
if (!isPatternWord(columnLabel, columnValue)) {
linksManager.removeLinksFromDataItem2(tabletraItem.getData());
OutPutMappingData data = (OutPutMappingData) tabletraItem.getData();
if (parame != null) {
data.getParameterList().remove(parame);
}
needAddLink = false;
for (TableItem item : itemList) {
addLinks(item, item.getData(), targetTable, tabletraItem.getData(), "OUTPUTMAPPING");
}
getBackgroundRefresher().refreshBackground();
// return;
// }
}
}
}
if (true) {
// if (!mark) {
if (inComeName != null) {
WebServiceExpressionParser webParser = new WebServiceExpressionParser("\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*");
Map<String, String> itemNamemap = webParser.parseInTableEntryLocations(newValue);
Set<Entry<String, String>> set = itemNamemap.entrySet();
Iterator<Entry<String, String>> ite = set.iterator();
while (ite.hasNext()) {
Entry<String, String> entry = ite.next();
String columnValue = entry.getKey();
String rowValue = entry.getValue();
if (isPatternWord(inComeName + "." + columnLabel, rowValue + "." + columnValue)) {
itemList.add(items[i]);
addLinks(items[i], items[i].getData(), targetTable, tabletraItem.getData(), "INPUTMAPPING");
getBackgroundRefresher().refreshBackground();
if (tabletraItem.getData() instanceof InputMappingData) {
InputMappingData data = (InputMappingData) tabletraItem.getData();
List<IMetadataColumn> list = data.getMetadataColumnList();
if (column != null && !list.contains(column)) {
list.add(column);
}
}
}
}
} else {
WebServiceExpressionParser webParser = new WebServiceExpressionParser("\\s*\\w+(\\[\\d+?\\])?\\s*");
Set<String> set = webParser.parseOutTableEntryLocations(newValue);
Iterator<String> ite = set.iterator();
while (ite.hasNext()) {
String columnValue = ite.next();
if (isPatternWord(columnLabel, columnValue)) {
itemList.add(items[i]);
addLinks(items[i], items[i].getData(), targetTable, tabletraItem.getData(), "OUTPUTMAPPING");
getBackgroundRefresher().refreshBackground();
}
}
}
}
} else if (oldValue.contains(columnLabel)) {
linksManager.removeLinksFromDataItem2(tabletraItem.getData());
if (tabletraItem.getData() instanceof InputMappingData) {
InputMappingData data = (InputMappingData) tabletraItem.getData();
List<IMetadataColumn> list = data.getMetadataColumnList();
if (column != null) {
list.remove(column);
}
} else if (tabletraItem.getData() instanceof OutPutMappingData) {
OutPutMappingData data = (OutPutMappingData) tabletraItem.getData();
if (parame != null) {
data.getParameterList().remove(parame);
}
}
for (TableItem item : itemList) {
if (inComeName != null) {
addLinks(item, item.getData(), targetTable, tabletraItem.getData(), "INPUTMAPPING");
} else {
addLinks(item, item.getData(), targetTable, tabletraItem.getData(), "OUTPUTMAPPING");
}
}
getBackgroundRefresher().refreshBackground();
}
}
// createFieldLinks(newValue, tableItem, null);
}
use of java.util.Map.Entry in project tdi-studio-se by Talend.
the class DynamicComposite method reverseParameters.
private List<ElementParameter> reverseParameters(List<ElementParameter> parameters) {
List<ElementParameter> reversedParameters = new ArrayList<>();
Map<Integer, List<ElementParameter>> paramMap = new LinkedHashMap<>();
for (ElementParameter parameter : parameters) {
int numRow = parameter.getNumRow();
List<ElementParameter> params = paramMap.get(numRow);
if (params == null) {
params = new ArrayList<>();
paramMap.put(numRow, params);
}
params.add(parameter);
}
Set<Entry<Integer, List<ElementParameter>>> paramEntrySet = paramMap.entrySet();
Iterator<Entry<Integer, List<ElementParameter>>> paramIterator = paramEntrySet.iterator();
while (paramIterator.hasNext()) {
Entry<Integer, List<ElementParameter>> paramEntry = paramIterator.next();
List<ElementParameter> params = paramEntry.getValue();
if (params != null && params.size() > 1) {
Collections.reverse(params);
}
reversedParameters.addAll(params);
}
return reversedParameters;
}
use of java.util.Map.Entry in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class BlockPosToShipUUIDData method writeToNBT.
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
Set<Entry<UUID, ChunkSet>> entries = UUIDToChunkSet.entrySet();
//2 ints, 1 byte (radius), and 2 longs for each ship, that comes out to 25 bytes per entry
int byteArraySize = entries.size() * 25;
ByteBuffer buffer = ByteBuffer.allocate(byteArraySize);
for (Entry<UUID, ChunkSet> entry : entries) {
int centerX = entry.getValue().centerX;
int centerZ = entry.getValue().centerZ;
byte radius = (byte) entry.getValue().radius;
long mostBits = entry.getKey().getMostSignificantBits();
long leastBits = entry.getKey().getLeastSignificantBits();
buffer.putInt(centerX);
buffer.putInt(centerZ);
buffer.put(radius);
buffer.putLong(mostBits);
buffer.putLong(leastBits);
}
NBTUtils.setByteBuf("WorldChunkSetUUIDMix", buffer, compound);
return compound;
}
use of java.util.Map.Entry in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class ShipUUIDToPosData method writeToNBT.
@Override
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
Set<Entry<Long, ShipPositionData>> entries = dataMap.entrySet();
//Each ship has 19 floats, and 1 long; that comes out (19 * 4 + 1 * 8) = 84 bytes per ship
int byteArraySize = entries.size() * 84;
ByteBuffer buffer = ByteBuffer.allocate(byteArraySize);
for (Entry<Long, ShipPositionData> entry : entries) {
long mostBits = entry.getKey();
ShipPositionData posData = entry.getValue();
buffer.putLong(mostBits);
posData.writeToByteBuffer(buffer);
}
NBTUtils.setByteBuf("ShipPositionByteBuf", buffer, compound);
return compound;
}
Aggregations