id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
147,500
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/painter/FeatureTransactionPainter.java
FeatureTransactionPainter.paint
public void paint(Paintable paintable, Object group, MapContext context) { FeatureTransaction featureTransaction = (FeatureTransaction) paintable; Feature[] features = featureTransaction.getNewFeatures(); if (features == null) { return; } context.getVectorContext().drawGroup(mapWidget.getGroup(RenderGroup.VECTOR), featureTransaction); for (int i = 0; i < features.length; i++) { Geometry geometry = mapWidget.getMapModel().getMapView().getWorldViewTransformer().worldToPan( features[i].getGeometry()); context.getVectorContext().drawGroup(featureTransaction, features[i]); if (geometry instanceof Point) { paint(features[i], "featureTransaction.feature" + i, (Point) geometry, context.getVectorContext()); } else if (geometry instanceof MultiPoint) { paint(features[i], "featureTransaction.feature" + i, (MultiPoint) geometry, context.getVectorContext()); } else if (geometry instanceof LineString) { paint(features[i], "featureTransaction.feature" + i, (LineString) geometry, context.getVectorContext()); } else if (geometry instanceof MultiLineString) { paint(features[i], "featureTransaction.feature" + i, (MultiLineString) geometry, context .getVectorContext()); } else if (geometry instanceof Polygon) { paint(features[i], "featureTransaction.feature" + i, (Polygon) geometry, context.getVectorContext()); } else if (geometry instanceof MultiPolygon) { paint(features[i], "featureTransaction.feature" + i, (MultiPolygon) geometry, context .getVectorContext()); } } }
java
public void paint(Paintable paintable, Object group, MapContext context) { FeatureTransaction featureTransaction = (FeatureTransaction) paintable; Feature[] features = featureTransaction.getNewFeatures(); if (features == null) { return; } context.getVectorContext().drawGroup(mapWidget.getGroup(RenderGroup.VECTOR), featureTransaction); for (int i = 0; i < features.length; i++) { Geometry geometry = mapWidget.getMapModel().getMapView().getWorldViewTransformer().worldToPan( features[i].getGeometry()); context.getVectorContext().drawGroup(featureTransaction, features[i]); if (geometry instanceof Point) { paint(features[i], "featureTransaction.feature" + i, (Point) geometry, context.getVectorContext()); } else if (geometry instanceof MultiPoint) { paint(features[i], "featureTransaction.feature" + i, (MultiPoint) geometry, context.getVectorContext()); } else if (geometry instanceof LineString) { paint(features[i], "featureTransaction.feature" + i, (LineString) geometry, context.getVectorContext()); } else if (geometry instanceof MultiLineString) { paint(features[i], "featureTransaction.feature" + i, (MultiLineString) geometry, context .getVectorContext()); } else if (geometry instanceof Polygon) { paint(features[i], "featureTransaction.feature" + i, (Polygon) geometry, context.getVectorContext()); } else if (geometry instanceof MultiPolygon) { paint(features[i], "featureTransaction.feature" + i, (MultiPolygon) geometry, context .getVectorContext()); } } }
[ "public", "void", "paint", "(", "Paintable", "paintable", ",", "Object", "group", ",", "MapContext", "context", ")", "{", "FeatureTransaction", "featureTransaction", "=", "(", "FeatureTransaction", ")", "paintable", ";", "Feature", "[", "]", "features", "=", "featureTransaction", ".", "getNewFeatures", "(", ")", ";", "if", "(", "features", "==", "null", ")", "{", "return", ";", "}", "context", ".", "getVectorContext", "(", ")", ".", "drawGroup", "(", "mapWidget", ".", "getGroup", "(", "RenderGroup", ".", "VECTOR", ")", ",", "featureTransaction", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "features", ".", "length", ";", "i", "++", ")", "{", "Geometry", "geometry", "=", "mapWidget", ".", "getMapModel", "(", ")", ".", "getMapView", "(", ")", ".", "getWorldViewTransformer", "(", ")", ".", "worldToPan", "(", "features", "[", "i", "]", ".", "getGeometry", "(", ")", ")", ";", "context", ".", "getVectorContext", "(", ")", ".", "drawGroup", "(", "featureTransaction", ",", "features", "[", "i", "]", ")", ";", "if", "(", "geometry", "instanceof", "Point", ")", "{", "paint", "(", "features", "[", "i", "]", ",", "\"featureTransaction.feature\"", "+", "i", ",", "(", "Point", ")", "geometry", ",", "context", ".", "getVectorContext", "(", ")", ")", ";", "}", "else", "if", "(", "geometry", "instanceof", "MultiPoint", ")", "{", "paint", "(", "features", "[", "i", "]", ",", "\"featureTransaction.feature\"", "+", "i", ",", "(", "MultiPoint", ")", "geometry", ",", "context", ".", "getVectorContext", "(", ")", ")", ";", "}", "else", "if", "(", "geometry", "instanceof", "LineString", ")", "{", "paint", "(", "features", "[", "i", "]", ",", "\"featureTransaction.feature\"", "+", "i", ",", "(", "LineString", ")", "geometry", ",", "context", ".", "getVectorContext", "(", ")", ")", ";", "}", "else", "if", "(", "geometry", "instanceof", "MultiLineString", ")", "{", "paint", "(", "features", "[", "i", "]", ",", "\"featureTransaction.feature\"", "+", "i", ",", "(", "MultiLineString", ")", "geometry", ",", "context", ".", "getVectorContext", "(", ")", ")", ";", "}", "else", "if", "(", "geometry", "instanceof", "Polygon", ")", "{", "paint", "(", "features", "[", "i", "]", ",", "\"featureTransaction.feature\"", "+", "i", ",", "(", "Polygon", ")", "geometry", ",", "context", ".", "getVectorContext", "(", ")", ")", ";", "}", "else", "if", "(", "geometry", "instanceof", "MultiPolygon", ")", "{", "paint", "(", "features", "[", "i", "]", ",", "\"featureTransaction.feature\"", "+", "i", ",", "(", "MultiPolygon", ")", "geometry", ",", "context", ".", "getVectorContext", "(", ")", ")", ";", "}", "}", "}" ]
The actual painting function. @param paintable A {@link FeatureTransaction} object. @param group The group where the object resides in (optional). @param context A MapContext object, responsible for actual drawing.
[ "The", "actual", "painting", "function", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/painter/FeatureTransactionPainter.java#L80-L108
147,501
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/ScaleSelect.java
ScaleSelect.setScales
@Api public void setScales(Double... scales) { // Sort decreasing and store the list: Arrays.sort(scales, Collections.reverseOrder()); scaleList = Arrays.asList(scales); // Apply the requested scales on the SelectItem. Make sure only available scales are added: updateScaleList(); }
java
@Api public void setScales(Double... scales) { // Sort decreasing and store the list: Arrays.sort(scales, Collections.reverseOrder()); scaleList = Arrays.asList(scales); // Apply the requested scales on the SelectItem. Make sure only available scales are added: updateScaleList(); }
[ "@", "Api", "public", "void", "setScales", "(", "Double", "...", "scales", ")", "{", "// Sort decreasing and store the list:", "Arrays", ".", "sort", "(", "scales", ",", "Collections", ".", "reverseOrder", "(", ")", ")", ";", "scaleList", "=", "Arrays", ".", "asList", "(", "scales", ")", ";", "// Apply the requested scales on the SelectItem. Make sure only available scales are added:", "updateScaleList", "(", ")", ";", "}" ]
Set the specified relative scale values in the select item. @param scales array of relative scales (should be multiplied by pixelLength if in pixels/m) @since 1.6.0
[ "Set", "the", "specified", "relative", "scale", "values", "in", "the", "select", "item", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/ScaleSelect.java#L172-L179
147,502
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/ScaleSelect.java
ScaleSelect.onKeyPress
public void onKeyPress(KeyPressEvent event) { String name = event.getKeyName(); if (KeyNames.ENTER.equals(name)) { reorderValues(); } }
java
public void onKeyPress(KeyPressEvent event) { String name = event.getKeyName(); if (KeyNames.ENTER.equals(name)) { reorderValues(); } }
[ "public", "void", "onKeyPress", "(", "KeyPressEvent", "event", ")", "{", "String", "name", "=", "event", ".", "getKeyName", "(", ")", ";", "if", "(", "KeyNames", ".", "ENTER", ".", "equals", "(", "name", ")", ")", "{", "reorderValues", "(", ")", ";", "}", "}" ]
Make sure that the scale in the scale select is applied on the map, when the user presses the 'Enter' key. @see com.smartgwt.client.widgets.form.fields.events.KeyPressHandler#onKeyPress (com.smartgwt.client.widgets.form.fields.events.KeyPressEvent)
[ "Make", "sure", "that", "the", "scale", "in", "the", "scale", "select", "is", "applied", "on", "the", "map", "when", "the", "user", "presses", "the", "Enter", "key", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/ScaleSelect.java#L278-L283
147,503
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/ScaleSelect.java
ScaleSelect.onChanged
public void onChanged(ChangedEvent event) { String value = (String) scaleItem.getValue(); Double scale = valueToScale.get(value); if (scale != null && !Double.isNaN(pixelLength) && 0.0 != pixelLength) { mapView.setCurrentScale(scale / pixelLength, MapView.ZoomOption.LEVEL_CLOSEST); } }
java
public void onChanged(ChangedEvent event) { String value = (String) scaleItem.getValue(); Double scale = valueToScale.get(value); if (scale != null && !Double.isNaN(pixelLength) && 0.0 != pixelLength) { mapView.setCurrentScale(scale / pixelLength, MapView.ZoomOption.LEVEL_CLOSEST); } }
[ "public", "void", "onChanged", "(", "ChangedEvent", "event", ")", "{", "String", "value", "=", "(", "String", ")", "scaleItem", ".", "getValue", "(", ")", ";", "Double", "scale", "=", "valueToScale", ".", "get", "(", "value", ")", ";", "if", "(", "scale", "!=", "null", "&&", "!", "Double", ".", "isNaN", "(", "pixelLength", ")", "&&", "0.0", "!=", "pixelLength", ")", "{", "mapView", ".", "setCurrentScale", "(", "scale", "/", "pixelLength", ",", "MapView", ".", "ZoomOption", ".", "LEVEL_CLOSEST", ")", ";", "}", "}" ]
When the user selects a different scale, have the map zoom to it. @see com.smartgwt.client.widgets.form.fields.events.ChangedHandler#onChanged (com.smartgwt.client.widgets.form.fields.events.ChangedEvent)
[ "When", "the", "user", "selects", "a", "different", "scale", "have", "the", "map", "zoom", "to", "it", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/ScaleSelect.java#L291-L298
147,504
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/ScaleSelect.java
ScaleSelect.updateScaleList
private void updateScaleList() { refreshPixelLength(); /* retrieve pixelLength from mapWidget. Needed in case mapWidget wasn't fully initialized the previous time the pixelLength was requested */ // Update lookup map (stores user friendly representation): valueToScale.clear(); if (!Double.isNaN(pixelLength) && (0.0 != pixelLength)) { for (Double scale : scaleList) { // Eliminate duplicates and null: if (scale != null) { String value = ScaleConverter.scaleToString(scale, precision, significantDigits); valueToScale.put(value, scale); } } List<String> availableScales = new ArrayList<String>(); for (Double scale : scaleList) { if (mapView.isResolutionAvailable(pixelLength / scale)) { availableScales.add(ScaleConverter.scaleToString(scale, precision, significantDigits)); } } scaleItem.setValueMap(availableScales.toArray(new String[availableScales.size()])); isScaleItemInitialized = true; } }
java
private void updateScaleList() { refreshPixelLength(); /* retrieve pixelLength from mapWidget. Needed in case mapWidget wasn't fully initialized the previous time the pixelLength was requested */ // Update lookup map (stores user friendly representation): valueToScale.clear(); if (!Double.isNaN(pixelLength) && (0.0 != pixelLength)) { for (Double scale : scaleList) { // Eliminate duplicates and null: if (scale != null) { String value = ScaleConverter.scaleToString(scale, precision, significantDigits); valueToScale.put(value, scale); } } List<String> availableScales = new ArrayList<String>(); for (Double scale : scaleList) { if (mapView.isResolutionAvailable(pixelLength / scale)) { availableScales.add(ScaleConverter.scaleToString(scale, precision, significantDigits)); } } scaleItem.setValueMap(availableScales.toArray(new String[availableScales.size()])); isScaleItemInitialized = true; } }
[ "private", "void", "updateScaleList", "(", ")", "{", "refreshPixelLength", "(", ")", ";", "/* retrieve pixelLength from mapWidget. Needed in case mapWidget wasn't fully initialized\n\t\t\t\t\tthe previous time the pixelLength was requested */", "// Update lookup map (stores user friendly representation):", "valueToScale", ".", "clear", "(", ")", ";", "if", "(", "!", "Double", ".", "isNaN", "(", "pixelLength", ")", "&&", "(", "0.0", "!=", "pixelLength", ")", ")", "{", "for", "(", "Double", "scale", ":", "scaleList", ")", "{", "// Eliminate duplicates and null:", "if", "(", "scale", "!=", "null", ")", "{", "String", "value", "=", "ScaleConverter", ".", "scaleToString", "(", "scale", ",", "precision", ",", "significantDigits", ")", ";", "valueToScale", ".", "put", "(", "value", ",", "scale", ")", ";", "}", "}", "List", "<", "String", ">", "availableScales", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "Double", "scale", ":", "scaleList", ")", "{", "if", "(", "mapView", ".", "isResolutionAvailable", "(", "pixelLength", "/", "scale", ")", ")", "{", "availableScales", ".", "add", "(", "ScaleConverter", ".", "scaleToString", "(", "scale", ",", "precision", ",", "significantDigits", ")", ")", ";", "}", "}", "scaleItem", ".", "setValueMap", "(", "availableScales", ".", "toArray", "(", "new", "String", "[", "availableScales", ".", "size", "(", ")", "]", ")", ")", ";", "isScaleItemInitialized", "=", "true", ";", "}", "}" ]
Given the full list of desirable resolutions, which ones are actually available? Update the widget accordingly.
[ "Given", "the", "full", "list", "of", "desirable", "resolutions", "which", "ones", "are", "actually", "available?", "Update", "the", "widget", "accordingly", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/ScaleSelect.java#L311-L338
147,505
seedstack/i18n-addon
rest/src/it/java/org/seedstack/i18n/internal/rest/TranslationsResourceIT.java
TranslationsResourceIT.outdated_scenario
@Test public void outdated_scenario() throws JSONException { httpPost("keys", jsonKey.toString(), 201); try { // Add two outdated translations sendTranslationUpdate("zztranslation", EN, true); sendTranslationUpdate("translation", FR, true); // Update the default translation jsonKey.put("translation", "updated translation"); httpPut("keys/" + keyName, jsonKey.toString(), 200); // The key should remain outdated assertOutdatedStatus(true); // Update English translations sendTranslationUpdate("updated translation", EN, false); // The key should remain outdated assertOutdatedStatus(true); // Update French translations sendTranslationUpdate("updated translation", FR, false); // Now, all the translation have been updated assertOutdatedStatus(false); } finally { // clean the repo httpDelete("keys/" + keyName, 204); } }
java
@Test public void outdated_scenario() throws JSONException { httpPost("keys", jsonKey.toString(), 201); try { // Add two outdated translations sendTranslationUpdate("zztranslation", EN, true); sendTranslationUpdate("translation", FR, true); // Update the default translation jsonKey.put("translation", "updated translation"); httpPut("keys/" + keyName, jsonKey.toString(), 200); // The key should remain outdated assertOutdatedStatus(true); // Update English translations sendTranslationUpdate("updated translation", EN, false); // The key should remain outdated assertOutdatedStatus(true); // Update French translations sendTranslationUpdate("updated translation", FR, false); // Now, all the translation have been updated assertOutdatedStatus(false); } finally { // clean the repo httpDelete("keys/" + keyName, 204); } }
[ "@", "Test", "public", "void", "outdated_scenario", "(", ")", "throws", "JSONException", "{", "httpPost", "(", "\"keys\"", ",", "jsonKey", ".", "toString", "(", ")", ",", "201", ")", ";", "try", "{", "// Add two outdated translations", "sendTranslationUpdate", "(", "\"zztranslation\"", ",", "EN", ",", "true", ")", ";", "sendTranslationUpdate", "(", "\"translation\"", ",", "FR", ",", "true", ")", ";", "// Update the default translation", "jsonKey", ".", "put", "(", "\"translation\"", ",", "\"updated translation\"", ")", ";", "httpPut", "(", "\"keys/\"", "+", "keyName", ",", "jsonKey", ".", "toString", "(", ")", ",", "200", ")", ";", "// The key should remain outdated", "assertOutdatedStatus", "(", "true", ")", ";", "// Update English translations", "sendTranslationUpdate", "(", "\"updated translation\"", ",", "EN", ",", "false", ")", ";", "// The key should remain outdated", "assertOutdatedStatus", "(", "true", ")", ";", "// Update French translations", "sendTranslationUpdate", "(", "\"updated translation\"", ",", "FR", ",", "false", ")", ";", "// Now, all the translation have been updated", "assertOutdatedStatus", "(", "false", ")", ";", "}", "finally", "{", "// clean the repo", "httpDelete", "(", "\"keys/\"", "+", "keyName", ",", "204", ")", ";", "}", "}" ]
Checks the outdated scenario. 1) A key is added 2) Add fr translation 3) Update default translation => key become outdated 4) Update en translation => key is still outdated 5) Update fr translation => key is no longer outdated
[ "Checks", "the", "outdated", "scenario", ".", "1", ")", "A", "key", "is", "added", "2", ")", "Add", "fr", "translation", "3", ")", "Update", "default", "translation", "=", ">", "key", "become", "outdated", "4", ")", "Update", "en", "translation", "=", ">", "key", "is", "still", "outdated", "5", ")", "Update", "fr", "translation", "=", ">", "key", "is", "no", "longer", "outdated" ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/internal/rest/TranslationsResourceIT.java#L76-L108
147,506
seedstack/i18n-addon
rest/src/it/java/org/seedstack/i18n/internal/rest/TranslationsResourceIT.java
TranslationsResourceIT.assertOutdatedStatus
private Response assertOutdatedStatus(boolean outdated) throws JSONException { Response response = httpGet("keys/" + keyName); JSONObject actual = new JSONObject(response.asString()); Assertions.assertThat(actual.getBoolean("outdated")).isEqualTo(outdated); return response; }
java
private Response assertOutdatedStatus(boolean outdated) throws JSONException { Response response = httpGet("keys/" + keyName); JSONObject actual = new JSONObject(response.asString()); Assertions.assertThat(actual.getBoolean("outdated")).isEqualTo(outdated); return response; }
[ "private", "Response", "assertOutdatedStatus", "(", "boolean", "outdated", ")", "throws", "JSONException", "{", "Response", "response", "=", "httpGet", "(", "\"keys/\"", "+", "keyName", ")", ";", "JSONObject", "actual", "=", "new", "JSONObject", "(", "response", ".", "asString", "(", ")", ")", ";", "Assertions", ".", "assertThat", "(", "actual", ".", "getBoolean", "(", "\"outdated\"", ")", ")", ".", "isEqualTo", "(", "outdated", ")", ";", "return", "response", ";", "}" ]
Checks the outdated state of the key. @param outdated expected value @return true if outdated state of the key corresponding to the outdated param
[ "Checks", "the", "outdated", "state", "of", "the", "key", "." ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/internal/rest/TranslationsResourceIT.java#L116-L121
147,507
seedstack/i18n-addon
rest/src/it/java/org/seedstack/i18n/internal/rest/TranslationsResourceIT.java
TranslationsResourceIT.sendTranslationUpdate
private void sendTranslationUpdate(String translation, String locale, boolean outdated) throws JSONException { JSONObject jsonTranslationValueObject = new JSONObject(); jsonTranslationValueObject.put("translation", translation); jsonTranslationValueObject.put("outdated", outdated); jsonTranslationValueObject.put("locale", locale); jsonTranslationValueObject.put("approx", true); jsonTranslation.put("target", jsonTranslationValueObject); // Translate in english httpPut("translations/" + locale + "/" + keyName, jsonTranslation.toString()); }
java
private void sendTranslationUpdate(String translation, String locale, boolean outdated) throws JSONException { JSONObject jsonTranslationValueObject = new JSONObject(); jsonTranslationValueObject.put("translation", translation); jsonTranslationValueObject.put("outdated", outdated); jsonTranslationValueObject.put("locale", locale); jsonTranslationValueObject.put("approx", true); jsonTranslation.put("target", jsonTranslationValueObject); // Translate in english httpPut("translations/" + locale + "/" + keyName, jsonTranslation.toString()); }
[ "private", "void", "sendTranslationUpdate", "(", "String", "translation", ",", "String", "locale", ",", "boolean", "outdated", ")", "throws", "JSONException", "{", "JSONObject", "jsonTranslationValueObject", "=", "new", "JSONObject", "(", ")", ";", "jsonTranslationValueObject", ".", "put", "(", "\"translation\"", ",", "translation", ")", ";", "jsonTranslationValueObject", ".", "put", "(", "\"outdated\"", ",", "outdated", ")", ";", "jsonTranslationValueObject", ".", "put", "(", "\"locale\"", ",", "locale", ")", ";", "jsonTranslationValueObject", ".", "put", "(", "\"approx\"", ",", "true", ")", ";", "jsonTranslation", ".", "put", "(", "\"target\"", ",", "jsonTranslationValueObject", ")", ";", "// Translate in english", "httpPut", "(", "\"translations/\"", "+", "locale", "+", "\"/\"", "+", "keyName", ",", "jsonTranslation", ".", "toString", "(", ")", ")", ";", "}" ]
Sends an HTTP put request to update the translation for the given locale. @param translation translation @param locale locale @param outdated outdated
[ "Sends", "an", "HTTP", "put", "request", "to", "update", "the", "translation", "for", "the", "given", "locale", "." ]
1e65101d8554623f09bda2497b0151fd10a16615
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/internal/rest/TranslationsResourceIT.java#L130-L140
147,508
geomajas/geomajas-project-client-gwt
plugin/editing/editing-gwt/src/main/java/org/geomajas/plugin/editing/gwt/client/snap/VectorLayerSourceProvider.java
VectorLayerSourceProvider.getSnappingSources
public void getSnappingSources(final GeometryArrayFunction callback) { GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND); SearchByLocationRequest request = new SearchByLocationRequest(); request.addLayerWithFilter(layer.getServerLayerId(), layer.getServerLayerId(), layer.getFilter()); request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_GEOMETRY); request.setLocation(boundsAsGeometry()); request.setCrs(layer.getMapModel().getCrs()); request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS); request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS); commandRequest.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(commandRequest, new AbstractCommandCallback<SearchByLocationResponse>() { public void execute(SearchByLocationResponse response) { if (response.getFeatureMap().size() > 0) { List<Feature> features = response.getFeatureMap().values().iterator().next(); Geometry[] geometries = new Geometry[features.size()]; for (int i = 0; i < features.size(); i++) { geometries[i] = features.get(i).getGeometry(); } callback.execute(geometries); } } }); }
java
public void getSnappingSources(final GeometryArrayFunction callback) { GwtCommand commandRequest = new GwtCommand(SearchByLocationRequest.COMMAND); SearchByLocationRequest request = new SearchByLocationRequest(); request.addLayerWithFilter(layer.getServerLayerId(), layer.getServerLayerId(), layer.getFilter()); request.setFeatureIncludes(GeomajasConstant.FEATURE_INCLUDE_GEOMETRY); request.setLocation(boundsAsGeometry()); request.setCrs(layer.getMapModel().getCrs()); request.setQueryType(SearchByLocationRequest.QUERY_INTERSECTS); request.setSearchType(SearchByLocationRequest.SEARCH_ALL_LAYERS); commandRequest.setCommandRequest(request); GwtCommandDispatcher.getInstance().execute(commandRequest, new AbstractCommandCallback<SearchByLocationResponse>() { public void execute(SearchByLocationResponse response) { if (response.getFeatureMap().size() > 0) { List<Feature> features = response.getFeatureMap().values().iterator().next(); Geometry[] geometries = new Geometry[features.size()]; for (int i = 0; i < features.size(); i++) { geometries[i] = features.get(i).getGeometry(); } callback.execute(geometries); } } }); }
[ "public", "void", "getSnappingSources", "(", "final", "GeometryArrayFunction", "callback", ")", "{", "GwtCommand", "commandRequest", "=", "new", "GwtCommand", "(", "SearchByLocationRequest", ".", "COMMAND", ")", ";", "SearchByLocationRequest", "request", "=", "new", "SearchByLocationRequest", "(", ")", ";", "request", ".", "addLayerWithFilter", "(", "layer", ".", "getServerLayerId", "(", ")", ",", "layer", ".", "getServerLayerId", "(", ")", ",", "layer", ".", "getFilter", "(", ")", ")", ";", "request", ".", "setFeatureIncludes", "(", "GeomajasConstant", ".", "FEATURE_INCLUDE_GEOMETRY", ")", ";", "request", ".", "setLocation", "(", "boundsAsGeometry", "(", ")", ")", ";", "request", ".", "setCrs", "(", "layer", ".", "getMapModel", "(", ")", ".", "getCrs", "(", ")", ")", ";", "request", ".", "setQueryType", "(", "SearchByLocationRequest", ".", "QUERY_INTERSECTS", ")", ";", "request", ".", "setSearchType", "(", "SearchByLocationRequest", ".", "SEARCH_ALL_LAYERS", ")", ";", "commandRequest", ".", "setCommandRequest", "(", "request", ")", ";", "GwtCommandDispatcher", ".", "getInstance", "(", ")", ".", "execute", "(", "commandRequest", ",", "new", "AbstractCommandCallback", "<", "SearchByLocationResponse", ">", "(", ")", "{", "public", "void", "execute", "(", "SearchByLocationResponse", "response", ")", "{", "if", "(", "response", ".", "getFeatureMap", "(", ")", ".", "size", "(", ")", ">", "0", ")", "{", "List", "<", "Feature", ">", "features", "=", "response", ".", "getFeatureMap", "(", ")", ".", "values", "(", ")", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "Geometry", "[", "]", "geometries", "=", "new", "Geometry", "[", "features", ".", "size", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "features", ".", "size", "(", ")", ";", "i", "++", ")", "{", "geometries", "[", "i", "]", "=", "features", ".", "get", "(", "i", ")", ".", "getGeometry", "(", ")", ";", "}", "callback", ".", "execute", "(", "geometries", ")", ";", "}", "}", "}", ")", ";", "}" ]
Get the geometries of all features within the map view bounds.
[ "Get", "the", "geometries", "of", "all", "features", "within", "the", "map", "view", "bounds", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/editing/editing-gwt/src/main/java/org/geomajas/plugin/editing/gwt/client/snap/VectorLayerSourceProvider.java#L49-L73
147,509
wnameless/rubycollect4j
src/main/java/net/sf/rubycollect4j/RubyIO.java
RubyIO.foreach
public static void foreach(String path, Consumer<? super String> block) { Ruby.Enumerator.of(new EachLineIterable(new File(path))).each(block); }
java
public static void foreach(String path, Consumer<? super String> block) { Ruby.Enumerator.of(new EachLineIterable(new File(path))).each(block); }
[ "public", "static", "void", "foreach", "(", "String", "path", ",", "Consumer", "<", "?", "super", "String", ">", "block", ")", "{", "Ruby", ".", "Enumerator", ".", "of", "(", "new", "EachLineIterable", "(", "new", "File", "(", "path", ")", ")", ")", ".", "each", "(", "block", ")", ";", "}" ]
Iterates a file line by line. @param path of a File @param block to process each line
[ "Iterates", "a", "file", "line", "by", "line", "." ]
b8b8d8eccaca2254a3d09b91745882fb7a0d5add
https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyIO.java#L297-L299
147,510
wnameless/rubycollect4j
src/main/java/net/sf/rubycollect4j/RubyIO.java
RubyIO.close
public void close() { try { raFile.close(); } catch (IOException e) { logger.log(Level.SEVERE, null, e); throw new RuntimeException(e); } }
java
public void close() { try { raFile.close(); } catch (IOException e) { logger.log(Level.SEVERE, null, e); throw new RuntimeException(e); } }
[ "public", "void", "close", "(", ")", "{", "try", "{", "raFile", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "e", ")", ";", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Closes this IO.
[ "Closes", "this", "IO", "." ]
b8b8d8eccaca2254a3d09b91745882fb7a0d5add
https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyIO.java#L304-L311
147,511
wnameless/rubycollect4j
src/main/java/net/sf/rubycollect4j/RubyIO.java
RubyIO.puts
public void puts(String words) { if (mode.isWritable() == false) throw new IllegalStateException("IOError: not opened for writing"); try { raFile.write(words.getBytes()); raFile.writeBytes(System.getProperty("line.separator")); } catch (IOException e) { logger.log(Level.SEVERE, null, e); throw new RuntimeException(e); } }
java
public void puts(String words) { if (mode.isWritable() == false) throw new IllegalStateException("IOError: not opened for writing"); try { raFile.write(words.getBytes()); raFile.writeBytes(System.getProperty("line.separator")); } catch (IOException e) { logger.log(Level.SEVERE, null, e); throw new RuntimeException(e); } }
[ "public", "void", "puts", "(", "String", "words", ")", "{", "if", "(", "mode", ".", "isWritable", "(", ")", "==", "false", ")", "throw", "new", "IllegalStateException", "(", "\"IOError: not opened for writing\"", ")", ";", "try", "{", "raFile", ".", "write", "(", "words", ".", "getBytes", "(", ")", ")", ";", "raFile", ".", "writeBytes", "(", "System", ".", "getProperty", "(", "\"line.separator\"", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "e", ")", ";", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Writes a line in the file. @param words to write a line @throws IllegalStateException if file is not writable
[ "Writes", "a", "line", "in", "the", "file", "." ]
b8b8d8eccaca2254a3d09b91745882fb7a0d5add
https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyIO.java#L335-L346
147,512
wnameless/rubycollect4j
src/main/java/net/sf/rubycollect4j/RubyIO.java
RubyIO.read
public String read() { if (mode.isReadable() == false) throw new IllegalStateException("IOError: not opened for reading"); StringBuilder sb = new StringBuilder(); try { BufferedReader reader = new BufferedReader(new FileReader(file)); char[] buf = new char[1024]; int numOfChars = 0; while ((numOfChars = reader.read(buf)) != -1) { sb.append(String.valueOf(buf, 0, numOfChars)); } reader.close(); } catch (IOException e) { logger.log(Level.SEVERE, null, e); throw new RuntimeException(e); } return sb.toString(); }
java
public String read() { if (mode.isReadable() == false) throw new IllegalStateException("IOError: not opened for reading"); StringBuilder sb = new StringBuilder(); try { BufferedReader reader = new BufferedReader(new FileReader(file)); char[] buf = new char[1024]; int numOfChars = 0; while ((numOfChars = reader.read(buf)) != -1) { sb.append(String.valueOf(buf, 0, numOfChars)); } reader.close(); } catch (IOException e) { logger.log(Level.SEVERE, null, e); throw new RuntimeException(e); } return sb.toString(); }
[ "public", "String", "read", "(", ")", "{", "if", "(", "mode", ".", "isReadable", "(", ")", "==", "false", ")", "throw", "new", "IllegalStateException", "(", "\"IOError: not opened for reading\"", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "try", "{", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "file", ")", ")", ";", "char", "[", "]", "buf", "=", "new", "char", "[", "1024", "]", ";", "int", "numOfChars", "=", "0", ";", "while", "(", "(", "numOfChars", "=", "reader", ".", "read", "(", "buf", ")", ")", "!=", "-", "1", ")", "{", "sb", ".", "append", "(", "String", ".", "valueOf", "(", "buf", ",", "0", ",", "numOfChars", ")", ")", ";", "}", "reader", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "e", ")", ";", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Reads the content of a file. @return String @throws IllegalStateException if file is not readable
[ "Reads", "the", "content", "of", "a", "file", "." ]
b8b8d8eccaca2254a3d09b91745882fb7a0d5add
https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyIO.java#L355-L373
147,513
wnameless/rubycollect4j
src/main/java/net/sf/rubycollect4j/RubyIO.java
RubyIO.seek
public void seek(long pos) { try { raFile.seek(pos); } catch (IOException e) { logger.log(Level.SEVERE, null, e); throw new RuntimeException(e); } }
java
public void seek(long pos) { try { raFile.seek(pos); } catch (IOException e) { logger.log(Level.SEVERE, null, e); throw new RuntimeException(e); } }
[ "public", "void", "seek", "(", "long", "pos", ")", "{", "try", "{", "raFile", ".", "seek", "(", "pos", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "e", ")", ";", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Moves the cursor to certain position. @param pos position of the file
[ "Moves", "the", "cursor", "to", "certain", "position", "." ]
b8b8d8eccaca2254a3d09b91745882fb7a0d5add
https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyIO.java#L381-L388
147,514
wnameless/rubycollect4j
src/main/java/net/sf/rubycollect4j/RubyIO.java
RubyIO.write
public int write(String words) { if (mode.isWritable() == false) throw new IllegalStateException("IOError: not opened for writing"); try { raFile.write(words.getBytes()); } catch (IOException e) { logger.log(Level.SEVERE, null, e); throw new RuntimeException(e); } return words.getBytes().length; }
java
public int write(String words) { if (mode.isWritable() == false) throw new IllegalStateException("IOError: not opened for writing"); try { raFile.write(words.getBytes()); } catch (IOException e) { logger.log(Level.SEVERE, null, e); throw new RuntimeException(e); } return words.getBytes().length; }
[ "public", "int", "write", "(", "String", "words", ")", "{", "if", "(", "mode", ".", "isWritable", "(", ")", "==", "false", ")", "throw", "new", "IllegalStateException", "(", "\"IOError: not opened for writing\"", ")", ";", "try", "{", "raFile", ".", "write", "(", "words", ".", "getBytes", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "logger", ".", "log", "(", "Level", ".", "SEVERE", ",", "null", ",", "e", ")", ";", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "return", "words", ".", "getBytes", "(", ")", ".", "length", ";", "}" ]
Writes to the file. @param words to write @return the number of written bytes. @throws IllegalStateException if file is not writable
[ "Writes", "to", "the", "file", "." ]
b8b8d8eccaca2254a3d09b91745882fb7a0d5add
https://github.com/wnameless/rubycollect4j/blob/b8b8d8eccaca2254a3d09b91745882fb7a0d5add/src/main/java/net/sf/rubycollect4j/RubyIO.java#L399-L410
147,515
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/LayersModelImpl.java
LayersModelImpl.getLayer
public Layer getLayer(String layerId) { org.geomajas.gwt.client.map.layer.Layer<?> layer = mapModel.getLayer(layerId); if (layer instanceof org.geomajas.gwt.client.map.layer.VectorLayer) { return new VectorLayer((org.geomajas.gwt.client.map.layer.VectorLayer) layer); } return new LayerImpl(layer); }
java
public Layer getLayer(String layerId) { org.geomajas.gwt.client.map.layer.Layer<?> layer = mapModel.getLayer(layerId); if (layer instanceof org.geomajas.gwt.client.map.layer.VectorLayer) { return new VectorLayer((org.geomajas.gwt.client.map.layer.VectorLayer) layer); } return new LayerImpl(layer); }
[ "public", "Layer", "getLayer", "(", "String", "layerId", ")", "{", "org", ".", "geomajas", ".", "gwt", ".", "client", ".", "map", ".", "layer", ".", "Layer", "<", "?", ">", "layer", "=", "mapModel", ".", "getLayer", "(", "layerId", ")", ";", "if", "(", "layer", "instanceof", "org", ".", "geomajas", ".", "gwt", ".", "client", ".", "map", ".", "layer", ".", "VectorLayer", ")", "{", "return", "new", "VectorLayer", "(", "(", "org", ".", "geomajas", ".", "gwt", ".", "client", ".", "map", ".", "layer", ".", "VectorLayer", ")", "layer", ")", ";", "}", "return", "new", "LayerImpl", "(", "layer", ")", ";", "}" ]
Get a single layer by its identifier. @param id The layers unique identifier within this map. @return Returns the layer, or null if it could not be found.
[ "Get", "a", "single", "layer", "by", "its", "identifier", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/LayersModelImpl.java#L61-L67
147,516
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/LayersModelImpl.java
LayersModelImpl.getLayerAt
public Layer getLayerAt(int index) { org.geomajas.gwt.client.map.layer.Layer<?> layer = mapModel.getLayers().get(index); if (layer instanceof org.geomajas.gwt.client.map.layer.VectorLayer) { return new VectorLayer((org.geomajas.gwt.client.map.layer.VectorLayer) layer); } return new LayerImpl(layer); }
java
public Layer getLayerAt(int index) { org.geomajas.gwt.client.map.layer.Layer<?> layer = mapModel.getLayers().get(index); if (layer instanceof org.geomajas.gwt.client.map.layer.VectorLayer) { return new VectorLayer((org.geomajas.gwt.client.map.layer.VectorLayer) layer); } return new LayerImpl(layer); }
[ "public", "Layer", "getLayerAt", "(", "int", "index", ")", "{", "org", ".", "geomajas", ".", "gwt", ".", "client", ".", "map", ".", "layer", ".", "Layer", "<", "?", ">", "layer", "=", "mapModel", ".", "getLayers", "(", ")", ".", "get", "(", "index", ")", ";", "if", "(", "layer", "instanceof", "org", ".", "geomajas", ".", "gwt", ".", "client", ".", "map", ".", "layer", ".", "VectorLayer", ")", "{", "return", "new", "VectorLayer", "(", "(", "org", ".", "geomajas", ".", "gwt", ".", "client", ".", "map", ".", "layer", ".", "VectorLayer", ")", "layer", ")", ";", "}", "return", "new", "LayerImpl", "(", "layer", ")", ";", "}" ]
Return the layer at a certain index. If the index can't be found, null is returned. @param index The specified index. @return Returns the layer, or null if the index can't be found.
[ "Return", "the", "layer", "at", "a", "certain", "index", ".", "If", "the", "index", "can", "t", "be", "found", "null", "is", "returned", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/map/LayersModelImpl.java#L76-L82
147,517
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/operation/InsertRingOperation.java
InsertRingOperation.execute
public Geometry execute(Geometry geometry) { if (geometry instanceof Polygon) { Polygon polygon = (Polygon) geometry; if (geometry.isEmpty()) { return null; } else { LinearRing[] interiorRings = new LinearRing[polygon.getNumInteriorRing() + 1]; int count = 0; for (int n = 0; n < interiorRings.length; n++) { if (n == index) { interiorRings[n] = ring; } else { interiorRings[n] = polygon.getInteriorRingN(count); } } return geometry.getGeometryFactory().createPolygon(polygon.getExteriorRing(), interiorRings); } } return null; }
java
public Geometry execute(Geometry geometry) { if (geometry instanceof Polygon) { Polygon polygon = (Polygon) geometry; if (geometry.isEmpty()) { return null; } else { LinearRing[] interiorRings = new LinearRing[polygon.getNumInteriorRing() + 1]; int count = 0; for (int n = 0; n < interiorRings.length; n++) { if (n == index) { interiorRings[n] = ring; } else { interiorRings[n] = polygon.getInteriorRingN(count); } } return geometry.getGeometryFactory().createPolygon(polygon.getExteriorRing(), interiorRings); } } return null; }
[ "public", "Geometry", "execute", "(", "Geometry", "geometry", ")", "{", "if", "(", "geometry", "instanceof", "Polygon", ")", "{", "Polygon", "polygon", "=", "(", "Polygon", ")", "geometry", ";", "if", "(", "geometry", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";", "}", "else", "{", "LinearRing", "[", "]", "interiorRings", "=", "new", "LinearRing", "[", "polygon", ".", "getNumInteriorRing", "(", ")", "+", "1", "]", ";", "int", "count", "=", "0", ";", "for", "(", "int", "n", "=", "0", ";", "n", "<", "interiorRings", ".", "length", ";", "n", "++", ")", "{", "if", "(", "n", "==", "index", ")", "{", "interiorRings", "[", "n", "]", "=", "ring", ";", "}", "else", "{", "interiorRings", "[", "n", "]", "=", "polygon", ".", "getInteriorRingN", "(", "count", ")", ";", "}", "}", "return", "geometry", ".", "getGeometryFactory", "(", ")", ".", "createPolygon", "(", "polygon", ".", "getExteriorRing", "(", ")", ",", "interiorRings", ")", ";", "}", "}", "return", "null", ";", "}" ]
Execute the operation! When the geometry is not a Polygon, null is returned.
[ "Execute", "the", "operation!", "When", "the", "geometry", "is", "not", "a", "Polygon", "null", "is", "returned", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/operation/InsertRingOperation.java#L50-L69
147,518
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java
DefaultFeatureForm.createItem
@Api public FormItem createItem(AbstractReadOnlyAttributeInfo info) { return AttributeFormFieldRegistry.createFormItem(info, attributeProvider.createProvider(info.getName())); }
java
@Api public FormItem createItem(AbstractReadOnlyAttributeInfo info) { return AttributeFormFieldRegistry.createFormItem(info, attributeProvider.createProvider(info.getName())); }
[ "@", "Api", "public", "FormItem", "createItem", "(", "AbstractReadOnlyAttributeInfo", "info", ")", "{", "return", "AttributeFormFieldRegistry", ".", "createFormItem", "(", "info", ",", "attributeProvider", ".", "createProvider", "(", "info", ".", "getName", "(", ")", ")", ")", ";", "}" ]
Creates a form item for a specific attribute. @param info the attribute information. @return the form item @since 1.11.1
[ "Creates", "a", "form", "item", "for", "a", "specific", "attribute", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java#L188-L191
147,519
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java
DefaultFeatureForm.setValue
public void setValue(String name, BooleanAttribute attribute) { FormItem item = formWidget.getField(name); if (item != null) { item.setValue(attribute.getValue()); } }
java
public void setValue(String name, BooleanAttribute attribute) { FormItem item = formWidget.getField(name); if (item != null) { item.setValue(attribute.getValue()); } }
[ "public", "void", "setValue", "(", "String", "name", ",", "BooleanAttribute", "attribute", ")", "{", "FormItem", "item", "=", "formWidget", ".", "getField", "(", "name", ")", ";", "if", "(", "item", "!=", "null", ")", "{", "item", ".", "setValue", "(", "attribute", ".", "getValue", "(", ")", ")", ";", "}", "}" ]
Apply a boolean attribute value on the form, with the given name. @param name attribute name @param attribute attribute value @since 1.11.1
[ "Apply", "a", "boolean", "attribute", "value", "on", "the", "form", "with", "the", "given", "name", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java#L483-L488
147,520
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java
DefaultFeatureForm.setValue
@Api public void setValue(String name, ShortAttribute attribute) { FormItem item = formWidget.getField(name); if (item != null) { item.setValue(attribute.getValue()); } }
java
@Api public void setValue(String name, ShortAttribute attribute) { FormItem item = formWidget.getField(name); if (item != null) { item.setValue(attribute.getValue()); } }
[ "@", "Api", "public", "void", "setValue", "(", "String", "name", ",", "ShortAttribute", "attribute", ")", "{", "FormItem", "item", "=", "formWidget", ".", "getField", "(", "name", ")", ";", "if", "(", "item", "!=", "null", ")", "{", "item", ".", "setValue", "(", "attribute", ".", "getValue", "(", ")", ")", ";", "}", "}" ]
Apply a short attribute value on the form, with the given name. @param name attribute name @param attribute attribute value @since 1.11.1
[ "Apply", "a", "short", "attribute", "value", "on", "the", "form", "with", "the", "given", "name", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/attribute/DefaultFeatureForm.java#L497-L503
147,521
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/action/menu/AttributesAction.java
AttributesAction.onClick
public void onClick(MenuItemClickEvent event) { final FeatureTransaction ft = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction(); if (ft != null) { SimpleFeatureAttributeWindow window = new SimpleFeatureAttributeWindow(ft.getNewFeatures()[0]) { public void onOk(Feature feature) { // Copy the attributes to the real feature: // Don't overwrite the feature itself, as the GraphicsContext expects the same object for rendering! ft.getNewFeatures()[0].setAttributes(feature.getAttributes()); } public void onClose() { } }; window.show(); } }
java
public void onClick(MenuItemClickEvent event) { final FeatureTransaction ft = mapWidget.getMapModel().getFeatureEditor().getFeatureTransaction(); if (ft != null) { SimpleFeatureAttributeWindow window = new SimpleFeatureAttributeWindow(ft.getNewFeatures()[0]) { public void onOk(Feature feature) { // Copy the attributes to the real feature: // Don't overwrite the feature itself, as the GraphicsContext expects the same object for rendering! ft.getNewFeatures()[0].setAttributes(feature.getAttributes()); } public void onClose() { } }; window.show(); } }
[ "public", "void", "onClick", "(", "MenuItemClickEvent", "event", ")", "{", "final", "FeatureTransaction", "ft", "=", "mapWidget", ".", "getMapModel", "(", ")", ".", "getFeatureEditor", "(", ")", ".", "getFeatureTransaction", "(", ")", ";", "if", "(", "ft", "!=", "null", ")", "{", "SimpleFeatureAttributeWindow", "window", "=", "new", "SimpleFeatureAttributeWindow", "(", "ft", ".", "getNewFeatures", "(", ")", "[", "0", "]", ")", "{", "public", "void", "onOk", "(", "Feature", "feature", ")", "{", "// Copy the attributes to the real feature:", "// Don't overwrite the feature itself, as the GraphicsContext expects the same object for rendering!", "ft", ".", "getNewFeatures", "(", ")", "[", "0", "]", ".", "setAttributes", "(", "feature", ".", "getAttributes", "(", ")", ")", ";", "}", "public", "void", "onClose", "(", ")", "{", "}", "}", ";", "window", ".", "show", "(", ")", ";", "}", "}" ]
Remove an existing ring from a Polygon or MultiPolygon at a given index. @param event The {@link MenuItemClickEvent} from clicking the action.
[ "Remove", "an", "existing", "ring", "from", "a", "Polygon", "or", "MultiPolygon", "at", "a", "given", "index", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/action/menu/AttributesAction.java#L57-L73
147,522
geomajas/geomajas-project-client-gwt
plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/wizard/WizardPage.java
WizardPage.savePage
public void savePage(WizardView view, Runnable successCallback, Runnable failureCallback) { if (null != successCallback) { successCallback.run(); } }
java
public void savePage(WizardView view, Runnable successCallback, Runnable failureCallback) { if (null != successCallback) { successCallback.run(); } }
[ "public", "void", "savePage", "(", "WizardView", "view", ",", "Runnable", "successCallback", ",", "Runnable", "failureCallback", ")", "{", "if", "(", "null", "!=", "successCallback", ")", "{", "successCallback", ".", "run", "(", ")", ";", "}", "}" ]
Save the page data. This can communicate with the server if needed. The return is handled by calling either the success or failure callback. @param view wizard view @param successCallback what to do on success @param failureCallback what to do on failure
[ "Save", "the", "page", "data", ".", "This", "can", "communicate", "with", "the", "server", "if", "needed", ".", "The", "return", "is", "handled", "by", "calling", "either", "the", "success", "or", "failure", "callback", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/wizard/WizardPage.java#L117-L121
147,523
geomajas/geomajas-project-client-gwt
plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/wizard/WizardPage.java
WizardPage.canShow
public boolean canShow() { WizardPage<DATA> back = getPreviousPage(); while (back != null && back.isValid()) { back = back.getPreviousPage(); } return back == null; }
java
public boolean canShow() { WizardPage<DATA> back = getPreviousPage(); while (back != null && back.isValid()) { back = back.getPreviousPage(); } return back == null; }
[ "public", "boolean", "canShow", "(", ")", "{", "WizardPage", "<", "DATA", ">", "back", "=", "getPreviousPage", "(", ")", ";", "while", "(", "back", "!=", "null", "&&", "back", ".", "isValid", "(", ")", ")", "{", "back", "=", "back", ".", "getPreviousPage", "(", ")", ";", "}", "return", "back", "==", "null", ";", "}" ]
Returns whether this page can already be shown to the user. Default implementation checks whether all previous pages have been validated. @return true if page can be shown
[ "Returns", "whether", "this", "page", "can", "already", "be", "shown", "to", "the", "user", ".", "Default", "implementation", "checks", "whether", "all", "previous", "pages", "have", "been", "validated", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/wizard/WizardPage.java#L143-L149
147,524
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/ExceptionWindow.java
ExceptionWindow.buildGui
private void buildGui() { setTitle(I18nProvider.getGlobal().commandError()); setHeaderIcon(WidgetLayout.iconError); setIsModal(true); setShowModalMask(true); setModalMaskOpacity(WidgetLayout.modalMaskOpacity); setWidth(WidgetLayout.exceptionWindowWidth); setHeight(WidgetLayout.exceptionWindowHeightNormal); setKeepInParentRect(WidgetLayout.exceptionWindowKeepInScreen); setCanDragResize(true); centerInPage(); setAutoSize(true); addCloseClickHandler(this); addItem(createErrorLayout(error)); }
java
private void buildGui() { setTitle(I18nProvider.getGlobal().commandError()); setHeaderIcon(WidgetLayout.iconError); setIsModal(true); setShowModalMask(true); setModalMaskOpacity(WidgetLayout.modalMaskOpacity); setWidth(WidgetLayout.exceptionWindowWidth); setHeight(WidgetLayout.exceptionWindowHeightNormal); setKeepInParentRect(WidgetLayout.exceptionWindowKeepInScreen); setCanDragResize(true); centerInPage(); setAutoSize(true); addCloseClickHandler(this); addItem(createErrorLayout(error)); }
[ "private", "void", "buildGui", "(", ")", "{", "setTitle", "(", "I18nProvider", ".", "getGlobal", "(", ")", ".", "commandError", "(", ")", ")", ";", "setHeaderIcon", "(", "WidgetLayout", ".", "iconError", ")", ";", "setIsModal", "(", "true", ")", ";", "setShowModalMask", "(", "true", ")", ";", "setModalMaskOpacity", "(", "WidgetLayout", ".", "modalMaskOpacity", ")", ";", "setWidth", "(", "WidgetLayout", ".", "exceptionWindowWidth", ")", ";", "setHeight", "(", "WidgetLayout", ".", "exceptionWindowHeightNormal", ")", ";", "setKeepInParentRect", "(", "WidgetLayout", ".", "exceptionWindowKeepInScreen", ")", ";", "setCanDragResize", "(", "true", ")", ";", "centerInPage", "(", ")", ";", "setAutoSize", "(", "true", ")", ";", "addCloseClickHandler", "(", "this", ")", ";", "addItem", "(", "createErrorLayout", "(", "error", ")", ")", ";", "}" ]
Build the entire GUI for this widget.
[ "Build", "the", "entire", "GUI", "for", "this", "widget", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/ExceptionWindow.java#L96-L111
147,525
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/ExceptionWindow.java
ExceptionWindow.createErrorLayout
private VLayout createErrorLayout(ExceptionDto error) { VLayout layout = new VLayout(); layout.setWidth100(); layout.setHeight100(); layout.setPadding(WidgetLayout.marginLarge); HLayout topLayout = new HLayout(WidgetLayout.marginLarge); topLayout.setWidth100(); Img icon = new Img(WidgetLayout.iconError, WidgetLayout.exceptionWindowIconSize, WidgetLayout.exceptionWindowIconSize); topLayout.addMember(icon); HTMLFlow message = new HTMLFlow(); message.setWidth100(); message.setHeight100(); message.setLayoutAlign(VerticalAlignment.TOP); message.setContents(HtmlBuilder.divStyle(WidgetLayout.exceptionWindowMessageStyle, error.getMessage())); topLayout.addMember(message); layout.addMember(topLayout); if (error.getStackTrace() != null && error.getStackTrace().length > 0) { expandButton = new Button(MESSAGES.exceptionDetailsView()); expandButton.setWidth(WidgetLayout.exceptionWindowButtonWidth); expandButton.setLayoutAlign(Alignment.RIGHT); expandButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { setDetailsVisible(!detailsLayout.isVisible()); } }); layout.addMember(expandButton); String content = getDetails(error); HTMLPane detailPane = new HTMLPane(); detailPane.setContents(content); detailPane.setWidth100(); detailPane.setHeight100(); detailsLayout = new VLayout(); detailsLayout.setWidth100(); detailsLayout.setHeight100(); detailsLayout.addMember(detailPane); detailsLayout.setBorder(WidgetLayout.exceptionWindowDetailBorderStyle); layout.addMember(detailsLayout); } return layout; }
java
private VLayout createErrorLayout(ExceptionDto error) { VLayout layout = new VLayout(); layout.setWidth100(); layout.setHeight100(); layout.setPadding(WidgetLayout.marginLarge); HLayout topLayout = new HLayout(WidgetLayout.marginLarge); topLayout.setWidth100(); Img icon = new Img(WidgetLayout.iconError, WidgetLayout.exceptionWindowIconSize, WidgetLayout.exceptionWindowIconSize); topLayout.addMember(icon); HTMLFlow message = new HTMLFlow(); message.setWidth100(); message.setHeight100(); message.setLayoutAlign(VerticalAlignment.TOP); message.setContents(HtmlBuilder.divStyle(WidgetLayout.exceptionWindowMessageStyle, error.getMessage())); topLayout.addMember(message); layout.addMember(topLayout); if (error.getStackTrace() != null && error.getStackTrace().length > 0) { expandButton = new Button(MESSAGES.exceptionDetailsView()); expandButton.setWidth(WidgetLayout.exceptionWindowButtonWidth); expandButton.setLayoutAlign(Alignment.RIGHT); expandButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { setDetailsVisible(!detailsLayout.isVisible()); } }); layout.addMember(expandButton); String content = getDetails(error); HTMLPane detailPane = new HTMLPane(); detailPane.setContents(content); detailPane.setWidth100(); detailPane.setHeight100(); detailsLayout = new VLayout(); detailsLayout.setWidth100(); detailsLayout.setHeight100(); detailsLayout.addMember(detailPane); detailsLayout.setBorder(WidgetLayout.exceptionWindowDetailBorderStyle); layout.addMember(detailsLayout); } return layout; }
[ "private", "VLayout", "createErrorLayout", "(", "ExceptionDto", "error", ")", "{", "VLayout", "layout", "=", "new", "VLayout", "(", ")", ";", "layout", ".", "setWidth100", "(", ")", ";", "layout", ".", "setHeight100", "(", ")", ";", "layout", ".", "setPadding", "(", "WidgetLayout", ".", "marginLarge", ")", ";", "HLayout", "topLayout", "=", "new", "HLayout", "(", "WidgetLayout", ".", "marginLarge", ")", ";", "topLayout", ".", "setWidth100", "(", ")", ";", "Img", "icon", "=", "new", "Img", "(", "WidgetLayout", ".", "iconError", ",", "WidgetLayout", ".", "exceptionWindowIconSize", ",", "WidgetLayout", ".", "exceptionWindowIconSize", ")", ";", "topLayout", ".", "addMember", "(", "icon", ")", ";", "HTMLFlow", "message", "=", "new", "HTMLFlow", "(", ")", ";", "message", ".", "setWidth100", "(", ")", ";", "message", ".", "setHeight100", "(", ")", ";", "message", ".", "setLayoutAlign", "(", "VerticalAlignment", ".", "TOP", ")", ";", "message", ".", "setContents", "(", "HtmlBuilder", ".", "divStyle", "(", "WidgetLayout", ".", "exceptionWindowMessageStyle", ",", "error", ".", "getMessage", "(", ")", ")", ")", ";", "topLayout", ".", "addMember", "(", "message", ")", ";", "layout", ".", "addMember", "(", "topLayout", ")", ";", "if", "(", "error", ".", "getStackTrace", "(", ")", "!=", "null", "&&", "error", ".", "getStackTrace", "(", ")", ".", "length", ">", "0", ")", "{", "expandButton", "=", "new", "Button", "(", "MESSAGES", ".", "exceptionDetailsView", "(", ")", ")", ";", "expandButton", ".", "setWidth", "(", "WidgetLayout", ".", "exceptionWindowButtonWidth", ")", ";", "expandButton", ".", "setLayoutAlign", "(", "Alignment", ".", "RIGHT", ")", ";", "expandButton", ".", "addClickHandler", "(", "new", "ClickHandler", "(", ")", "{", "public", "void", "onClick", "(", "ClickEvent", "event", ")", "{", "setDetailsVisible", "(", "!", "detailsLayout", ".", "isVisible", "(", ")", ")", ";", "}", "}", ")", ";", "layout", ".", "addMember", "(", "expandButton", ")", ";", "String", "content", "=", "getDetails", "(", "error", ")", ";", "HTMLPane", "detailPane", "=", "new", "HTMLPane", "(", ")", ";", "detailPane", ".", "setContents", "(", "content", ")", ";", "detailPane", ".", "setWidth100", "(", ")", ";", "detailPane", ".", "setHeight100", "(", ")", ";", "detailsLayout", "=", "new", "VLayout", "(", ")", ";", "detailsLayout", ".", "setWidth100", "(", ")", ";", "detailsLayout", ".", "setHeight100", "(", ")", ";", "detailsLayout", ".", "addMember", "(", "detailPane", ")", ";", "detailsLayout", ".", "setBorder", "(", "WidgetLayout", ".", "exceptionWindowDetailBorderStyle", ")", ";", "layout", ".", "addMember", "(", "detailsLayout", ")", ";", "}", "return", "layout", ";", "}" ]
Create the GUI for a single exception. @param error error to report @return layout
[ "Create", "the", "GUI", "for", "a", "single", "exception", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/ExceptionWindow.java#L129-L173
147,526
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/ExceptionWindow.java
ExceptionWindow.setDetailsVisible
private void setDetailsVisible(boolean detailsVisible) { detailsLayout.setVisible(detailsVisible); if (detailsVisible) { setAutoSize(false); expandButton.setTitle(MESSAGES.exceptionDetailsHide()); setHeight(WidgetLayout.exceptionWindowHeightDetails); } else { expandButton.setTitle(MESSAGES.exceptionDetailsView()); setHeight(WidgetLayout.exceptionWindowHeightNormal); } }
java
private void setDetailsVisible(boolean detailsVisible) { detailsLayout.setVisible(detailsVisible); if (detailsVisible) { setAutoSize(false); expandButton.setTitle(MESSAGES.exceptionDetailsHide()); setHeight(WidgetLayout.exceptionWindowHeightDetails); } else { expandButton.setTitle(MESSAGES.exceptionDetailsView()); setHeight(WidgetLayout.exceptionWindowHeightNormal); } }
[ "private", "void", "setDetailsVisible", "(", "boolean", "detailsVisible", ")", "{", "detailsLayout", ".", "setVisible", "(", "detailsVisible", ")", ";", "if", "(", "detailsVisible", ")", "{", "setAutoSize", "(", "false", ")", ";", "expandButton", ".", "setTitle", "(", "MESSAGES", ".", "exceptionDetailsHide", "(", ")", ")", ";", "setHeight", "(", "WidgetLayout", ".", "exceptionWindowHeightDetails", ")", ";", "}", "else", "{", "expandButton", ".", "setTitle", "(", "MESSAGES", ".", "exceptionDetailsView", "(", ")", ")", ";", "setHeight", "(", "WidgetLayout", ".", "exceptionWindowHeightNormal", ")", ";", "}", "}" ]
Toggle the visibility of the exception details. @param detailsVisible should details be visible
[ "Toggle", "the", "visibility", "of", "the", "exception", "details", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/ExceptionWindow.java#L219-L229
147,527
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java
HtmlBuilder.tagClassHtmlContent
public static String tagClassHtmlContent(String tag, String clazz, String... content) { return openTagClassHtmlContent(tag, clazz, content) + closeTag(tag); }
java
public static String tagClassHtmlContent(String tag, String clazz, String... content) { return openTagClassHtmlContent(tag, clazz, content) + closeTag(tag); }
[ "public", "static", "String", "tagClassHtmlContent", "(", "String", "tag", ",", "String", "clazz", ",", "String", "...", "content", ")", "{", "return", "openTagClassHtmlContent", "(", "tag", ",", "clazz", ",", "content", ")", "+", "closeTag", "(", "tag", ")", ";", "}" ]
Build a String containing a HTML opening tag with given CSS class, HTML content and closing tag. @param tag String name of HTML tag @param clazz CSS class of the tag @param content content string @return HTML tag element as string
[ "Build", "a", "String", "containing", "a", "HTML", "opening", "tag", "with", "given", "CSS", "class", "HTML", "content", "and", "closing", "tag", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L325-L327
147,528
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java
HtmlBuilder.openTagClassHtmlContent
public static String openTagClassHtmlContent(String tag, String clazz, String... content) { return openTagHtmlContent(tag, clazz, null, content); }
java
public static String openTagClassHtmlContent(String tag, String clazz, String... content) { return openTagHtmlContent(tag, clazz, null, content); }
[ "public", "static", "String", "openTagClassHtmlContent", "(", "String", "tag", ",", "String", "clazz", ",", "String", "...", "content", ")", "{", "return", "openTagHtmlContent", "(", "tag", ",", "clazz", ",", "null", ",", "content", ")", ";", "}" ]
Build a String containing a HTML opening tag with given CSS class and concatenates the given HTML content. @param tag String name of HTML tag @param clazz CSS class of the tag @param content content string @return HTML tag element as string
[ "Build", "a", "String", "containing", "a", "HTML", "opening", "tag", "with", "given", "CSS", "class", "and", "concatenates", "the", "given", "HTML", "content", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L350-L352
147,529
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/map/layer/VectorLayer.java
VectorLayer.clearSelectedFeatures
public void clearSelectedFeatures() { List<Feature> clone = new LinkedList<Feature>(selectedFeatures.values()); for (Feature feature : clone) { selectedFeatures.remove(feature.getId()); handlerManager.fireEvent(new FeatureDeselectedEvent(feature)); } }
java
public void clearSelectedFeatures() { List<Feature> clone = new LinkedList<Feature>(selectedFeatures.values()); for (Feature feature : clone) { selectedFeatures.remove(feature.getId()); handlerManager.fireEvent(new FeatureDeselectedEvent(feature)); } }
[ "public", "void", "clearSelectedFeatures", "(", ")", "{", "List", "<", "Feature", ">", "clone", "=", "new", "LinkedList", "<", "Feature", ">", "(", "selectedFeatures", ".", "values", "(", ")", ")", ";", "for", "(", "Feature", "feature", ":", "clone", ")", "{", "selectedFeatures", ".", "remove", "(", "feature", ".", "getId", "(", ")", ")", ";", "handlerManager", ".", "fireEvent", "(", "new", "FeatureDeselectedEvent", "(", "feature", ")", ")", ";", "}", "}" ]
Clear the list of selected features.
[ "Clear", "the", "list", "of", "selected", "features", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/layer/VectorLayer.java#L195-L201
147,530
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgStyleDecoder.java
SvgStyleDecoder.decode
public static String decode(Style style) { if (style != null) { if (style instanceof ShapeStyle) { return decode((ShapeStyle) style); } else if (style instanceof FontStyle) { return decode((FontStyle) style); } else if (style instanceof PictureStyle) { return decode((PictureStyle) style); } } return ""; }
java
public static String decode(Style style) { if (style != null) { if (style instanceof ShapeStyle) { return decode((ShapeStyle) style); } else if (style instanceof FontStyle) { return decode((FontStyle) style); } else if (style instanceof PictureStyle) { return decode((PictureStyle) style); } } return ""; }
[ "public", "static", "String", "decode", "(", "Style", "style", ")", "{", "if", "(", "style", "!=", "null", ")", "{", "if", "(", "style", "instanceof", "ShapeStyle", ")", "{", "return", "decode", "(", "(", "ShapeStyle", ")", "style", ")", ";", "}", "else", "if", "(", "style", "instanceof", "FontStyle", ")", "{", "return", "decode", "(", "(", "FontStyle", ")", "style", ")", ";", "}", "else", "if", "(", "style", "instanceof", "PictureStyle", ")", "{", "return", "decode", "(", "(", "PictureStyle", ")", "style", ")", ";", "}", "}", "return", "\"\"", ";", "}" ]
Return the CSS equivalent of the Style object. @param style @return
[ "Return", "the", "CSS", "equivalent", "of", "the", "Style", "object", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgStyleDecoder.java#L34-L45
147,531
geomajas/geomajas-project-client-gwt
plugin/editing/editing-javascript-api/src/main/java/org/geomajas/plugin/editing/jsapi/client/service/JsGeometryIndex.java
JsGeometryIndex.getType
@ExportInstanceMethod public static String getType(GeometryIndex instance) { switch (instance.getType()) { case TYPE_GEOMETRY: return "geometry"; case TYPE_VERTEX: return "vertex"; case TYPE_EDGE: return "edge"; default: return "unknown"; } }
java
@ExportInstanceMethod public static String getType(GeometryIndex instance) { switch (instance.getType()) { case TYPE_GEOMETRY: return "geometry"; case TYPE_VERTEX: return "vertex"; case TYPE_EDGE: return "edge"; default: return "unknown"; } }
[ "@", "ExportInstanceMethod", "public", "static", "String", "getType", "(", "GeometryIndex", "instance", ")", "{", "switch", "(", "instance", ".", "getType", "(", ")", ")", "{", "case", "TYPE_GEOMETRY", ":", "return", "\"geometry\"", ";", "case", "TYPE_VERTEX", ":", "return", "\"vertex\"", ";", "case", "TYPE_EDGE", ":", "return", "\"edge\"", ";", "default", ":", "return", "\"unknown\"", ";", "}", "}" ]
Get the type of sub-part this index points to. Can be a vertex, edge or sub-geometry. @return The type of sub-part this index points to.
[ "Get", "the", "type", "of", "sub", "-", "part", "this", "index", "points", "to", ".", "Can", "be", "a", "vertex", "edge", "or", "sub", "-", "geometry", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/editing/editing-javascript-api/src/main/java/org/geomajas/plugin/editing/jsapi/client/service/JsGeometryIndex.java#L38-L50
147,532
geomajas/geomajas-project-client-gwt
plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/widget/CardLayout.java
CardLayout.addCard
@Api public void addCard(KEY_TYPE key, Canvas card) { if (currentCard != null) { currentCard.hide(); } addMember(card); currentCard = card; cards.put(key, card); }
java
@Api public void addCard(KEY_TYPE key, Canvas card) { if (currentCard != null) { currentCard.hide(); } addMember(card); currentCard = card; cards.put(key, card); }
[ "@", "Api", "public", "void", "addCard", "(", "KEY_TYPE", "key", ",", "Canvas", "card", ")", "{", "if", "(", "currentCard", "!=", "null", ")", "{", "currentCard", ".", "hide", "(", ")", ";", "}", "addMember", "(", "card", ")", ";", "currentCard", "=", "card", ";", "cards", ".", "put", "(", "key", ",", "card", ")", ";", "}" ]
Add a card to the deck and associate it with the specified key. @param key key associated to the card @param card the card @since 1.0.0
[ "Add", "a", "card", "to", "the", "deck", "and", "associate", "it", "with", "the", "specified", "key", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/widget/CardLayout.java#L41-L49
147,533
geomajas/geomajas-project-client-gwt
plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/widget/CardLayout.java
CardLayout.showCard
@Api public void showCard(KEY_TYPE key) { Canvas newCurrent = cards.get(key); if (null != newCurrent) { if (newCurrent != currentCard && null != currentCard) { currentCard.hide(); } currentCard = newCurrent; currentCard.show(); } }
java
@Api public void showCard(KEY_TYPE key) { Canvas newCurrent = cards.get(key); if (null != newCurrent) { if (newCurrent != currentCard && null != currentCard) { currentCard.hide(); } currentCard = newCurrent; currentCard.show(); } }
[ "@", "Api", "public", "void", "showCard", "(", "KEY_TYPE", "key", ")", "{", "Canvas", "newCurrent", "=", "cards", ".", "get", "(", "key", ")", ";", "if", "(", "null", "!=", "newCurrent", ")", "{", "if", "(", "newCurrent", "!=", "currentCard", "&&", "null", "!=", "currentCard", ")", "{", "currentCard", ".", "hide", "(", ")", ";", "}", "currentCard", "=", "newCurrent", ";", "currentCard", ".", "show", "(", ")", ";", "}", "}" ]
Show the card associated with the specified key. @param key key associated to the card that should be shown @since 1.0.0
[ "Show", "the", "card", "associated", "with", "the", "specified", "key", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-utility/utility-gwt/src/main/java/org/geomajas/widget/utility/gwt/client/widget/CardLayout.java#L57-L67
147,534
geomajas/geomajas-project-client-gwt
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/FeatureListGridTab.java
FeatureListGridTab.addFeatures
public void addFeatures(List<Feature> features) { numFeatures += features.size(); for (Feature feature : features) { featureListGrid.addFeature(feature); } if (sortFeatures) { featureListGrid.sort(sortFieldName, sortDirGWT); } if (exportCsvHandler instanceof ExportFeatureListToCsvHandler) { ((ExportFeatureListToCsvHandler) exportCsvHandler).setFeatures(features); } }
java
public void addFeatures(List<Feature> features) { numFeatures += features.size(); for (Feature feature : features) { featureListGrid.addFeature(feature); } if (sortFeatures) { featureListGrid.sort(sortFieldName, sortDirGWT); } if (exportCsvHandler instanceof ExportFeatureListToCsvHandler) { ((ExportFeatureListToCsvHandler) exportCsvHandler).setFeatures(features); } }
[ "public", "void", "addFeatures", "(", "List", "<", "Feature", ">", "features", ")", "{", "numFeatures", "+=", "features", ".", "size", "(", ")", ";", "for", "(", "Feature", "feature", ":", "features", ")", "{", "featureListGrid", ".", "addFeature", "(", "feature", ")", ";", "}", "if", "(", "sortFeatures", ")", "{", "featureListGrid", ".", "sort", "(", "sortFieldName", ",", "sortDirGWT", ")", ";", "}", "if", "(", "exportCsvHandler", "instanceof", "ExportFeatureListToCsvHandler", ")", "{", "(", "(", "ExportFeatureListToCsvHandler", ")", "exportCsvHandler", ")", ".", "setFeatures", "(", "features", ")", ";", "}", "}" ]
Add features to grid. @param features features to add
[ "Add", "features", "to", "grid", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/FeatureListGridTab.java#L232-L244
147,535
geomajas/geomajas-project-client-gwt
plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/FeatureListGridTab.java
FeatureListGridTab.setCriterion
public void setCriterion(Criterion criterion) { this.criterion = criterion; // Replace the handler if it is of type featureList // (when we have a criterion it is better to use that as it has no limitation on returned items) if (exportCsvHandler == null || exportCsvHandler instanceof ExportFeatureListToCsvHandler) { this.exportCsvHandler = new ExportSearchToCsvHandler(mapWidget.getMapModel(), layer, criterion); } else if (exportCsvHandler instanceof ExportSearchToCsvHandler) { ((ExportSearchToCsvHandler) exportCsvHandler).setCriterion(criterion); } }
java
public void setCriterion(Criterion criterion) { this.criterion = criterion; // Replace the handler if it is of type featureList // (when we have a criterion it is better to use that as it has no limitation on returned items) if (exportCsvHandler == null || exportCsvHandler instanceof ExportFeatureListToCsvHandler) { this.exportCsvHandler = new ExportSearchToCsvHandler(mapWidget.getMapModel(), layer, criterion); } else if (exportCsvHandler instanceof ExportSearchToCsvHandler) { ((ExportSearchToCsvHandler) exportCsvHandler).setCriterion(criterion); } }
[ "public", "void", "setCriterion", "(", "Criterion", "criterion", ")", "{", "this", ".", "criterion", "=", "criterion", ";", "// Replace the handler if it is of type featureList ", "// (when we have a criterion it is better to use that as it has no limitation on returned items)", "if", "(", "exportCsvHandler", "==", "null", "||", "exportCsvHandler", "instanceof", "ExportFeatureListToCsvHandler", ")", "{", "this", ".", "exportCsvHandler", "=", "new", "ExportSearchToCsvHandler", "(", "mapWidget", ".", "getMapModel", "(", ")", ",", "layer", ",", "criterion", ")", ";", "}", "else", "if", "(", "exportCsvHandler", "instanceof", "ExportSearchToCsvHandler", ")", "{", "(", "(", "ExportSearchToCsvHandler", ")", "exportCsvHandler", ")", ".", "setCriterion", "(", "criterion", ")", ";", "}", "}" ]
Set the search criterion. @param criterion the criterion to set
[ "Set", "the", "search", "criterion", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-searchandfilter/searchandfilter-gwt/src/main/java/org/geomajas/widget/searchandfilter/client/widget/multifeaturelistgrid/FeatureListGridTab.java#L321-L331
147,536
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/paintable/Composite.java
Composite.contains
public boolean contains(Paintable p) { if (children.contains(p)) { return true; } for (Paintable t : children) { if (t instanceof Composite) { if (((Composite) t).contains(p)) { return true; } } } return false; }
java
public boolean contains(Paintable p) { if (children.contains(p)) { return true; } for (Paintable t : children) { if (t instanceof Composite) { if (((Composite) t).contains(p)) { return true; } } } return false; }
[ "public", "boolean", "contains", "(", "Paintable", "p", ")", "{", "if", "(", "children", ".", "contains", "(", "p", ")", ")", "{", "return", "true", ";", "}", "for", "(", "Paintable", "t", ":", "children", ")", "{", "if", "(", "t", "instanceof", "Composite", ")", "{", "if", "(", "(", "(", "Composite", ")", "t", ")", ".", "contains", "(", "p", ")", ")", "{", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Recursively checks children to find p. @param p Paintable to search for @return true when the composite contains the passed object
[ "Recursively", "checks", "children", "to", "find", "p", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/paintable/Composite.java#L111-L124
147,537
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/LayerTree.java
LayerTree.onLeafClick
public void onLeafClick(LeafClickEvent event) { LayerTreeTreeNode layerTreeNode = (LayerTreeTreeNode) event.getLeaf(); if (null != selectedLayerTreeNode && layerTreeNode.getLayer().getId().equals(selectedLayerTreeNode.getLayer().getId())) { mapModel.selectLayer(null); } else { mapModel.selectLayer(layerTreeNode.getLayer()); } }
java
public void onLeafClick(LeafClickEvent event) { LayerTreeTreeNode layerTreeNode = (LayerTreeTreeNode) event.getLeaf(); if (null != selectedLayerTreeNode && layerTreeNode.getLayer().getId().equals(selectedLayerTreeNode.getLayer().getId())) { mapModel.selectLayer(null); } else { mapModel.selectLayer(layerTreeNode.getLayer()); } }
[ "public", "void", "onLeafClick", "(", "LeafClickEvent", "event", ")", "{", "LayerTreeTreeNode", "layerTreeNode", "=", "(", "LayerTreeTreeNode", ")", "event", ".", "getLeaf", "(", ")", ";", "if", "(", "null", "!=", "selectedLayerTreeNode", "&&", "layerTreeNode", ".", "getLayer", "(", ")", ".", "getId", "(", ")", ".", "equals", "(", "selectedLayerTreeNode", ".", "getLayer", "(", ")", ".", "getId", "(", ")", ")", ")", "{", "mapModel", ".", "selectLayer", "(", "null", ")", ";", "}", "else", "{", "mapModel", ".", "selectLayer", "(", "layerTreeNode", ".", "getLayer", "(", ")", ")", ";", "}", "}" ]
When the user clicks on a leaf the header text of the tree table is changed to the selected leaf and the toolbar buttons are updated to represent the correct state of the buttons.
[ "When", "the", "user", "clicks", "on", "a", "leaf", "the", "header", "text", "of", "the", "tree", "table", "is", "changed", "to", "the", "selected", "leaf", "and", "the", "toolbar", "buttons", "are", "updated", "to", "represent", "the", "correct", "state", "of", "the", "buttons", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/LayerTree.java#L196-L204
147,538
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/LayerTree.java
LayerTree.buildToolstrip
private ToolStrip buildToolstrip(MapWidget mapWidget) { toolStrip = new ToolStrip(); toolStrip.setWidth100(); toolStrip.setPadding(3); ClientLayerTreeInfo layerTreeInfo = mapModel.getMapInfo().getLayerTree(); if (layerTreeInfo != null) { for (ClientToolInfo tool : layerTreeInfo.getTools()) { String id = tool.getToolId(); Canvas button = null; ToolbarBaseAction action = LayerTreeRegistry.getToolbarAction(id, mapWidget); if (action instanceof ToolbarWidget) { toolStrip.addMember(((ToolbarWidget) action).getWidget()); } else if (action instanceof ToolbarCanvas) { button = ((ToolbarCanvas) action).getCanvas(); } else if (action instanceof LayerTreeAction) { button = new LayerTreeButton(this, (LayerTreeAction) action); } else if (action instanceof LayerTreeModalAction) { button = new LayerTreeModalButton(this, (LayerTreeModalAction) action); } else { String msg = "LayerTree tool with id " + id + " unknown."; Log.logError(msg); // console log SC.warn(msg); // in your face } if (button != null) { toolStrip.addMember(button); LayoutSpacer spacer = new LayoutSpacer(); spacer.setWidth(WidgetLayout.layerTreePadding); toolStrip.addMember(spacer); } } } final Canvas[] toolStripMembers = toolStrip.getMembers(); // delaying this fixes an image 'undefined' error Timer t = new Timer() { public void run() { updateButtonIconsAndStates(toolStripMembers); } }; t.schedule(10); return toolStrip; }
java
private ToolStrip buildToolstrip(MapWidget mapWidget) { toolStrip = new ToolStrip(); toolStrip.setWidth100(); toolStrip.setPadding(3); ClientLayerTreeInfo layerTreeInfo = mapModel.getMapInfo().getLayerTree(); if (layerTreeInfo != null) { for (ClientToolInfo tool : layerTreeInfo.getTools()) { String id = tool.getToolId(); Canvas button = null; ToolbarBaseAction action = LayerTreeRegistry.getToolbarAction(id, mapWidget); if (action instanceof ToolbarWidget) { toolStrip.addMember(((ToolbarWidget) action).getWidget()); } else if (action instanceof ToolbarCanvas) { button = ((ToolbarCanvas) action).getCanvas(); } else if (action instanceof LayerTreeAction) { button = new LayerTreeButton(this, (LayerTreeAction) action); } else if (action instanceof LayerTreeModalAction) { button = new LayerTreeModalButton(this, (LayerTreeModalAction) action); } else { String msg = "LayerTree tool with id " + id + " unknown."; Log.logError(msg); // console log SC.warn(msg); // in your face } if (button != null) { toolStrip.addMember(button); LayoutSpacer spacer = new LayoutSpacer(); spacer.setWidth(WidgetLayout.layerTreePadding); toolStrip.addMember(spacer); } } } final Canvas[] toolStripMembers = toolStrip.getMembers(); // delaying this fixes an image 'undefined' error Timer t = new Timer() { public void run() { updateButtonIconsAndStates(toolStripMembers); } }; t.schedule(10); return toolStrip; }
[ "private", "ToolStrip", "buildToolstrip", "(", "MapWidget", "mapWidget", ")", "{", "toolStrip", "=", "new", "ToolStrip", "(", ")", ";", "toolStrip", ".", "setWidth100", "(", ")", ";", "toolStrip", ".", "setPadding", "(", "3", ")", ";", "ClientLayerTreeInfo", "layerTreeInfo", "=", "mapModel", ".", "getMapInfo", "(", ")", ".", "getLayerTree", "(", ")", ";", "if", "(", "layerTreeInfo", "!=", "null", ")", "{", "for", "(", "ClientToolInfo", "tool", ":", "layerTreeInfo", ".", "getTools", "(", ")", ")", "{", "String", "id", "=", "tool", ".", "getToolId", "(", ")", ";", "Canvas", "button", "=", "null", ";", "ToolbarBaseAction", "action", "=", "LayerTreeRegistry", ".", "getToolbarAction", "(", "id", ",", "mapWidget", ")", ";", "if", "(", "action", "instanceof", "ToolbarWidget", ")", "{", "toolStrip", ".", "addMember", "(", "(", "(", "ToolbarWidget", ")", "action", ")", ".", "getWidget", "(", ")", ")", ";", "}", "else", "if", "(", "action", "instanceof", "ToolbarCanvas", ")", "{", "button", "=", "(", "(", "ToolbarCanvas", ")", "action", ")", ".", "getCanvas", "(", ")", ";", "}", "else", "if", "(", "action", "instanceof", "LayerTreeAction", ")", "{", "button", "=", "new", "LayerTreeButton", "(", "this", ",", "(", "LayerTreeAction", ")", "action", ")", ";", "}", "else", "if", "(", "action", "instanceof", "LayerTreeModalAction", ")", "{", "button", "=", "new", "LayerTreeModalButton", "(", "this", ",", "(", "LayerTreeModalAction", ")", "action", ")", ";", "}", "else", "{", "String", "msg", "=", "\"LayerTree tool with id \"", "+", "id", "+", "\" unknown.\"", ";", "Log", ".", "logError", "(", "msg", ")", ";", "// console log", "SC", ".", "warn", "(", "msg", ")", ";", "// in your face", "}", "if", "(", "button", "!=", "null", ")", "{", "toolStrip", ".", "addMember", "(", "button", ")", ";", "LayoutSpacer", "spacer", "=", "new", "LayoutSpacer", "(", ")", ";", "spacer", ".", "setWidth", "(", "WidgetLayout", ".", "layerTreePadding", ")", ";", "toolStrip", ".", "addMember", "(", "spacer", ")", ";", "}", "}", "}", "final", "Canvas", "[", "]", "toolStripMembers", "=", "toolStrip", ".", "getMembers", "(", ")", ";", "// delaying this fixes an image 'undefined' error", "Timer", "t", "=", "new", "Timer", "(", ")", "{", "public", "void", "run", "(", ")", "{", "updateButtonIconsAndStates", "(", "toolStripMembers", ")", ";", "}", "}", ";", "t", ".", "schedule", "(", "10", ")", ";", "return", "toolStrip", ";", "}" ]
Builds the toolbar @param mapWidget The mapWidget containing the layerTree @return {@link com.smartgwt.client.widgets.toolbar.ToolStrip} which was built
[ "Builds", "the", "toolbar" ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/LayerTree.java#L230-L272
147,539
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/LayerTree.java
LayerTree.buildTree
private void buildTree(MapModel mapModel) { treeGrid.setWidth100(); treeGrid.setHeight100(); treeGrid.setShowHeader(false); tree = new RefreshableTree(); final TreeNode nodeRoot = new TreeNode("ROOT"); tree.setRoot(nodeRoot); // invisible ROOT node (ROOT node is required) ClientLayerTreeInfo layerTreeInfo = mapModel.getMapInfo().getLayerTree(); if (layerTreeInfo != null) { ClientLayerTreeNodeInfo treeNode = layerTreeInfo.getTreeNode(); processNode(treeNode, nodeRoot, tree, mapModel, false); } treeGrid.setData(tree); treeGrid.addLeafClickHandler(this); treeGrid.addFolderClickHandler(this); // -- add event listeners to layers for (Layer<?> layer : mapModel.getLayers()) { registrations.add(layer.addLayerChangedHandler(new LayerChangedHandler() { public void onLabelChange(LayerLabeledEvent event) { } public void onVisibleChange(LayerShownEvent event) { for (TreeNode node : tree.getAllNodes()) { if (node.getName().equals(event.getLayer().getLabel())) { if (node instanceof LayerTreeTreeNode) { ((LayerTreeTreeNode) node).updateIcon(); } } } } })); } }
java
private void buildTree(MapModel mapModel) { treeGrid.setWidth100(); treeGrid.setHeight100(); treeGrid.setShowHeader(false); tree = new RefreshableTree(); final TreeNode nodeRoot = new TreeNode("ROOT"); tree.setRoot(nodeRoot); // invisible ROOT node (ROOT node is required) ClientLayerTreeInfo layerTreeInfo = mapModel.getMapInfo().getLayerTree(); if (layerTreeInfo != null) { ClientLayerTreeNodeInfo treeNode = layerTreeInfo.getTreeNode(); processNode(treeNode, nodeRoot, tree, mapModel, false); } treeGrid.setData(tree); treeGrid.addLeafClickHandler(this); treeGrid.addFolderClickHandler(this); // -- add event listeners to layers for (Layer<?> layer : mapModel.getLayers()) { registrations.add(layer.addLayerChangedHandler(new LayerChangedHandler() { public void onLabelChange(LayerLabeledEvent event) { } public void onVisibleChange(LayerShownEvent event) { for (TreeNode node : tree.getAllNodes()) { if (node.getName().equals(event.getLayer().getLabel())) { if (node instanceof LayerTreeTreeNode) { ((LayerTreeTreeNode) node).updateIcon(); } } } } })); } }
[ "private", "void", "buildTree", "(", "MapModel", "mapModel", ")", "{", "treeGrid", ".", "setWidth100", "(", ")", ";", "treeGrid", ".", "setHeight100", "(", ")", ";", "treeGrid", ".", "setShowHeader", "(", "false", ")", ";", "tree", "=", "new", "RefreshableTree", "(", ")", ";", "final", "TreeNode", "nodeRoot", "=", "new", "TreeNode", "(", "\"ROOT\"", ")", ";", "tree", ".", "setRoot", "(", "nodeRoot", ")", ";", "// invisible ROOT node (ROOT node is required)", "ClientLayerTreeInfo", "layerTreeInfo", "=", "mapModel", ".", "getMapInfo", "(", ")", ".", "getLayerTree", "(", ")", ";", "if", "(", "layerTreeInfo", "!=", "null", ")", "{", "ClientLayerTreeNodeInfo", "treeNode", "=", "layerTreeInfo", ".", "getTreeNode", "(", ")", ";", "processNode", "(", "treeNode", ",", "nodeRoot", ",", "tree", ",", "mapModel", ",", "false", ")", ";", "}", "treeGrid", ".", "setData", "(", "tree", ")", ";", "treeGrid", ".", "addLeafClickHandler", "(", "this", ")", ";", "treeGrid", ".", "addFolderClickHandler", "(", "this", ")", ";", "// -- add event listeners to layers", "for", "(", "Layer", "<", "?", ">", "layer", ":", "mapModel", ".", "getLayers", "(", ")", ")", "{", "registrations", ".", "add", "(", "layer", ".", "addLayerChangedHandler", "(", "new", "LayerChangedHandler", "(", ")", "{", "public", "void", "onLabelChange", "(", "LayerLabeledEvent", "event", ")", "{", "}", "public", "void", "onVisibleChange", "(", "LayerShownEvent", "event", ")", "{", "for", "(", "TreeNode", "node", ":", "tree", ".", "getAllNodes", "(", ")", ")", "{", "if", "(", "node", ".", "getName", "(", ")", ".", "equals", "(", "event", ".", "getLayer", "(", ")", ".", "getLabel", "(", ")", ")", ")", "{", "if", "(", "node", "instanceof", "LayerTreeTreeNode", ")", "{", "(", "(", "LayerTreeTreeNode", ")", "node", ")", ".", "updateIcon", "(", ")", ";", "}", "}", "}", "}", "}", ")", ")", ";", "}", "}" ]
Builds up the tree showing the layers @param mapModel The mapModel containing the layerTree
[ "Builds", "up", "the", "tree", "showing", "the", "layers" ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/LayerTree.java#L280-L315
147,540
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/widget/LayerTree.java
LayerTree.updateButtonIconsAndStates
private void updateButtonIconsAndStates(Canvas[] toolStripMembers) { for (Canvas toolStripMember : toolStripMembers) { if (toolStripMember instanceof LayerTreeModalButton) { ((LayerTreeModalButton) toolStripMember).update(); } else if (toolStripMember instanceof LayerTreeButton) { ((LayerTreeButton) toolStripMember).update(); } } }
java
private void updateButtonIconsAndStates(Canvas[] toolStripMembers) { for (Canvas toolStripMember : toolStripMembers) { if (toolStripMember instanceof LayerTreeModalButton) { ((LayerTreeModalButton) toolStripMember).update(); } else if (toolStripMember instanceof LayerTreeButton) { ((LayerTreeButton) toolStripMember).update(); } } }
[ "private", "void", "updateButtonIconsAndStates", "(", "Canvas", "[", "]", "toolStripMembers", ")", "{", "for", "(", "Canvas", "toolStripMember", ":", "toolStripMembers", ")", "{", "if", "(", "toolStripMember", "instanceof", "LayerTreeModalButton", ")", "{", "(", "(", "LayerTreeModalButton", ")", "toolStripMember", ")", ".", "update", "(", ")", ";", "}", "else", "if", "(", "toolStripMember", "instanceof", "LayerTreeButton", ")", "{", "(", "(", "LayerTreeButton", ")", "toolStripMember", ")", ".", "update", "(", ")", ";", "}", "}", "}" ]
Updates the icons and the state of the buttons in the toolbar based upon the currently selected layer @param toolStripMembers data for the toolbar
[ "Updates", "the", "icons", "and", "the", "state", "of", "the", "buttons", "in", "the", "toolbar", "based", "upon", "the", "currently", "selected", "layer" ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/widget/LayerTree.java#L381-L389
147,541
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlGraphicsContext.java
VmlGraphicsContext.unhide
public void unhide(Object group, String name) { if (isAttached()) { Element element = helper.getElement(group, name); if (element != null) { Dom.setStyleAttribute(element, "visibility", "inherit"); } } }
java
public void unhide(Object group, String name) { if (isAttached()) { Element element = helper.getElement(group, name); if (element != null) { Dom.setStyleAttribute(element, "visibility", "inherit"); } } }
[ "public", "void", "unhide", "(", "Object", "group", ",", "String", "name", ")", "{", "if", "(", "isAttached", "(", ")", ")", "{", "Element", "element", "=", "helper", ".", "getElement", "(", "group", ",", "name", ")", ";", "if", "(", "element", "!=", "null", ")", "{", "Dom", ".", "setStyleAttribute", "(", "element", ",", "\"visibility\"", ",", "\"inherit\"", ")", ";", "}", "}", "}" ]
Show the specified element in the specified group. If the element does not exist, nothing will happen. @param group The group object. @param name The element name.
[ "Show", "the", "specified", "element", "in", "the", "specified", "group", ".", "If", "the", "element", "does", "not", "exist", "nothing", "will", "happen", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/VmlGraphicsContext.java#L699-L706
147,542
geomajas/geomajas-project-client-gwt
plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/widget/CombinedLayertree.java
CombinedLayertree.onLeafClick
public void onLeafClick(LeafClickEvent event) { LayerTreeTreeNode layerTreeNode; if (event.getLeaf() instanceof LayerTreeLegendItemNode) { layerTreeNode = ((LayerTreeLegendItemNode) event.getLeaf()).parent; treeGrid.deselectRecord(event.getLeaf()); treeGrid.selectRecord(layerTreeNode); } else { layerTreeNode = (LayerTreeTreeNode) event.getLeaf(); } // -- update model mapModel.selectLayer(layerTreeNode.getLayer()); }
java
public void onLeafClick(LeafClickEvent event) { LayerTreeTreeNode layerTreeNode; if (event.getLeaf() instanceof LayerTreeLegendItemNode) { layerTreeNode = ((LayerTreeLegendItemNode) event.getLeaf()).parent; treeGrid.deselectRecord(event.getLeaf()); treeGrid.selectRecord(layerTreeNode); } else { layerTreeNode = (LayerTreeTreeNode) event.getLeaf(); } // -- update model mapModel.selectLayer(layerTreeNode.getLayer()); }
[ "public", "void", "onLeafClick", "(", "LeafClickEvent", "event", ")", "{", "LayerTreeTreeNode", "layerTreeNode", ";", "if", "(", "event", ".", "getLeaf", "(", ")", "instanceof", "LayerTreeLegendItemNode", ")", "{", "layerTreeNode", "=", "(", "(", "LayerTreeLegendItemNode", ")", "event", ".", "getLeaf", "(", ")", ")", ".", "parent", ";", "treeGrid", ".", "deselectRecord", "(", "event", ".", "getLeaf", "(", ")", ")", ";", "treeGrid", ".", "selectRecord", "(", "layerTreeNode", ")", ";", "}", "else", "{", "layerTreeNode", "=", "(", "LayerTreeTreeNode", ")", "event", ".", "getLeaf", "(", ")", ";", "}", "// -- update model", "mapModel", ".", "selectLayer", "(", "layerTreeNode", ".", "getLayer", "(", ")", ")", ";", "}" ]
When a legendItem is selected, select the layer instead. @param event event
[ "When", "a", "legendItem", "is", "selected", "select", "the", "layer", "instead", "." ]
1c1adc48deb192ed825265eebcc74d70bbf45670
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-layer/layer-gwt/src/main/java/org/geomajas/widget/layer/client/widget/CombinedLayertree.java#L148-L160
147,543
ykrasik/jaci
jaci-libgdx-cli/src/main/java/com/github/ykrasik/jaci/cli/libgdx/output/LibGdxCliOutputBuffer.java
LibGdxCliOutputBuffer.println
public void println(String text, Color color) { final Label label = new Label(text, skin, "outputEntry"); label.setColor(color); label.setWrap(true); addLabel(label); }
java
public void println(String text, Color color) { final Label label = new Label(text, skin, "outputEntry"); label.setColor(color); label.setWrap(true); addLabel(label); }
[ "public", "void", "println", "(", "String", "text", ",", "Color", "color", ")", "{", "final", "Label", "label", "=", "new", "Label", "(", "text", ",", "skin", ",", "\"outputEntry\"", ")", ";", "label", ".", "setColor", "(", "color", ")", ";", "label", ".", "setWrap", "(", "true", ")", ";", "addLabel", "(", "label", ")", ";", "}" ]
Add a single line to this buffer. The line may contain a '\n' character, and it will be honored, but this is discouraged. @param text Line text. @param color Line color.
[ "Add", "a", "single", "line", "to", "this", "buffer", ".", "The", "line", "may", "contain", "a", "\\", "n", "character", "and", "it", "will", "be", "honored", "but", "this", "is", "discouraged", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-libgdx-cli/src/main/java/com/github/ykrasik/jaci/cli/libgdx/output/LibGdxCliOutputBuffer.java#L81-L86
147,544
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/AbstractMessage.java
AbstractMessage.hashFields
@SuppressWarnings("unchecked") protected int hashFields(int hash, Map<FieldDescriptor, Object> map) { for (Map.Entry<FieldDescriptor, Object> entry : map.entrySet()) { FieldDescriptor field = entry.getKey(); Object value = entry.getValue(); hash = (37 * hash) + field.getNumber(); if (field.getType() != FieldDescriptor.Type.ENUM){ hash = (53 * hash) + value.hashCode(); } else if (field.isRepeated()) { List<? extends EnumLite> list = (List<? extends EnumLite>) value; hash = (53 * hash) + hashEnumList(list); } else { hash = (53 * hash) + hashEnum((EnumLite) value); } } return hash; }
java
@SuppressWarnings("unchecked") protected int hashFields(int hash, Map<FieldDescriptor, Object> map) { for (Map.Entry<FieldDescriptor, Object> entry : map.entrySet()) { FieldDescriptor field = entry.getKey(); Object value = entry.getValue(); hash = (37 * hash) + field.getNumber(); if (field.getType() != FieldDescriptor.Type.ENUM){ hash = (53 * hash) + value.hashCode(); } else if (field.isRepeated()) { List<? extends EnumLite> list = (List<? extends EnumLite>) value; hash = (53 * hash) + hashEnumList(list); } else { hash = (53 * hash) + hashEnum((EnumLite) value); } } return hash; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "int", "hashFields", "(", "int", "hash", ",", "Map", "<", "FieldDescriptor", ",", "Object", ">", "map", ")", "{", "for", "(", "Map", ".", "Entry", "<", "FieldDescriptor", ",", "Object", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ")", "{", "FieldDescriptor", "field", "=", "entry", ".", "getKey", "(", ")", ";", "Object", "value", "=", "entry", ".", "getValue", "(", ")", ";", "hash", "=", "(", "37", "*", "hash", ")", "+", "field", ".", "getNumber", "(", ")", ";", "if", "(", "field", ".", "getType", "(", ")", "!=", "FieldDescriptor", ".", "Type", ".", "ENUM", ")", "{", "hash", "=", "(", "53", "*", "hash", ")", "+", "value", ".", "hashCode", "(", ")", ";", "}", "else", "if", "(", "field", ".", "isRepeated", "(", ")", ")", "{", "List", "<", "?", "extends", "EnumLite", ">", "list", "=", "(", "List", "<", "?", "extends", "EnumLite", ">", ")", "value", ";", "hash", "=", "(", "53", "*", "hash", ")", "+", "hashEnumList", "(", "list", ")", ";", "}", "else", "{", "hash", "=", "(", "53", "*", "hash", ")", "+", "hashEnum", "(", "(", "EnumLite", ")", "value", ")", ";", "}", "}", "return", "hash", ";", "}" ]
Get a hash code for given fields and values, using the given seed.
[ "Get", "a", "hash", "code", "for", "given", "fields", "and", "values", "using", "the", "given", "seed", "." ]
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/AbstractMessage.java#L197-L213
147,545
awltech/org.parallelj
parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/launching/transport/tcp/command/option/OptionsUtils.java
OptionsUtils.initializeArg
public static void initializeArg(final RemoteProgram remoteProgram, final String[] arguments, final Launch<?> launch) throws OptionException, ParserException { int numberOfEquals = 0; for (String argument : arguments) { if (argument.indexOf('=') > -1) numberOfEquals++; } if (numberOfEquals != arguments.length) throw new OptionException(LaunchingMessageKind.WREMOTE001.format(remoteProgram.getClass().getCanonicalName())); for (String argument : arguments) { if (argument.indexOf("=") > 0) { String[] arg = argument.split("="); String argName = arg[0]; String argValue = null; if (arg.length>1) argValue = arg[1]; if (argValue != null && argValue.trim().length() == 0) argValue = null; if (argValue!=null && argValue.charAt(0) == '"' && argValue.charAt(argValue.length()-1) == '"') { argValue = argValue.substring(1, argValue.length()-1); } if (argValue!=null && argValue.charAt(0) == '\'' && argValue.charAt(argValue.length()-1) == '\'') { argValue = argValue.substring(1, argValue.length()-1); } if (argValue!=null && argValue.equals("''")){ argValue = ""; } Iterator<Argument> argumentIterator = remoteProgram.getArguments().iterator(); boolean found = false; while (argumentIterator.hasNext() && !found) { Argument a = argumentIterator.next(); try { if (a.getName().equals(argName)) { a.setValueUsingParser(argValue); found = true; } } catch (Exception e) { throw new OptionException(LaunchingMessageKind.EREMOTE0010.format(a.getName(), remoteProgram.getClass().getCanonicalName()), e); } } if (!found) { throw new OptionException(LaunchingMessageKind.EREMOTE0012.format(argument, remoteProgram.getClass().getCanonicalName(), argument)); } } else { throw new OptionException(LaunchingMessageKind.EREMOTE0011.format(remoteProgram.getClass().getCanonicalName())); } } }
java
public static void initializeArg(final RemoteProgram remoteProgram, final String[] arguments, final Launch<?> launch) throws OptionException, ParserException { int numberOfEquals = 0; for (String argument : arguments) { if (argument.indexOf('=') > -1) numberOfEquals++; } if (numberOfEquals != arguments.length) throw new OptionException(LaunchingMessageKind.WREMOTE001.format(remoteProgram.getClass().getCanonicalName())); for (String argument : arguments) { if (argument.indexOf("=") > 0) { String[] arg = argument.split("="); String argName = arg[0]; String argValue = null; if (arg.length>1) argValue = arg[1]; if (argValue != null && argValue.trim().length() == 0) argValue = null; if (argValue!=null && argValue.charAt(0) == '"' && argValue.charAt(argValue.length()-1) == '"') { argValue = argValue.substring(1, argValue.length()-1); } if (argValue!=null && argValue.charAt(0) == '\'' && argValue.charAt(argValue.length()-1) == '\'') { argValue = argValue.substring(1, argValue.length()-1); } if (argValue!=null && argValue.equals("''")){ argValue = ""; } Iterator<Argument> argumentIterator = remoteProgram.getArguments().iterator(); boolean found = false; while (argumentIterator.hasNext() && !found) { Argument a = argumentIterator.next(); try { if (a.getName().equals(argName)) { a.setValueUsingParser(argValue); found = true; } } catch (Exception e) { throw new OptionException(LaunchingMessageKind.EREMOTE0010.format(a.getName(), remoteProgram.getClass().getCanonicalName()), e); } } if (!found) { throw new OptionException(LaunchingMessageKind.EREMOTE0012.format(argument, remoteProgram.getClass().getCanonicalName(), argument)); } } else { throw new OptionException(LaunchingMessageKind.EREMOTE0011.format(remoteProgram.getClass().getCanonicalName())); } } }
[ "public", "static", "void", "initializeArg", "(", "final", "RemoteProgram", "remoteProgram", ",", "final", "String", "[", "]", "arguments", ",", "final", "Launch", "<", "?", ">", "launch", ")", "throws", "OptionException", ",", "ParserException", "{", "int", "numberOfEquals", "=", "0", ";", "for", "(", "String", "argument", ":", "arguments", ")", "{", "if", "(", "argument", ".", "indexOf", "(", "'", "'", ")", ">", "-", "1", ")", "numberOfEquals", "++", ";", "}", "if", "(", "numberOfEquals", "!=", "arguments", ".", "length", ")", "throw", "new", "OptionException", "(", "LaunchingMessageKind", ".", "WREMOTE001", ".", "format", "(", "remoteProgram", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ")", ")", ";", "for", "(", "String", "argument", ":", "arguments", ")", "{", "if", "(", "argument", ".", "indexOf", "(", "\"=\"", ")", ">", "0", ")", "{", "String", "[", "]", "arg", "=", "argument", ".", "split", "(", "\"=\"", ")", ";", "String", "argName", "=", "arg", "[", "0", "]", ";", "String", "argValue", "=", "null", ";", "if", "(", "arg", ".", "length", ">", "1", ")", "argValue", "=", "arg", "[", "1", "]", ";", "if", "(", "argValue", "!=", "null", "&&", "argValue", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "argValue", "=", "null", ";", "if", "(", "argValue", "!=", "null", "&&", "argValue", ".", "charAt", "(", "0", ")", "==", "'", "'", "&&", "argValue", ".", "charAt", "(", "argValue", ".", "length", "(", ")", "-", "1", ")", "==", "'", "'", ")", "{", "argValue", "=", "argValue", ".", "substring", "(", "1", ",", "argValue", ".", "length", "(", ")", "-", "1", ")", ";", "}", "if", "(", "argValue", "!=", "null", "&&", "argValue", ".", "charAt", "(", "0", ")", "==", "'", "'", "&&", "argValue", ".", "charAt", "(", "argValue", ".", "length", "(", ")", "-", "1", ")", "==", "'", "'", ")", "{", "argValue", "=", "argValue", ".", "substring", "(", "1", ",", "argValue", ".", "length", "(", ")", "-", "1", ")", ";", "}", "if", "(", "argValue", "!=", "null", "&&", "argValue", ".", "equals", "(", "\"''\"", ")", ")", "{", "argValue", "=", "\"\"", ";", "}", "Iterator", "<", "Argument", ">", "argumentIterator", "=", "remoteProgram", ".", "getArguments", "(", ")", ".", "iterator", "(", ")", ";", "boolean", "found", "=", "false", ";", "while", "(", "argumentIterator", ".", "hasNext", "(", ")", "&&", "!", "found", ")", "{", "Argument", "a", "=", "argumentIterator", ".", "next", "(", ")", ";", "try", "{", "if", "(", "a", ".", "getName", "(", ")", ".", "equals", "(", "argName", ")", ")", "{", "a", ".", "setValueUsingParser", "(", "argValue", ")", ";", "found", "=", "true", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "OptionException", "(", "LaunchingMessageKind", ".", "EREMOTE0010", ".", "format", "(", "a", ".", "getName", "(", ")", ",", "remoteProgram", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ")", ",", "e", ")", ";", "}", "}", "if", "(", "!", "found", ")", "{", "throw", "new", "OptionException", "(", "LaunchingMessageKind", ".", "EREMOTE0012", ".", "format", "(", "argument", ",", "remoteProgram", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ",", "argument", ")", ")", ";", "}", "}", "else", "{", "throw", "new", "OptionException", "(", "LaunchingMessageKind", ".", "EREMOTE0011", ".", "format", "(", "remoteProgram", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ")", ")", ";", "}", "}", "}" ]
Check the validity of arguments values coming from remote launching with regard to types. If not done, the Quartz Exception thrown doesn't stop the launch and Program may be launched with invalid arguments values. @param adapterArguments @param arguments @throws ParserException
[ "Check", "the", "validity", "of", "arguments", "values", "coming", "from", "remote", "launching", "with", "regard", "to", "types", ".", "If", "not", "done", "the", "Quartz", "Exception", "thrown", "doesn", "t", "stop", "the", "launch", "and", "Program", "may", "be", "launched", "with", "invalid", "arguments", "values", "." ]
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/launching/transport/tcp/command/option/OptionsUtils.java#L83-L137
147,546
mlhartme/sushi
src/main/java/net/oneandone/sushi/fs/filter/Filter.java
Filter.invoke
public void invoke(Node root, Action result) throws IOException { doInvoke(0, root, root.isLink(), new ArrayList<>(includes), new ArrayList<>(excludes), result); }
java
public void invoke(Node root, Action result) throws IOException { doInvoke(0, root, root.isLink(), new ArrayList<>(includes), new ArrayList<>(excludes), result); }
[ "public", "void", "invoke", "(", "Node", "root", ",", "Action", "result", ")", "throws", "IOException", "{", "doInvoke", "(", "0", ",", "root", ",", "root", ".", "isLink", "(", ")", ",", "new", "ArrayList", "<>", "(", "includes", ")", ",", "new", "ArrayList", "<>", "(", "excludes", ")", ",", "result", ")", ";", "}" ]
Main methods of this class. @throws IOException as thrown by the specified FileTask
[ "Main", "methods", "of", "this", "class", "." ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/filter/Filter.java#L274-L276
147,547
mlhartme/sushi
src/main/java/net/oneandone/sushi/xml/Serializer.java
Serializer.serialize
public String serialize(Node node, boolean format) { Result result; StringWriter dest; if (node == null) { throw new IllegalArgumentException(); } dest = new StringWriter(); result = new StreamResult(dest); try { serialize(node, result, format); } catch (IOException e) { throw new IllegalStateException(e); } return dest.getBuffer().toString(); }
java
public String serialize(Node node, boolean format) { Result result; StringWriter dest; if (node == null) { throw new IllegalArgumentException(); } dest = new StringWriter(); result = new StreamResult(dest); try { serialize(node, result, format); } catch (IOException e) { throw new IllegalStateException(e); } return dest.getBuffer().toString(); }
[ "public", "String", "serialize", "(", "Node", "node", ",", "boolean", "format", ")", "{", "Result", "result", ";", "StringWriter", "dest", ";", "if", "(", "node", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "dest", "=", "new", "StringWriter", "(", ")", ";", "result", "=", "new", "StreamResult", "(", "dest", ")", ";", "try", "{", "serialize", "(", "node", ",", "result", ",", "format", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "e", ")", ";", "}", "return", "dest", ".", "getBuffer", "(", ")", ".", "toString", "(", ")", ";", "}" ]
does not genereate encoding headers
[ "does", "not", "genereate", "encoding", "headers" ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/xml/Serializer.java#L123-L138
147,548
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.filter
public IContextMapping<INode> filter(IContextMapping<INode> mapping) throws MappingFilterException { //add the first mapping element for the root to the mappings result if (0 < mapping.size()) { IContext sourceContext = mapping.getSourceContext(); IContext targetContext = mapping.getTargetContext(); sourceIndex = new ArrayList<Integer>(); targetIndex = new ArrayList<Integer>(); defautlMappings = mapping; spsmMapping = mappingFactory.getContextMappingInstance(sourceContext, targetContext); spsmMapping.setSimilarity(computeSimilarity(mapping)); log.info("Similarity: " + spsmMapping.getSimilarity()); if (isRelated(sourceContext.getRoot(), targetContext.getRoot(), IMappingElement.EQUIVALENCE) || isRelated(sourceContext.getRoot(), targetContext.getRoot(), IMappingElement.LESS_GENERAL) || isRelated(sourceContext.getRoot(), targetContext.getRoot(), IMappingElement.MORE_GENERAL)) { setStrongestMapping(sourceContext.getRoot(), targetContext.getRoot()); filterMappingsOfChildren(sourceContext.getRoot(), targetContext.getRoot(), IMappingElement.EQUIVALENCE); filterMappingsOfChildren(sourceContext.getRoot(), targetContext.getRoot(), IMappingElement.MORE_GENERAL); filterMappingsOfChildren(sourceContext.getRoot(), targetContext.getRoot(), IMappingElement.LESS_GENERAL); } return spsmMapping; } return mapping; }
java
public IContextMapping<INode> filter(IContextMapping<INode> mapping) throws MappingFilterException { //add the first mapping element for the root to the mappings result if (0 < mapping.size()) { IContext sourceContext = mapping.getSourceContext(); IContext targetContext = mapping.getTargetContext(); sourceIndex = new ArrayList<Integer>(); targetIndex = new ArrayList<Integer>(); defautlMappings = mapping; spsmMapping = mappingFactory.getContextMappingInstance(sourceContext, targetContext); spsmMapping.setSimilarity(computeSimilarity(mapping)); log.info("Similarity: " + spsmMapping.getSimilarity()); if (isRelated(sourceContext.getRoot(), targetContext.getRoot(), IMappingElement.EQUIVALENCE) || isRelated(sourceContext.getRoot(), targetContext.getRoot(), IMappingElement.LESS_GENERAL) || isRelated(sourceContext.getRoot(), targetContext.getRoot(), IMappingElement.MORE_GENERAL)) { setStrongestMapping(sourceContext.getRoot(), targetContext.getRoot()); filterMappingsOfChildren(sourceContext.getRoot(), targetContext.getRoot(), IMappingElement.EQUIVALENCE); filterMappingsOfChildren(sourceContext.getRoot(), targetContext.getRoot(), IMappingElement.MORE_GENERAL); filterMappingsOfChildren(sourceContext.getRoot(), targetContext.getRoot(), IMappingElement.LESS_GENERAL); } return spsmMapping; } return mapping; }
[ "public", "IContextMapping", "<", "INode", ">", "filter", "(", "IContextMapping", "<", "INode", ">", "mapping", ")", "throws", "MappingFilterException", "{", "//add the first mapping element for the root to the mappings result\r", "if", "(", "0", "<", "mapping", ".", "size", "(", ")", ")", "{", "IContext", "sourceContext", "=", "mapping", ".", "getSourceContext", "(", ")", ";", "IContext", "targetContext", "=", "mapping", ".", "getTargetContext", "(", ")", ";", "sourceIndex", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "targetIndex", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "defautlMappings", "=", "mapping", ";", "spsmMapping", "=", "mappingFactory", ".", "getContextMappingInstance", "(", "sourceContext", ",", "targetContext", ")", ";", "spsmMapping", ".", "setSimilarity", "(", "computeSimilarity", "(", "mapping", ")", ")", ";", "log", ".", "info", "(", "\"Similarity: \"", "+", "spsmMapping", ".", "getSimilarity", "(", ")", ")", ";", "if", "(", "isRelated", "(", "sourceContext", ".", "getRoot", "(", ")", ",", "targetContext", ".", "getRoot", "(", ")", ",", "IMappingElement", ".", "EQUIVALENCE", ")", "||", "isRelated", "(", "sourceContext", ".", "getRoot", "(", ")", ",", "targetContext", ".", "getRoot", "(", ")", ",", "IMappingElement", ".", "LESS_GENERAL", ")", "||", "isRelated", "(", "sourceContext", ".", "getRoot", "(", ")", ",", "targetContext", ".", "getRoot", "(", ")", ",", "IMappingElement", ".", "MORE_GENERAL", ")", ")", "{", "setStrongestMapping", "(", "sourceContext", ".", "getRoot", "(", ")", ",", "targetContext", ".", "getRoot", "(", ")", ")", ";", "filterMappingsOfChildren", "(", "sourceContext", ".", "getRoot", "(", ")", ",", "targetContext", ".", "getRoot", "(", ")", ",", "IMappingElement", ".", "EQUIVALENCE", ")", ";", "filterMappingsOfChildren", "(", "sourceContext", ".", "getRoot", "(", ")", ",", "targetContext", ".", "getRoot", "(", ")", ",", "IMappingElement", ".", "MORE_GENERAL", ")", ";", "filterMappingsOfChildren", "(", "sourceContext", ".", "getRoot", "(", ")", ",", "targetContext", ".", "getRoot", "(", ")", ",", "IMappingElement", ".", "LESS_GENERAL", ")", ";", "}", "return", "spsmMapping", ";", "}", "return", "mapping", ";", "}" ]
Sorts the siblings in the source and target tree defined in the constructor using the given mapping.
[ "Sorts", "the", "siblings", "in", "the", "source", "and", "target", "tree", "defined", "in", "the", "constructor", "using", "the", "given", "mapping", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L59-L90
147,549
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.filterMappingsOfChildren
private void filterMappingsOfChildren(INode sourceParent, INode targetParent, char semanticRelation) { List<INode> source = new ArrayList<INode>(sourceParent.getChildrenList()); List<INode> target = new ArrayList<INode>(targetParent.getChildrenList()); sourceIndex.add(sourceParent.getLevel(), 0); targetIndex.add(targetParent.getLevel(), 0); if (source.size() >= 1 && target.size() >= 1) { //sorts the siblings first with the strongest relation, and then with the others filterMappingsOfSiblingsByRelation(source, target, semanticRelation); } sourceIndex.remove(sourceParent.getLevel()); targetIndex.remove(targetParent.getLevel()); }
java
private void filterMappingsOfChildren(INode sourceParent, INode targetParent, char semanticRelation) { List<INode> source = new ArrayList<INode>(sourceParent.getChildrenList()); List<INode> target = new ArrayList<INode>(targetParent.getChildrenList()); sourceIndex.add(sourceParent.getLevel(), 0); targetIndex.add(targetParent.getLevel(), 0); if (source.size() >= 1 && target.size() >= 1) { //sorts the siblings first with the strongest relation, and then with the others filterMappingsOfSiblingsByRelation(source, target, semanticRelation); } sourceIndex.remove(sourceParent.getLevel()); targetIndex.remove(targetParent.getLevel()); }
[ "private", "void", "filterMappingsOfChildren", "(", "INode", "sourceParent", ",", "INode", "targetParent", ",", "char", "semanticRelation", ")", "{", "List", "<", "INode", ">", "source", "=", "new", "ArrayList", "<", "INode", ">", "(", "sourceParent", ".", "getChildrenList", "(", ")", ")", ";", "List", "<", "INode", ">", "target", "=", "new", "ArrayList", "<", "INode", ">", "(", "targetParent", ".", "getChildrenList", "(", ")", ")", ";", "sourceIndex", ".", "add", "(", "sourceParent", ".", "getLevel", "(", ")", ",", "0", ")", ";", "targetIndex", ".", "add", "(", "targetParent", ".", "getLevel", "(", ")", ",", "0", ")", ";", "if", "(", "source", ".", "size", "(", ")", ">=", "1", "&&", "target", ".", "size", "(", ")", ">=", "1", ")", "{", "//sorts the siblings first with the strongest relation, and then with the others\r", "filterMappingsOfSiblingsByRelation", "(", "source", ",", "target", ",", "semanticRelation", ")", ";", "}", "sourceIndex", ".", "remove", "(", "sourceParent", ".", "getLevel", "(", ")", ")", ";", "targetIndex", ".", "remove", "(", "targetParent", ".", "getLevel", "(", ")", ")", ";", "}" ]
Sorts the children of the given nodes. @param sourceParent Source node. @param targetParent Target node. @param semanticRelation the relation to use for comparison.
[ "Sorts", "the", "children", "of", "the", "given", "nodes", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L122-L136
147,550
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.filterMappingsOfSiblingsByRelation
private void filterMappingsOfSiblingsByRelation(List<INode> source, List<INode> target, char semanticRelation) { int sourceDepth = (source.get(0).getLevel() - 1); int targetDepth = (target.get(0).getLevel() - 1); int sourceSize = source.size(); int targetSize = target.size(); while (sourceIndex.get(sourceDepth) < sourceSize && targetIndex.get(targetDepth) < targetSize) { if (isRelated(source.get(sourceIndex.get(sourceDepth)), target.get(targetIndex.get(targetDepth)), semanticRelation)) { //sort the children of the matched node setStrongestMapping(source.get(sourceIndex.get(sourceDepth)), target.get(targetIndex.get(targetDepth))); filterMappingsOfChildren(source.get(sourceIndex.get(sourceDepth)), target.get(targetIndex.get(targetDepth)), semanticRelation); //increment the index inc(sourceIndex, sourceDepth); inc(targetIndex, targetDepth); } else { //look for the next related node in the target int relatedIndex = getRelatedIndex(source, target, semanticRelation); if (relatedIndex > sourceIndex.get(sourceDepth)) { //there is a related node, but further between the siblings //they should be swapped swapINodes(target, targetIndex.get(targetDepth), relatedIndex); //filter the mappings of the children of the matched node filterMappingsOfChildren(source.get(sourceIndex.get(sourceDepth)), target.get(targetIndex.get(targetDepth)), semanticRelation); //increment the index inc(sourceIndex, sourceDepth); inc(targetIndex, targetDepth); } else { //there is not related item among the remaining siblings //swap this element of source with the last, and decrement the sourceSize swapINodes(source, sourceIndex.get(sourceDepth), (sourceSize - 1)); sourceSize--; } } } }
java
private void filterMappingsOfSiblingsByRelation(List<INode> source, List<INode> target, char semanticRelation) { int sourceDepth = (source.get(0).getLevel() - 1); int targetDepth = (target.get(0).getLevel() - 1); int sourceSize = source.size(); int targetSize = target.size(); while (sourceIndex.get(sourceDepth) < sourceSize && targetIndex.get(targetDepth) < targetSize) { if (isRelated(source.get(sourceIndex.get(sourceDepth)), target.get(targetIndex.get(targetDepth)), semanticRelation)) { //sort the children of the matched node setStrongestMapping(source.get(sourceIndex.get(sourceDepth)), target.get(targetIndex.get(targetDepth))); filterMappingsOfChildren(source.get(sourceIndex.get(sourceDepth)), target.get(targetIndex.get(targetDepth)), semanticRelation); //increment the index inc(sourceIndex, sourceDepth); inc(targetIndex, targetDepth); } else { //look for the next related node in the target int relatedIndex = getRelatedIndex(source, target, semanticRelation); if (relatedIndex > sourceIndex.get(sourceDepth)) { //there is a related node, but further between the siblings //they should be swapped swapINodes(target, targetIndex.get(targetDepth), relatedIndex); //filter the mappings of the children of the matched node filterMappingsOfChildren(source.get(sourceIndex.get(sourceDepth)), target.get(targetIndex.get(targetDepth)), semanticRelation); //increment the index inc(sourceIndex, sourceDepth); inc(targetIndex, targetDepth); } else { //there is not related item among the remaining siblings //swap this element of source with the last, and decrement the sourceSize swapINodes(source, sourceIndex.get(sourceDepth), (sourceSize - 1)); sourceSize--; } } } }
[ "private", "void", "filterMappingsOfSiblingsByRelation", "(", "List", "<", "INode", ">", "source", ",", "List", "<", "INode", ">", "target", ",", "char", "semanticRelation", ")", "{", "int", "sourceDepth", "=", "(", "source", ".", "get", "(", "0", ")", ".", "getLevel", "(", ")", "-", "1", ")", ";", "int", "targetDepth", "=", "(", "target", ".", "get", "(", "0", ")", ".", "getLevel", "(", ")", "-", "1", ")", ";", "int", "sourceSize", "=", "source", ".", "size", "(", ")", ";", "int", "targetSize", "=", "target", ".", "size", "(", ")", ";", "while", "(", "sourceIndex", ".", "get", "(", "sourceDepth", ")", "<", "sourceSize", "&&", "targetIndex", ".", "get", "(", "targetDepth", ")", "<", "targetSize", ")", "{", "if", "(", "isRelated", "(", "source", ".", "get", "(", "sourceIndex", ".", "get", "(", "sourceDepth", ")", ")", ",", "target", ".", "get", "(", "targetIndex", ".", "get", "(", "targetDepth", ")", ")", ",", "semanticRelation", ")", ")", "{", "//sort the children of the matched node\r", "setStrongestMapping", "(", "source", ".", "get", "(", "sourceIndex", ".", "get", "(", "sourceDepth", ")", ")", ",", "target", ".", "get", "(", "targetIndex", ".", "get", "(", "targetDepth", ")", ")", ")", ";", "filterMappingsOfChildren", "(", "source", ".", "get", "(", "sourceIndex", ".", "get", "(", "sourceDepth", ")", ")", ",", "target", ".", "get", "(", "targetIndex", ".", "get", "(", "targetDepth", ")", ")", ",", "semanticRelation", ")", ";", "//increment the index\r", "inc", "(", "sourceIndex", ",", "sourceDepth", ")", ";", "inc", "(", "targetIndex", ",", "targetDepth", ")", ";", "}", "else", "{", "//look for the next related node in the target\r", "int", "relatedIndex", "=", "getRelatedIndex", "(", "source", ",", "target", ",", "semanticRelation", ")", ";", "if", "(", "relatedIndex", ">", "sourceIndex", ".", "get", "(", "sourceDepth", ")", ")", "{", "//there is a related node, but further between the siblings\r", "//they should be swapped\r", "swapINodes", "(", "target", ",", "targetIndex", ".", "get", "(", "targetDepth", ")", ",", "relatedIndex", ")", ";", "//filter the mappings of the children of the matched node\r", "filterMappingsOfChildren", "(", "source", ".", "get", "(", "sourceIndex", ".", "get", "(", "sourceDepth", ")", ")", ",", "target", ".", "get", "(", "targetIndex", ".", "get", "(", "targetDepth", ")", ")", ",", "semanticRelation", ")", ";", "//increment the index\r", "inc", "(", "sourceIndex", ",", "sourceDepth", ")", ";", "inc", "(", "targetIndex", ",", "targetDepth", ")", ";", "}", "else", "{", "//there is not related item among the remaining siblings\r", "//swap this element of source with the last, and decrement the sourceSize\r", "swapINodes", "(", "source", ",", "sourceIndex", ".", "get", "(", "sourceDepth", ")", ",", "(", "sourceSize", "-", "1", ")", ")", ";", "sourceSize", "--", ";", "}", "}", "}", "}" ]
Filters the mappings of two siblings node list for which the parents are also supposed to be related. Checks whether in the two given node list there is a pair of nodes related by the given relation and if so, if deletes all the other relations for the given 2 nodes setting the current one as strongest. @param source Source list of siblings. @param target Target list of siblings. @param semanticRelation a char representing the semantic realtion as defined in IMappingElement.
[ "Filters", "the", "mappings", "of", "two", "siblings", "node", "list", "for", "which", "the", "parents", "are", "also", "supposed", "to", "be", "related", ".", "Checks", "whether", "in", "the", "two", "given", "node", "list", "there", "is", "a", "pair", "of", "nodes", "related", "by", "the", "given", "relation", "and", "if", "so", "if", "deletes", "all", "the", "other", "relations", "for", "the", "given", "2", "nodes", "setting", "the", "current", "one", "as", "strongest", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L149-L192
147,551
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.swapINodes
private void swapINodes(List<INode> listOfNodes, int source, int target) { INode aux = listOfNodes.get(source); listOfNodes.set(source, listOfNodes.get(target)); listOfNodes.set(target, aux); }
java
private void swapINodes(List<INode> listOfNodes, int source, int target) { INode aux = listOfNodes.get(source); listOfNodes.set(source, listOfNodes.get(target)); listOfNodes.set(target, aux); }
[ "private", "void", "swapINodes", "(", "List", "<", "INode", ">", "listOfNodes", ",", "int", "source", ",", "int", "target", ")", "{", "INode", "aux", "=", "listOfNodes", ".", "get", "(", "source", ")", ";", "listOfNodes", ".", "set", "(", "source", ",", "listOfNodes", ".", "get", "(", "target", ")", ")", ";", "listOfNodes", ".", "set", "(", "target", ",", "aux", ")", ";", "}" ]
Swaps the INodes in listOfNodes in the positions source and target. @param listOfNodes List of INodes of which the elements should be swapped. @param source index of the source element to be swapped. @param target index of the target element to be swapped.
[ "Swaps", "the", "INodes", "in", "listOfNodes", "in", "the", "positions", "source", "and", "target", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L202-L206
147,552
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.getRelatedIndex
private int getRelatedIndex(List<INode> source, List<INode> target, char relation) { int srcIndex = sourceIndex.get(source.get(0).getLevel() - 1); int tgtIndex = targetIndex.get(target.get(0).getLevel() - 1); int returnIndex = -1; INode sourceNode = source.get(srcIndex); //find the first one who is related in the same level for (int i = tgtIndex + 1; i < target.size(); i++) { INode targetNode = target.get(i); if (isRelated(sourceNode, targetNode, relation)) { setStrongestMapping(sourceNode, targetNode); return i; } } //there was no correspondence between siblings in source and target lists //try to clean the mapping elements computeStrongestMappingForSource(source.get(srcIndex)); return returnIndex; }
java
private int getRelatedIndex(List<INode> source, List<INode> target, char relation) { int srcIndex = sourceIndex.get(source.get(0).getLevel() - 1); int tgtIndex = targetIndex.get(target.get(0).getLevel() - 1); int returnIndex = -1; INode sourceNode = source.get(srcIndex); //find the first one who is related in the same level for (int i = tgtIndex + 1; i < target.size(); i++) { INode targetNode = target.get(i); if (isRelated(sourceNode, targetNode, relation)) { setStrongestMapping(sourceNode, targetNode); return i; } } //there was no correspondence between siblings in source and target lists //try to clean the mapping elements computeStrongestMappingForSource(source.get(srcIndex)); return returnIndex; }
[ "private", "int", "getRelatedIndex", "(", "List", "<", "INode", ">", "source", ",", "List", "<", "INode", ">", "target", ",", "char", "relation", ")", "{", "int", "srcIndex", "=", "sourceIndex", ".", "get", "(", "source", ".", "get", "(", "0", ")", ".", "getLevel", "(", ")", "-", "1", ")", ";", "int", "tgtIndex", "=", "targetIndex", ".", "get", "(", "target", ".", "get", "(", "0", ")", ".", "getLevel", "(", ")", "-", "1", ")", ";", "int", "returnIndex", "=", "-", "1", ";", "INode", "sourceNode", "=", "source", ".", "get", "(", "srcIndex", ")", ";", "//find the first one who is related in the same level\r", "for", "(", "int", "i", "=", "tgtIndex", "+", "1", ";", "i", "<", "target", ".", "size", "(", ")", ";", "i", "++", ")", "{", "INode", "targetNode", "=", "target", ".", "get", "(", "i", ")", ";", "if", "(", "isRelated", "(", "sourceNode", ",", "targetNode", ",", "relation", ")", ")", "{", "setStrongestMapping", "(", "sourceNode", ",", "targetNode", ")", ";", "return", "i", ";", "}", "}", "//there was no correspondence between siblings in source and target lists\r", "//try to clean the mapping elements\r", "computeStrongestMappingForSource", "(", "source", ".", "get", "(", "srcIndex", ")", ")", ";", "return", "returnIndex", ";", "}" ]
Looks for the related index for the source list at the position sourceIndex in the target list beginning at the targetIndex position for the defined relation. @param source source list of siblings. @param target target list of siblings. @param relation relation @return the index of the related element in target, or -1 if there is no relate element.
[ "Looks", "for", "the", "related", "index", "for", "the", "source", "list", "at", "the", "position", "sourceIndex", "in", "the", "target", "list", "beginning", "at", "the", "targetIndex", "position", "for", "the", "defined", "relation", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L218-L240
147,553
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.inc
private void inc(ArrayList<Integer> array, int index) { array.set(index, array.get(index) + 1); }
java
private void inc(ArrayList<Integer> array, int index) { array.set(index, array.get(index) + 1); }
[ "private", "void", "inc", "(", "ArrayList", "<", "Integer", ">", "array", ",", "int", "index", ")", "{", "array", ".", "set", "(", "index", ",", "array", ".", "get", "(", "index", ")", "+", "1", ")", ";", "}" ]
Increments by 1 the Integer of the given list of integers at the index position. @param array array list of integers. @param index index of the element to be incremented.
[ "Increments", "by", "1", "the", "Integer", "of", "the", "given", "list", "of", "integers", "at", "the", "index", "position", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L248-L250
147,554
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.isRelated
private boolean isRelated(final INode source, final INode target, final char relation) { return relation == defautlMappings.getRelation(source, target); }
java
private boolean isRelated(final INode source, final INode target, final char relation) { return relation == defautlMappings.getRelation(source, target); }
[ "private", "boolean", "isRelated", "(", "final", "INode", "source", ",", "final", "INode", "target", ",", "final", "char", "relation", ")", "{", "return", "relation", "==", "defautlMappings", ".", "getRelation", "(", "source", ",", "target", ")", ";", "}" ]
Checks if the given source and target elements are related considering the defined relation and the temp. @param source source @param target target @param relation relation @return true if the relation holds between source and target, false otherwise.
[ "Checks", "if", "the", "given", "source", "and", "target", "elements", "are", "related", "considering", "the", "defined", "relation", "and", "the", "temp", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L260-L262
147,555
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.setStrongestMapping
private void setStrongestMapping(INode source, INode target) { //if it's structure preserving if (isSameStructure(source, target)) { spsmMapping.setRelation(source, target, defautlMappings.getRelation(source, target)); //deletes all the less precedent relations for the same source node for (INode node : defautlMappings.getTargetContext().getNodesList()) { //if its not the target of the mapping elements and the relation is weaker if (source != node && defautlMappings.getRelation(source, node) != IMappingElement.IDK && isPrecedent(defautlMappings.getRelation(source, target), defautlMappings.getRelation(source, node))) { defautlMappings.setRelation(source, node, IMappingElement.IDK); } } //deletes all the less precedent relations for the same target node for (INode node : defautlMappings.getSourceContext().getNodesList()) { if (target != node) { defautlMappings.setRelation(node, target, IMappingElement.IDK); } } } else { //the elements are not in the same structure, look for the correct relation computeStrongestMappingForSource(source); } }
java
private void setStrongestMapping(INode source, INode target) { //if it's structure preserving if (isSameStructure(source, target)) { spsmMapping.setRelation(source, target, defautlMappings.getRelation(source, target)); //deletes all the less precedent relations for the same source node for (INode node : defautlMappings.getTargetContext().getNodesList()) { //if its not the target of the mapping elements and the relation is weaker if (source != node && defautlMappings.getRelation(source, node) != IMappingElement.IDK && isPrecedent(defautlMappings.getRelation(source, target), defautlMappings.getRelation(source, node))) { defautlMappings.setRelation(source, node, IMappingElement.IDK); } } //deletes all the less precedent relations for the same target node for (INode node : defautlMappings.getSourceContext().getNodesList()) { if (target != node) { defautlMappings.setRelation(node, target, IMappingElement.IDK); } } } else { //the elements are not in the same structure, look for the correct relation computeStrongestMappingForSource(source); } }
[ "private", "void", "setStrongestMapping", "(", "INode", "source", ",", "INode", "target", ")", "{", "//if it's structure preserving\r", "if", "(", "isSameStructure", "(", "source", ",", "target", ")", ")", "{", "spsmMapping", ".", "setRelation", "(", "source", ",", "target", ",", "defautlMappings", ".", "getRelation", "(", "source", ",", "target", ")", ")", ";", "//deletes all the less precedent relations for the same source node\r", "for", "(", "INode", "node", ":", "defautlMappings", ".", "getTargetContext", "(", ")", ".", "getNodesList", "(", ")", ")", "{", "//if its not the target of the mapping elements and the relation is weaker\r", "if", "(", "source", "!=", "node", "&&", "defautlMappings", ".", "getRelation", "(", "source", ",", "node", ")", "!=", "IMappingElement", ".", "IDK", "&&", "isPrecedent", "(", "defautlMappings", ".", "getRelation", "(", "source", ",", "target", ")", ",", "defautlMappings", ".", "getRelation", "(", "source", ",", "node", ")", ")", ")", "{", "defautlMappings", ".", "setRelation", "(", "source", ",", "node", ",", "IMappingElement", ".", "IDK", ")", ";", "}", "}", "//deletes all the less precedent relations for the same target node\r", "for", "(", "INode", "node", ":", "defautlMappings", ".", "getSourceContext", "(", ")", ".", "getNodesList", "(", ")", ")", "{", "if", "(", "target", "!=", "node", ")", "{", "defautlMappings", ".", "setRelation", "(", "node", ",", "target", ",", "IMappingElement", ".", "IDK", ")", ";", "}", "}", "}", "else", "{", "//the elements are not in the same structure, look for the correct relation\r", "computeStrongestMappingForSource", "(", "source", ")", ";", "}", "}" ]
Sets the relation between source and target as the strongest in the temp, setting all the other relations for the same source as IDK if the relations are weaker. @param source source node @param target target node
[ "Sets", "the", "relation", "between", "source", "and", "target", "as", "the", "strongest", "in", "the", "temp", "setting", "all", "the", "other", "relations", "for", "the", "same", "source", "as", "IDK", "if", "the", "relations", "are", "weaker", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L271-L295
147,556
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.computeStrongestMappingForSource
private void computeStrongestMappingForSource(INode source) { INode strongetsRelationInTarget = null; List<IMappingElement<INode>> strongest = new ArrayList<IMappingElement<INode>>(); //look for the strongest relation, and deletes all the non structure preserving relations for (INode j : defautlMappings.getTargetContext().getNodesList()) { if (isSameStructure(source, j)) { if (strongest.isEmpty() && defautlMappings.getRelation(source, j) != IMappingElement.IDK && !existsStrongerInColumn(source, j)) { strongetsRelationInTarget = j; strongest.add(new MappingElement<INode>(source, j, defautlMappings.getRelation(source, j))); } else if (defautlMappings.getRelation(source, j) != IMappingElement.IDK && !strongest.isEmpty()) { int precedence = comparePrecedence(strongest.get(0).getRelation(), defautlMappings.getRelation(source, j)); if (precedence == -1 && !existsStrongerInColumn(source, j)) { //if target is more precedent, and there is no other stronger relation for that particular target strongetsRelationInTarget = j; strongest.set(0, new MappingElement<INode>(source, j, defautlMappings.getRelation(source, j))); } } } else { //they are not the same structure, function to function, variable to variable //delete the relation defautlMappings.setRelation(source, j, IMappingElement.IDK); } } //if there is a strongest element, and it is different from IDK if (!strongest.isEmpty() && strongest.get(0).getRelation() != IMappingElement.IDK) { //erase all the weaker relations in the row for (INode j : defautlMappings.getTargetContext().getNodesList()) { if (j != strongetsRelationInTarget && defautlMappings.getRelation(source, j) != IMappingElement.IDK) { int precedence = comparePrecedence(strongest.get(0).getRelation(), defautlMappings.getRelation(source, j)); if (precedence == 1) { defautlMappings.setRelation(source, j, IMappingElement.IDK); } else if (precedence == 0) { if (isSameStructure(source, j)) { strongest.add(new MappingElement<INode>(source, j, defautlMappings.getRelation(source, j))); } } } } //if there is more than one strongest relation if (strongest.size() > 1) { resolveStrongestMappingConflicts(source, strongest); } else { //deletes all the relations in the column for (INode i : defautlMappings.getSourceContext().getNodesList()) { if (i != source) { defautlMappings.setRelation(i, strongetsRelationInTarget, IMappingElement.IDK); } } if (strongest.get(0).getRelation() != IMappingElement.IDK) { spsmMapping.add(strongest.get(0)); // remove the relations from the same column and row deleteRemainingRelationsFromMatrix(strongest.get(0)); } } } }
java
private void computeStrongestMappingForSource(INode source) { INode strongetsRelationInTarget = null; List<IMappingElement<INode>> strongest = new ArrayList<IMappingElement<INode>>(); //look for the strongest relation, and deletes all the non structure preserving relations for (INode j : defautlMappings.getTargetContext().getNodesList()) { if (isSameStructure(source, j)) { if (strongest.isEmpty() && defautlMappings.getRelation(source, j) != IMappingElement.IDK && !existsStrongerInColumn(source, j)) { strongetsRelationInTarget = j; strongest.add(new MappingElement<INode>(source, j, defautlMappings.getRelation(source, j))); } else if (defautlMappings.getRelation(source, j) != IMappingElement.IDK && !strongest.isEmpty()) { int precedence = comparePrecedence(strongest.get(0).getRelation(), defautlMappings.getRelation(source, j)); if (precedence == -1 && !existsStrongerInColumn(source, j)) { //if target is more precedent, and there is no other stronger relation for that particular target strongetsRelationInTarget = j; strongest.set(0, new MappingElement<INode>(source, j, defautlMappings.getRelation(source, j))); } } } else { //they are not the same structure, function to function, variable to variable //delete the relation defautlMappings.setRelation(source, j, IMappingElement.IDK); } } //if there is a strongest element, and it is different from IDK if (!strongest.isEmpty() && strongest.get(0).getRelation() != IMappingElement.IDK) { //erase all the weaker relations in the row for (INode j : defautlMappings.getTargetContext().getNodesList()) { if (j != strongetsRelationInTarget && defautlMappings.getRelation(source, j) != IMappingElement.IDK) { int precedence = comparePrecedence(strongest.get(0).getRelation(), defautlMappings.getRelation(source, j)); if (precedence == 1) { defautlMappings.setRelation(source, j, IMappingElement.IDK); } else if (precedence == 0) { if (isSameStructure(source, j)) { strongest.add(new MappingElement<INode>(source, j, defautlMappings.getRelation(source, j))); } } } } //if there is more than one strongest relation if (strongest.size() > 1) { resolveStrongestMappingConflicts(source, strongest); } else { //deletes all the relations in the column for (INode i : defautlMappings.getSourceContext().getNodesList()) { if (i != source) { defautlMappings.setRelation(i, strongetsRelationInTarget, IMappingElement.IDK); } } if (strongest.get(0).getRelation() != IMappingElement.IDK) { spsmMapping.add(strongest.get(0)); // remove the relations from the same column and row deleteRemainingRelationsFromMatrix(strongest.get(0)); } } } }
[ "private", "void", "computeStrongestMappingForSource", "(", "INode", "source", ")", "{", "INode", "strongetsRelationInTarget", "=", "null", ";", "List", "<", "IMappingElement", "<", "INode", ">", ">", "strongest", "=", "new", "ArrayList", "<", "IMappingElement", "<", "INode", ">", ">", "(", ")", ";", "//look for the strongest relation, and deletes all the non structure preserving relations\r", "for", "(", "INode", "j", ":", "defautlMappings", ".", "getTargetContext", "(", ")", ".", "getNodesList", "(", ")", ")", "{", "if", "(", "isSameStructure", "(", "source", ",", "j", ")", ")", "{", "if", "(", "strongest", ".", "isEmpty", "(", ")", "&&", "defautlMappings", ".", "getRelation", "(", "source", ",", "j", ")", "!=", "IMappingElement", ".", "IDK", "&&", "!", "existsStrongerInColumn", "(", "source", ",", "j", ")", ")", "{", "strongetsRelationInTarget", "=", "j", ";", "strongest", ".", "add", "(", "new", "MappingElement", "<", "INode", ">", "(", "source", ",", "j", ",", "defautlMappings", ".", "getRelation", "(", "source", ",", "j", ")", ")", ")", ";", "}", "else", "if", "(", "defautlMappings", ".", "getRelation", "(", "source", ",", "j", ")", "!=", "IMappingElement", ".", "IDK", "&&", "!", "strongest", ".", "isEmpty", "(", ")", ")", "{", "int", "precedence", "=", "comparePrecedence", "(", "strongest", ".", "get", "(", "0", ")", ".", "getRelation", "(", ")", ",", "defautlMappings", ".", "getRelation", "(", "source", ",", "j", ")", ")", ";", "if", "(", "precedence", "==", "-", "1", "&&", "!", "existsStrongerInColumn", "(", "source", ",", "j", ")", ")", "{", "//if target is more precedent, and there is no other stronger relation for that particular target\r", "strongetsRelationInTarget", "=", "j", ";", "strongest", ".", "set", "(", "0", ",", "new", "MappingElement", "<", "INode", ">", "(", "source", ",", "j", ",", "defautlMappings", ".", "getRelation", "(", "source", ",", "j", ")", ")", ")", ";", "}", "}", "}", "else", "{", "//they are not the same structure, function to function, variable to variable\r", "//delete the relation\r", "defautlMappings", ".", "setRelation", "(", "source", ",", "j", ",", "IMappingElement", ".", "IDK", ")", ";", "}", "}", "//if there is a strongest element, and it is different from IDK\r", "if", "(", "!", "strongest", ".", "isEmpty", "(", ")", "&&", "strongest", ".", "get", "(", "0", ")", ".", "getRelation", "(", ")", "!=", "IMappingElement", ".", "IDK", ")", "{", "//erase all the weaker relations in the row\r", "for", "(", "INode", "j", ":", "defautlMappings", ".", "getTargetContext", "(", ")", ".", "getNodesList", "(", ")", ")", "{", "if", "(", "j", "!=", "strongetsRelationInTarget", "&&", "defautlMappings", ".", "getRelation", "(", "source", ",", "j", ")", "!=", "IMappingElement", ".", "IDK", ")", "{", "int", "precedence", "=", "comparePrecedence", "(", "strongest", ".", "get", "(", "0", ")", ".", "getRelation", "(", ")", ",", "defautlMappings", ".", "getRelation", "(", "source", ",", "j", ")", ")", ";", "if", "(", "precedence", "==", "1", ")", "{", "defautlMappings", ".", "setRelation", "(", "source", ",", "j", ",", "IMappingElement", ".", "IDK", ")", ";", "}", "else", "if", "(", "precedence", "==", "0", ")", "{", "if", "(", "isSameStructure", "(", "source", ",", "j", ")", ")", "{", "strongest", ".", "add", "(", "new", "MappingElement", "<", "INode", ">", "(", "source", ",", "j", ",", "defautlMappings", ".", "getRelation", "(", "source", ",", "j", ")", ")", ")", ";", "}", "}", "}", "}", "//if there is more than one strongest relation\r", "if", "(", "strongest", ".", "size", "(", ")", ">", "1", ")", "{", "resolveStrongestMappingConflicts", "(", "source", ",", "strongest", ")", ";", "}", "else", "{", "//deletes all the relations in the column\r", "for", "(", "INode", "i", ":", "defautlMappings", ".", "getSourceContext", "(", ")", ".", "getNodesList", "(", ")", ")", "{", "if", "(", "i", "!=", "source", ")", "{", "defautlMappings", ".", "setRelation", "(", "i", ",", "strongetsRelationInTarget", ",", "IMappingElement", ".", "IDK", ")", ";", "}", "}", "if", "(", "strongest", ".", "get", "(", "0", ")", ".", "getRelation", "(", ")", "!=", "IMappingElement", ".", "IDK", ")", "{", "spsmMapping", ".", "add", "(", "strongest", ".", "get", "(", "0", ")", ")", ";", "// remove the relations from the same column and row\r", "deleteRemainingRelationsFromMatrix", "(", "strongest", ".", "get", "(", "0", ")", ")", ";", "}", "}", "}", "}" ]
Looks for the strongest relation for the given source and sets to IDK all the other mappings existing for the same source if they are less precedent. @param source INode to look for the strongest relation.
[ "Looks", "for", "the", "strongest", "relation", "for", "the", "given", "source", "and", "sets", "to", "IDK", "all", "the", "other", "mappings", "existing", "for", "the", "same", "source", "if", "they", "are", "less", "precedent", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L303-L364
147,557
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.resolveStrongestMappingConflicts
private void resolveStrongestMappingConflicts(INode source, List<IMappingElement<INode>> strongest) { //copy the relations to a string to log it int strongestIndex = -1; String sourceString = source.getNodeData().getName().trim(); if (log.isEnabledFor(Level.DEBUG)) { StringBuilder strongRelations = new StringBuilder(); for (IMappingElement<INode> aStrongest : strongest) { strongRelations.append(aStrongest.getTarget().toString()).append("|"); } log.debug("More than one strongest relation for " + sourceString + ": |" + strongRelations.toString()); } //looks the first related node that is equal to the source node for (int i = 0; i < strongest.size(); i++) { String strongString = strongest.get(i).getTarget().getNodeData().getName().trim(); if (sourceString.equalsIgnoreCase(strongString)) { strongestIndex = i; break; } } //if there was no equal string, then set it to the first one if (strongestIndex == -1) { strongestIndex = 0; } if (strongest.get(strongestIndex).getRelation() != IMappingElement.IDK) { spsmMapping.add(strongest.get(strongestIndex)); // Remove the relations from the same column and row deleteRemainingRelationsFromMatrix(strongest.get(strongestIndex)); } }
java
private void resolveStrongestMappingConflicts(INode source, List<IMappingElement<INode>> strongest) { //copy the relations to a string to log it int strongestIndex = -1; String sourceString = source.getNodeData().getName().trim(); if (log.isEnabledFor(Level.DEBUG)) { StringBuilder strongRelations = new StringBuilder(); for (IMappingElement<INode> aStrongest : strongest) { strongRelations.append(aStrongest.getTarget().toString()).append("|"); } log.debug("More than one strongest relation for " + sourceString + ": |" + strongRelations.toString()); } //looks the first related node that is equal to the source node for (int i = 0; i < strongest.size(); i++) { String strongString = strongest.get(i).getTarget().getNodeData().getName().trim(); if (sourceString.equalsIgnoreCase(strongString)) { strongestIndex = i; break; } } //if there was no equal string, then set it to the first one if (strongestIndex == -1) { strongestIndex = 0; } if (strongest.get(strongestIndex).getRelation() != IMappingElement.IDK) { spsmMapping.add(strongest.get(strongestIndex)); // Remove the relations from the same column and row deleteRemainingRelationsFromMatrix(strongest.get(strongestIndex)); } }
[ "private", "void", "resolveStrongestMappingConflicts", "(", "INode", "source", ",", "List", "<", "IMappingElement", "<", "INode", ">", ">", "strongest", ")", "{", "//copy the relations to a string to log it\r", "int", "strongestIndex", "=", "-", "1", ";", "String", "sourceString", "=", "source", ".", "getNodeData", "(", ")", ".", "getName", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "log", ".", "isEnabledFor", "(", "Level", ".", "DEBUG", ")", ")", "{", "StringBuilder", "strongRelations", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "IMappingElement", "<", "INode", ">", "aStrongest", ":", "strongest", ")", "{", "strongRelations", ".", "append", "(", "aStrongest", ".", "getTarget", "(", ")", ".", "toString", "(", ")", ")", ".", "append", "(", "\"|\"", ")", ";", "}", "log", ".", "debug", "(", "\"More than one strongest relation for \"", "+", "sourceString", "+", "\": |\"", "+", "strongRelations", ".", "toString", "(", ")", ")", ";", "}", "//looks the first related node that is equal to the source node\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "strongest", ".", "size", "(", ")", ";", "i", "++", ")", "{", "String", "strongString", "=", "strongest", ".", "get", "(", "i", ")", ".", "getTarget", "(", ")", ".", "getNodeData", "(", ")", ".", "getName", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "sourceString", ".", "equalsIgnoreCase", "(", "strongString", ")", ")", "{", "strongestIndex", "=", "i", ";", "break", ";", "}", "}", "//if there was no equal string, then set it to the first one\r", "if", "(", "strongestIndex", "==", "-", "1", ")", "{", "strongestIndex", "=", "0", ";", "}", "if", "(", "strongest", ".", "get", "(", "strongestIndex", ")", ".", "getRelation", "(", ")", "!=", "IMappingElement", ".", "IDK", ")", "{", "spsmMapping", ".", "add", "(", "strongest", ".", "get", "(", "strongestIndex", ")", ")", ";", "// Remove the relations from the same column and row\r", "deleteRemainingRelationsFromMatrix", "(", "strongest", ".", "get", "(", "strongestIndex", ")", ")", ";", "}", "}" ]
Resolves conflicts in case there are more than one element with the strongest relation for a given source node. @param source the node for which more than one strongest relation is found @param strongest the list of the strongest relations.
[ "Resolves", "conflicts", "in", "case", "there", "are", "more", "than", "one", "element", "with", "the", "strongest", "relation", "for", "a", "given", "source", "node", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L373-L407
147,558
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.isSameStructure
private boolean isSameStructure(INode source, INode target) { boolean result = false; if (null != source && null != target) { if (source.getChildrenList() != null && target.getChildrenList() != null) { int sourceChildren = source.getChildrenList().size(); int targetChildren = target.getChildrenList().size(); if (sourceChildren == 0 && targetChildren == 0) { result = true; } else if (sourceChildren > 0 && targetChildren > 0) { result = true; } } else if (source.getChildrenList() == null && target.getChildrenList() == null) { result = true; } } else if (null == source && null == target) { result = true; } return result; }
java
private boolean isSameStructure(INode source, INode target) { boolean result = false; if (null != source && null != target) { if (source.getChildrenList() != null && target.getChildrenList() != null) { int sourceChildren = source.getChildrenList().size(); int targetChildren = target.getChildrenList().size(); if (sourceChildren == 0 && targetChildren == 0) { result = true; } else if (sourceChildren > 0 && targetChildren > 0) { result = true; } } else if (source.getChildrenList() == null && target.getChildrenList() == null) { result = true; } } else if (null == source && null == target) { result = true; } return result; }
[ "private", "boolean", "isSameStructure", "(", "INode", "source", ",", "INode", "target", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "null", "!=", "source", "&&", "null", "!=", "target", ")", "{", "if", "(", "source", ".", "getChildrenList", "(", ")", "!=", "null", "&&", "target", ".", "getChildrenList", "(", ")", "!=", "null", ")", "{", "int", "sourceChildren", "=", "source", ".", "getChildrenList", "(", ")", ".", "size", "(", ")", ";", "int", "targetChildren", "=", "target", ".", "getChildrenList", "(", ")", ".", "size", "(", ")", ";", "if", "(", "sourceChildren", "==", "0", "&&", "targetChildren", "==", "0", ")", "{", "result", "=", "true", ";", "}", "else", "if", "(", "sourceChildren", ">", "0", "&&", "targetChildren", ">", "0", ")", "{", "result", "=", "true", ";", "}", "}", "else", "if", "(", "source", ".", "getChildrenList", "(", ")", "==", "null", "&&", "target", ".", "getChildrenList", "(", ")", "==", "null", ")", "{", "result", "=", "true", ";", "}", "}", "else", "if", "(", "null", "==", "source", "&&", "null", "==", "target", ")", "{", "result", "=", "true", ";", "}", "return", "result", ";", "}" ]
Checks if source and target are structural preserving this is, function to function and argument to argument match. @param source source node. @param target target node. @return true if they are the same structure, false otherwise.
[ "Checks", "if", "source", "and", "target", "are", "structural", "preserving", "this", "is", "function", "to", "function", "and", "argument", "to", "argument", "match", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L442-L460
147,559
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.existsStrongerInColumn
private boolean existsStrongerInColumn(INode source, INode target) { boolean result = false; char current = defautlMappings.getRelation(source, target); //compare with the other relations in the column for (INode i : defautlMappings.getSourceContext().getNodesList()) { if (i != source && defautlMappings.getRelation(i, target) != IMappingElement.IDK && isPrecedent(defautlMappings.getRelation(i, target), current)) { result = true; break; } } return result; }
java
private boolean existsStrongerInColumn(INode source, INode target) { boolean result = false; char current = defautlMappings.getRelation(source, target); //compare with the other relations in the column for (INode i : defautlMappings.getSourceContext().getNodesList()) { if (i != source && defautlMappings.getRelation(i, target) != IMappingElement.IDK && isPrecedent(defautlMappings.getRelation(i, target), current)) { result = true; break; } } return result; }
[ "private", "boolean", "existsStrongerInColumn", "(", "INode", "source", ",", "INode", "target", ")", "{", "boolean", "result", "=", "false", ";", "char", "current", "=", "defautlMappings", ".", "getRelation", "(", "source", ",", "target", ")", ";", "//compare with the other relations in the column\r", "for", "(", "INode", "i", ":", "defautlMappings", ".", "getSourceContext", "(", ")", ".", "getNodesList", "(", ")", ")", "{", "if", "(", "i", "!=", "source", "&&", "defautlMappings", ".", "getRelation", "(", "i", ",", "target", ")", "!=", "IMappingElement", ".", "IDK", "&&", "isPrecedent", "(", "defautlMappings", ".", "getRelation", "(", "i", ",", "target", ")", ",", "current", ")", ")", "{", "result", "=", "true", ";", "break", ";", "}", "}", "return", "result", ";", "}" ]
Checks if there is no other stronger relation in the same column. @param source source node @param target target node @return true if exists stronger relation in the same column, false otherwise.
[ "Checks", "if", "there", "is", "no", "other", "stronger", "relation", "in", "the", "same", "column", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L469-L484
147,560
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java
SPSMMappingFilter.getPrecedenceNumber
private int getPrecedenceNumber(char semanticRelation) { //initializes the precedence number to the least precedent int precedence = Integer.MAX_VALUE; if (semanticRelation == IMappingElement.EQUIVALENCE) { precedence = 1; } else if (semanticRelation == IMappingElement.MORE_GENERAL) { precedence = 2; } else if (semanticRelation == IMappingElement.LESS_GENERAL) { precedence = 3; } else if (semanticRelation == IMappingElement.DISJOINT) { precedence = 4; } else if (semanticRelation == IMappingElement.IDK) { precedence = 5; } return precedence; }
java
private int getPrecedenceNumber(char semanticRelation) { //initializes the precedence number to the least precedent int precedence = Integer.MAX_VALUE; if (semanticRelation == IMappingElement.EQUIVALENCE) { precedence = 1; } else if (semanticRelation == IMappingElement.MORE_GENERAL) { precedence = 2; } else if (semanticRelation == IMappingElement.LESS_GENERAL) { precedence = 3; } else if (semanticRelation == IMappingElement.DISJOINT) { precedence = 4; } else if (semanticRelation == IMappingElement.IDK) { precedence = 5; } return precedence; }
[ "private", "int", "getPrecedenceNumber", "(", "char", "semanticRelation", ")", "{", "//initializes the precedence number to the least precedent\r", "int", "precedence", "=", "Integer", ".", "MAX_VALUE", ";", "if", "(", "semanticRelation", "==", "IMappingElement", ".", "EQUIVALENCE", ")", "{", "precedence", "=", "1", ";", "}", "else", "if", "(", "semanticRelation", "==", "IMappingElement", ".", "MORE_GENERAL", ")", "{", "precedence", "=", "2", ";", "}", "else", "if", "(", "semanticRelation", "==", "IMappingElement", ".", "LESS_GENERAL", ")", "{", "precedence", "=", "3", ";", "}", "else", "if", "(", "semanticRelation", "==", "IMappingElement", ".", "DISJOINT", ")", "{", "precedence", "=", "4", ";", "}", "else", "if", "(", "semanticRelation", "==", "IMappingElement", ".", "IDK", ")", "{", "precedence", "=", "5", ";", "}", "return", "precedence", ";", "}" ]
Gives the precedence order for the given semanticRelation defined in IMappingElement. EQUIVALENT_TO = 1 MORE_GENERAL = 2 LESS_GENERAL = 3 DISJOINT_FROM = 4 IDK = 5 @param semanticRelation the semantic relation as defined in IMappingElement. @return the order of precedence for the given relation, Integer.MAX_VALUE if the relation is not recognized.
[ "Gives", "the", "precedence", "order", "for", "the", "given", "semanticRelation", "defined", "in", "IMappingElement", ".", "EQUIVALENT_TO", "=", "1", "MORE_GENERAL", "=", "2", "LESS_GENERAL", "=", "3", "DISJOINT_FROM", "=", "4", "IDK", "=", "5" ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/SPSMMappingFilter.java#L541-L559
147,561
ykrasik/jaci
jaci-core/src/main/java/com/github/ykrasik/jaci/path/ParsedPath.java
ParsedPath.append
public ParsedPath append(ParsedPath other) { final List<String> composedPath = new ArrayList<>(this.elements.size() + other.elements.size()); composedPath.addAll(this.elements); composedPath.addAll(other.elements); return new ParsedPath(startsWithDelimiter, composedPath); }
java
public ParsedPath append(ParsedPath other) { final List<String> composedPath = new ArrayList<>(this.elements.size() + other.elements.size()); composedPath.addAll(this.elements); composedPath.addAll(other.elements); return new ParsedPath(startsWithDelimiter, composedPath); }
[ "public", "ParsedPath", "append", "(", "ParsedPath", "other", ")", "{", "final", "List", "<", "String", ">", "composedPath", "=", "new", "ArrayList", "<>", "(", "this", ".", "elements", ".", "size", "(", ")", "+", "other", ".", "elements", ".", "size", "(", ")", ")", ";", "composedPath", ".", "addAll", "(", "this", ".", "elements", ")", ";", "composedPath", ".", "addAll", "(", "other", ".", "elements", ")", ";", "return", "new", "ParsedPath", "(", "startsWithDelimiter", ",", "composedPath", ")", ";", "}" ]
Append the received path to this path. @param other Path to append to this path. @return A {@link ParsedPath} resulting from appending the received path to this path.
[ "Append", "the", "received", "path", "to", "this", "path", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-core/src/main/java/com/github/ykrasik/jaci/path/ParsedPath.java#L89-L94
147,562
scaleset/scaleset-search
es2/src/main/java/com/scaleset/search/es2/agg/AbstractCombinedConverter.java
AbstractCombinedConverter.addSubAggs
void addSubAggs(QueryConverter queryConverter, Aggregation agg, AggregationBuilder builder) { Map<String, Aggregation> aggs = agg.getAggs(); for (String key : aggs.keySet()) { Aggregation subAgg = aggs.get(key); AbstractAggregationBuilder subBuilder = queryConverter.converterAggregation(subAgg); if (subBuilder != null) { builder.subAggregation(subBuilder); } } }
java
void addSubAggs(QueryConverter queryConverter, Aggregation agg, AggregationBuilder builder) { Map<String, Aggregation> aggs = agg.getAggs(); for (String key : aggs.keySet()) { Aggregation subAgg = aggs.get(key); AbstractAggregationBuilder subBuilder = queryConverter.converterAggregation(subAgg); if (subBuilder != null) { builder.subAggregation(subBuilder); } } }
[ "void", "addSubAggs", "(", "QueryConverter", "queryConverter", ",", "Aggregation", "agg", ",", "AggregationBuilder", "builder", ")", "{", "Map", "<", "String", ",", "Aggregation", ">", "aggs", "=", "agg", ".", "getAggs", "(", ")", ";", "for", "(", "String", "key", ":", "aggs", ".", "keySet", "(", ")", ")", "{", "Aggregation", "subAgg", "=", "aggs", ".", "get", "(", "key", ")", ";", "AbstractAggregationBuilder", "subBuilder", "=", "queryConverter", ".", "converterAggregation", "(", "subAgg", ")", ";", "if", "(", "subBuilder", "!=", "null", ")", "{", "builder", ".", "subAggregation", "(", "subBuilder", ")", ";", "}", "}", "}" ]
add sub-aggs when building search request
[ "add", "sub", "-", "aggs", "when", "building", "search", "request" ]
b1d7a002aaea0d7cdefcaac9870d7fab0631ea2a
https://github.com/scaleset/scaleset-search/blob/b1d7a002aaea0d7cdefcaac9870d7fab0631ea2a/es2/src/main/java/com/scaleset/search/es2/agg/AbstractCombinedConverter.java#L41-L50
147,563
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/AbstractParser.java
AbstractParser.newUninitializedMessageException
private UninitializedMessageException newUninitializedMessageException(MessageType message) { if (message instanceof AbstractMessageLite) { return ((AbstractMessageLite) message).newUninitializedMessageException(); } return new UninitializedMessageException(message); }
java
private UninitializedMessageException newUninitializedMessageException(MessageType message) { if (message instanceof AbstractMessageLite) { return ((AbstractMessageLite) message).newUninitializedMessageException(); } return new UninitializedMessageException(message); }
[ "private", "UninitializedMessageException", "newUninitializedMessageException", "(", "MessageType", "message", ")", "{", "if", "(", "message", "instanceof", "AbstractMessageLite", ")", "{", "return", "(", "(", "AbstractMessageLite", ")", "message", ")", ".", "newUninitializedMessageException", "(", ")", ";", "}", "return", "new", "UninitializedMessageException", "(", "message", ")", ";", "}" ]
Creates an UninitializedMessageException for MessageType.
[ "Creates", "an", "UninitializedMessageException", "for", "MessageType", "." ]
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/AbstractParser.java#L54-L60
147,564
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/AbstractParser.java
AbstractParser.checkMessageInitialized
private MessageType checkMessageInitialized(MessageType message) throws InvalidProtocolBufferException { if (message != null && !message.isInitialized()) { throw newUninitializedMessageException(message) .asInvalidProtocolBufferException() .setUnfinishedMessage(message); } return message; }
java
private MessageType checkMessageInitialized(MessageType message) throws InvalidProtocolBufferException { if (message != null && !message.isInitialized()) { throw newUninitializedMessageException(message) .asInvalidProtocolBufferException() .setUnfinishedMessage(message); } return message; }
[ "private", "MessageType", "checkMessageInitialized", "(", "MessageType", "message", ")", "throws", "InvalidProtocolBufferException", "{", "if", "(", "message", "!=", "null", "&&", "!", "message", ".", "isInitialized", "(", ")", ")", "{", "throw", "newUninitializedMessageException", "(", "message", ")", ".", "asInvalidProtocolBufferException", "(", ")", ".", "setUnfinishedMessage", "(", "message", ")", ";", "}", "return", "message", ";", "}" ]
Helper method to check if message is initialized. @throws InvalidProtocolBufferException if it is not initialized. @return The message to check.
[ "Helper", "method", "to", "check", "if", "message", "is", "initialized", "." ]
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/AbstractParser.java#L68-L76
147,565
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/propertysheet/DefaultProperty.java
DefaultProperty.readFromObject
@Override public void readFromObject(Object object) { try { Method method = BeanUtils.getReadMethod(object.getClass(), getName()); if (method != null) { Object value = method.invoke(object); initializeValue(value); // avoid updating parent or firing property change if (value != null) { for (Property subProperty : subProperties) { subProperty.readFromObject(value); } } } } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } }
java
@Override public void readFromObject(Object object) { try { Method method = BeanUtils.getReadMethod(object.getClass(), getName()); if (method != null) { Object value = method.invoke(object); initializeValue(value); // avoid updating parent or firing property change if (value != null) { for (Property subProperty : subProperties) { subProperty.readFromObject(value); } } } } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } }
[ "@", "Override", "public", "void", "readFromObject", "(", "Object", "object", ")", "{", "try", "{", "Method", "method", "=", "BeanUtils", ".", "getReadMethod", "(", "object", ".", "getClass", "(", ")", ",", "getName", "(", ")", ")", ";", "if", "(", "method", "!=", "null", ")", "{", "Object", "value", "=", "method", ".", "invoke", "(", "object", ")", ";", "initializeValue", "(", "value", ")", ";", "// avoid updating parent or firing property change", "if", "(", "value", "!=", "null", ")", "{", "for", "(", "Property", "subProperty", ":", "subProperties", ")", "{", "subProperty", ".", "readFromObject", "(", "value", ")", ";", "}", "}", "}", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Reads the value of this Property from the given object. It uses reflection and looks for a method starting with "is" or "get" followed by the capitalized Property name. @param object
[ "Reads", "the", "value", "of", "this", "Property", "from", "the", "given", "object", ".", "It", "uses", "reflection", "and", "looks", "for", "a", "method", "starting", "with", "is", "or", "get", "followed", "by", "the", "capitalized", "Property", "name", "." ]
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/DefaultProperty.java#L103-L123
147,566
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/propertysheet/DefaultProperty.java
DefaultProperty.writeToObject
@Override public void writeToObject(Object object) { try { Method method = BeanUtils.getWriteMethod(object.getClass(), getName()); if (method != null) { method.invoke(object, new Object[]{getValue()}); } } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } }
java
@Override public void writeToObject(Object object) { try { Method method = BeanUtils.getWriteMethod(object.getClass(), getName()); if (method != null) { method.invoke(object, new Object[]{getValue()}); } } catch (IllegalAccessException e) { throw new RuntimeException(e); } catch (IllegalArgumentException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { throw new RuntimeException(e); } }
[ "@", "Override", "public", "void", "writeToObject", "(", "Object", "object", ")", "{", "try", "{", "Method", "method", "=", "BeanUtils", ".", "getWriteMethod", "(", "object", ".", "getClass", "(", ")", ",", "getName", "(", ")", ")", ";", "if", "(", "method", "!=", "null", ")", "{", "method", ".", "invoke", "(", "object", ",", "new", "Object", "[", "]", "{", "getValue", "(", ")", "}", ")", ";", "}", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Writes the value of the Property to the given object. It uses reflection and looks for a method starting with "set" followed by the capitalized Property name and with one parameter with the same type as the Property. @param object
[ "Writes", "the", "value", "of", "the", "Property", "to", "the", "given", "object", ".", "It", "uses", "reflection", "and", "looks", "for", "a", "method", "starting", "with", "set", "followed", "by", "the", "capitalized", "Property", "name", "and", "with", "one", "parameter", "with", "the", "same", "type", "as", "the", "Property", "." ]
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/DefaultProperty.java#L132-L146
147,567
awltech/org.parallelj
parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/KExecutable.java
KExecutable.values
public Map<String, String> values(Object context) { if (this.attributes.isEmpty()) { return Collections.emptyMap(); } Map<String, String> map = new HashMap<String, String>(); for (KAttribute attribute : this.attributes) { String value = attribute.value(context); if (value != null) { map.put(attribute.getName(), value); } } return map; }
java
public Map<String, String> values(Object context) { if (this.attributes.isEmpty()) { return Collections.emptyMap(); } Map<String, String> map = new HashMap<String, String>(); for (KAttribute attribute : this.attributes) { String value = attribute.value(context); if (value != null) { map.put(attribute.getName(), value); } } return map; }
[ "public", "Map", "<", "String", ",", "String", ">", "values", "(", "Object", "context", ")", "{", "if", "(", "this", ".", "attributes", ".", "isEmpty", "(", ")", ")", "{", "return", "Collections", ".", "emptyMap", "(", ")", ";", "}", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "for", "(", "KAttribute", "attribute", ":", "this", ".", "attributes", ")", "{", "String", "value", "=", "attribute", ".", "value", "(", "context", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "map", ".", "put", "(", "attribute", ".", "getName", "(", ")", ",", "value", ")", ";", "}", "}", "return", "map", ";", "}" ]
Get the attribute values @param context the context @return a map of attribute name/value. Empty map if no attributes/
[ "Get", "the", "attribute", "values" ]
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/KExecutable.java#L61-L74
147,568
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/util/UriUtil.java
UriUtil.getUniqueId
public static String getUniqueId(URI resourceUri, URI basePath) { String result = null; URI relativeUri = basePath.relativize(resourceUri); // If it is relative the first part of the path is the Unique ID if (!relativeUri.isAbsolute()) { result = relativeUri.toASCIIString(); int slashIndex = result.indexOf('/'); int hashIndex = result.indexOf('#'); if (slashIndex > -1) { result = result.substring(0, slashIndex); } else if (hashIndex > -1) { result = result.substring(0, hashIndex); } } return result; }
java
public static String getUniqueId(URI resourceUri, URI basePath) { String result = null; URI relativeUri = basePath.relativize(resourceUri); // If it is relative the first part of the path is the Unique ID if (!relativeUri.isAbsolute()) { result = relativeUri.toASCIIString(); int slashIndex = result.indexOf('/'); int hashIndex = result.indexOf('#'); if (slashIndex > -1) { result = result.substring(0, slashIndex); } else if (hashIndex > -1) { result = result.substring(0, hashIndex); } } return result; }
[ "public", "static", "String", "getUniqueId", "(", "URI", "resourceUri", ",", "URI", "basePath", ")", "{", "String", "result", "=", "null", ";", "URI", "relativeUri", "=", "basePath", ".", "relativize", "(", "resourceUri", ")", ";", "// If it is relative the first part of the path is the Unique ID", "if", "(", "!", "relativeUri", ".", "isAbsolute", "(", ")", ")", "{", "result", "=", "relativeUri", ".", "toASCIIString", "(", ")", ";", "int", "slashIndex", "=", "result", ".", "indexOf", "(", "'", "'", ")", ";", "int", "hashIndex", "=", "result", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "slashIndex", ">", "-", "1", ")", "{", "result", "=", "result", ".", "substring", "(", "0", ",", "slashIndex", ")", ";", "}", "else", "if", "(", "hashIndex", ">", "-", "1", ")", "{", "result", "=", "result", ".", "substring", "(", "0", ",", "hashIndex", ")", ";", "}", "}", "return", "result", ";", "}" ]
Given the URI of a resource it returns the Unique ID. In reality this obtains the first path element after the basePath. Checks for those that are local to the server only. Developed both for hash and slash URIs. Works in iServe on the basis of the following assumption behind resource URIs: http://host:port/...some...path.../{uniqueResourceId}#fragment or http://host:port/...some...path.../{uniqueResourceId}/subPart The result should be {uniqueResourceId} @param resourceUri the actual resource URI @param basePath the base path of the URI @return the uniqueId if it is a local URI to the server or null.
[ "Given", "the", "URI", "of", "a", "resource", "it", "returns", "the", "Unique", "ID", ".", "In", "reality", "this", "obtains", "the", "first", "path", "element", "after", "the", "basePath", ".", "Checks", "for", "those", "that", "are", "local", "to", "the", "server", "only", ".", "Developed", "both", "for", "hash", "and", "slash", "URIs", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/util/UriUtil.java#L46-L61
147,569
kmi/iserve
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/util/UriUtil.java
UriUtil.isResourceLocalToServer
public static boolean isResourceLocalToServer(URI resourceUri, URI serverUri) { URI relativeUri = serverUri.relativize(resourceUri); return !relativeUri.isAbsolute(); }
java
public static boolean isResourceLocalToServer(URI resourceUri, URI serverUri) { URI relativeUri = serverUri.relativize(resourceUri); return !relativeUri.isAbsolute(); }
[ "public", "static", "boolean", "isResourceLocalToServer", "(", "URI", "resourceUri", ",", "URI", "serverUri", ")", "{", "URI", "relativeUri", "=", "serverUri", ".", "relativize", "(", "resourceUri", ")", ";", "return", "!", "relativeUri", ".", "isAbsolute", "(", ")", ";", "}" ]
Figure out whether the URI is actually local to the server. That is, it tells whether the resouce is controlled by the server. @param resourceUri @param serverUri the server URI @return
[ "Figure", "out", "whether", "the", "URI", "is", "actually", "local", "to", "the", "server", ".", "That", "is", "it", "tells", "whether", "the", "resouce", "is", "controlled", "by", "the", "server", "." ]
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/util/UriUtil.java#L71-L74
147,570
netceteragroup/trema-core
src/main/java/com/netcetera/trema/core/exporting/XLSExporter.java
XLSExporter.createStyles
private static Map<String, CellStyle> createStyles(Workbook wb) { Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); CellStyle style; Font headerFont = wb.createFont(); style = createBorderedStyle(wb); style.setAlignment(CellStyle.ALIGN_CENTER); style.setFillForegroundColor(HSSFColor.LIGHT_CORNFLOWER_BLUE.index); style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setFont(headerFont); styles.put("header", style); Font font1 = wb.createFont(); style = createBorderedStyle(wb); style.setAlignment(CellStyle.ALIGN_LEFT); style.setFont(font1); styles.put("cell_b", style); return styles; }
java
private static Map<String, CellStyle> createStyles(Workbook wb) { Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); CellStyle style; Font headerFont = wb.createFont(); style = createBorderedStyle(wb); style.setAlignment(CellStyle.ALIGN_CENTER); style.setFillForegroundColor(HSSFColor.LIGHT_CORNFLOWER_BLUE.index); style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setFont(headerFont); styles.put("header", style); Font font1 = wb.createFont(); style = createBorderedStyle(wb); style.setAlignment(CellStyle.ALIGN_LEFT); style.setFont(font1); styles.put("cell_b", style); return styles; }
[ "private", "static", "Map", "<", "String", ",", "CellStyle", ">", "createStyles", "(", "Workbook", "wb", ")", "{", "Map", "<", "String", ",", "CellStyle", ">", "styles", "=", "new", "HashMap", "<", "String", ",", "CellStyle", ">", "(", ")", ";", "CellStyle", "style", ";", "Font", "headerFont", "=", "wb", ".", "createFont", "(", ")", ";", "style", "=", "createBorderedStyle", "(", "wb", ")", ";", "style", ".", "setAlignment", "(", "CellStyle", ".", "ALIGN_CENTER", ")", ";", "style", ".", "setFillForegroundColor", "(", "HSSFColor", ".", "LIGHT_CORNFLOWER_BLUE", ".", "index", ")", ";", "style", ".", "setFillPattern", "(", "CellStyle", ".", "SOLID_FOREGROUND", ")", ";", "style", ".", "setFont", "(", "headerFont", ")", ";", "styles", ".", "put", "(", "\"header\"", ",", "style", ")", ";", "Font", "font1", "=", "wb", ".", "createFont", "(", ")", ";", "style", "=", "createBorderedStyle", "(", "wb", ")", ";", "style", ".", "setAlignment", "(", "CellStyle", ".", "ALIGN_LEFT", ")", ";", "style", ".", "setFont", "(", "font1", ")", ";", "styles", ".", "put", "(", "\"cell_b\"", ",", "style", ")", ";", "return", "styles", ";", "}" ]
Cell styles used.
[ "Cell", "styles", "used", "." ]
e5367f4b80b38038d462627aa146a62bc34fc489
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/exporting/XLSExporter.java#L125-L146
147,571
netceteragroup/trema-core
src/main/java/com/netcetera/trema/core/exporting/TremaCSVPrinter.java
TremaCSVPrinter.print
public void print(String[][] values) throws IOException { if (values == null || values.length == 0) { csvPrinter.println(); } else { for (String[] value : values) { csvPrinter.printRecords((Object) value); } } csvPrinter.flush(); }
java
public void print(String[][] values) throws IOException { if (values == null || values.length == 0) { csvPrinter.println(); } else { for (String[] value : values) { csvPrinter.printRecords((Object) value); } } csvPrinter.flush(); }
[ "public", "void", "print", "(", "String", "[", "]", "[", "]", "values", ")", "throws", "IOException", "{", "if", "(", "values", "==", "null", "||", "values", ".", "length", "==", "0", ")", "{", "csvPrinter", ".", "println", "(", ")", ";", "}", "else", "{", "for", "(", "String", "[", "]", "value", ":", "values", ")", "{", "csvPrinter", ".", "printRecords", "(", "(", "Object", ")", "value", ")", ";", "}", "}", "csvPrinter", ".", "flush", "(", ")", ";", "}" ]
Print several lines of comma separated values. The values will be quoted if needed. Quotes and new line characters will be escaped. @param values the values to be put out @throws IOException if printing to the stream fails
[ "Print", "several", "lines", "of", "comma", "separated", "values", ".", "The", "values", "will", "be", "quoted", "if", "needed", ".", "Quotes", "and", "new", "line", "characters", "will", "be", "escaped", "." ]
e5367f4b80b38038d462627aa146a62bc34fc489
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/exporting/TremaCSVPrinter.java#L42-L51
147,572
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/filters/RedundantGeneratorMappingFilter.java
RedundantGeneratorMappingFilter.isRedundant
private boolean isRedundant(IContextMapping<INode> mapping, INode source, INode target, char R) { switch (R) { case IMappingElement.LESS_GENERAL: { if (verifyCondition1(mapping, source, target)) { return true; } break; } case IMappingElement.MORE_GENERAL: { if (verifyCondition2(mapping, source, target)) { return true; } break; } case IMappingElement.DISJOINT: { if (verifyCondition3(mapping, source, target)) { return true; } break; } case IMappingElement.EQUIVALENCE: { if (verifyCondition1(mapping, source, target) && verifyCondition2(mapping, source, target)) { return true; } break; } default: { return false; } }// end switch return false; }
java
private boolean isRedundant(IContextMapping<INode> mapping, INode source, INode target, char R) { switch (R) { case IMappingElement.LESS_GENERAL: { if (verifyCondition1(mapping, source, target)) { return true; } break; } case IMappingElement.MORE_GENERAL: { if (verifyCondition2(mapping, source, target)) { return true; } break; } case IMappingElement.DISJOINT: { if (verifyCondition3(mapping, source, target)) { return true; } break; } case IMappingElement.EQUIVALENCE: { if (verifyCondition1(mapping, source, target) && verifyCondition2(mapping, source, target)) { return true; } break; } default: { return false; } }// end switch return false; }
[ "private", "boolean", "isRedundant", "(", "IContextMapping", "<", "INode", ">", "mapping", ",", "INode", "source", ",", "INode", "target", ",", "char", "R", ")", "{", "switch", "(", "R", ")", "{", "case", "IMappingElement", ".", "LESS_GENERAL", ":", "{", "if", "(", "verifyCondition1", "(", "mapping", ",", "source", ",", "target", ")", ")", "{", "return", "true", ";", "}", "break", ";", "}", "case", "IMappingElement", ".", "MORE_GENERAL", ":", "{", "if", "(", "verifyCondition2", "(", "mapping", ",", "source", ",", "target", ")", ")", "{", "return", "true", ";", "}", "break", ";", "}", "case", "IMappingElement", ".", "DISJOINT", ":", "{", "if", "(", "verifyCondition3", "(", "mapping", ",", "source", ",", "target", ")", ")", "{", "return", "true", ";", "}", "break", ";", "}", "case", "IMappingElement", ".", "EQUIVALENCE", ":", "{", "if", "(", "verifyCondition1", "(", "mapping", ",", "source", ",", "target", ")", "&&", "verifyCondition2", "(", "mapping", ",", "source", ",", "target", ")", ")", "{", "return", "true", ";", "}", "break", ";", "}", "default", ":", "{", "return", "false", ";", "}", "}", "// end switch\r", "return", "false", ";", "}" ]
Checks whether the relation between source and target is redundant or not for minimal mapping. @param mapping a mapping @param source source @param target target @param R relation between source and target node @return true for redundant relation @return true if the relation between source and target is redundant
[ "Checks", "whether", "the", "relation", "between", "source", "and", "target", "is", "redundant", "or", "not", "for", "minimal", "mapping", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/RedundantGeneratorMappingFilter.java#L122-L155
147,573
mlhartme/sushi
src/main/java/net/oneandone/sushi/fs/http/io/ChunkedInputStream.java
ChunkedInputStream.before
private boolean before() throws IOException { if (closed) { throw new IOException("Attempted read from closed stream."); } switch (length) { case EOF: return false; case UNKNOWN: length = readLength(); pos = 0; if (length == EOF) { HeaderList.parse(src); // result is ignored return false; } return true; default: return true; } }
java
private boolean before() throws IOException { if (closed) { throw new IOException("Attempted read from closed stream."); } switch (length) { case EOF: return false; case UNKNOWN: length = readLength(); pos = 0; if (length == EOF) { HeaderList.parse(src); // result is ignored return false; } return true; default: return true; } }
[ "private", "boolean", "before", "(", ")", "throws", "IOException", "{", "if", "(", "closed", ")", "{", "throw", "new", "IOException", "(", "\"Attempted read from closed stream.\"", ")", ";", "}", "switch", "(", "length", ")", "{", "case", "EOF", ":", "return", "false", ";", "case", "UNKNOWN", ":", "length", "=", "readLength", "(", ")", ";", "pos", "=", "0", ";", "if", "(", "length", "==", "EOF", ")", "{", "HeaderList", ".", "parse", "(", "src", ")", ";", "// result is ignored", "return", "false", ";", "}", "return", "true", ";", "default", ":", "return", "true", ";", "}", "}" ]
Standard processing before reading data. @return false for eof
[ "Standard", "processing", "before", "reading", "data", "." ]
4af33414b04bd58584d4febe5cc63ef6c7346a75
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/http/io/ChunkedInputStream.java#L114-L132
147,574
yfpeng/pengyifan-bioc
src/main/java/com/pengyifan/bioc/BioCAnnotation.java
BioCAnnotation.getTotalLocation
public BioCLocation getTotalLocation() { checkArgument(getLocationCount() > 0, "No location added"); RangeSet<Integer> rangeSet = TreeRangeSet.create(); for (BioCLocation location : getLocations()) { rangeSet.add( Range.closedOpen(location.getOffset(), location.getOffset() + location.getLength())); } Range<Integer> totalSpan = rangeSet.span(); return new BioCLocation(totalSpan.lowerEndpoint(), totalSpan.upperEndpoint() - totalSpan.lowerEndpoint()); }
java
public BioCLocation getTotalLocation() { checkArgument(getLocationCount() > 0, "No location added"); RangeSet<Integer> rangeSet = TreeRangeSet.create(); for (BioCLocation location : getLocations()) { rangeSet.add( Range.closedOpen(location.getOffset(), location.getOffset() + location.getLength())); } Range<Integer> totalSpan = rangeSet.span(); return new BioCLocation(totalSpan.lowerEndpoint(), totalSpan.upperEndpoint() - totalSpan.lowerEndpoint()); }
[ "public", "BioCLocation", "getTotalLocation", "(", ")", "{", "checkArgument", "(", "getLocationCount", "(", ")", ">", "0", ",", "\"No location added\"", ")", ";", "RangeSet", "<", "Integer", ">", "rangeSet", "=", "TreeRangeSet", ".", "create", "(", ")", ";", "for", "(", "BioCLocation", "location", ":", "getLocations", "(", ")", ")", "{", "rangeSet", ".", "add", "(", "Range", ".", "closedOpen", "(", "location", ".", "getOffset", "(", ")", ",", "location", ".", "getOffset", "(", ")", "+", "location", ".", "getLength", "(", ")", ")", ")", ";", "}", "Range", "<", "Integer", ">", "totalSpan", "=", "rangeSet", ".", "span", "(", ")", ";", "return", "new", "BioCLocation", "(", "totalSpan", ".", "lowerEndpoint", "(", ")", ",", "totalSpan", ".", "upperEndpoint", "(", ")", "-", "totalSpan", ".", "lowerEndpoint", "(", ")", ")", ";", "}" ]
Returns the minimal range which encloses all locations in this annotation. @return the minimal range which encloses all locations in this annotation
[ "Returns", "the", "minimal", "range", "which", "encloses", "all", "locations", "in", "this", "annotation", "." ]
e09cce1969aa598ff89e7957237375715d7a1a3a
https://github.com/yfpeng/pengyifan-bioc/blob/e09cce1969aa598ff89e7957237375715d7a1a3a/src/main/java/com/pengyifan/bioc/BioCAnnotation.java#L146-L156
147,575
netceteragroup/trema-core
src/main/java/com/netcetera/trema/common/TremaCoreUtil.java
TremaCoreUtil.getLanguages
public static Set<String> getLanguages(final ITextNode[] textNodes) { SortedSet<String> languages = new TreeSet<String>(); for (ITextNode textNode : textNodes) { IValueNode[] valueNodes = textNode.getValueNodes(); for (IValueNode valueNode : valueNodes) { languages.add(valueNode.getLanguage()); } } return languages; }
java
public static Set<String> getLanguages(final ITextNode[] textNodes) { SortedSet<String> languages = new TreeSet<String>(); for (ITextNode textNode : textNodes) { IValueNode[] valueNodes = textNode.getValueNodes(); for (IValueNode valueNode : valueNodes) { languages.add(valueNode.getLanguage()); } } return languages; }
[ "public", "static", "Set", "<", "String", ">", "getLanguages", "(", "final", "ITextNode", "[", "]", "textNodes", ")", "{", "SortedSet", "<", "String", ">", "languages", "=", "new", "TreeSet", "<", "String", ">", "(", ")", ";", "for", "(", "ITextNode", "textNode", ":", "textNodes", ")", "{", "IValueNode", "[", "]", "valueNodes", "=", "textNode", ".", "getValueNodes", "(", ")", ";", "for", "(", "IValueNode", "valueNode", ":", "valueNodes", ")", "{", "languages", ".", "add", "(", "valueNode", ".", "getLanguage", "(", ")", ")", ";", "}", "}", "return", "languages", ";", "}" ]
Gets the languages of all value nodes whose parents are a given array of text nodes. @param textNodes the text nodes to extract the languages from @return a sorted set containing all languages or an empty set if none
[ "Gets", "the", "languages", "of", "all", "value", "nodes", "whose", "parents", "are", "a", "given", "array", "of", "text", "nodes", "." ]
e5367f4b80b38038d462627aa146a62bc34fc489
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/common/TremaCoreUtil.java#L29-L38
147,576
netceteragroup/trema-core
src/main/java/com/netcetera/trema/common/TremaCoreUtil.java
TremaCoreUtil.containsStatus
public static boolean containsStatus(final Status status, final Status[] statusArray) { if (status == null) { return false; } for (Status currentStatus : statusArray) { if (currentStatus == status) { return true; } } return false; }
java
public static boolean containsStatus(final Status status, final Status[] statusArray) { if (status == null) { return false; } for (Status currentStatus : statusArray) { if (currentStatus == status) { return true; } } return false; }
[ "public", "static", "boolean", "containsStatus", "(", "final", "Status", "status", ",", "final", "Status", "[", "]", "statusArray", ")", "{", "if", "(", "status", "==", "null", ")", "{", "return", "false", ";", "}", "for", "(", "Status", "currentStatus", ":", "statusArray", ")", "{", "if", "(", "currentStatus", "==", "status", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Checks whether a given status is contained in an array of status. @param status the status to be looked for @param statusArray the status array. @return true if the given status is contained in the array.
[ "Checks", "whether", "a", "given", "status", "is", "contained", "in", "an", "array", "of", "status", "." ]
e5367f4b80b38038d462627aa146a62bc34fc489
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/common/TremaCoreUtil.java#L46-L58
147,577
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/loaders/mapping/PlainMappingLoader.java
PlainMappingLoader.getNodePathToRoot
protected String getNodePathToRoot(INode node) { StringBuilder sb = new StringBuilder(); INode parent = node; while (null != parent) { if (parent.getNodeData().getName().contains("\\")) { log.debug("source: replacing \\ in: " + parent.getNodeData().getName()); sb.insert(0, "\\" + parent.getNodeData().getName().replaceAll("\\\\", "/")); } else { sb.insert(0, "\\" + parent.getNodeData().getName()); } parent = parent.getParent(); } return sb.toString(); }
java
protected String getNodePathToRoot(INode node) { StringBuilder sb = new StringBuilder(); INode parent = node; while (null != parent) { if (parent.getNodeData().getName().contains("\\")) { log.debug("source: replacing \\ in: " + parent.getNodeData().getName()); sb.insert(0, "\\" + parent.getNodeData().getName().replaceAll("\\\\", "/")); } else { sb.insert(0, "\\" + parent.getNodeData().getName()); } parent = parent.getParent(); } return sb.toString(); }
[ "protected", "String", "getNodePathToRoot", "(", "INode", "node", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "INode", "parent", "=", "node", ";", "while", "(", "null", "!=", "parent", ")", "{", "if", "(", "parent", ".", "getNodeData", "(", ")", ".", "getName", "(", ")", ".", "contains", "(", "\"\\\\\"", ")", ")", "{", "log", ".", "debug", "(", "\"source: replacing \\\\ in: \"", "+", "parent", ".", "getNodeData", "(", ")", ".", "getName", "(", ")", ")", ";", "sb", ".", "insert", "(", "0", ",", "\"\\\\\"", "+", "parent", ".", "getNodeData", "(", ")", ".", "getName", "(", ")", ".", "replaceAll", "(", "\"\\\\\\\\\"", ",", "\"/\"", ")", ")", ";", "}", "else", "{", "sb", ".", "insert", "(", "0", ",", "\"\\\\\"", "+", "parent", ".", "getNodeData", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "parent", "=", "parent", ".", "getParent", "(", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Gets the path of a node from root for hash mapping. @param node the interface of data structure of input node @return the string of the path from root to node
[ "Gets", "the", "path", "of", "a", "node", "from", "root", "for", "hash", "mapping", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/loaders/mapping/PlainMappingLoader.java#L84-L97
147,578
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/loaders/mapping/PlainMappingLoader.java
PlainMappingLoader.createHash
protected HashMap<String, INode> createHash(IContext context) { HashMap<String, INode> result = new HashMap<String, INode>(); int nodeCount = 0; for (INode node : context.getNodesList()) { result.put(getNodePathToRoot(node), node); nodeCount++; } if (log.isEnabledFor(Level.INFO)) { log.info("Created hash for " + nodeCount + " nodes..."); } return result; }
java
protected HashMap<String, INode> createHash(IContext context) { HashMap<String, INode> result = new HashMap<String, INode>(); int nodeCount = 0; for (INode node : context.getNodesList()) { result.put(getNodePathToRoot(node), node); nodeCount++; } if (log.isEnabledFor(Level.INFO)) { log.info("Created hash for " + nodeCount + " nodes..."); } return result; }
[ "protected", "HashMap", "<", "String", ",", "INode", ">", "createHash", "(", "IContext", "context", ")", "{", "HashMap", "<", "String", ",", "INode", ">", "result", "=", "new", "HashMap", "<", "String", ",", "INode", ">", "(", ")", ";", "int", "nodeCount", "=", "0", ";", "for", "(", "INode", "node", ":", "context", ".", "getNodesList", "(", ")", ")", "{", "result", ".", "put", "(", "getNodePathToRoot", "(", "node", ")", ",", "node", ")", ";", "nodeCount", "++", ";", "}", "if", "(", "log", ".", "isEnabledFor", "(", "Level", ".", "INFO", ")", ")", "{", "log", ".", "info", "(", "\"Created hash for \"", "+", "nodeCount", "+", "\" nodes...\"", ")", ";", "}", "return", "result", ";", "}" ]
Creates hash map for nodes which contains path from root to node for each node. @param context a context @return a hash table which contains path from root to node for each node
[ "Creates", "hash", "map", "for", "nodes", "which", "contains", "path", "from", "root", "to", "node", "for", "each", "node", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/loaders/mapping/PlainMappingLoader.java#L105-L119
147,579
synchronoss/cpo-api
cpo-core/src/main/java/org/synchronoss/cpo/CpoException.java
CpoException.getMessage
@Override public String getMessage() { StringBuilder msg = new StringBuilder("\n"); msg.append(super.getMessage()); if (detail != null) { msg.append("\n"); msg.append(detail.getMessage()); if (detail.getCause() != null) { msg.append(detail.getCause().getMessage()); } } return msg.toString(); }
java
@Override public String getMessage() { StringBuilder msg = new StringBuilder("\n"); msg.append(super.getMessage()); if (detail != null) { msg.append("\n"); msg.append(detail.getMessage()); if (detail.getCause() != null) { msg.append(detail.getCause().getMessage()); } } return msg.toString(); }
[ "@", "Override", "public", "String", "getMessage", "(", ")", "{", "StringBuilder", "msg", "=", "new", "StringBuilder", "(", "\"\\n\"", ")", ";", "msg", ".", "append", "(", "super", ".", "getMessage", "(", ")", ")", ";", "if", "(", "detail", "!=", "null", ")", "{", "msg", ".", "append", "(", "\"\\n\"", ")", ";", "msg", ".", "append", "(", "detail", ".", "getMessage", "(", ")", ")", ";", "if", "(", "detail", ".", "getCause", "(", ")", "!=", "null", ")", "{", "msg", ".", "append", "(", "detail", ".", "getCause", "(", ")", ".", "getMessage", "(", ")", ")", ";", "}", "}", "return", "msg", ".", "toString", "(", ")", ";", "}" ]
Returns the detail message, including the message from the nested exception if there is one.
[ "Returns", "the", "detail", "message", "including", "the", "message", "from", "the", "nested", "exception", "if", "there", "is", "one", "." ]
dc745aca3b3206abf80b85d9689b0132f5baa694
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-core/src/main/java/org/synchronoss/cpo/CpoException.java#L87-L101
147,580
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/swing/PercentLayout.java
PercentLayout.maximumLayoutSize
@Override public Dimension maximumLayoutSize(Container parent) { return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); }
java
@Override public Dimension maximumLayoutSize(Container parent) { return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); }
[ "@", "Override", "public", "Dimension", "maximumLayoutSize", "(", "Container", "parent", ")", "{", "return", "new", "Dimension", "(", "Integer", ".", "MAX_VALUE", ",", "Integer", ".", "MAX_VALUE", ")", ";", "}" ]
Returns the maximum size of this component. @param parent @return @see java.awt.Component#getMinimumSize() @see java.awt.Component#getPreferredSize() @see java.awt.LayoutManager
[ "Returns", "the", "maximum", "size", "of", "this", "component", "." ]
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/PercentLayout.java#L261-L264
147,581
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/string/GSuffix.java
GSuffix.matchSuffix
private char matchSuffix(String str1, String str2) { //here always str1.endsWith(str2) char rel = IMappingElement.IDK; int spacePos1 = str1.lastIndexOf(' '); String prefix = str1.substring(0, str1.length() - str2.length()); if (-1 < spacePos1 && !prefixes.containsKey(prefix)) {//check prefixes - ordered set!unordered set if (str1.length() == spacePos1 + str2.length() + 1) {//adhesive tape<tape attention deficit disorder<disorder rel = IMappingElement.LESS_GENERAL; } else {//connective tissue<issue String left = str1.substring(spacePos1 + 1, str1.length()); char secondRel = match(left, str2); if (IMappingElement.MORE_GENERAL == secondRel || IMappingElement.EQUIVALENCE == secondRel) { rel = IMappingElement.LESS_GENERAL; } else { //?,<,! rel = secondRel; } } } else { if (prefix.startsWith("-")) { prefix = prefix.substring(1); } if (prefix.endsWith("-") && !prefixes.containsKey(prefix = prefix.substring(0, prefix.length() - 1))) { //prefix = prefix.substring(0, prefix.length() - 1); //smth like cajun-creole, parrot-fish //but anti-virus rel = IMappingElement.LESS_GENERAL; } else { if (prefixes.containsKey(prefix)) { rel = prefixes.get(prefix); } else if (suffixes.containsKey(str2)) { rel = suffixes.get(str2); } } //another approximation = Gversion4 // if (rel == MatchManager.LESS_GENERAL || rel == MatchManager.MORE_GENERAL) { // rel = MatchManager.EQUIVALENCE; // } } //filter = Gversion3 // if (MatchManager.LESS_GENERAL == rel || MatchManager.MORE_GENERAL == rel) { // rel = MatchManager.EQUIVALENCE; // } return rel; }
java
private char matchSuffix(String str1, String str2) { //here always str1.endsWith(str2) char rel = IMappingElement.IDK; int spacePos1 = str1.lastIndexOf(' '); String prefix = str1.substring(0, str1.length() - str2.length()); if (-1 < spacePos1 && !prefixes.containsKey(prefix)) {//check prefixes - ordered set!unordered set if (str1.length() == spacePos1 + str2.length() + 1) {//adhesive tape<tape attention deficit disorder<disorder rel = IMappingElement.LESS_GENERAL; } else {//connective tissue<issue String left = str1.substring(spacePos1 + 1, str1.length()); char secondRel = match(left, str2); if (IMappingElement.MORE_GENERAL == secondRel || IMappingElement.EQUIVALENCE == secondRel) { rel = IMappingElement.LESS_GENERAL; } else { //?,<,! rel = secondRel; } } } else { if (prefix.startsWith("-")) { prefix = prefix.substring(1); } if (prefix.endsWith("-") && !prefixes.containsKey(prefix = prefix.substring(0, prefix.length() - 1))) { //prefix = prefix.substring(0, prefix.length() - 1); //smth like cajun-creole, parrot-fish //but anti-virus rel = IMappingElement.LESS_GENERAL; } else { if (prefixes.containsKey(prefix)) { rel = prefixes.get(prefix); } else if (suffixes.containsKey(str2)) { rel = suffixes.get(str2); } } //another approximation = Gversion4 // if (rel == MatchManager.LESS_GENERAL || rel == MatchManager.MORE_GENERAL) { // rel = MatchManager.EQUIVALENCE; // } } //filter = Gversion3 // if (MatchManager.LESS_GENERAL == rel || MatchManager.MORE_GENERAL == rel) { // rel = MatchManager.EQUIVALENCE; // } return rel; }
[ "private", "char", "matchSuffix", "(", "String", "str1", ",", "String", "str2", ")", "{", "//here always str1.endsWith(str2)\r", "char", "rel", "=", "IMappingElement", ".", "IDK", ";", "int", "spacePos1", "=", "str1", ".", "lastIndexOf", "(", "'", "'", ")", ";", "String", "prefix", "=", "str1", ".", "substring", "(", "0", ",", "str1", ".", "length", "(", ")", "-", "str2", ".", "length", "(", ")", ")", ";", "if", "(", "-", "1", "<", "spacePos1", "&&", "!", "prefixes", ".", "containsKey", "(", "prefix", ")", ")", "{", "//check prefixes - ordered set!unordered set\r", "if", "(", "str1", ".", "length", "(", ")", "==", "spacePos1", "+", "str2", ".", "length", "(", ")", "+", "1", ")", "{", "//adhesive tape<tape attention deficit disorder<disorder\r", "rel", "=", "IMappingElement", ".", "LESS_GENERAL", ";", "}", "else", "{", "//connective tissue<issue\r", "String", "left", "=", "str1", ".", "substring", "(", "spacePos1", "+", "1", ",", "str1", ".", "length", "(", ")", ")", ";", "char", "secondRel", "=", "match", "(", "left", ",", "str2", ")", ";", "if", "(", "IMappingElement", ".", "MORE_GENERAL", "==", "secondRel", "||", "IMappingElement", ".", "EQUIVALENCE", "==", "secondRel", ")", "{", "rel", "=", "IMappingElement", ".", "LESS_GENERAL", ";", "}", "else", "{", "//?,<,!\r", "rel", "=", "secondRel", ";", "}", "}", "}", "else", "{", "if", "(", "prefix", ".", "startsWith", "(", "\"-\"", ")", ")", "{", "prefix", "=", "prefix", ".", "substring", "(", "1", ")", ";", "}", "if", "(", "prefix", ".", "endsWith", "(", "\"-\"", ")", "&&", "!", "prefixes", ".", "containsKey", "(", "prefix", "=", "prefix", ".", "substring", "(", "0", ",", "prefix", ".", "length", "(", ")", "-", "1", ")", ")", ")", "{", "//prefix = prefix.substring(0, prefix.length() - 1);\r", "//smth like cajun-creole, parrot-fish\r", "//but anti-virus\r", "rel", "=", "IMappingElement", ".", "LESS_GENERAL", ";", "}", "else", "{", "if", "(", "prefixes", ".", "containsKey", "(", "prefix", ")", ")", "{", "rel", "=", "prefixes", ".", "get", "(", "prefix", ")", ";", "}", "else", "if", "(", "suffixes", ".", "containsKey", "(", "str2", ")", ")", "{", "rel", "=", "suffixes", ".", "get", "(", "str2", ")", ";", "}", "}", "//another approximation = Gversion4\r", "// if (rel == MatchManager.LESS_GENERAL || rel == MatchManager.MORE_GENERAL) {\r", "// rel = MatchManager.EQUIVALENCE;\r", "// }\r", "}", "//filter = Gversion3\r", "// if (MatchManager.LESS_GENERAL == rel || MatchManager.MORE_GENERAL == rel) {\r", "// rel = MatchManager.EQUIVALENCE;\r", "// }\r", "return", "rel", ";", "}" ]
Computes the relation with suffix matcher. @param str1 the source input @param str2 the target input @return synonym, more general, less general or IDK relation
[ "Computes", "the", "relation", "with", "suffix", "matcher", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/string/GSuffix.java#L604-L651
147,582
ykrasik/jaci
jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java
StringUtils.removeLeadingAndTrailingDelimiter
public static String removeLeadingAndTrailingDelimiter(String str, String delimiter) { final int strLength = str.length(); final int delimiterLength = delimiter.length(); final boolean leadingDelimiter = str.startsWith(delimiter); final boolean trailingDelimiter = strLength > delimiterLength && str.endsWith(delimiter); if (!leadingDelimiter && !trailingDelimiter) { return str; } else { final int startingDelimiterIndex = leadingDelimiter ? delimiterLength : 0; final int endingDelimiterIndex = trailingDelimiter ? Math.max(strLength - delimiterLength, startingDelimiterIndex) : strLength; return str.substring(startingDelimiterIndex, endingDelimiterIndex); } }
java
public static String removeLeadingAndTrailingDelimiter(String str, String delimiter) { final int strLength = str.length(); final int delimiterLength = delimiter.length(); final boolean leadingDelimiter = str.startsWith(delimiter); final boolean trailingDelimiter = strLength > delimiterLength && str.endsWith(delimiter); if (!leadingDelimiter && !trailingDelimiter) { return str; } else { final int startingDelimiterIndex = leadingDelimiter ? delimiterLength : 0; final int endingDelimiterIndex = trailingDelimiter ? Math.max(strLength - delimiterLength, startingDelimiterIndex) : strLength; return str.substring(startingDelimiterIndex, endingDelimiterIndex); } }
[ "public", "static", "String", "removeLeadingAndTrailingDelimiter", "(", "String", "str", ",", "String", "delimiter", ")", "{", "final", "int", "strLength", "=", "str", ".", "length", "(", ")", ";", "final", "int", "delimiterLength", "=", "delimiter", ".", "length", "(", ")", ";", "final", "boolean", "leadingDelimiter", "=", "str", ".", "startsWith", "(", "delimiter", ")", ";", "final", "boolean", "trailingDelimiter", "=", "strLength", ">", "delimiterLength", "&&", "str", ".", "endsWith", "(", "delimiter", ")", ";", "if", "(", "!", "leadingDelimiter", "&&", "!", "trailingDelimiter", ")", "{", "return", "str", ";", "}", "else", "{", "final", "int", "startingDelimiterIndex", "=", "leadingDelimiter", "?", "delimiterLength", ":", "0", ";", "final", "int", "endingDelimiterIndex", "=", "trailingDelimiter", "?", "Math", ".", "max", "(", "strLength", "-", "delimiterLength", ",", "startingDelimiterIndex", ")", ":", "strLength", ";", "return", "str", ".", "substring", "(", "startingDelimiterIndex", ",", "endingDelimiterIndex", ")", ";", "}", "}" ]
Removes the leading and trailing delimiter from a string. @param str String to process. @param delimiter Delimiter to remove. @return The string with the leading and trailing delimiter removed.
[ "Removes", "the", "leading", "and", "trailing", "delimiter", "from", "a", "string", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java#L38-L51
147,583
ykrasik/jaci
jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java
StringUtils.removeTrailingDelimiter
public static String removeTrailingDelimiter(String str, String delimiter) { if (!str.endsWith(delimiter)) { return str; } else { return str.substring(0, str.length() - delimiter.length()); } }
java
public static String removeTrailingDelimiter(String str, String delimiter) { if (!str.endsWith(delimiter)) { return str; } else { return str.substring(0, str.length() - delimiter.length()); } }
[ "public", "static", "String", "removeTrailingDelimiter", "(", "String", "str", ",", "String", "delimiter", ")", "{", "if", "(", "!", "str", ".", "endsWith", "(", "delimiter", ")", ")", "{", "return", "str", ";", "}", "else", "{", "return", "str", ".", "substring", "(", "0", ",", "str", ".", "length", "(", ")", "-", "delimiter", ".", "length", "(", ")", ")", ";", "}", "}" ]
Removes the trailing delimiter from a string. @param str String to process. @param delimiter Delimiter to remove. @return The string with the trailing delimiter removed.
[ "Removes", "the", "trailing", "delimiter", "from", "a", "string", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java#L60-L66
147,584
ykrasik/jaci
jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java
StringUtils.removeLeadingDelimiter
public static String removeLeadingDelimiter(String str, String delimiter) { if (!str.startsWith(delimiter)) { return str; } else { return str.substring(delimiter.length(), str.length()); } }
java
public static String removeLeadingDelimiter(String str, String delimiter) { if (!str.startsWith(delimiter)) { return str; } else { return str.substring(delimiter.length(), str.length()); } }
[ "public", "static", "String", "removeLeadingDelimiter", "(", "String", "str", ",", "String", "delimiter", ")", "{", "if", "(", "!", "str", ".", "startsWith", "(", "delimiter", ")", ")", "{", "return", "str", ";", "}", "else", "{", "return", "str", ".", "substring", "(", "delimiter", ".", "length", "(", ")", ",", "str", ".", "length", "(", ")", ")", ";", "}", "}" ]
Removes the leading delimiter from a string. @param str String to process. @param delimiter Delimiter to remove. @return The string with the leading delimiter removed.
[ "Removes", "the", "leading", "delimiter", "from", "a", "string", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java#L75-L81
147,585
ykrasik/jaci
jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java
StringUtils.emptyToNull
public static String emptyToNull(String str) { return (str != null && !str.isEmpty()) ? str : null; }
java
public static String emptyToNull(String str) { return (str != null && !str.isEmpty()) ? str : null; }
[ "public", "static", "String", "emptyToNull", "(", "String", "str", ")", "{", "return", "(", "str", "!=", "null", "&&", "!", "str", ".", "isEmpty", "(", ")", ")", "?", "str", ":", "null", ";", "}" ]
Transform an empty string into null. @param str String to check. @return The string if it was non-empty, or null otherwise.
[ "Transform", "an", "empty", "string", "into", "null", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java#L100-L102
147,586
ykrasik/jaci
jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java
StringUtils.join
public static <T> String join(List<T> list, String delimiter) { if (list.isEmpty()) { return ""; } final StringBuilder sb = new StringBuilder(); for (T element : list) { sb.append(element); sb.append(delimiter); } sb.delete(sb.length() - delimiter.length(), sb.length()); return sb.toString(); }
java
public static <T> String join(List<T> list, String delimiter) { if (list.isEmpty()) { return ""; } final StringBuilder sb = new StringBuilder(); for (T element : list) { sb.append(element); sb.append(delimiter); } sb.delete(sb.length() - delimiter.length(), sb.length()); return sb.toString(); }
[ "public", "static", "<", "T", ">", "String", "join", "(", "List", "<", "T", ">", "list", ",", "String", "delimiter", ")", "{", "if", "(", "list", ".", "isEmpty", "(", ")", ")", "{", "return", "\"\"", ";", "}", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "T", "element", ":", "list", ")", "{", "sb", ".", "append", "(", "element", ")", ";", "sb", ".", "append", "(", "delimiter", ")", ";", "}", "sb", ".", "delete", "(", "sb", ".", "length", "(", ")", "-", "delimiter", ".", "length", "(", ")", ",", "sb", ".", "length", "(", ")", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Create a string out of the list's elements using the given delimiter. @param list List to create a string from. @param delimiter Delimiter to use between elements. @param <T> Type of elements in the list. @return A string created from the given list's elements, delimited by the given delimiter.
[ "Create", "a", "string", "out", "of", "the", "list", "s", "elements", "using", "the", "given", "delimiter", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java#L112-L124
147,587
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/structure/node/BaseNodeMatcher.java
BaseNodeMatcher.mkAxioms
protected static Object[] mkAxioms(HashMap<IAtomicConceptOfLabel, String> hashConceptNumber, Map<INode, ArrayList<IAtomicConceptOfLabel>> nmtAcols, Map<String, IAtomicConceptOfLabel> sourceACoLs, Map<String, IAtomicConceptOfLabel> targetACoLs, IContextMapping<IAtomicConceptOfLabel> acolMapping, INode sourceNode, INode targetNode) { StringBuilder axioms = new StringBuilder(); Integer numberOfClauses = 0; // create DIMACS variables for all acols in the matching task createVariables(hashConceptNumber, nmtAcols, sourceACoLs, sourceNode); createVariables(hashConceptNumber, nmtAcols, targetACoLs, targetNode); ArrayList<IAtomicConceptOfLabel> sourceACols = nmtAcols.get(sourceNode); ArrayList<IAtomicConceptOfLabel> targetACols = nmtAcols.get(targetNode); if (null != sourceACols && null != targetACols) { for (IAtomicConceptOfLabel sourceACoL : sourceACols) { for (IAtomicConceptOfLabel targetACoL : targetACols) { char relation = acolMapping.getRelation(sourceACoL, targetACoL); if (IMappingElement.IDK != relation) { //get the numbers of DIMACS variables corresponding to ACoLs String sourceVarNumber = hashConceptNumber.get(sourceACoL); String targetVarNumber = hashConceptNumber.get(targetACoL); if (IMappingElement.LESS_GENERAL == relation) { String tmp = "-" + sourceVarNumber + " " + targetVarNumber + " 0\n"; //if not already present add to axioms if (-1 == axioms.indexOf(tmp)) { axioms.append(tmp); numberOfClauses++; } } else if (IMappingElement.MORE_GENERAL == relation) { String tmp = sourceVarNumber + " -" + targetVarNumber + " 0\n"; if (-1 == axioms.indexOf(tmp)) { axioms.append(tmp); numberOfClauses++; } } else if (IMappingElement.EQUIVALENCE == relation) { if (!sourceVarNumber.equals(targetVarNumber)) { //add clauses for less and more generality String tmp = "-" + sourceVarNumber + " " + targetVarNumber + " 0\n"; if (-1 == axioms.indexOf(tmp)) { axioms.append(tmp); numberOfClauses++; } tmp = sourceVarNumber + " -" + targetVarNumber + " 0\n"; if (-1 == axioms.indexOf(tmp)) { axioms.append(tmp); numberOfClauses++; } } } else if (IMappingElement.DISJOINT == relation) { String tmp = "-" + sourceVarNumber + " -" + targetVarNumber + " 0\n"; if (-1 == axioms.indexOf(tmp)) { axioms.append(tmp); numberOfClauses++; } } } } } } return new Object[]{axioms.toString(), numberOfClauses}; }
java
protected static Object[] mkAxioms(HashMap<IAtomicConceptOfLabel, String> hashConceptNumber, Map<INode, ArrayList<IAtomicConceptOfLabel>> nmtAcols, Map<String, IAtomicConceptOfLabel> sourceACoLs, Map<String, IAtomicConceptOfLabel> targetACoLs, IContextMapping<IAtomicConceptOfLabel> acolMapping, INode sourceNode, INode targetNode) { StringBuilder axioms = new StringBuilder(); Integer numberOfClauses = 0; // create DIMACS variables for all acols in the matching task createVariables(hashConceptNumber, nmtAcols, sourceACoLs, sourceNode); createVariables(hashConceptNumber, nmtAcols, targetACoLs, targetNode); ArrayList<IAtomicConceptOfLabel> sourceACols = nmtAcols.get(sourceNode); ArrayList<IAtomicConceptOfLabel> targetACols = nmtAcols.get(targetNode); if (null != sourceACols && null != targetACols) { for (IAtomicConceptOfLabel sourceACoL : sourceACols) { for (IAtomicConceptOfLabel targetACoL : targetACols) { char relation = acolMapping.getRelation(sourceACoL, targetACoL); if (IMappingElement.IDK != relation) { //get the numbers of DIMACS variables corresponding to ACoLs String sourceVarNumber = hashConceptNumber.get(sourceACoL); String targetVarNumber = hashConceptNumber.get(targetACoL); if (IMappingElement.LESS_GENERAL == relation) { String tmp = "-" + sourceVarNumber + " " + targetVarNumber + " 0\n"; //if not already present add to axioms if (-1 == axioms.indexOf(tmp)) { axioms.append(tmp); numberOfClauses++; } } else if (IMappingElement.MORE_GENERAL == relation) { String tmp = sourceVarNumber + " -" + targetVarNumber + " 0\n"; if (-1 == axioms.indexOf(tmp)) { axioms.append(tmp); numberOfClauses++; } } else if (IMappingElement.EQUIVALENCE == relation) { if (!sourceVarNumber.equals(targetVarNumber)) { //add clauses for less and more generality String tmp = "-" + sourceVarNumber + " " + targetVarNumber + " 0\n"; if (-1 == axioms.indexOf(tmp)) { axioms.append(tmp); numberOfClauses++; } tmp = sourceVarNumber + " -" + targetVarNumber + " 0\n"; if (-1 == axioms.indexOf(tmp)) { axioms.append(tmp); numberOfClauses++; } } } else if (IMappingElement.DISJOINT == relation) { String tmp = "-" + sourceVarNumber + " -" + targetVarNumber + " 0\n"; if (-1 == axioms.indexOf(tmp)) { axioms.append(tmp); numberOfClauses++; } } } } } } return new Object[]{axioms.toString(), numberOfClauses}; }
[ "protected", "static", "Object", "[", "]", "mkAxioms", "(", "HashMap", "<", "IAtomicConceptOfLabel", ",", "String", ">", "hashConceptNumber", ",", "Map", "<", "INode", ",", "ArrayList", "<", "IAtomicConceptOfLabel", ">", ">", "nmtAcols", ",", "Map", "<", "String", ",", "IAtomicConceptOfLabel", ">", "sourceACoLs", ",", "Map", "<", "String", ",", "IAtomicConceptOfLabel", ">", "targetACoLs", ",", "IContextMapping", "<", "IAtomicConceptOfLabel", ">", "acolMapping", ",", "INode", "sourceNode", ",", "INode", "targetNode", ")", "{", "StringBuilder", "axioms", "=", "new", "StringBuilder", "(", ")", ";", "Integer", "numberOfClauses", "=", "0", ";", "// create DIMACS variables for all acols in the matching task\r", "createVariables", "(", "hashConceptNumber", ",", "nmtAcols", ",", "sourceACoLs", ",", "sourceNode", ")", ";", "createVariables", "(", "hashConceptNumber", ",", "nmtAcols", ",", "targetACoLs", ",", "targetNode", ")", ";", "ArrayList", "<", "IAtomicConceptOfLabel", ">", "sourceACols", "=", "nmtAcols", ".", "get", "(", "sourceNode", ")", ";", "ArrayList", "<", "IAtomicConceptOfLabel", ">", "targetACols", "=", "nmtAcols", ".", "get", "(", "targetNode", ")", ";", "if", "(", "null", "!=", "sourceACols", "&&", "null", "!=", "targetACols", ")", "{", "for", "(", "IAtomicConceptOfLabel", "sourceACoL", ":", "sourceACols", ")", "{", "for", "(", "IAtomicConceptOfLabel", "targetACoL", ":", "targetACols", ")", "{", "char", "relation", "=", "acolMapping", ".", "getRelation", "(", "sourceACoL", ",", "targetACoL", ")", ";", "if", "(", "IMappingElement", ".", "IDK", "!=", "relation", ")", "{", "//get the numbers of DIMACS variables corresponding to ACoLs\r", "String", "sourceVarNumber", "=", "hashConceptNumber", ".", "get", "(", "sourceACoL", ")", ";", "String", "targetVarNumber", "=", "hashConceptNumber", ".", "get", "(", "targetACoL", ")", ";", "if", "(", "IMappingElement", ".", "LESS_GENERAL", "==", "relation", ")", "{", "String", "tmp", "=", "\"-\"", "+", "sourceVarNumber", "+", "\" \"", "+", "targetVarNumber", "+", "\" 0\\n\"", ";", "//if not already present add to axioms\r", "if", "(", "-", "1", "==", "axioms", ".", "indexOf", "(", "tmp", ")", ")", "{", "axioms", ".", "append", "(", "tmp", ")", ";", "numberOfClauses", "++", ";", "}", "}", "else", "if", "(", "IMappingElement", ".", "MORE_GENERAL", "==", "relation", ")", "{", "String", "tmp", "=", "sourceVarNumber", "+", "\" -\"", "+", "targetVarNumber", "+", "\" 0\\n\"", ";", "if", "(", "-", "1", "==", "axioms", ".", "indexOf", "(", "tmp", ")", ")", "{", "axioms", ".", "append", "(", "tmp", ")", ";", "numberOfClauses", "++", ";", "}", "}", "else", "if", "(", "IMappingElement", ".", "EQUIVALENCE", "==", "relation", ")", "{", "if", "(", "!", "sourceVarNumber", ".", "equals", "(", "targetVarNumber", ")", ")", "{", "//add clauses for less and more generality\r", "String", "tmp", "=", "\"-\"", "+", "sourceVarNumber", "+", "\" \"", "+", "targetVarNumber", "+", "\" 0\\n\"", ";", "if", "(", "-", "1", "==", "axioms", ".", "indexOf", "(", "tmp", ")", ")", "{", "axioms", ".", "append", "(", "tmp", ")", ";", "numberOfClauses", "++", ";", "}", "tmp", "=", "sourceVarNumber", "+", "\" -\"", "+", "targetVarNumber", "+", "\" 0\\n\"", ";", "if", "(", "-", "1", "==", "axioms", ".", "indexOf", "(", "tmp", ")", ")", "{", "axioms", ".", "append", "(", "tmp", ")", ";", "numberOfClauses", "++", ";", "}", "}", "}", "else", "if", "(", "IMappingElement", ".", "DISJOINT", "==", "relation", ")", "{", "String", "tmp", "=", "\"-\"", "+", "sourceVarNumber", "+", "\" -\"", "+", "targetVarNumber", "+", "\" 0\\n\"", ";", "if", "(", "-", "1", "==", "axioms", ".", "indexOf", "(", "tmp", ")", ")", "{", "axioms", ".", "append", "(", "tmp", ")", ";", "numberOfClauses", "++", ";", "}", "}", "}", "}", "}", "}", "return", "new", "Object", "[", "]", "{", "axioms", ".", "toString", "(", ")", ",", "numberOfClauses", "}", ";", "}" ]
Makes axioms for a CNF formula out of relations between atomic concepts. @param hashConceptNumber HashMap for atomic concept of labels with its id @param nmtAcols node -> list of node matching task acols @param sourceACoLs acol id -> acol object @param targetACoLs acol id -> acol object @param acolMapping mapping between atomic concepts @param sourceNode source node @param targetNode target node @return axiom string and axiom count
[ "Makes", "axioms", "for", "a", "CNF", "formula", "out", "of", "relations", "between", "atomic", "concepts", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/structure/node/BaseNodeMatcher.java#L58-L119
147,588
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/structure/node/BaseNodeMatcher.java
BaseNodeMatcher.DIMACSfromList
protected static String DIMACSfromList(ArrayList<ArrayList<String>> formula) { StringBuilder dimacs = new StringBuilder(""); for (List<String> conjClause : formula) { for (String disjClause : conjClause) { dimacs.append(disjClause).append(" "); } dimacs.append(" 0\n"); } return dimacs.toString(); }
java
protected static String DIMACSfromList(ArrayList<ArrayList<String>> formula) { StringBuilder dimacs = new StringBuilder(""); for (List<String> conjClause : formula) { for (String disjClause : conjClause) { dimacs.append(disjClause).append(" "); } dimacs.append(" 0\n"); } return dimacs.toString(); }
[ "protected", "static", "String", "DIMACSfromList", "(", "ArrayList", "<", "ArrayList", "<", "String", ">", ">", "formula", ")", "{", "StringBuilder", "dimacs", "=", "new", "StringBuilder", "(", "\"\"", ")", ";", "for", "(", "List", "<", "String", ">", "conjClause", ":", "formula", ")", "{", "for", "(", "String", "disjClause", ":", "conjClause", ")", "{", "dimacs", ".", "append", "(", "disjClause", ")", ".", "append", "(", "\" \"", ")", ";", "}", "dimacs", ".", "append", "(", "\" 0\\n\"", ")", ";", "}", "return", "dimacs", ".", "toString", "(", ")", ";", "}" ]
Converts parsed formula into DIMACS format. @param formula parsed formula @return formula in DIMACS format
[ "Converts", "parsed", "formula", "into", "DIMACS", "format", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/structure/node/BaseNodeMatcher.java#L208-L217
147,589
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/swing/UserPreferences.java
UserPreferences.getFileChooser
public static JFileChooser getFileChooser(final String id) { JFileChooser chooser = new JFileChooser(); track(chooser, "FileChooser." + id + ".path"); return chooser; }
java
public static JFileChooser getFileChooser(final String id) { JFileChooser chooser = new JFileChooser(); track(chooser, "FileChooser." + id + ".path"); return chooser; }
[ "public", "static", "JFileChooser", "getFileChooser", "(", "final", "String", "id", ")", "{", "JFileChooser", "chooser", "=", "new", "JFileChooser", "(", ")", ";", "track", "(", "chooser", ",", "\"FileChooser.\"", "+", "id", "+", "\".path\"", ")", ";", "return", "chooser", ";", "}" ]
Gets the file chooser with the given id. Its current directory will be tracked and restored on subsequent calls. @param id @return the file chooser with the given id
[ "Gets", "the", "file", "chooser", "with", "the", "given", "id", ".", "Its", "current", "directory", "will", "be", "tracked", "and", "restored", "on", "subsequent", "calls", "." ]
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/UserPreferences.java#L112-L116
147,590
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/swing/UserPreferences.java
UserPreferences.getDirectoryChooser
public static JFileChooser getDirectoryChooser(String id) { JFileChooser chooser; Class<?> directoryChooserClass; try { directoryChooserClass = Class .forName("com.l2fprod.common.swing.JDirectoryChooser"); chooser = (JFileChooser) directoryChooserClass.newInstance(); } catch (ClassNotFoundException ex) { chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); } catch (InstantiationException ex) { chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); } catch (IllegalAccessException ex) { chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); } track(chooser, "DirectoryChooser." + id + ".path"); return chooser; }
java
public static JFileChooser getDirectoryChooser(String id) { JFileChooser chooser; Class<?> directoryChooserClass; try { directoryChooserClass = Class .forName("com.l2fprod.common.swing.JDirectoryChooser"); chooser = (JFileChooser) directoryChooserClass.newInstance(); } catch (ClassNotFoundException ex) { chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); } catch (InstantiationException ex) { chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); } catch (IllegalAccessException ex) { chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); } track(chooser, "DirectoryChooser." + id + ".path"); return chooser; }
[ "public", "static", "JFileChooser", "getDirectoryChooser", "(", "String", "id", ")", "{", "JFileChooser", "chooser", ";", "Class", "<", "?", ">", "directoryChooserClass", ";", "try", "{", "directoryChooserClass", "=", "Class", ".", "forName", "(", "\"com.l2fprod.common.swing.JDirectoryChooser\"", ")", ";", "chooser", "=", "(", "JFileChooser", ")", "directoryChooserClass", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "ClassNotFoundException", "ex", ")", "{", "chooser", "=", "new", "JFileChooser", "(", ")", ";", "chooser", ".", "setFileSelectionMode", "(", "JFileChooser", ".", "DIRECTORIES_ONLY", ")", ";", "}", "catch", "(", "InstantiationException", "ex", ")", "{", "chooser", "=", "new", "JFileChooser", "(", ")", ";", "chooser", ".", "setFileSelectionMode", "(", "JFileChooser", ".", "DIRECTORIES_ONLY", ")", ";", "}", "catch", "(", "IllegalAccessException", "ex", ")", "{", "chooser", "=", "new", "JFileChooser", "(", ")", ";", "chooser", ".", "setFileSelectionMode", "(", "JFileChooser", ".", "DIRECTORIES_ONLY", ")", ";", "}", "track", "(", "chooser", ",", "\"DirectoryChooser.\"", "+", "id", "+", "\".path\"", ")", ";", "return", "chooser", ";", "}" ]
Gets the directory chooser with the given id. Its current directory will be tracked and restored on subsequent calls. @param id @return the directory chooser with the given id
[ "Gets", "the", "directory", "chooser", "with", "the", "given", "id", ".", "Its", "current", "directory", "will", "be", "tracked", "and", "restored", "on", "subsequent", "calls", "." ]
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/UserPreferences.java#L125-L144
147,591
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/swing/UserPreferences.java
UserPreferences.track
public static void track(Window window) { Preferences prefs = node().node("Windows"); String bounds = prefs.get(window.getName() + ".bounds", null); if (bounds != null) { Rectangle rect = (Rectangle) ConverterRegistry.instance().convert( Rectangle.class, bounds); window.setBounds(rect); } window.addComponentListener(WINDOW_DIMENSIONS); }
java
public static void track(Window window) { Preferences prefs = node().node("Windows"); String bounds = prefs.get(window.getName() + ".bounds", null); if (bounds != null) { Rectangle rect = (Rectangle) ConverterRegistry.instance().convert( Rectangle.class, bounds); window.setBounds(rect); } window.addComponentListener(WINDOW_DIMENSIONS); }
[ "public", "static", "void", "track", "(", "Window", "window", ")", "{", "Preferences", "prefs", "=", "node", "(", ")", ".", "node", "(", "\"Windows\"", ")", ";", "String", "bounds", "=", "prefs", ".", "get", "(", "window", ".", "getName", "(", ")", "+", "\".bounds\"", ",", "null", ")", ";", "if", "(", "bounds", "!=", "null", ")", "{", "Rectangle", "rect", "=", "(", "Rectangle", ")", "ConverterRegistry", ".", "instance", "(", ")", ".", "convert", "(", "Rectangle", ".", "class", ",", "bounds", ")", ";", "window", ".", "setBounds", "(", "rect", ")", ";", "}", "window", ".", "addComponentListener", "(", "WINDOW_DIMENSIONS", ")", ";", "}" ]
Restores the window size, position and state if possible. Tracks the window size, position and state. @param window
[ "Restores", "the", "window", "size", "position", "and", "state", "if", "possible", ".", "Tracks", "the", "window", "size", "position", "and", "state", "." ]
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/UserPreferences.java#L190-L201
147,592
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/param/AbstractCliParam.java
AbstractCliParam.parse
@Override public T parse(String arg) throws ParseException { if (isNull(arg)) { if (nullable) { return null; } else { throw new ParseException(ParseError.INVALID_PARAM, "Parameter doesn't take 'null' values: " + getName()); } } return parseNonNull(arg); }
java
@Override public T parse(String arg) throws ParseException { if (isNull(arg)) { if (nullable) { return null; } else { throw new ParseException(ParseError.INVALID_PARAM, "Parameter doesn't take 'null' values: " + getName()); } } return parseNonNull(arg); }
[ "@", "Override", "public", "T", "parse", "(", "String", "arg", ")", "throws", "ParseException", "{", "if", "(", "isNull", "(", "arg", ")", ")", "{", "if", "(", "nullable", ")", "{", "return", "null", ";", "}", "else", "{", "throw", "new", "ParseException", "(", "ParseError", ".", "INVALID_PARAM", ",", "\"Parameter doesn't take 'null' values: \"", "+", "getName", "(", ")", ")", ";", "}", "}", "return", "parseNonNull", "(", "arg", ")", ";", "}" ]
Type specialization - subclasses must parse a value of type T.
[ "Type", "specialization", "-", "subclasses", "must", "parse", "a", "value", "of", "type", "T", "." ]
4615edef7c76288ad5ea8d678132b161645ca1e3
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/param/AbstractCliParam.java#L73-L83
147,593
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/SingleFieldBuilder.java
SingleFieldBuilder.setMessage
public SingleFieldBuilder<MType, BType, IType> setMessage( MType message) { if (message == null) { throw new NullPointerException(); } this.message = message; if (builder != null) { builder.dispose(); builder = null; } onChanged(); return this; }
java
public SingleFieldBuilder<MType, BType, IType> setMessage( MType message) { if (message == null) { throw new NullPointerException(); } this.message = message; if (builder != null) { builder.dispose(); builder = null; } onChanged(); return this; }
[ "public", "SingleFieldBuilder", "<", "MType", ",", "BType", ",", "IType", ">", "setMessage", "(", "MType", "message", ")", "{", "if", "(", "message", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "this", ".", "message", "=", "message", ";", "if", "(", "builder", "!=", "null", ")", "{", "builder", ".", "dispose", "(", ")", ";", "builder", "=", "null", ";", "}", "onChanged", "(", ")", ";", "return", "this", ";", "}" ]
Sets a message for the field replacing any existing value. @param message the message to set @return the builder
[ "Sets", "a", "message", "for", "the", "field", "replacing", "any", "existing", "value", "." ]
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/SingleFieldBuilder.java#L170-L182
147,594
udoprog/ffwd-client-java
src/main/java/com/google/protobuf250/SingleFieldBuilder.java
SingleFieldBuilder.mergeFrom
public SingleFieldBuilder<MType, BType, IType> mergeFrom( MType value) { if (builder == null && message == message.getDefaultInstanceForType()) { message = value; } else { getBuilder().mergeFrom(value); } onChanged(); return this; }
java
public SingleFieldBuilder<MType, BType, IType> mergeFrom( MType value) { if (builder == null && message == message.getDefaultInstanceForType()) { message = value; } else { getBuilder().mergeFrom(value); } onChanged(); return this; }
[ "public", "SingleFieldBuilder", "<", "MType", ",", "BType", ",", "IType", ">", "mergeFrom", "(", "MType", "value", ")", "{", "if", "(", "builder", "==", "null", "&&", "message", "==", "message", ".", "getDefaultInstanceForType", "(", ")", ")", "{", "message", "=", "value", ";", "}", "else", "{", "getBuilder", "(", ")", ".", "mergeFrom", "(", "value", ")", ";", "}", "onChanged", "(", ")", ";", "return", "this", ";", "}" ]
Merges the field from another field. @param value the value to merge from @return the builder
[ "Merges", "the", "field", "from", "another", "field", "." ]
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/SingleFieldBuilder.java#L190-L199
147,595
udoprog/ffwd-client-java
src/main/java/eu/toolchain/ffwd/FastForward.java
FastForward.setup
public static FastForward setup(InetAddress addr, int port) throws SocketException { final DatagramSocket socket = new DatagramSocket(); return new FastForward(addr, port, socket); }
java
public static FastForward setup(InetAddress addr, int port) throws SocketException { final DatagramSocket socket = new DatagramSocket(); return new FastForward(addr, port, socket); }
[ "public", "static", "FastForward", "setup", "(", "InetAddress", "addr", ",", "int", "port", ")", "throws", "SocketException", "{", "final", "DatagramSocket", "socket", "=", "new", "DatagramSocket", "(", ")", ";", "return", "new", "FastForward", "(", "addr", ",", "port", ",", "socket", ")", ";", "}" ]
Initialization method for a FastForward client. @return A new instance of a FastForward client. @throws SocketException If a datagram socket cannot be created.
[ "Initialization", "method", "for", "a", "FastForward", "client", "." ]
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/eu/toolchain/ffwd/FastForward.java#L40-L43
147,596
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/structure/node/OptimizedStageNodeMatcher.java
OptimizedStageNodeMatcher.nodeDisjoint
public boolean nodeDisjoint(IContextMapping<IAtomicConceptOfLabel> acolMapping, Map<INode, ArrayList<IAtomicConceptOfLabel>> nmtAcols, Map<String, IAtomicConceptOfLabel> sourceACoLs, Map<String, IAtomicConceptOfLabel> targetACoLs, INode sourceNode, INode targetNode) throws NodeMatcherException { boolean result = false; String sourceCNodeFormula = sourceNode.getNodeData().getcNodeFormula(); String targetCNodeFormula = targetNode.getNodeData().getcNodeFormula(); String sourceCLabFormula = sourceNode.getNodeData().getcLabFormula(); String targetCLabFormula = targetNode.getNodeData().getcLabFormula(); if (null != sourceCNodeFormula && null != targetCNodeFormula && !sourceCNodeFormula.isEmpty() && !targetCNodeFormula.isEmpty() && null != sourceCLabFormula && null != targetCLabFormula && !sourceCLabFormula.isEmpty() && !targetCLabFormula.isEmpty() ) { HashMap<IAtomicConceptOfLabel, String> hashConceptNumber = new HashMap<IAtomicConceptOfLabel, String>(); Object[] obj = mkAxioms(hashConceptNumber, nmtAcols, sourceACoLs, targetACoLs, acolMapping, sourceNode, targetNode); String axioms = (String) obj[0]; int num_of_axiom_clauses = (Integer) obj[1]; ArrayList<ArrayList<String>> contextA = parseFormula(hashConceptNumber, sourceACoLs, sourceNode); ArrayList<ArrayList<String>> contextB = parseFormula(hashConceptNumber, targetACoLs, targetNode); String contextAInDIMACSFormat = DIMACSfromList(contextA); String contextBInDIMACSFormat = DIMACSfromList(contextB); String satProblemInDIMACS = axioms + contextBInDIMACSFormat + contextAInDIMACSFormat; int numberOfClauses = contextA.size() + contextB.size() + num_of_axiom_clauses; int numberOfVariables = hashConceptNumber.size(); String DIMACSproblem = "p cnf " + numberOfVariables + " " + numberOfClauses + "\n" + satProblemInDIMACS; result = isUnsatisfiable(DIMACSproblem); } return result; }
java
public boolean nodeDisjoint(IContextMapping<IAtomicConceptOfLabel> acolMapping, Map<INode, ArrayList<IAtomicConceptOfLabel>> nmtAcols, Map<String, IAtomicConceptOfLabel> sourceACoLs, Map<String, IAtomicConceptOfLabel> targetACoLs, INode sourceNode, INode targetNode) throws NodeMatcherException { boolean result = false; String sourceCNodeFormula = sourceNode.getNodeData().getcNodeFormula(); String targetCNodeFormula = targetNode.getNodeData().getcNodeFormula(); String sourceCLabFormula = sourceNode.getNodeData().getcLabFormula(); String targetCLabFormula = targetNode.getNodeData().getcLabFormula(); if (null != sourceCNodeFormula && null != targetCNodeFormula && !sourceCNodeFormula.isEmpty() && !targetCNodeFormula.isEmpty() && null != sourceCLabFormula && null != targetCLabFormula && !sourceCLabFormula.isEmpty() && !targetCLabFormula.isEmpty() ) { HashMap<IAtomicConceptOfLabel, String> hashConceptNumber = new HashMap<IAtomicConceptOfLabel, String>(); Object[] obj = mkAxioms(hashConceptNumber, nmtAcols, sourceACoLs, targetACoLs, acolMapping, sourceNode, targetNode); String axioms = (String) obj[0]; int num_of_axiom_clauses = (Integer) obj[1]; ArrayList<ArrayList<String>> contextA = parseFormula(hashConceptNumber, sourceACoLs, sourceNode); ArrayList<ArrayList<String>> contextB = parseFormula(hashConceptNumber, targetACoLs, targetNode); String contextAInDIMACSFormat = DIMACSfromList(contextA); String contextBInDIMACSFormat = DIMACSfromList(contextB); String satProblemInDIMACS = axioms + contextBInDIMACSFormat + contextAInDIMACSFormat; int numberOfClauses = contextA.size() + contextB.size() + num_of_axiom_clauses; int numberOfVariables = hashConceptNumber.size(); String DIMACSproblem = "p cnf " + numberOfVariables + " " + numberOfClauses + "\n" + satProblemInDIMACS; result = isUnsatisfiable(DIMACSproblem); } return result; }
[ "public", "boolean", "nodeDisjoint", "(", "IContextMapping", "<", "IAtomicConceptOfLabel", ">", "acolMapping", ",", "Map", "<", "INode", ",", "ArrayList", "<", "IAtomicConceptOfLabel", ">", ">", "nmtAcols", ",", "Map", "<", "String", ",", "IAtomicConceptOfLabel", ">", "sourceACoLs", ",", "Map", "<", "String", ",", "IAtomicConceptOfLabel", ">", "targetACoLs", ",", "INode", "sourceNode", ",", "INode", "targetNode", ")", "throws", "NodeMatcherException", "{", "boolean", "result", "=", "false", ";", "String", "sourceCNodeFormula", "=", "sourceNode", ".", "getNodeData", "(", ")", ".", "getcNodeFormula", "(", ")", ";", "String", "targetCNodeFormula", "=", "targetNode", ".", "getNodeData", "(", ")", ".", "getcNodeFormula", "(", ")", ";", "String", "sourceCLabFormula", "=", "sourceNode", ".", "getNodeData", "(", ")", ".", "getcLabFormula", "(", ")", ";", "String", "targetCLabFormula", "=", "targetNode", ".", "getNodeData", "(", ")", ".", "getcLabFormula", "(", ")", ";", "if", "(", "null", "!=", "sourceCNodeFormula", "&&", "null", "!=", "targetCNodeFormula", "&&", "!", "sourceCNodeFormula", ".", "isEmpty", "(", ")", "&&", "!", "targetCNodeFormula", ".", "isEmpty", "(", ")", "&&", "null", "!=", "sourceCLabFormula", "&&", "null", "!=", "targetCLabFormula", "&&", "!", "sourceCLabFormula", ".", "isEmpty", "(", ")", "&&", "!", "targetCLabFormula", ".", "isEmpty", "(", ")", ")", "{", "HashMap", "<", "IAtomicConceptOfLabel", ",", "String", ">", "hashConceptNumber", "=", "new", "HashMap", "<", "IAtomicConceptOfLabel", ",", "String", ">", "(", ")", ";", "Object", "[", "]", "obj", "=", "mkAxioms", "(", "hashConceptNumber", ",", "nmtAcols", ",", "sourceACoLs", ",", "targetACoLs", ",", "acolMapping", ",", "sourceNode", ",", "targetNode", ")", ";", "String", "axioms", "=", "(", "String", ")", "obj", "[", "0", "]", ";", "int", "num_of_axiom_clauses", "=", "(", "Integer", ")", "obj", "[", "1", "]", ";", "ArrayList", "<", "ArrayList", "<", "String", ">", ">", "contextA", "=", "parseFormula", "(", "hashConceptNumber", ",", "sourceACoLs", ",", "sourceNode", ")", ";", "ArrayList", "<", "ArrayList", "<", "String", ">", ">", "contextB", "=", "parseFormula", "(", "hashConceptNumber", ",", "targetACoLs", ",", "targetNode", ")", ";", "String", "contextAInDIMACSFormat", "=", "DIMACSfromList", "(", "contextA", ")", ";", "String", "contextBInDIMACSFormat", "=", "DIMACSfromList", "(", "contextB", ")", ";", "String", "satProblemInDIMACS", "=", "axioms", "+", "contextBInDIMACSFormat", "+", "contextAInDIMACSFormat", ";", "int", "numberOfClauses", "=", "contextA", ".", "size", "(", ")", "+", "contextB", ".", "size", "(", ")", "+", "num_of_axiom_clauses", ";", "int", "numberOfVariables", "=", "hashConceptNumber", ".", "size", "(", ")", ";", "String", "DIMACSproblem", "=", "\"p cnf \"", "+", "numberOfVariables", "+", "\" \"", "+", "numberOfClauses", "+", "\"\\n\"", "+", "satProblemInDIMACS", ";", "result", "=", "isUnsatisfiable", "(", "DIMACSproblem", ")", ";", "}", "return", "result", ";", "}" ]
Checks whether source node and target node are disjoint. @param acolMapping mapping between acols @param nmtAcols node -> list of node matching task acols @param sourceACoLs mapping acol id -> acol object @param targetACoLs mapping acol id -> acol object @param sourceNode interface of source node @param targetNode interface of target node @return true if the nodes are in disjoint relation @throws NodeMatcherException NodeMatcherException
[ "Checks", "whether", "source", "node", "and", "target", "node", "are", "disjoint", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/structure/node/OptimizedStageNodeMatcher.java#L31-L62
147,597
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/structure/node/OptimizedStageNodeMatcher.java
OptimizedStageNodeMatcher.nodeMatch
public char nodeMatch(IContextMapping<IAtomicConceptOfLabel> acolMapping, Map<INode, ArrayList<IAtomicConceptOfLabel>> nmtAcols, Map<String, IAtomicConceptOfLabel> sourceACoLs, Map<String, IAtomicConceptOfLabel> targetACoLs, INode sourceNode, INode targetNode) throws NodeMatcherException { throw new NodeMatcherException("Unsupported operation"); }
java
public char nodeMatch(IContextMapping<IAtomicConceptOfLabel> acolMapping, Map<INode, ArrayList<IAtomicConceptOfLabel>> nmtAcols, Map<String, IAtomicConceptOfLabel> sourceACoLs, Map<String, IAtomicConceptOfLabel> targetACoLs, INode sourceNode, INode targetNode) throws NodeMatcherException { throw new NodeMatcherException("Unsupported operation"); }
[ "public", "char", "nodeMatch", "(", "IContextMapping", "<", "IAtomicConceptOfLabel", ">", "acolMapping", ",", "Map", "<", "INode", ",", "ArrayList", "<", "IAtomicConceptOfLabel", ">", ">", "nmtAcols", ",", "Map", "<", "String", ",", "IAtomicConceptOfLabel", ">", "sourceACoLs", ",", "Map", "<", "String", ",", "IAtomicConceptOfLabel", ">", "targetACoLs", ",", "INode", "sourceNode", ",", "INode", "targetNode", ")", "throws", "NodeMatcherException", "{", "throw", "new", "NodeMatcherException", "(", "\"Unsupported operation\"", ")", ";", "}" ]
stub to allow it to be created as node matcher.
[ "stub", "to", "allow", "it", "to", "be", "created", "as", "node", "matcher", "." ]
ba5982ef406b7010c2f92592e43887a485935aa1
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/structure/node/OptimizedStageNodeMatcher.java#L133-L139
147,598
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java
PropertySheetTable.initDefaultColors
private void initDefaultColors() { this.categoryBackground = UIManager.getColor(PANEL_BACKGROUND_COLOR_KEY); this.categoryForeground = UIManager.getColor(TABLE_FOREGROUND_COLOR_KEY).darker().darker().darker(); this.selectedCategoryBackground = categoryBackground.darker(); this.selectedCategoryForeground = categoryForeground; this.propertyBackground = UIManager.getColor(TABLE_BACKGROUND_COLOR_KEY); this.propertyForeground = UIManager.getColor(TABLE_FOREGROUND_COLOR_KEY); this.selectedPropertyBackground = UIManager .getColor(TABLE_SELECTED_BACKGROUND_COLOR_KEY); this.selectedPropertyForeground = UIManager .getColor(TABLE_SELECTED_FOREGROUND_COLOR_KEY); setGridColor(categoryBackground); }
java
private void initDefaultColors() { this.categoryBackground = UIManager.getColor(PANEL_BACKGROUND_COLOR_KEY); this.categoryForeground = UIManager.getColor(TABLE_FOREGROUND_COLOR_KEY).darker().darker().darker(); this.selectedCategoryBackground = categoryBackground.darker(); this.selectedCategoryForeground = categoryForeground; this.propertyBackground = UIManager.getColor(TABLE_BACKGROUND_COLOR_KEY); this.propertyForeground = UIManager.getColor(TABLE_FOREGROUND_COLOR_KEY); this.selectedPropertyBackground = UIManager .getColor(TABLE_SELECTED_BACKGROUND_COLOR_KEY); this.selectedPropertyForeground = UIManager .getColor(TABLE_SELECTED_FOREGROUND_COLOR_KEY); setGridColor(categoryBackground); }
[ "private", "void", "initDefaultColors", "(", ")", "{", "this", ".", "categoryBackground", "=", "UIManager", ".", "getColor", "(", "PANEL_BACKGROUND_COLOR_KEY", ")", ";", "this", ".", "categoryForeground", "=", "UIManager", ".", "getColor", "(", "TABLE_FOREGROUND_COLOR_KEY", ")", ".", "darker", "(", ")", ".", "darker", "(", ")", ".", "darker", "(", ")", ";", "this", ".", "selectedCategoryBackground", "=", "categoryBackground", ".", "darker", "(", ")", ";", "this", ".", "selectedCategoryForeground", "=", "categoryForeground", ";", "this", ".", "propertyBackground", "=", "UIManager", ".", "getColor", "(", "TABLE_BACKGROUND_COLOR_KEY", ")", ";", "this", ".", "propertyForeground", "=", "UIManager", ".", "getColor", "(", "TABLE_FOREGROUND_COLOR_KEY", ")", ";", "this", ".", "selectedPropertyBackground", "=", "UIManager", ".", "getColor", "(", "TABLE_SELECTED_BACKGROUND_COLOR_KEY", ")", ";", "this", ".", "selectedPropertyForeground", "=", "UIManager", ".", "getColor", "(", "TABLE_SELECTED_FOREGROUND_COLOR_KEY", ")", ";", "setGridColor", "(", "categoryBackground", ")", ";", "}" ]
Initializes the default set of colors used by the PropertySheetTable. @see #categoryBackground @see #categoryForeground @see #selectedCategoryBackground @see #selectedCategoryForeground @see #propertyBackground @see #propertyForeground @see #selectedPropertyBackground @see #selectedPropertyForeground
[ "Initializes", "the", "default", "set", "of", "colors", "used", "by", "the", "PropertySheetTable", "." ]
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java#L153-L169
147,599
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java
PropertySheetTable.getCellEditor
@Override public TableCellEditor getCellEditor(int row, int column) { if (column == 0) { return null; } Item item = getSheetModel().getPropertySheetElement(row); if (!item.isProperty()) { return null; } TableCellEditor result = null; Property propery = item.getProperty(); PropertyEditor editor = getEditorFactory().createPropertyEditor(propery); if (editor != null) { result = new CellEditorAdapter(editor); } return result; }
java
@Override public TableCellEditor getCellEditor(int row, int column) { if (column == 0) { return null; } Item item = getSheetModel().getPropertySheetElement(row); if (!item.isProperty()) { return null; } TableCellEditor result = null; Property propery = item.getProperty(); PropertyEditor editor = getEditorFactory().createPropertyEditor(propery); if (editor != null) { result = new CellEditorAdapter(editor); } return result; }
[ "@", "Override", "public", "TableCellEditor", "getCellEditor", "(", "int", "row", ",", "int", "column", ")", "{", "if", "(", "column", "==", "0", ")", "{", "return", "null", ";", "}", "Item", "item", "=", "getSheetModel", "(", ")", ".", "getPropertySheetElement", "(", "row", ")", ";", "if", "(", "!", "item", ".", "isProperty", "(", ")", ")", "{", "return", "null", ";", "}", "TableCellEditor", "result", "=", "null", ";", "Property", "propery", "=", "item", ".", "getProperty", "(", ")", ";", "PropertyEditor", "editor", "=", "getEditorFactory", "(", ")", ".", "createPropertyEditor", "(", "propery", ")", ";", "if", "(", "editor", "!=", "null", ")", "{", "result", "=", "new", "CellEditorAdapter", "(", "editor", ")", ";", "}", "return", "result", ";", "}" ]
Gets the CellEditor for the given row and column. It uses the editor registry to find a suitable editor for the property. @return @see javax.swing.JTable#getCellEditor(int, int)
[ "Gets", "the", "CellEditor", "for", "the", "given", "row", "and", "column", ".", "It", "uses", "the", "editor", "registry", "to", "find", "a", "suitable", "editor", "for", "the", "property", "." ]
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java#L337-L356