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
partition
stringclasses
1 value
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/chart/raphael/ShapeCollection.java
ShapeCollection.remove
public void remove( Widget w ) { int index = indexOf( w ); if( index == -1 ) { throw new NoSuchElementException(); } remove( index ); }
java
public void remove( Widget w ) { int index = indexOf( w ); if( index == -1 ) { throw new NoSuchElementException(); } remove( index ); }
[ "public", "void", "remove", "(", "Widget", "w", ")", "{", "int", "index", "=", "indexOf", "(", "w", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "throw", "new", "NoSuchElementException", "(", ")", ";", "}", "remove", "(", "index", ")", ...
Removes the specified widget. @param w the widget to be removed @throws NoSuchElementException if the widget is not present
[ "Removes", "the", "specified", "widget", "." ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/chart/raphael/ShapeCollection.java#L218-L227
train
ltearno/hexa.tools
hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/PropertyValues.java
PropertyValues.getSetterPropertyType
Class<?> getSetterPropertyType( Clazz<?> clazz, String name ) { ClassInfoCache cache = retrieveCache( clazz ); Class<?> res = cache.getSetterType( name ); if( res != null ) return res; String setterName = "set" + capitalizeFirstLetter( name ); Method setter = clazz.getMethod( setterName ); if( setter != null && setter.getParameterTypes().size() == 1 ) { res = setter.getParameterTypes().get( 0 ); } else { Field field = clazz.getAllField( name ); if( field != null ) res = field.getType(); } if( res != null ) cache.setSetterType( name, res ); return res; }
java
Class<?> getSetterPropertyType( Clazz<?> clazz, String name ) { ClassInfoCache cache = retrieveCache( clazz ); Class<?> res = cache.getSetterType( name ); if( res != null ) return res; String setterName = "set" + capitalizeFirstLetter( name ); Method setter = clazz.getMethod( setterName ); if( setter != null && setter.getParameterTypes().size() == 1 ) { res = setter.getParameterTypes().get( 0 ); } else { Field field = clazz.getAllField( name ); if( field != null ) res = field.getType(); } if( res != null ) cache.setSetterType( name, res ); return res; }
[ "Class", "<", "?", ">", "getSetterPropertyType", "(", "Clazz", "<", "?", ">", "clazz", ",", "String", "name", ")", "{", "ClassInfoCache", "cache", "=", "retrieveCache", "(", "clazz", ")", ";", "Class", "<", "?", ">", "res", "=", "cache", ".", "getSette...
Returns the class of the setter property. It can be this of the setter or of the field
[ "Returns", "the", "class", "of", "the", "setter", "property", ".", "It", "can", "be", "this", "of", "the", "setter", "or", "of", "the", "field" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/PropertyValues.java#L151-L175
train
ltearno/hexa.tools
hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/PropertyValues.java
PropertyValues.hasObjectDynamicProperty
boolean hasObjectDynamicProperty( Object object, String propertyName ) { DynamicPropertyBag bag = propertyBagAccess.getObjectDynamicPropertyBag( object ); return bag != null && bag.contains( propertyName ); }
java
boolean hasObjectDynamicProperty( Object object, String propertyName ) { DynamicPropertyBag bag = propertyBagAccess.getObjectDynamicPropertyBag( object ); return bag != null && bag.contains( propertyName ); }
[ "boolean", "hasObjectDynamicProperty", "(", "Object", "object", ",", "String", "propertyName", ")", "{", "DynamicPropertyBag", "bag", "=", "propertyBagAccess", ".", "getObjectDynamicPropertyBag", "(", "object", ")", ";", "return", "bag", "!=", "null", "&&", "bag", ...
Whether a dynamic property value has already been set on this object
[ "Whether", "a", "dynamic", "property", "value", "has", "already", "been", "set", "on", "this", "object" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/PropertyValues.java#L229-L233
train
ltearno/hexa.tools
hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/tools/SmartRegistration.java
SmartRegistration.register
public void register( Object source, String path ) { unregister(); dataBinding = Binder.bind( source, path ).mode( Mode.OneWay ).to( adapter ).activate(); }
java
public void register( Object source, String path ) { unregister(); dataBinding = Binder.bind( source, path ).mode( Mode.OneWay ).to( adapter ).activate(); }
[ "public", "void", "register", "(", "Object", "source", ",", "String", "path", ")", "{", "unregister", "(", ")", ";", "dataBinding", "=", "Binder", ".", "bind", "(", "source", ",", "path", ")", ".", "mode", "(", "Mode", ".", "OneWay", ")", ".", "to", ...
Registers the databinding source. If any previous source was binded, its bindings are freed. @param source The object which is the source of the binding @param path The path of the data
[ "Registers", "the", "databinding", "source", ".", "If", "any", "previous", "source", "was", "binded", "its", "bindings", "are", "freed", "." ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/tools/SmartRegistration.java#L43-L48
train
ltearno/hexa.tools
hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/Binder.java
Binder.bind
public static BindingCreation bind( Object source, String propertyPath ) { return createBinder( new CompositePropertyAdapter( source, propertyPath ) ); }
java
public static BindingCreation bind( Object source, String propertyPath ) { return createBinder( new CompositePropertyAdapter( source, propertyPath ) ); }
[ "public", "static", "BindingCreation", "bind", "(", "Object", "source", ",", "String", "propertyPath", ")", "{", "return", "createBinder", "(", "new", "CompositePropertyAdapter", "(", "source", ",", "propertyPath", ")", ")", ";", "}" ]
First step, accepts a data binding source definition and creates a binder The source value is searched as specified in the @param propertyPath, in the context of the @param source object. For example : <i>...To( customer, "company.address.city" )</i> can be used to access data at different depths. If all intermediary steps provide a correct implementation for the Data Binding mechanism, any change at any depth will be catched. @param source The source object @param propertyPath The source object's property path @return The Binder to continue specifying the data binding
[ "First", "step", "accepts", "a", "data", "binding", "source", "definition", "and", "creates", "a", "binder" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/Binder.java#L56-L59
train
ltearno/hexa.tools
hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/Binder.java
Binder.map
public static DataBinding map( Object source, Object destination ) { return bindObject( source ).mapTo( destination ); }
java
public static DataBinding map( Object source, Object destination ) { return bindObject( source ).mapTo( destination ); }
[ "public", "static", "DataBinding", "map", "(", "Object", "source", ",", "Object", "destination", ")", "{", "return", "bindObject", "(", "source", ")", ".", "mapTo", "(", "destination", ")", ";", "}" ]
Maps two objects together. All matching fields will then be two-way data-bound.
[ "Maps", "two", "objects", "together", ".", "All", "matching", "fields", "will", "then", "be", "two", "-", "way", "data", "-", "bound", "." ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/Binder.java#L94-L97
train
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-rest-client/src/main/java/org/hawkular/bus/restclient/RestClient.java
RestClient.postTopicMessage
public HttpResponse postTopicMessage(String topicName, String jsonPayload, Map<String, String> headers) throws RestClientException { return postMessage(Type.TOPIC, topicName, jsonPayload, headers); }
java
public HttpResponse postTopicMessage(String topicName, String jsonPayload, Map<String, String> headers) throws RestClientException { return postMessage(Type.TOPIC, topicName, jsonPayload, headers); }
[ "public", "HttpResponse", "postTopicMessage", "(", "String", "topicName", ",", "String", "jsonPayload", ",", "Map", "<", "String", ",", "String", ">", "headers", ")", "throws", "RestClientException", "{", "return", "postMessage", "(", "Type", ".", "TOPIC", ",", ...
Sends a message to the REST endpoint in order to put a message on the given topic. @param topicName name of the topic @param jsonPayload the actual message (as a JSON string) to put on the bus @param headers any headers to send with the message (can be null or empty) @return the response @throws RestClientException if the response was not a 200 status code
[ "Sends", "a", "message", "to", "the", "REST", "endpoint", "in", "order", "to", "put", "a", "message", "on", "the", "given", "topic", "." ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-rest-client/src/main/java/org/hawkular/bus/restclient/RestClient.java#L129-L132
train
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-rest-client/src/main/java/org/hawkular/bus/restclient/RestClient.java
RestClient.postQueueMessage
public HttpResponse postQueueMessage(String queueName, String jsonPayload, Map<String, String> headers) throws RestClientException { return postMessage(Type.QUEUE, queueName, jsonPayload, headers); }
java
public HttpResponse postQueueMessage(String queueName, String jsonPayload, Map<String, String> headers) throws RestClientException { return postMessage(Type.QUEUE, queueName, jsonPayload, headers); }
[ "public", "HttpResponse", "postQueueMessage", "(", "String", "queueName", ",", "String", "jsonPayload", ",", "Map", "<", "String", ",", "String", ">", "headers", ")", "throws", "RestClientException", "{", "return", "postMessage", "(", "Type", ".", "QUEUE", ",", ...
Sends a message to the REST endpoint in order to put a message on the given queue. @param queueName name of the queue @param jsonPayload the actual message (as a JSON string) to put on the bus @param headers any headers to send with the message (can be null or empty) @return the response @throws RestClientException if the response was not a 200 status code
[ "Sends", "a", "message", "to", "the", "REST", "endpoint", "in", "order", "to", "put", "a", "message", "on", "the", "given", "queue", "." ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-rest-client/src/main/java/org/hawkular/bus/restclient/RestClient.java#L143-L146
train
ltearno/hexa.tools
hexa.demo.gwt/src/main/java/fr/lteconsulting/hexa/demo/client/databinding/DataBindingDemo.java
DataBindingDemo.run
public void run( AcceptsOneWidget container ) { /** Add our widgets in the container */ container.setWidget( UiBuilder.addIn( new VerticalPanel(), personListWidget, personneForm, categoryForm, nextButton ) ); /* * Bind things together */ // selectedPerson to person form Bind( personListWidget, "selectedPersonne" ).Mode( Mode.OneWay ).Log("PERSONNEFORM").To( personneForm, "personne" ); // maps the selected person's category to the category form Bind( personListWidget, "selectedPersonne.category" ).Mode( Mode.OneWay ).MapTo( categoryForm ); // selected person's description to Window's title Bind( personListWidget, "selectedPersonne.description" ).Mode( Mode.OneWay ).To( new WriteOnlyPropertyAdapter() { @Override public void setValue( Object object ) { Window.setTitle( (String) object ); } } ); /* * Initialize person list widget */ personListWidget.setPersonList( famille ); personListWidget.setSelectedPersonne( famille.get( 0 ) ); nextButton.addClickHandler( nextButtonClickHandler ); }
java
public void run( AcceptsOneWidget container ) { /** Add our widgets in the container */ container.setWidget( UiBuilder.addIn( new VerticalPanel(), personListWidget, personneForm, categoryForm, nextButton ) ); /* * Bind things together */ // selectedPerson to person form Bind( personListWidget, "selectedPersonne" ).Mode( Mode.OneWay ).Log("PERSONNEFORM").To( personneForm, "personne" ); // maps the selected person's category to the category form Bind( personListWidget, "selectedPersonne.category" ).Mode( Mode.OneWay ).MapTo( categoryForm ); // selected person's description to Window's title Bind( personListWidget, "selectedPersonne.description" ).Mode( Mode.OneWay ).To( new WriteOnlyPropertyAdapter() { @Override public void setValue( Object object ) { Window.setTitle( (String) object ); } } ); /* * Initialize person list widget */ personListWidget.setPersonList( famille ); personListWidget.setSelectedPersonne( famille.get( 0 ) ); nextButton.addClickHandler( nextButtonClickHandler ); }
[ "public", "void", "run", "(", "AcceptsOneWidget", "container", ")", "{", "/** Add our widgets in the container */", "container", ".", "setWidget", "(", "UiBuilder", ".", "addIn", "(", "new", "VerticalPanel", "(", ")", ",", "personListWidget", ",", "personneForm", ",...
Runs the demo
[ "Runs", "the", "demo" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.demo.gwt/src/main/java/fr/lteconsulting/hexa/demo/client/databinding/DataBindingDemo.java#L74-L110
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/treetable/TreeTableEditorManager.java
TreeTableEditorManager._RemoveValidator
private void _RemoveValidator( Row item, int column ) { // already clean ? if( m_currentEditedItem == null && m_currentEditedColumn < 0 ) return; // touch the table if( m_callback != null ) m_callback.onTouchCellContent( item, column ); if( m_currentEditor != null ) m_currentEditor.removeFromParent(); m_currentEditor = null; m_currentEditedItem = null; m_currentEditedColumn = -1; }
java
private void _RemoveValidator( Row item, int column ) { // already clean ? if( m_currentEditedItem == null && m_currentEditedColumn < 0 ) return; // touch the table if( m_callback != null ) m_callback.onTouchCellContent( item, column ); if( m_currentEditor != null ) m_currentEditor.removeFromParent(); m_currentEditor = null; m_currentEditedItem = null; m_currentEditedColumn = -1; }
[ "private", "void", "_RemoveValidator", "(", "Row", "item", ",", "int", "column", ")", "{", "// already clean ?", "if", "(", "m_currentEditedItem", "==", "null", "&&", "m_currentEditedColumn", "<", "0", ")", "return", ";", "// touch the table", "if", "(", "m_call...
just replace the validator widget by a text in the table
[ "just", "replace", "the", "validator", "widget", "by", "a", "text", "in", "the", "table" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/treetable/TreeTableEditorManager.java#L108-L124
train
ltearno/hexa.tools
hexa.css-maven-plugin/src/main/java/fr/lteconsulting/hexacssmaven/CssMapper.java
CssMapper.processFile
public static void processFile( String input, String mappingPath, String outputFile, boolean doPrune, Log log ) throws IOException { Set<String> usedClassNames = new HashSet<>(); input = replaceClassNames( input, mappingPath, usedClassNames, log ); log.debug( usedClassNames.size() + " used css classes in the mapping file" ); log.debug( "used css classes : " + usedClassNames ); CssRewriter cssRewriter = new CssRewriter( usedClassNames, doPrune, log ); input = cssRewriter.process( input ); input += "\r\n// generated by HexaCss maven plugin, see http://www.lteconsulting.fr/hexacss"; writeFile( outputFile, input, log ); }
java
public static void processFile( String input, String mappingPath, String outputFile, boolean doPrune, Log log ) throws IOException { Set<String> usedClassNames = new HashSet<>(); input = replaceClassNames( input, mappingPath, usedClassNames, log ); log.debug( usedClassNames.size() + " used css classes in the mapping file" ); log.debug( "used css classes : " + usedClassNames ); CssRewriter cssRewriter = new CssRewriter( usedClassNames, doPrune, log ); input = cssRewriter.process( input ); input += "\r\n// generated by HexaCss maven plugin, see http://www.lteconsulting.fr/hexacss"; writeFile( outputFile, input, log ); }
[ "public", "static", "void", "processFile", "(", "String", "input", ",", "String", "mappingPath", ",", "String", "outputFile", ",", "boolean", "doPrune", ",", "Log", "log", ")", "throws", "IOException", "{", "Set", "<", "String", ">", "usedClassNames", "=", "...
Process an input file @throws IOException In case there is a problem @param input The input file content @param mappingPath The file containing mapping information (lines in the form of newName=oldName) @param outputFile Path to the output file @param doPrune <code>true</code> if pruning unused CSS rules is needed @param log Maven logger
[ "Process", "an", "input", "file" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.css-maven-plugin/src/main/java/fr/lteconsulting/hexacssmaven/CssMapper.java#L43-L58
train
magott/spring-social-yammer
spring-social-yammer/src/main/java/org/springframework/social/yammer/api/impl/GroupTemplate.java
GroupTemplate.updateGroup
public void updateGroup(long groupId, String name, boolean isPrivate) { LinkedMultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(); params.set("name",name); params.set("private", String.valueOf(isPrivate)); restTemplate.put(buildUri("groups/"+groupId), params); }
java
public void updateGroup(long groupId, String name, boolean isPrivate) { LinkedMultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>(); params.set("name",name); params.set("private", String.valueOf(isPrivate)); restTemplate.put(buildUri("groups/"+groupId), params); }
[ "public", "void", "updateGroup", "(", "long", "groupId", ",", "String", "name", ",", "boolean", "isPrivate", ")", "{", "LinkedMultiValueMap", "<", "String", ",", "String", ">", "params", "=", "new", "LinkedMultiValueMap", "<", "String", ",", "String", ">", "...
Method returns 401 from Yammer, so it isn't visible in GroupOperations yet @param groupId @param name @param isPrivate
[ "Method", "returns", "401", "from", "Yammer", "so", "it", "isn", "t", "visible", "in", "GroupOperations", "yet" ]
a39dab7c33e40bfaa26c15b6336823edf57452c3
https://github.com/magott/spring-social-yammer/blob/a39dab7c33e40bfaa26c15b6336823edf57452c3/spring-social-yammer/src/main/java/org/springframework/social/yammer/api/impl/GroupTemplate.java#L71-L76
train
hawkular/hawkular-commons
hawkular-rest-status/src/main/java/org/hawkular/commons/rest/status/ManifestUtil.java
ManifestUtil.getVersionAttributes
static Map<String, String> getVersionAttributes(URL url) throws IOException { Map<String, String> ret = new LinkedHashMap<>(); try (InputStream inputStream = url.openStream()) { Manifest manifest = new Manifest(inputStream); Attributes attributes = manifest.getMainAttributes(); for (String key : VERSION_ATTRIBUTES) { final String value = attributes.getValue(key); ret.put(key, value == null ? UNKNOWN_VALUE : value); } } return ret; }
java
static Map<String, String> getVersionAttributes(URL url) throws IOException { Map<String, String> ret = new LinkedHashMap<>(); try (InputStream inputStream = url.openStream()) { Manifest manifest = new Manifest(inputStream); Attributes attributes = manifest.getMainAttributes(); for (String key : VERSION_ATTRIBUTES) { final String value = attributes.getValue(key); ret.put(key, value == null ? UNKNOWN_VALUE : value); } } return ret; }
[ "static", "Map", "<", "String", ",", "String", ">", "getVersionAttributes", "(", "URL", "url", ")", "throws", "IOException", "{", "Map", "<", "String", ",", "String", ">", "ret", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "try", "(", "InputStream"...
For the sake of unit testing @param url the URL to load the MANIFEST.MF file from @return a {@link Map} of attributes @throws IOException on problems with reading {@code /META-INF/MANIFEST.MF} file from the given {@code url}
[ "For", "the", "sake", "of", "unit", "testing" ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-rest-status/src/main/java/org/hawkular/commons/rest/status/ManifestUtil.java#L68-L79
train
lsjwzh/MaskEverywhere
library/src/main/java/com/lsjwzh/loadingeverywhere/LoadingLayout.java
LoadingLayout.createOverlayView
@Override protected View createOverlayView() { LinearLayout ll = new LinearLayout(getContext()); ll.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,FrameLayout.LayoutParams.MATCH_PARENT)); ll.setGravity(Gravity.CENTER); View progressBar = createProgressBar(); ll.addView(progressBar); return ll; }
java
@Override protected View createOverlayView() { LinearLayout ll = new LinearLayout(getContext()); ll.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT,FrameLayout.LayoutParams.MATCH_PARENT)); ll.setGravity(Gravity.CENTER); View progressBar = createProgressBar(); ll.addView(progressBar); return ll; }
[ "@", "Override", "protected", "View", "createOverlayView", "(", ")", "{", "LinearLayout", "ll", "=", "new", "LinearLayout", "(", "getContext", "(", ")", ")", ";", "ll", ".", "setLayoutParams", "(", "new", "FrameLayout", ".", "LayoutParams", "(", "FrameLayout",...
create loading mask @return
[ "create", "loading", "mask" ]
b30831f470c7066ae71ad0aa322e6535c009ba2a
https://github.com/lsjwzh/MaskEverywhere/blob/b30831f470c7066ae71ad0aa322e6535c009ba2a/library/src/main/java/com/lsjwzh/loadingeverywhere/LoadingLayout.java#L100-L108
train
hawkular/hawkular-commons
hawkular-nest/hawkular-nest-wf-extension/src/main/java/org/hawkular/nest/extension/NestService.java
NestService.getNestName
protected String getNestName() { if (nestName == null || nestName.equals(NestSubsystemExtension.NEST_NAME_AUTOGENERATE)) { return this.envServiceValue.getValue().getNodeName(); } else { return nestName; } }
java
protected String getNestName() { if (nestName == null || nestName.equals(NestSubsystemExtension.NEST_NAME_AUTOGENERATE)) { return this.envServiceValue.getValue().getNodeName(); } else { return nestName; } }
[ "protected", "String", "getNestName", "(", ")", "{", "if", "(", "nestName", "==", "null", "||", "nestName", ".", "equals", "(", "NestSubsystemExtension", ".", "NEST_NAME_AUTOGENERATE", ")", ")", "{", "return", "this", ".", "envServiceValue", ".", "getValue", "...
Do not call this until the nest has been initialized - it needs a dependent service. @return the name this nest is to be identified as
[ "Do", "not", "call", "this", "until", "the", "nest", "has", "been", "initialized", "-", "it", "needs", "a", "dependent", "service", "." ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-nest/hawkular-nest-wf-extension/src/main/java/org/hawkular/nest/extension/NestService.java#L147-L153
train
randomsync/robotframework-mqttlibrary-java
src/main/java/net/randomsync/robotframework/mqtt/MQTTLibrary.java
MQTTLibrary.connectToMQTTBroker
@RobotKeyword("Connect to MQTT Broker") @ArgumentNames({ "broker", "clientId" }) public void connectToMQTTBroker(String broker, String clientId) throws MqttException { client = new MqttClient(broker, clientId); System.out.println("*INFO:" + System.currentTimeMillis() + "* connecting to broker"); client.connect(); System.out.println("*INFO:" + System.currentTimeMillis() + "* connected"); }
java
@RobotKeyword("Connect to MQTT Broker") @ArgumentNames({ "broker", "clientId" }) public void connectToMQTTBroker(String broker, String clientId) throws MqttException { client = new MqttClient(broker, clientId); System.out.println("*INFO:" + System.currentTimeMillis() + "* connecting to broker"); client.connect(); System.out.println("*INFO:" + System.currentTimeMillis() + "* connected"); }
[ "@", "RobotKeyword", "(", "\"Connect to MQTT Broker\"", ")", "@", "ArgumentNames", "(", "{", "\"broker\"", ",", "\"clientId\"", "}", ")", "public", "void", "connectToMQTTBroker", "(", "String", "broker", ",", "String", "clientId", ")", "throws", "MqttException", "...
Connect to an MQTT broker. @param broker Uri of the broker to connect to @param clientId Client Id @throws MqttException if there is an issue connecting to the broker
[ "Connect", "to", "an", "MQTT", "broker", "." ]
b10e346ea159d86e60a73062297c4a0d57149c89
https://github.com/randomsync/robotframework-mqttlibrary-java/blob/b10e346ea159d86e60a73062297c4a0d57149c89/src/main/java/net/randomsync/robotframework/mqtt/MQTTLibrary.java#L53-L63
train
randomsync/robotframework-mqttlibrary-java
src/main/java/net/randomsync/robotframework/mqtt/MQTTLibrary.java
MQTTLibrary.publishToMQTTSynchronously
@RobotKeywordOverload @ArgumentNames({ "topic", "message" }) public void publishToMQTTSynchronously(String topic, Object message) throws MqttException { publishToMQTTSynchronously(topic, message, 0, false); }
java
@RobotKeywordOverload @ArgumentNames({ "topic", "message" }) public void publishToMQTTSynchronously(String topic, Object message) throws MqttException { publishToMQTTSynchronously(topic, message, 0, false); }
[ "@", "RobotKeywordOverload", "@", "ArgumentNames", "(", "{", "\"topic\"", ",", "\"message\"", "}", ")", "public", "void", "publishToMQTTSynchronously", "(", "String", "topic", ",", "Object", "message", ")", "throws", "MqttException", "{", "publishToMQTTSynchronously",...
Publish a message to a topic @param topic topic to which the message will be published @param message message payload to publish @throws MqttException if there is an issue publishing to the broker
[ "Publish", "a", "message", "to", "a", "topic" ]
b10e346ea159d86e60a73062297c4a0d57149c89
https://github.com/randomsync/robotframework-mqttlibrary-java/blob/b10e346ea159d86e60a73062297c4a0d57149c89/src/main/java/net/randomsync/robotframework/mqtt/MQTTLibrary.java#L75-L80
train
randomsync/robotframework-mqttlibrary-java
src/main/java/net/randomsync/robotframework/mqtt/MQTTLibrary.java
MQTTLibrary.publishToMQTTSynchronously
@RobotKeyword("Publish to MQTT Synchronously") @ArgumentNames({ "topic", "message", "qos=0", "retained=false" }) public void publishToMQTTSynchronously(String topic, Object message, int qos, boolean retained) throws MqttException { MqttMessage msg; if (message instanceof String) { msg = new MqttMessage(message.toString().getBytes()); } else { msg = new MqttMessage((byte[]) message); } msg.setQos(qos); msg.setRetained(retained); System.out.println("*INFO:" + System.currentTimeMillis() + "* publishing message"); client.publish(topic, msg); System.out.println("*INFO:" + System.currentTimeMillis() + "* published"); }
java
@RobotKeyword("Publish to MQTT Synchronously") @ArgumentNames({ "topic", "message", "qos=0", "retained=false" }) public void publishToMQTTSynchronously(String topic, Object message, int qos, boolean retained) throws MqttException { MqttMessage msg; if (message instanceof String) { msg = new MqttMessage(message.toString().getBytes()); } else { msg = new MqttMessage((byte[]) message); } msg.setQos(qos); msg.setRetained(retained); System.out.println("*INFO:" + System.currentTimeMillis() + "* publishing message"); client.publish(topic, msg); System.out.println("*INFO:" + System.currentTimeMillis() + "* published"); }
[ "@", "RobotKeyword", "(", "\"Publish to MQTT Synchronously\"", ")", "@", "ArgumentNames", "(", "{", "\"topic\"", ",", "\"message\"", ",", "\"qos=0\"", ",", "\"retained=false\"", "}", ")", "public", "void", "publishToMQTTSynchronously", "(", "String", "topic", ",", "...
Publish a message to a topic with specified qos and retained flag @param topic topic to which the message will be published @param message message payload to publish @param qos qos of the message @param retained retained flag @throws MqttException if there is an issue publishing to the broker
[ "Publish", "a", "message", "to", "a", "topic", "with", "specified", "qos", "and", "retained", "flag" ]
b10e346ea159d86e60a73062297c4a0d57149c89
https://github.com/randomsync/robotframework-mqttlibrary-java/blob/b10e346ea159d86e60a73062297c4a0d57149c89/src/main/java/net/randomsync/robotframework/mqtt/MQTTLibrary.java#L96-L113
train
randomsync/robotframework-mqttlibrary-java
src/main/java/net/randomsync/robotframework/mqtt/MQTTLibrary.java
MQTTLibrary.disconnectFromMQTTBroker
@RobotKeyword("Disconnect from MQTT Broker") public void disconnectFromMQTTBroker() { if (client != null) { try { client.disconnect(); } catch (MqttException e) { throw new RuntimeException(e.getLocalizedMessage()); } } }
java
@RobotKeyword("Disconnect from MQTT Broker") public void disconnectFromMQTTBroker() { if (client != null) { try { client.disconnect(); } catch (MqttException e) { throw new RuntimeException(e.getLocalizedMessage()); } } }
[ "@", "RobotKeyword", "(", "\"Disconnect from MQTT Broker\"", ")", "public", "void", "disconnectFromMQTTBroker", "(", ")", "{", "if", "(", "client", "!=", "null", ")", "{", "try", "{", "client", ".", "disconnect", "(", ")", ";", "}", "catch", "(", "MqttExcept...
Disconnect from MQTT Broker
[ "Disconnect", "from", "MQTT", "Broker" ]
b10e346ea159d86e60a73062297c4a0d57149c89
https://github.com/randomsync/robotframework-mqttlibrary-java/blob/b10e346ea159d86e60a73062297c4a0d57149c89/src/main/java/net/randomsync/robotframework/mqtt/MQTTLibrary.java#L118-L127
train
randomsync/robotframework-mqttlibrary-java
src/main/java/net/randomsync/robotframework/mqtt/MQTTLibrary.java
MQTTLibrary.subscribeToMQTTAndValidate
@RobotKeyword("Subscribe to MQTT Broker and validate that it received a specific message") @ArgumentNames({ "broker", "clientId", "topic", "expectedPayload", "timeout" }) public void subscribeToMQTTAndValidate(String broker, String clientId, String topic, String expectedPayload, long timeout) { MqttClient client = null; try { MqttClientPersistence persistence = new MemoryPersistence(); client = new MqttClient(broker, clientId, persistence); // set clean session to false so the state is remembered across // sessions MqttConnectOptions connOpts = new MqttConnectOptions(); connOpts.setCleanSession(false); // set callback before connecting so prior messages are delivered as // soon as we connect MQTTResponseHandler handler = new MQTTResponseHandler(); client.setCallback(handler); System.out.println("*INFO:" + System.currentTimeMillis() + "* Connecting to broker: " + broker); client.connect(connOpts); System.out.println("*INFO:" + System.currentTimeMillis() + "* Subscribing to topic: " + topic); client.subscribe(topic); System.out.println("*INFO:" + System.currentTimeMillis() + "* Subscribed to topic: " + topic); // now loop until either we receive the message in the topic or // timeout System.out.println("*INFO:" + System.currentTimeMillis() + "* Waiting for message to arrive"); boolean validated = false; byte[] payload; MqttMessage message; long endTime = System.currentTimeMillis() + timeout; while (true) { /* * If expected payload is empty, all we need to validate is * receiving the message in the topic. If expected payload is * not empty, then we need to validate that it is contained in * the actual payload */ message = handler.getNextMessage(timeout); if (message != null) { // received a message in the topic payload = message.getPayload(); String payloadStr = new String(payload); if (expectedPayload.isEmpty() || (payloadStr.matches(expectedPayload))) { validated = true; break; } } // update timeout to remaining time and check if ((timeout = endTime - System.currentTimeMillis()) <= 0) { System.out.println("*DEBUG:" + System.currentTimeMillis() + "* timeout: " + timeout); break; } } if (!validated) { throw new RuntimeException( "The expected payload didn't arrive in the topic"); } } catch (MqttException e) { throw new RuntimeException(e.getLocalizedMessage()); } finally { try { client.disconnect(); } catch (MqttException e) { // empty } } }
java
@RobotKeyword("Subscribe to MQTT Broker and validate that it received a specific message") @ArgumentNames({ "broker", "clientId", "topic", "expectedPayload", "timeout" }) public void subscribeToMQTTAndValidate(String broker, String clientId, String topic, String expectedPayload, long timeout) { MqttClient client = null; try { MqttClientPersistence persistence = new MemoryPersistence(); client = new MqttClient(broker, clientId, persistence); // set clean session to false so the state is remembered across // sessions MqttConnectOptions connOpts = new MqttConnectOptions(); connOpts.setCleanSession(false); // set callback before connecting so prior messages are delivered as // soon as we connect MQTTResponseHandler handler = new MQTTResponseHandler(); client.setCallback(handler); System.out.println("*INFO:" + System.currentTimeMillis() + "* Connecting to broker: " + broker); client.connect(connOpts); System.out.println("*INFO:" + System.currentTimeMillis() + "* Subscribing to topic: " + topic); client.subscribe(topic); System.out.println("*INFO:" + System.currentTimeMillis() + "* Subscribed to topic: " + topic); // now loop until either we receive the message in the topic or // timeout System.out.println("*INFO:" + System.currentTimeMillis() + "* Waiting for message to arrive"); boolean validated = false; byte[] payload; MqttMessage message; long endTime = System.currentTimeMillis() + timeout; while (true) { /* * If expected payload is empty, all we need to validate is * receiving the message in the topic. If expected payload is * not empty, then we need to validate that it is contained in * the actual payload */ message = handler.getNextMessage(timeout); if (message != null) { // received a message in the topic payload = message.getPayload(); String payloadStr = new String(payload); if (expectedPayload.isEmpty() || (payloadStr.matches(expectedPayload))) { validated = true; break; } } // update timeout to remaining time and check if ((timeout = endTime - System.currentTimeMillis()) <= 0) { System.out.println("*DEBUG:" + System.currentTimeMillis() + "* timeout: " + timeout); break; } } if (!validated) { throw new RuntimeException( "The expected payload didn't arrive in the topic"); } } catch (MqttException e) { throw new RuntimeException(e.getLocalizedMessage()); } finally { try { client.disconnect(); } catch (MqttException e) { // empty } } }
[ "@", "RobotKeyword", "(", "\"Subscribe to MQTT Broker and validate that it received a specific message\"", ")", "@", "ArgumentNames", "(", "{", "\"broker\"", ",", "\"clientId\"", ",", "\"topic\"", ",", "\"expectedPayload\"", ",", "\"timeout\"", "}", ")", "public", "void", ...
Subscribe to an MQTT broker and validate that a message with specified payload is received @param broker Uri of broker to subscribe to @param clientId Client Id @param topic topic to subscribe to @param expectedPayload payload to validate @param timeout timeout for the payload to be received
[ "Subscribe", "to", "an", "MQTT", "broker", "and", "validate", "that", "a", "message", "with", "specified", "payload", "is", "received" ]
b10e346ea159d86e60a73062297c4a0d57149c89
https://github.com/randomsync/robotframework-mqttlibrary-java/blob/b10e346ea159d86e60a73062297c4a0d57149c89/src/main/java/net/randomsync/robotframework/mqtt/MQTTLibrary.java#L144-L219
train
ltearno/hexa.tools
hexa.rpc/src/main/java/fr/lteconsulting/hexa/client/comm/RequestDesc.java
RequestDesc._getUniqueKey
private String _getUniqueKey() { StringBuilder b = new StringBuilder(); b.append( service ); b.append( "#" ); b.append( method ); if( params != null ) { b.append( "#" ); b.append( params.toString() ); } return b.toString(); }
java
private String _getUniqueKey() { StringBuilder b = new StringBuilder(); b.append( service ); b.append( "#" ); b.append( method ); if( params != null ) { b.append( "#" ); b.append( params.toString() ); } return b.toString(); }
[ "private", "String", "_getUniqueKey", "(", ")", "{", "StringBuilder", "b", "=", "new", "StringBuilder", "(", ")", ";", "b", ".", "append", "(", "service", ")", ";", "b", ".", "append", "(", "\"#\"", ")", ";", "b", ".", "append", "(", "method", ")", ...
calculate the unique key of that request
[ "calculate", "the", "unique", "key", "of", "that", "request" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.rpc/src/main/java/fr/lteconsulting/hexa/client/comm/RequestDesc.java#L59-L72
train
hawkular/hawkular-commons
hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/bus/BusEndpointProcessors.java
BusEndpointProcessors.initialize
public void initialize(@Observes @Initialized(ApplicationScoped.class) Object ignore) { log.debugf("Initializing [%s]", this.getClass().getName()); try { feedSessionListenerProducer = new BiFunction<String, Session, WsSessionListener>() { @Override public WsSessionListener apply(String key, Session session) { // In the future, if we need other queues/topics that need to be listened to, we add them here. final Endpoint endpoint = Constants.FEED_COMMAND_QUEUE; BasicMessageListener<BasicMessage> busEndpointListener = new FeedBusEndpointListener(session, key, endpoint); return new BusWsSessionListener(Constants.HEADER_FEEDID, key, endpoint, busEndpointListener); } }; wsEndpoints.getFeedSessions().addWsSessionListenerProducer(feedSessionListenerProducer); uiClientSessionListenerProducer = new BiFunction<String, Session, WsSessionListener>() { @Override public WsSessionListener apply(String key, Session session) { // In the future, if we need other queues/topics that need to be listened to, we add them here. final Endpoint endpoint = Constants.UI_COMMAND_QUEUE; BasicMessageListener<BasicMessage> busEndpointListener = new UiClientBusEndpointListener( commandContextFactory, busCommands, endpoint); return new BusWsSessionListener(Constants.HEADER_UICLIENTID, key, endpoint, busEndpointListener); } }; wsEndpoints.getUiClientSessions().addWsSessionListenerProducer(uiClientSessionListenerProducer); } catch (Exception e) { log.errorCouldNotInitialize(e, this.getClass().getName()); } }
java
public void initialize(@Observes @Initialized(ApplicationScoped.class) Object ignore) { log.debugf("Initializing [%s]", this.getClass().getName()); try { feedSessionListenerProducer = new BiFunction<String, Session, WsSessionListener>() { @Override public WsSessionListener apply(String key, Session session) { // In the future, if we need other queues/topics that need to be listened to, we add them here. final Endpoint endpoint = Constants.FEED_COMMAND_QUEUE; BasicMessageListener<BasicMessage> busEndpointListener = new FeedBusEndpointListener(session, key, endpoint); return new BusWsSessionListener(Constants.HEADER_FEEDID, key, endpoint, busEndpointListener); } }; wsEndpoints.getFeedSessions().addWsSessionListenerProducer(feedSessionListenerProducer); uiClientSessionListenerProducer = new BiFunction<String, Session, WsSessionListener>() { @Override public WsSessionListener apply(String key, Session session) { // In the future, if we need other queues/topics that need to be listened to, we add them here. final Endpoint endpoint = Constants.UI_COMMAND_QUEUE; BasicMessageListener<BasicMessage> busEndpointListener = new UiClientBusEndpointListener( commandContextFactory, busCommands, endpoint); return new BusWsSessionListener(Constants.HEADER_UICLIENTID, key, endpoint, busEndpointListener); } }; wsEndpoints.getUiClientSessions().addWsSessionListenerProducer(uiClientSessionListenerProducer); } catch (Exception e) { log.errorCouldNotInitialize(e, this.getClass().getName()); } }
[ "public", "void", "initialize", "(", "@", "Observes", "@", "Initialized", "(", "ApplicationScoped", ".", "class", ")", "Object", "ignore", ")", "{", "log", ".", "debugf", "(", "\"Initializing [%s]\"", ",", "this", ".", "getClass", "(", ")", ".", "getName", ...
This creates the bi-function listener-producers that will create listeners which will create JMS bus listeners for each websocket session that gets created in the future. @param ignore unused
[ "This", "creates", "the", "bi", "-", "function", "listener", "-", "producers", "that", "will", "create", "listeners", "which", "will", "create", "JMS", "bus", "listeners", "for", "each", "websocket", "session", "that", "gets", "created", "in", "the", "future",...
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/bus/BusEndpointProcessors.java#L256-L286
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/collection/TrieMap.java
TrieMap.modifyData
void modifyData(final TrieNode<V> node, final V value) { node.value = value; ++modCount; ++size; }
java
void modifyData(final TrieNode<V> node, final V value) { node.value = value; ++modCount; ++size; }
[ "void", "modifyData", "(", "final", "TrieNode", "<", "V", ">", "node", ",", "final", "V", "value", ")", "{", "node", ".", "value", "=", "value", ";", "++", "modCount", ";", "++", "size", ";", "}" ]
Sets the given value as the new value on the given node, increases size and modCount.
[ "Sets", "the", "given", "value", "as", "the", "new", "value", "on", "the", "given", "node", "increases", "size", "and", "modCount", "." ]
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/collection/TrieMap.java#L200-L204
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/collection/TrieMap.java
TrieMap.addNode
private void addNode(final TrieNode<V> node, final CharSequence key, final int beginIndex, final TrieNode<V> newNode) { final int lastKeyIndex = key.length() - 1; TrieNode<V> currentNode = node; int i = beginIndex; for (; i < lastKeyIndex; i++) { final TrieNode<V> nextNode = new TrieNode<V>(false); currentNode.children.put(key.charAt(i), nextNode); currentNode = nextNode; } currentNode.children.put(key.charAt(i), newNode); }
java
private void addNode(final TrieNode<V> node, final CharSequence key, final int beginIndex, final TrieNode<V> newNode) { final int lastKeyIndex = key.length() - 1; TrieNode<V> currentNode = node; int i = beginIndex; for (; i < lastKeyIndex; i++) { final TrieNode<V> nextNode = new TrieNode<V>(false); currentNode.children.put(key.charAt(i), nextNode); currentNode = nextNode; } currentNode.children.put(key.charAt(i), newNode); }
[ "private", "void", "addNode", "(", "final", "TrieNode", "<", "V", ">", "node", ",", "final", "CharSequence", "key", ",", "final", "int", "beginIndex", ",", "final", "TrieNode", "<", "V", ">", "newNode", ")", "{", "final", "int", "lastKeyIndex", "=", "key...
Adds the given new node to the node with the given key beginning at beginIndex.
[ "Adds", "the", "given", "new", "node", "to", "the", "node", "with", "the", "given", "key", "beginning", "at", "beginIndex", "." ]
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/collection/TrieMap.java#L210-L223
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/collection/TrieMap.java
TrieMap.removeMapping
V removeMapping(final Object o) { if (!(o instanceof Map.Entry)) { throw new IllegalArgumentException(); } @SuppressWarnings("unchecked") final Entry<? extends CharSequence, V> e = (Map.Entry<? extends CharSequence, V>) o; final CharSequence key = keyCheck(e.getKey()); final V value = e.getValue(); final TrieNode<V> currentNode = findPreviousNode(key); if (currentNode == null) { /* Node not found for the given key */ return null; } final TrieNode<V> node = currentNode.children.get(key.charAt(key .length() - 1)); if (node == null || !node.inUse) { /* Node not found for the given key or is not in use */ return null; } final V removed = node.value; if (removed != value && (removed == null || !removed.equals(value))) { /* * Value in the map differs from the value given in the entry so do * nothing and return null. */ return null; } node.unset(); --size; ++modCount; if (node.children.isEmpty()) { /* Since there are no children left, we can compact the trie */ compact(key); } return removed; }
java
V removeMapping(final Object o) { if (!(o instanceof Map.Entry)) { throw new IllegalArgumentException(); } @SuppressWarnings("unchecked") final Entry<? extends CharSequence, V> e = (Map.Entry<? extends CharSequence, V>) o; final CharSequence key = keyCheck(e.getKey()); final V value = e.getValue(); final TrieNode<V> currentNode = findPreviousNode(key); if (currentNode == null) { /* Node not found for the given key */ return null; } final TrieNode<V> node = currentNode.children.get(key.charAt(key .length() - 1)); if (node == null || !node.inUse) { /* Node not found for the given key or is not in use */ return null; } final V removed = node.value; if (removed != value && (removed == null || !removed.equals(value))) { /* * Value in the map differs from the value given in the entry so do * nothing and return null. */ return null; } node.unset(); --size; ++modCount; if (node.children.isEmpty()) { /* Since there are no children left, we can compact the trie */ compact(key); } return removed; }
[ "V", "removeMapping", "(", "final", "Object", "o", ")", "{", "if", "(", "!", "(", "o", "instanceof", "Map", ".", "Entry", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", ")", ";", "}", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", ...
Special version of remove for EntrySet.
[ "Special", "version", "of", "remove", "for", "EntrySet", "." ]
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/collection/TrieMap.java#L325-L368
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/collection/TrieMap.java
TrieMap.compact
private void compact(final CharSequence key) { final int keyLength = key.length(); TrieNode<V> currentNode = getRoot(); TrieNode<V> lastInUseNode = currentNode; int lastInUseIndex = 0; for (int i = 0; i < keyLength && currentNode != null; i++) { if (currentNode.inUse) { lastInUseNode = currentNode; lastInUseIndex = i; } currentNode = currentNode.children.get(key.charAt(i)); } currentNode = lastInUseNode; for (int i = lastInUseIndex; i < keyLength; i++) { currentNode = currentNode.children.remove(key.charAt(i)).unset(); } }
java
private void compact(final CharSequence key) { final int keyLength = key.length(); TrieNode<V> currentNode = getRoot(); TrieNode<V> lastInUseNode = currentNode; int lastInUseIndex = 0; for (int i = 0; i < keyLength && currentNode != null; i++) { if (currentNode.inUse) { lastInUseNode = currentNode; lastInUseIndex = i; } currentNode = currentNode.children.get(key.charAt(i)); } currentNode = lastInUseNode; for (int i = lastInUseIndex; i < keyLength; i++) { currentNode = currentNode.children.remove(key.charAt(i)).unset(); } }
[ "private", "void", "compact", "(", "final", "CharSequence", "key", ")", "{", "final", "int", "keyLength", "=", "key", ".", "length", "(", ")", ";", "TrieNode", "<", "V", ">", "currentNode", "=", "getRoot", "(", ")", ";", "TrieNode", "<", "V", ">", "l...
Compact the trie by removing unused nodes on the path that is specified by the given key.
[ "Compact", "the", "trie", "by", "removing", "unused", "nodes", "on", "the", "path", "that", "is", "specified", "by", "the", "given", "key", "." ]
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/collection/TrieMap.java#L386-L406
train
ltearno/hexa.tools
hexa.binding/processor/src/main/java/fr/lteconsulting/hexa/databinding/annotation/processor/TypeSimplifier.java
TypeSimplifier.getTypeQualifiedName
public static String getTypeQualifiedName(TypeMirror type) throws CodeGenerationIncompleteException { if(type.toString().equals("<any>")) { throw new CodeGenerationIncompleteException("Type reported as <any> is likely a not-yet " + "generated parameterized type."); } switch( type.getKind() ) { case ARRAY: return getTypeQualifiedName( ((ArrayType) type).getComponentType() ) + "[]"; case BOOLEAN: return "boolean"; case BYTE: return "byte"; case CHAR: return "char"; case DOUBLE: return "double"; case FLOAT: return "float"; case INT: return "int"; case LONG: return "long"; case SHORT: return "short"; case DECLARED: StringBuilder b = new StringBuilder(); b.append( ((TypeElement) ((DeclaredType) type).asElement()).getQualifiedName().toString() ); if( !((DeclaredType) type).getTypeArguments().isEmpty() ) { b.append( "<" ); boolean addComa = false; for( TypeMirror pType : ((DeclaredType) type).getTypeArguments() ) { if( addComa ) b.append( ", " ); else addComa = true; b.append( getTypeQualifiedName( pType ) ); } b.append( ">" ); } return b.toString(); default: return type.toString(); } }
java
public static String getTypeQualifiedName(TypeMirror type) throws CodeGenerationIncompleteException { if(type.toString().equals("<any>")) { throw new CodeGenerationIncompleteException("Type reported as <any> is likely a not-yet " + "generated parameterized type."); } switch( type.getKind() ) { case ARRAY: return getTypeQualifiedName( ((ArrayType) type).getComponentType() ) + "[]"; case BOOLEAN: return "boolean"; case BYTE: return "byte"; case CHAR: return "char"; case DOUBLE: return "double"; case FLOAT: return "float"; case INT: return "int"; case LONG: return "long"; case SHORT: return "short"; case DECLARED: StringBuilder b = new StringBuilder(); b.append( ((TypeElement) ((DeclaredType) type).asElement()).getQualifiedName().toString() ); if( !((DeclaredType) type).getTypeArguments().isEmpty() ) { b.append( "<" ); boolean addComa = false; for( TypeMirror pType : ((DeclaredType) type).getTypeArguments() ) { if( addComa ) b.append( ", " ); else addComa = true; b.append( getTypeQualifiedName( pType ) ); } b.append( ">" ); } return b.toString(); default: return type.toString(); } }
[ "public", "static", "String", "getTypeQualifiedName", "(", "TypeMirror", "type", ")", "throws", "CodeGenerationIncompleteException", "{", "if", "(", "type", ".", "toString", "(", ")", ".", "equals", "(", "\"<any>\"", ")", ")", "{", "throw", "new", "CodeGeneratio...
Returns the qualified name of a TypeMirror.
[ "Returns", "the", "qualified", "name", "of", "a", "TypeMirror", "." ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.binding/processor/src/main/java/fr/lteconsulting/hexa/databinding/annotation/processor/TypeSimplifier.java#L247-L295
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/CalendarPeriod.java
CalendarPeriod.IsInside
public boolean IsInside( String pDate ) { if( periods == null ) { if( days == null ) // security added to avoid null exception return false; if( days.getDay( CalendarFunctions.date_get_day( pDate ) ).get() > 0 ) return true; return false; } for( int i = 0; i < periods.size(); i++ ) { Period period = periods.get( i ); if( period.getFrom().compareTo( pDate ) > 0 ) return false; if( (period.getFrom().compareTo( pDate ) <= 0) && (period.getTo().compareTo( pDate ) >= 0) ) return true; } return false; }
java
public boolean IsInside( String pDate ) { if( periods == null ) { if( days == null ) // security added to avoid null exception return false; if( days.getDay( CalendarFunctions.date_get_day( pDate ) ).get() > 0 ) return true; return false; } for( int i = 0; i < periods.size(); i++ ) { Period period = periods.get( i ); if( period.getFrom().compareTo( pDate ) > 0 ) return false; if( (period.getFrom().compareTo( pDate ) <= 0) && (period.getTo().compareTo( pDate ) >= 0) ) return true; } return false; }
[ "public", "boolean", "IsInside", "(", "String", "pDate", ")", "{", "if", "(", "periods", "==", "null", ")", "{", "if", "(", "days", "==", "null", ")", "// security added to avoid null exception", "return", "false", ";", "if", "(", "days", ".", "getDay", "(...
false if not
[ "false", "if", "not" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/CalendarPeriod.java#L185-L208
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/CalendarPeriod.java
CalendarPeriod.IsContained
public boolean IsContained( String pFrom, String pTo ) { if( periods == null ) { // echo "IsContained() TO BE IMPLEMENTED FLLKJ :: {{ } ''<br/>"; throw new RuntimeException( "Error Periods is Null" ); } for( int i = 0; i < periods.size(); i++ ) { Period period = periods.get( i ); if( period.getFrom().compareTo( pFrom ) > 0 ) return false; if( (pFrom.compareTo( period.getFrom() ) >= 0) && (pTo.compareTo( period.getTo() ) <= 0) ) return true; } return false; }
java
public boolean IsContained( String pFrom, String pTo ) { if( periods == null ) { // echo "IsContained() TO BE IMPLEMENTED FLLKJ :: {{ } ''<br/>"; throw new RuntimeException( "Error Periods is Null" ); } for( int i = 0; i < periods.size(); i++ ) { Period period = periods.get( i ); if( period.getFrom().compareTo( pFrom ) > 0 ) return false; if( (pFrom.compareTo( period.getFrom() ) >= 0) && (pTo.compareTo( period.getTo() ) <= 0) ) return true; } return false; }
[ "public", "boolean", "IsContained", "(", "String", "pFrom", ",", "String", "pTo", ")", "{", "if", "(", "periods", "==", "null", ")", "{", "// echo \"IsContained() TO BE IMPLEMENTED FLLKJ :: {{ } ''<br/>\";", "throw", "new", "RuntimeException", "(", "\"Error Periods is N...
list of periods, false if not
[ "list", "of", "periods", "false", "if", "not" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/CalendarPeriod.java#L212-L231
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/CalendarPeriod.java
CalendarPeriod.Resolve
public void Resolve( String pFrom, String pTo ) { if( periods != null ) { // call on an already resolved CalendarPeriod // echo // "LJLJKZHL KJH ELF B.EB EKJGF EFJBH EKLFJHL JGH <{{ : ' } <br/>"; throw new RuntimeException( "Error call on an already resolved CalendarPeriod" ); } // echo "Resolving from $from to $to " . implode( ".", $this->days ) . // "<br/>"; // if all days are selected, make a whole period // build the micro periods int nb = 0; for( int i = 0; i < 7; i++ ) nb += days.getDay( i ).get(); if( nb == 7 ) { periods = new ArrayList<Period>(); periods.add( new Period( pFrom, pTo ) ); return; } else if( nb == 0 ) { periods = new ArrayList<Period>(); return; } // echo "Continuing<br/>"; int fromDay = CalendarFunctions.date_get_day( pFrom ); // we have at least one gap Groups groups = new Groups(); Group curGroup = null; for( int i = fromDay; i < fromDay + 7; i++ ) { if( days.getDay( i % 7 ).get() > 0 ) { if( curGroup == null ) // no group created yet curGroup = new Group( i - fromDay, i - fromDay ); else if( curGroup.getTo() == i - fromDay - 1 ) // day jointed to // current group curGroup.setTo( i - fromDay ); else // day disjointed from current group { groups.add( curGroup ); curGroup = new Group( i - fromDay, i - fromDay ); } } } if( curGroup != null ) groups.add( curGroup ); // Dump( $groups ); // now generate the periods // String msg = "Starts on " + pFrom + ", which day is a " + fromDay + // "<br/>"; // for( int i = 0; i < groups.size(); i++ ) // { // Group group = groups.get( i ); // msg += "Group : " + group.implode( " to " ) + "<br/>"; // } // echo "From day : $from : $fromDay <br/>"; String firstOccurence = pFrom; // echo "First occurence : $firstOccurence<br/>"; days = null; periods = new ArrayList<Period>(); while( firstOccurence.compareTo( pTo ) <= 0 ) { // msg += "Occurence " + firstOccurence + "<br/>"; // day of $firstOccurence is always $fromDay // foreach( $groups as $group ) for( int i = 0; i < groups.size(); i++ ) { Group group = groups.get( i ); String mpFrom = CalendarFunctions.date_add_day( firstOccurence, group.getFrom() ); if( mpFrom.compareTo( pTo ) <= 0 ) { String mpTo = CalendarFunctions.date_add_day( firstOccurence, group.getTo() ); if( mpTo.compareTo( pTo ) > 0 ) mpTo = pTo; // msg += "Adding " + mpFrom + ", " + mpTo + "<br/>"; periods.add( new Period( mpFrom, mpTo ) ); } } firstOccurence = CalendarFunctions.date_add_day( firstOccurence, 7 ); } // ServerState::inst()->AddMessage( $msg ); }
java
public void Resolve( String pFrom, String pTo ) { if( periods != null ) { // call on an already resolved CalendarPeriod // echo // "LJLJKZHL KJH ELF B.EB EKJGF EFJBH EKLFJHL JGH <{{ : ' } <br/>"; throw new RuntimeException( "Error call on an already resolved CalendarPeriod" ); } // echo "Resolving from $from to $to " . implode( ".", $this->days ) . // "<br/>"; // if all days are selected, make a whole period // build the micro periods int nb = 0; for( int i = 0; i < 7; i++ ) nb += days.getDay( i ).get(); if( nb == 7 ) { periods = new ArrayList<Period>(); periods.add( new Period( pFrom, pTo ) ); return; } else if( nb == 0 ) { periods = new ArrayList<Period>(); return; } // echo "Continuing<br/>"; int fromDay = CalendarFunctions.date_get_day( pFrom ); // we have at least one gap Groups groups = new Groups(); Group curGroup = null; for( int i = fromDay; i < fromDay + 7; i++ ) { if( days.getDay( i % 7 ).get() > 0 ) { if( curGroup == null ) // no group created yet curGroup = new Group( i - fromDay, i - fromDay ); else if( curGroup.getTo() == i - fromDay - 1 ) // day jointed to // current group curGroup.setTo( i - fromDay ); else // day disjointed from current group { groups.add( curGroup ); curGroup = new Group( i - fromDay, i - fromDay ); } } } if( curGroup != null ) groups.add( curGroup ); // Dump( $groups ); // now generate the periods // String msg = "Starts on " + pFrom + ", which day is a " + fromDay + // "<br/>"; // for( int i = 0; i < groups.size(); i++ ) // { // Group group = groups.get( i ); // msg += "Group : " + group.implode( " to " ) + "<br/>"; // } // echo "From day : $from : $fromDay <br/>"; String firstOccurence = pFrom; // echo "First occurence : $firstOccurence<br/>"; days = null; periods = new ArrayList<Period>(); while( firstOccurence.compareTo( pTo ) <= 0 ) { // msg += "Occurence " + firstOccurence + "<br/>"; // day of $firstOccurence is always $fromDay // foreach( $groups as $group ) for( int i = 0; i < groups.size(); i++ ) { Group group = groups.get( i ); String mpFrom = CalendarFunctions.date_add_day( firstOccurence, group.getFrom() ); if( mpFrom.compareTo( pTo ) <= 0 ) { String mpTo = CalendarFunctions.date_add_day( firstOccurence, group.getTo() ); if( mpTo.compareTo( pTo ) > 0 ) mpTo = pTo; // msg += "Adding " + mpFrom + ", " + mpTo + "<br/>"; periods.add( new Period( mpFrom, mpTo ) ); } } firstOccurence = CalendarFunctions.date_add_day( firstOccurence, 7 ); } // ServerState::inst()->AddMessage( $msg ); }
[ "public", "void", "Resolve", "(", "String", "pFrom", ",", "String", "pTo", ")", "{", "if", "(", "periods", "!=", "null", ")", "{", "// call on an already resolved CalendarPeriod", "// echo", "// \"LJLJKZHL KJH ELF B.EB EKJGF EFJBH EKLFJHL JGH <{{ : ' } <br/>\";", "throw", ...
from and to parameters
[ "from", "and", "to", "parameters" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/CalendarPeriod.java#L438-L539
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/CalendarPeriod.java
CalendarPeriod._Intersect
private List<Period> _Intersect( List<Period> periods1, List<Period> periods2 ) { List<Period> result = new ArrayList<Period>(); int count1 = periods1.size(); int count2 = periods2.size(); int i = 0; int j = 0; while( i < count1 && j < count2 ) { // one of the periods begins after the end of the other if( periods1.get( i ).getFrom().compareTo( periods2.get( j ).getTo() ) > 0 ) { // period 1 begins after period 2 finishes => period2 is // eliminated ! j++; } else if( periods2.get( j ).getFrom().compareTo( periods1.get( i ).getTo() ) > 0 ) { // period 2 begins after end of period 1 => period 1 is eliminated // ! i++; } // after that test, we can assume there is a non-void intersection else { // result[] = array( max($periods1[$i][0],$periods2[$j][0]), // min($periods1[$i][1],$periods2[$j][1]) ); result.add( new Period( CalendarFunctions.max_date( periods1.get( i ).getFrom(), periods2.get( j ).getFrom() ), CalendarFunctions.min_date( periods1.get( i ).getTo(), periods2.get( j ).getTo() ) ) ); if( periods1.get( i ).getTo().compareTo( periods2.get( j ).getTo() ) > 0 ) j++; else i++; } } return result; }
java
private List<Period> _Intersect( List<Period> periods1, List<Period> periods2 ) { List<Period> result = new ArrayList<Period>(); int count1 = periods1.size(); int count2 = periods2.size(); int i = 0; int j = 0; while( i < count1 && j < count2 ) { // one of the periods begins after the end of the other if( periods1.get( i ).getFrom().compareTo( periods2.get( j ).getTo() ) > 0 ) { // period 1 begins after period 2 finishes => period2 is // eliminated ! j++; } else if( periods2.get( j ).getFrom().compareTo( periods1.get( i ).getTo() ) > 0 ) { // period 2 begins after end of period 1 => period 1 is eliminated // ! i++; } // after that test, we can assume there is a non-void intersection else { // result[] = array( max($periods1[$i][0],$periods2[$j][0]), // min($periods1[$i][1],$periods2[$j][1]) ); result.add( new Period( CalendarFunctions.max_date( periods1.get( i ).getFrom(), periods2.get( j ).getFrom() ), CalendarFunctions.min_date( periods1.get( i ).getTo(), periods2.get( j ).getTo() ) ) ); if( periods1.get( i ).getTo().compareTo( periods2.get( j ).getTo() ) > 0 ) j++; else i++; } } return result; }
[ "private", "List", "<", "Period", ">", "_Intersect", "(", "List", "<", "Period", ">", "periods1", ",", "List", "<", "Period", ">", "periods2", ")", "{", "List", "<", "Period", ">", "result", "=", "new", "ArrayList", "<", "Period", ">", "(", ")", ";",...
intersect two period arrays
[ "intersect", "two", "period", "arrays" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/CalendarPeriod.java#L572-L611
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/comparator/BaseComparator.java
BaseComparator.compareNullObjects
protected Integer compareNullObjects(Object object1, Object object2) { if ((object1 == null) && (object2 == null)) { return 0; } if (object1 == null) { return 1; } if (object2 == null) { return -1; } return null; }
java
protected Integer compareNullObjects(Object object1, Object object2) { if ((object1 == null) && (object2 == null)) { return 0; } if (object1 == null) { return 1; } if (object2 == null) { return -1; } return null; }
[ "protected", "Integer", "compareNullObjects", "(", "Object", "object1", ",", "Object", "object2", ")", "{", "if", "(", "(", "object1", "==", "null", ")", "&&", "(", "object2", "==", "null", ")", ")", "{", "return", "0", ";", "}", "if", "(", "object1", ...
Checks for null objects and returns the proper result depedning on which object is null @param object1 @param object2 @return <ol> <li>0 = field null or both objects null</li> <li>1 = object1 is null</li> <li>-1 = object2 is null</li> <li>null = both objects are not null</li> </ol>
[ "Checks", "for", "null", "objects", "and", "returns", "the", "proper", "result", "depedning", "on", "which", "object", "is", "null" ]
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/comparator/BaseComparator.java#L38-L49
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/chart/raphael/PathBuilder.java
PathBuilder.append
public PathBuilder append( String cmd, double... coords ) { s.append( cmd ).append( " " ); for( double a : coords ) { s.append( a ).append( " " ); } return this; }
java
public PathBuilder append( String cmd, double... coords ) { s.append( cmd ).append( " " ); for( double a : coords ) { s.append( a ).append( " " ); } return this; }
[ "public", "PathBuilder", "append", "(", "String", "cmd", ",", "double", "...", "coords", ")", "{", "s", ".", "append", "(", "cmd", ")", ".", "append", "(", "\" \"", ")", ";", "for", "(", "double", "a", ":", "coords", ")", "{", "s", ".", "append", ...
append an SVG Path command to this instance
[ "append", "an", "SVG", "Path", "command", "to", "this", "instance" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/chart/raphael/PathBuilder.java#L20-L28
train
Blazebit/blaze-utils
blaze-ee-utils/src/main/java/com/blazebit/cdi/exception/CatchHandlerInterceptor.java
CatchHandlerInterceptor.handle
@AroundInvoke public Object handle(InvocationContext ic) throws Exception { Method m = ic.getMethod(); Object targetObject = ic.getTarget(); Class<?> targetClass = targetObject == null ? m.getDeclaringClass() : targetObject.getClass(); CatchHandler exceptionHandlerAnnotation = AnnotationUtils .findAnnotation(m, targetClass, CatchHandler.class); Exception unexpectedException = null; if (exceptionHandlerAnnotation == null) { throw new IllegalStateException( "The interceptor annotation can not be determined!"); } CatchHandling[] exceptionHandlingAnnotations = exceptionHandlerAnnotation .value(); Class<? extends Throwable>[] unwrap = exceptionHandlerAnnotation .unwrap(); try { return ic.proceed(); } catch (Exception ex) { if (!contains(unwrap, InvocationTargetException.class)) { unwrap = Arrays.copyOf(unwrap, unwrap.length + 1); unwrap[unwrap.length - 1] = InvocationTargetException.class; } // Unwrap Exception if ex is instanceof InvocationTargetException Throwable t = ExceptionUtils.unwrap(ex, InvocationTargetException.class); boolean exceptionHandled = false; boolean cleanupInvoked = false; if (exceptionHandlingAnnotations.length > 0) { for (CatchHandling handling : exceptionHandlingAnnotations) { if (handling.exception().isInstance(t)) { try { handleThrowable(t); exceptionHandled = true; } catch (Exception unexpected) { unexpectedException = unexpected; } // Only invoke cleanup declared at handling level if (!handling.cleanup().equals(Object.class)) { cleanupInvoked = invokeCleanups(targetClass, targetObject, handling.cleanup(), t); } break; } } } // Handle the default exception type if no handlings are // declared or the handling did not handle the exception if (!exceptionHandled) { if (exceptionHandlerAnnotation.exception().isInstance(t)) { try { handleThrowable(t); exceptionHandled = true; } catch (Exception unexpected) { unexpectedException = unexpected; } if (!exceptionHandlerAnnotation.cleanup().equals( Object.class) && !cleanupInvoked) { if (!cleanupInvoked) { invokeCleanups(targetClass, targetObject, exceptionHandlerAnnotation.cleanup(), t); } } } } if (!exceptionHandled) { if (t instanceof Exception) { unexpectedException = (Exception) t; } else { unexpectedException = new Exception(t); } } } if (unexpectedException != null) { throw unexpectedException; } return null; }
java
@AroundInvoke public Object handle(InvocationContext ic) throws Exception { Method m = ic.getMethod(); Object targetObject = ic.getTarget(); Class<?> targetClass = targetObject == null ? m.getDeclaringClass() : targetObject.getClass(); CatchHandler exceptionHandlerAnnotation = AnnotationUtils .findAnnotation(m, targetClass, CatchHandler.class); Exception unexpectedException = null; if (exceptionHandlerAnnotation == null) { throw new IllegalStateException( "The interceptor annotation can not be determined!"); } CatchHandling[] exceptionHandlingAnnotations = exceptionHandlerAnnotation .value(); Class<? extends Throwable>[] unwrap = exceptionHandlerAnnotation .unwrap(); try { return ic.proceed(); } catch (Exception ex) { if (!contains(unwrap, InvocationTargetException.class)) { unwrap = Arrays.copyOf(unwrap, unwrap.length + 1); unwrap[unwrap.length - 1] = InvocationTargetException.class; } // Unwrap Exception if ex is instanceof InvocationTargetException Throwable t = ExceptionUtils.unwrap(ex, InvocationTargetException.class); boolean exceptionHandled = false; boolean cleanupInvoked = false; if (exceptionHandlingAnnotations.length > 0) { for (CatchHandling handling : exceptionHandlingAnnotations) { if (handling.exception().isInstance(t)) { try { handleThrowable(t); exceptionHandled = true; } catch (Exception unexpected) { unexpectedException = unexpected; } // Only invoke cleanup declared at handling level if (!handling.cleanup().equals(Object.class)) { cleanupInvoked = invokeCleanups(targetClass, targetObject, handling.cleanup(), t); } break; } } } // Handle the default exception type if no handlings are // declared or the handling did not handle the exception if (!exceptionHandled) { if (exceptionHandlerAnnotation.exception().isInstance(t)) { try { handleThrowable(t); exceptionHandled = true; } catch (Exception unexpected) { unexpectedException = unexpected; } if (!exceptionHandlerAnnotation.cleanup().equals( Object.class) && !cleanupInvoked) { if (!cleanupInvoked) { invokeCleanups(targetClass, targetObject, exceptionHandlerAnnotation.cleanup(), t); } } } } if (!exceptionHandled) { if (t instanceof Exception) { unexpectedException = (Exception) t; } else { unexpectedException = new Exception(t); } } } if (unexpectedException != null) { throw unexpectedException; } return null; }
[ "@", "AroundInvoke", "public", "Object", "handle", "(", "InvocationContext", "ic", ")", "throws", "Exception", "{", "Method", "m", "=", "ic", ".", "getMethod", "(", ")", ";", "Object", "targetObject", "=", "ic", ".", "getTarget", "(", ")", ";", "Class", ...
Handles the exception. @param ic The InvocationContext. @return The result of the intercepted method. @throws Exception if an error occurs the handling
[ "Handles", "the", "exception", "." ]
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-ee-utils/src/main/java/com/blazebit/cdi/exception/CatchHandlerInterceptor.java#L47-L137
train
Blazebit/blaze-utils
blaze-ee-utils/src/main/java/com/blazebit/cdi/exception/CatchHandlerInterceptor.java
CatchHandlerInterceptor.invokeCleanups
private boolean invokeCleanups(Class<?> clazz, Object target, Class<?> cleanupClazz, Throwable exception) throws Exception { boolean invoked = false; if (!cleanupClazz.equals(Object.class)) { // Christian Beikov 29.07.2013: Traverse whole hierarchy // instead of retrieving the annotation directly from // the class object. List<Method> methods = ReflectionUtils.getMethods(target.getClass(), Cleanup.class); Method m = null; for (Method candidate : methods) { Cleanup c = AnnotationUtils.findAnnotation(candidate, Cleanup.class); if (cleanupClazz.equals(c.value())) { m = candidate; break; } } if (m != null) { final Class<?>[] parameterTypes = m.getParameterTypes(); if (parameterTypes.length == 1) { if (ReflectionUtils.isSubtype(exception.getClass(), parameterTypes[0])) { m.invoke(target, exception); invoked = true; } else { throw new IllegalArgumentException("Cleanup method with name " + cleanupClazz.getName() + " requires a parameter that is not a subtype of the exception class " + exception.getClass().getName()); } } else { m.invoke(target); invoked = true; } } } return invoked; }
java
private boolean invokeCleanups(Class<?> clazz, Object target, Class<?> cleanupClazz, Throwable exception) throws Exception { boolean invoked = false; if (!cleanupClazz.equals(Object.class)) { // Christian Beikov 29.07.2013: Traverse whole hierarchy // instead of retrieving the annotation directly from // the class object. List<Method> methods = ReflectionUtils.getMethods(target.getClass(), Cleanup.class); Method m = null; for (Method candidate : methods) { Cleanup c = AnnotationUtils.findAnnotation(candidate, Cleanup.class); if (cleanupClazz.equals(c.value())) { m = candidate; break; } } if (m != null) { final Class<?>[] parameterTypes = m.getParameterTypes(); if (parameterTypes.length == 1) { if (ReflectionUtils.isSubtype(exception.getClass(), parameterTypes[0])) { m.invoke(target, exception); invoked = true; } else { throw new IllegalArgumentException("Cleanup method with name " + cleanupClazz.getName() + " requires a parameter that is not a subtype of the exception class " + exception.getClass().getName()); } } else { m.invoke(target); invoked = true; } } } return invoked; }
[ "private", "boolean", "invokeCleanups", "(", "Class", "<", "?", ">", "clazz", ",", "Object", "target", ",", "Class", "<", "?", ">", "cleanupClazz", ",", "Throwable", "exception", ")", "throws", "Exception", "{", "boolean", "invoked", "=", "false", ";", "if...
Invokes the cleanup methods of the exception handler or exception handling. @param clazz the class of the bean to get the methods from @param target the target on which the method is invoked @param cleanupName the name of the cleanup method @return true if the cleanup method were found and invoked @throws Exception if an reflection specific exception occurs
[ "Invokes", "the", "cleanup", "methods", "of", "the", "exception", "handler", "or", "exception", "handling", "." ]
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-ee-utils/src/main/java/com/blazebit/cdi/exception/CatchHandlerInterceptor.java#L171-L208
train
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java
ConnectionContextFactory.createProducerConnectionContext
public ProducerConnectionContext createProducerConnectionContext(Endpoint endpoint) throws JMSException { ProducerConnectionContext context = new ProducerConnectionContext(); createOrReuseConnection(context, true); createSession(context); createDestination(context, endpoint); createProducer(context); return context; }
java
public ProducerConnectionContext createProducerConnectionContext(Endpoint endpoint) throws JMSException { ProducerConnectionContext context = new ProducerConnectionContext(); createOrReuseConnection(context, true); createSession(context); createDestination(context, endpoint); createProducer(context); return context; }
[ "public", "ProducerConnectionContext", "createProducerConnectionContext", "(", "Endpoint", "endpoint", ")", "throws", "JMSException", "{", "ProducerConnectionContext", "context", "=", "new", "ProducerConnectionContext", "(", ")", ";", "createOrReuseConnection", "(", "context"...
Creates a new producer connection context, reusing any existing connection that might have already been created. The destination of the connection's session will be that of the given endpoint. @param endpoint where the producer will send messages @return the new producer connection context fully populated @throws JMSException any error
[ "Creates", "a", "new", "producer", "connection", "context", "reusing", "any", "existing", "connection", "that", "might", "have", "already", "been", "created", ".", "The", "destination", "of", "the", "connection", "s", "session", "will", "be", "that", "of", "th...
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java#L92-L99
train
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java
ConnectionContextFactory.cacheConnection
protected void cacheConnection(Connection connection, boolean closeExistingConnection) { if (this.connection != null && closeExistingConnection) { try { // make sure it is closed to free up any resources it was using this.connection.close(); } catch (JMSException e) { msglog.errorCannotCloseConnectionMemoryMightLeak(e); } } this.connection = connection; }
java
protected void cacheConnection(Connection connection, boolean closeExistingConnection) { if (this.connection != null && closeExistingConnection) { try { // make sure it is closed to free up any resources it was using this.connection.close(); } catch (JMSException e) { msglog.errorCannotCloseConnectionMemoryMightLeak(e); } } this.connection = connection; }
[ "protected", "void", "cacheConnection", "(", "Connection", "connection", ",", "boolean", "closeExistingConnection", ")", "{", "if", "(", "this", ".", "connection", "!=", "null", "&&", "closeExistingConnection", ")", "{", "try", "{", "// make sure it is closed to free ...
To store a connection in this processor object, call this setter. If there was already a cached connection, it will be closed. NOTE: Calling {@link #createConnection(ConnectionContext)} does <b>not</b> set this processor's connection - that method only creates the connection and puts that connection in the context. It does not save that connection in this processor object. You must explicitly set the connection via this method if you want that connection cached here. See also {@link #createOrReuseConnection(ConnectionContext, boolean)}. @param connection the connection @param closeExistingConnection if true, and if there was already a connection cached, that connection will be closed. Otherwise it will be left alone but the new connection will take its place. @see #createOrReuseConnection(ConnectionContext, boolean)
[ "To", "store", "a", "connection", "in", "this", "processor", "object", "call", "this", "setter", ".", "If", "there", "was", "already", "a", "cached", "connection", "it", "will", "be", "closed", "." ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java#L192-L203
train
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java
ConnectionContextFactory.createConnection
protected void createConnection(ConnectionContext context) throws JMSException { if (context == null) { throw new IllegalStateException("The context is null"); } ConnectionFactory factory = getConnectionFactory(); Connection conn = factory.createConnection(); context.setConnection(conn); }
java
protected void createConnection(ConnectionContext context) throws JMSException { if (context == null) { throw new IllegalStateException("The context is null"); } ConnectionFactory factory = getConnectionFactory(); Connection conn = factory.createConnection(); context.setConnection(conn); }
[ "protected", "void", "createConnection", "(", "ConnectionContext", "context", ")", "throws", "JMSException", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"The context is null\"", ")", ";", "}", "ConnectionFactory...
Creates a connection using this object's connection factory and stores that connection in the given context object. NOTE: this does <b>not</b> set the connection in this processor object. If the caller wants the created connection cached in this processor object, {@link #cacheConnection} must be passed the connection found in the context after this method returns. See also {@link #createOrReuseConnection(ConnectionContext, boolean)}. @param context the context where the new connection is stored @throws JMSException any error @throws IllegalStateException if the context is null @see #createOrReuseConnection(ConnectionContext, boolean) @see #cacheConnection
[ "Creates", "a", "connection", "using", "this", "object", "s", "connection", "factory", "and", "stores", "that", "connection", "in", "the", "given", "context", "object", "." ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java#L274-L281
train
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java
ConnectionContextFactory.createSession
protected void createSession(ConnectionContext context) throws JMSException { if (context == null) { throw new IllegalStateException("The context is null"); } Connection conn = context.getConnection(); if (conn == null) { throw new IllegalStateException("The context had a null connection"); } Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); context.setSession(session); }
java
protected void createSession(ConnectionContext context) throws JMSException { if (context == null) { throw new IllegalStateException("The context is null"); } Connection conn = context.getConnection(); if (conn == null) { throw new IllegalStateException("The context had a null connection"); } Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE); context.setSession(session); }
[ "protected", "void", "createSession", "(", "ConnectionContext", "context", ")", "throws", "JMSException", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"The context is null\"", ")", ";", "}", "Connection", "conn...
Creates a default session using the context's connection. This implementation creates a non-transacted, auto-acknowledged session. Subclasses are free to override this behavior. @param context the context where the new session is stored @throws JMSException any error @throws IllegalStateException if the context is null or the context's connection is null
[ "Creates", "a", "default", "session", "using", "the", "context", "s", "connection", ".", "This", "implementation", "creates", "a", "non", "-", "transacted", "auto", "-", "acknowledged", "session", ".", "Subclasses", "are", "free", "to", "override", "this", "be...
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java#L291-L301
train
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java
ConnectionContextFactory.createDestination
protected void createDestination(ConnectionContext context, Endpoint endpoint) throws JMSException { if (endpoint == null) { throw new IllegalStateException("Endpoint is null"); } if (context == null) { throw new IllegalStateException("The context is null"); } Session session = context.getSession(); if (session == null) { throw new IllegalStateException("The context had a null session"); } Destination dest; if (endpoint.getType() == Endpoint.Type.QUEUE) { if (endpoint.isTemporary()) { dest = session.createTemporaryQueue(); } else { dest = session.createQueue(getDestinationName(endpoint)); } } else { if (endpoint.isTemporary()) { dest = session.createTemporaryTopic(); } else { dest = session.createTopic(getDestinationName(endpoint)); } } context.setDestination(dest); }
java
protected void createDestination(ConnectionContext context, Endpoint endpoint) throws JMSException { if (endpoint == null) { throw new IllegalStateException("Endpoint is null"); } if (context == null) { throw new IllegalStateException("The context is null"); } Session session = context.getSession(); if (session == null) { throw new IllegalStateException("The context had a null session"); } Destination dest; if (endpoint.getType() == Endpoint.Type.QUEUE) { if (endpoint.isTemporary()) { dest = session.createTemporaryQueue(); } else { dest = session.createQueue(getDestinationName(endpoint)); } } else { if (endpoint.isTemporary()) { dest = session.createTemporaryTopic(); } else { dest = session.createTopic(getDestinationName(endpoint)); } } context.setDestination(dest); }
[ "protected", "void", "createDestination", "(", "ConnectionContext", "context", ",", "Endpoint", "endpoint", ")", "throws", "JMSException", "{", "if", "(", "endpoint", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Endpoint is null\"", ")", ...
Creates a destination using the context's session. The destination correlates to the given named queue or topic. @param context the context where the new destination is stored @param endpoint identifies the queue or topic @throws JMSException any error @throws IllegalStateException if the context is null or the context's session is null or endpoint is null
[ "Creates", "a", "destination", "using", "the", "context", "s", "session", ".", "The", "destination", "correlates", "to", "the", "given", "named", "queue", "or", "topic", "." ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java#L311-L337
train
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java
ConnectionContextFactory.createProducer
protected void createProducer(ProducerConnectionContext context) throws JMSException { if (context == null) { throw new IllegalStateException("The context is null"); } Session session = context.getSession(); if (session == null) { throw new IllegalStateException("The context had a null session"); } Destination dest = context.getDestination(); if (dest == null) { throw new IllegalStateException("The context had a null destination"); } MessageProducer producer = session.createProducer(dest); context.setMessageProducer(producer); }
java
protected void createProducer(ProducerConnectionContext context) throws JMSException { if (context == null) { throw new IllegalStateException("The context is null"); } Session session = context.getSession(); if (session == null) { throw new IllegalStateException("The context had a null session"); } Destination dest = context.getDestination(); if (dest == null) { throw new IllegalStateException("The context had a null destination"); } MessageProducer producer = session.createProducer(dest); context.setMessageProducer(producer); }
[ "protected", "void", "createProducer", "(", "ProducerConnectionContext", "context", ")", "throws", "JMSException", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"The context is null\"", ")", ";", "}", "Session", ...
Creates a message producer using the context's session and destination. @param context the context where the new producer is stored @throws JMSException any error @throws IllegalStateException if the context is null or the context's session is null or the context's destination is null
[ "Creates", "a", "message", "producer", "using", "the", "context", "s", "session", "and", "destination", "." ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java#L356-L370
train
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java
ConnectionContextFactory.createConsumer
protected void createConsumer(ConsumerConnectionContext context, String messageSelector) throws JMSException { if (context == null) { throw new IllegalStateException("The context is null"); } Session session = context.getSession(); if (session == null) { throw new IllegalStateException("The context had a null session"); } Destination dest = context.getDestination(); if (dest == null) { throw new IllegalStateException("The context had a null destination"); } MessageConsumer consumer = session.createConsumer(dest, messageSelector); context.setMessageConsumer(consumer); }
java
protected void createConsumer(ConsumerConnectionContext context, String messageSelector) throws JMSException { if (context == null) { throw new IllegalStateException("The context is null"); } Session session = context.getSession(); if (session == null) { throw new IllegalStateException("The context had a null session"); } Destination dest = context.getDestination(); if (dest == null) { throw new IllegalStateException("The context had a null destination"); } MessageConsumer consumer = session.createConsumer(dest, messageSelector); context.setMessageConsumer(consumer); }
[ "protected", "void", "createConsumer", "(", "ConsumerConnectionContext", "context", ",", "String", "messageSelector", ")", "throws", "JMSException", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"The context is null...
Creates a message consumer using the context's session and destination. @param context the context where the new consumer is stored @param messageSelector the message selector expression that the consumer will use to filter messages @throws JMSException any error @throws IllegalStateException if the context is null or the context's session is null or the context's destination is null
[ "Creates", "a", "message", "consumer", "using", "the", "context", "s", "session", "and", "destination", "." ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContextFactory.java#L381-L395
train
gtri/typesafeconfig-extensions
factory/src/main/java/edu/gatech/gtri/typesafeconfigextensions/factory/ConfigFactory.java
ConfigFactory.defaultBindings
public static Bindings defaultBindings() { return noHashMapBindings() .set( ClassLoader.class, Thread.currentThread().getContextClassLoader() ) .set( ConfigParseOptions.class, ConfigParseOptions.defaults() ) .set( ConfigResolveOptions.class, ConfigResolveOptions.defaults() ) .set( Config.class, emptyConfig() ); }
java
public static Bindings defaultBindings() { return noHashMapBindings() .set( ClassLoader.class, Thread.currentThread().getContextClassLoader() ) .set( ConfigParseOptions.class, ConfigParseOptions.defaults() ) .set( ConfigResolveOptions.class, ConfigResolveOptions.defaults() ) .set( Config.class, emptyConfig() ); }
[ "public", "static", "Bindings", "defaultBindings", "(", ")", "{", "return", "noHashMapBindings", "(", ")", ".", "set", "(", "ClassLoader", ".", "class", ",", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ")", ".", "set", ...
Some default bindings that most config factories will need. <ul> <li> {@link ClassLoader} &rarr; {@link Thread#currentThread()}.{@link Thread#getContextClassLoader() getContextClassLoader()} </li> <li> {@link com.typesafe.config.ConfigParseOptions} &rarr; {@link com.typesafe.config.ConfigParseOptions#defaults()} </li> <li> {@link com.typesafe.config.ConfigResolveOptions} &rarr; {@link com.typesafe.config.ConfigParseOptions#defaults()} </li> <li> {@link com.typesafe.config.Config} &rarr; {@link com.typesafe.config.ConfigFactory#empty() ConfigFactory.empty()} </li> </ul>
[ "Some", "default", "bindings", "that", "most", "config", "factories", "will", "need", "." ]
4ef126605f45c60041542a23b9f331b0575e9bd1
https://github.com/gtri/typesafeconfig-extensions/blob/4ef126605f45c60041542a23b9f331b0575e9bd1/factory/src/main/java/edu/gatech/gtri/typesafeconfigextensions/factory/ConfigFactory.java#L584-L603
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/CalendarPeriodAssociative.java
CalendarPeriodAssociative.Init
public void Init( CalendarPeriod period, T value ) { for( int i = 0; i < period.getPeriods().size(); i++ ) { Period p = period.getPeriods().get( i ); periods.add( new PeriodAssociative<T>( p.getFrom(), p.getTo(), value ) ); } }
java
public void Init( CalendarPeriod period, T value ) { for( int i = 0; i < period.getPeriods().size(); i++ ) { Period p = period.getPeriods().get( i ); periods.add( new PeriodAssociative<T>( p.getFrom(), p.getTo(), value ) ); } }
[ "public", "void", "Init", "(", "CalendarPeriod", "period", ",", "T", "value", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "period", ".", "getPeriods", "(", ")", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Period", "p", "=",...
init from a CalendarPeriod with a value
[ "init", "from", "a", "CalendarPeriod", "with", "a", "value" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/CalendarPeriodAssociative.java#L41-L48
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/CalendarPeriodAssociative.java
CalendarPeriodAssociative.Add
public Boolean Add( CalendarPeriodAssociative<T> period, AddFunction<T> addFunction ) { // combine les deux tableaux dans ordre croissant List<PeriodAssociative<T>> combined = _Combine( periods, period.getPeriods() ); // merge overlapping periods List<PeriodAssociative<T>> result = _Merge( combined, addFunction ); if( result == null ) return null; // we should stop the MakeUpCalendarAssociative process periods = result; // to say we can continue... return true; }
java
public Boolean Add( CalendarPeriodAssociative<T> period, AddFunction<T> addFunction ) { // combine les deux tableaux dans ordre croissant List<PeriodAssociative<T>> combined = _Combine( periods, period.getPeriods() ); // merge overlapping periods List<PeriodAssociative<T>> result = _Merge( combined, addFunction ); if( result == null ) return null; // we should stop the MakeUpCalendarAssociative process periods = result; // to say we can continue... return true; }
[ "public", "Boolean", "Add", "(", "CalendarPeriodAssociative", "<", "T", ">", "period", ",", "AddFunction", "<", "T", ">", "addFunction", ")", "{", "// combine les deux tableaux dans ordre croissant", "List", "<", "PeriodAssociative", "<", "T", ">>", "combined", "=",...
adding two associative periods
[ "adding", "two", "associative", "periods" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/CalendarPeriodAssociative.java#L75-L89
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/CalendarPeriodAssociative.java
CalendarPeriodAssociative.GetCalendarPeriod
public CalendarPeriod GetCalendarPeriod() { CalendarPeriod res = new CalendarPeriod(); List<Period> periods = new ArrayList<Period>(); for( int i = 0; i < this.periods.size(); i++ ) { PeriodAssociative<T> p = this.periods.get( i ); periods.add( new Period( p.getFrom(), p.getTo() ) ); } // use merge to merge jointed periods... res.setPeriods( res._Merge( periods ) ); return res; }
java
public CalendarPeriod GetCalendarPeriod() { CalendarPeriod res = new CalendarPeriod(); List<Period> periods = new ArrayList<Period>(); for( int i = 0; i < this.periods.size(); i++ ) { PeriodAssociative<T> p = this.periods.get( i ); periods.add( new Period( p.getFrom(), p.getTo() ) ); } // use merge to merge jointed periods... res.setPeriods( res._Merge( periods ) ); return res; }
[ "public", "CalendarPeriod", "GetCalendarPeriod", "(", ")", "{", "CalendarPeriod", "res", "=", "new", "CalendarPeriod", "(", ")", ";", "List", "<", "Period", ">", "periods", "=", "new", "ArrayList", "<", "Period", ">", "(", ")", ";", "for", "(", "int", "i...
returns the same but with no values, and with the periods merged
[ "returns", "the", "same", "but", "with", "no", "values", "and", "with", "the", "periods", "merged" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/CalendarPeriodAssociative.java#L92-L105
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/ParsingExpression.java
ParsingExpression._readDate
private boolean _readDate() { int endIndex = pos + 10; if( endIndex <= len ) { _date = text.substring( pos, endIndex ); pos += 10; return true; } pos = len; return false; }
java
private boolean _readDate() { int endIndex = pos + 10; if( endIndex <= len ) { _date = text.substring( pos, endIndex ); pos += 10; return true; } pos = len; return false; }
[ "private", "boolean", "_readDate", "(", ")", "{", "int", "endIndex", "=", "pos", "+", "10", ";", "if", "(", "endIndex", "<=", "len", ")", "{", "_date", "=", "text", ".", "substring", "(", "pos", ",", "endIndex", ")", ";", "pos", "+=", "10", ";", ...
parse a date in the format yyyy-mm-dd @return boolean
[ "parse", "a", "date", "in", "the", "format", "yyyy", "-", "mm", "-", "dd" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/calendar/ParsingExpression.java#L139-L150
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/chart/XYMoneyStep.java
XYMoneyStep.emphasizePoint
public void emphasizePoint( int index ) { if( dots == null || dots.length < (index - 1) ) return; // impossible ! // if no change, nothing to do if( emphasizedPoint == index ) return; // de-emphasize the current emphasized point if( emphasizedPoint >= 0 ) { dots[emphasizedPoint].attr( "r", dotNormalSize ); emphasizedPoint = -1; } if( index >= 0 ) { dots[index].attr( "r", dotBigSize ); emphasizedPoint = index; } }
java
public void emphasizePoint( int index ) { if( dots == null || dots.length < (index - 1) ) return; // impossible ! // if no change, nothing to do if( emphasizedPoint == index ) return; // de-emphasize the current emphasized point if( emphasizedPoint >= 0 ) { dots[emphasizedPoint].attr( "r", dotNormalSize ); emphasizedPoint = -1; } if( index >= 0 ) { dots[index].attr( "r", dotBigSize ); emphasizedPoint = index; } }
[ "public", "void", "emphasizePoint", "(", "int", "index", ")", "{", "if", "(", "dots", "==", "null", "||", "dots", ".", "length", "<", "(", "index", "-", "1", ")", ")", "return", ";", "// impossible !", "// if no change, nothing to do", "if", "(", "emphasiz...
index < 0 means that we emphasize no point at all
[ "index", "<", "0", "means", "that", "we", "emphasize", "no", "point", "at", "all" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/chart/XYMoneyStep.java#L75-L98
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/treetable/Row.java
Row.moveLastChild
public void moveLastChild( Row newParent ) { if( this == newParent ) return; // remove from its current position Row parentItem = m_parent; if( parentItem == null ) parentItem = this.treeTable.m_rootItem; parentItem.getChilds().remove( this ); // DOM.removeChild( m_body, m_tr ); if( newParent == null ) newParent = this.treeTable.m_rootItem; // insert at the end of the current parent // DOM add Row lastLeaf = newParent.getLastLeaf(); Element trToInsertAfter = lastLeaf.m_tr; if( trToInsertAfter != null ) { int after = DOM.getChildIndex( this.treeTable.m_body, trToInsertAfter ); int before = after + 1; DOM.insertChild( this.treeTable.m_body, m_tr, before ); } else { DOM.appendChild( this.treeTable.m_body, m_tr ); } parentItem.getChilds().add( this ); // take care of the left padding Element firstTd = DOM.getChild( m_tr, 0 ); firstTd.getStyle().setPaddingLeft( getLevel() * this.treeTable.treePadding, Unit.PX ); }
java
public void moveLastChild( Row newParent ) { if( this == newParent ) return; // remove from its current position Row parentItem = m_parent; if( parentItem == null ) parentItem = this.treeTable.m_rootItem; parentItem.getChilds().remove( this ); // DOM.removeChild( m_body, m_tr ); if( newParent == null ) newParent = this.treeTable.m_rootItem; // insert at the end of the current parent // DOM add Row lastLeaf = newParent.getLastLeaf(); Element trToInsertAfter = lastLeaf.m_tr; if( trToInsertAfter != null ) { int after = DOM.getChildIndex( this.treeTable.m_body, trToInsertAfter ); int before = after + 1; DOM.insertChild( this.treeTable.m_body, m_tr, before ); } else { DOM.appendChild( this.treeTable.m_body, m_tr ); } parentItem.getChilds().add( this ); // take care of the left padding Element firstTd = DOM.getChild( m_tr, 0 ); firstTd.getStyle().setPaddingLeft( getLevel() * this.treeTable.treePadding, Unit.PX ); }
[ "public", "void", "moveLastChild", "(", "Row", "newParent", ")", "{", "if", "(", "this", "==", "newParent", ")", "return", ";", "// remove from its current position", "Row", "parentItem", "=", "m_parent", ";", "if", "(", "parentItem", "==", "null", ")", "paren...
move to be the last item of parent
[ "move", "to", "be", "the", "last", "item", "of", "parent" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/treetable/Row.java#L124-L161
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/treetable/Row.java
Row.moveBefore
public void moveBefore( Row item ) { if( this == item ) return; Element lastTrToMove = getLastLeafTR(); Element firstChildRow = DOM.getNextSibling( m_tr ); // remove from its current position Row parentItem = m_parent; if( parentItem == null ) parentItem = this.treeTable.m_rootItem; parentItem.getChilds().remove( this ); // insert at the selected position if( item == null ) { // insert at the end of the current parent // DOM add Row lastLeaf = parentItem.getLastLeaf(); Element trToInsertAfter = lastLeaf.m_tr; if( trToInsertAfter != null ) { int after = DOM.getChildIndex( this.treeTable.m_body, trToInsertAfter ); int before = after + 1; DOM.insertChild( this.treeTable.m_body, m_tr, before ); } else { DOM.appendChild( this.treeTable.m_body, m_tr ); } parentItem.getChilds().add( this ); } else { Row newParentItem = item.m_parent; if( newParentItem == null ) newParentItem = this.treeTable.m_rootItem; int itemPos = item.m_parent.getChilds().indexOf( item ); newParentItem.getChilds().add( itemPos, this ); DOM.insertBefore( this.treeTable.m_body, m_tr, item.m_tr ); } // take care of the left padding Element firstTd = DOM.getChild( m_tr, 0 ); firstTd.getStyle().setPaddingLeft( getLevel() * this.treeTable.treePadding, Unit.PX ); // update child rows Element nextTR = DOM.getNextSibling( m_tr ); if( firstChildRow != null && lastTrToMove != null && hasChilds() ) { while( true ) { Element next = DOM.getNextSibling( firstChildRow ); DOM.insertBefore( this.treeTable.m_body, firstChildRow, nextTR ); if( firstChildRow == lastTrToMove ) break; firstChildRow = next; } } }
java
public void moveBefore( Row item ) { if( this == item ) return; Element lastTrToMove = getLastLeafTR(); Element firstChildRow = DOM.getNextSibling( m_tr ); // remove from its current position Row parentItem = m_parent; if( parentItem == null ) parentItem = this.treeTable.m_rootItem; parentItem.getChilds().remove( this ); // insert at the selected position if( item == null ) { // insert at the end of the current parent // DOM add Row lastLeaf = parentItem.getLastLeaf(); Element trToInsertAfter = lastLeaf.m_tr; if( trToInsertAfter != null ) { int after = DOM.getChildIndex( this.treeTable.m_body, trToInsertAfter ); int before = after + 1; DOM.insertChild( this.treeTable.m_body, m_tr, before ); } else { DOM.appendChild( this.treeTable.m_body, m_tr ); } parentItem.getChilds().add( this ); } else { Row newParentItem = item.m_parent; if( newParentItem == null ) newParentItem = this.treeTable.m_rootItem; int itemPos = item.m_parent.getChilds().indexOf( item ); newParentItem.getChilds().add( itemPos, this ); DOM.insertBefore( this.treeTable.m_body, m_tr, item.m_tr ); } // take care of the left padding Element firstTd = DOM.getChild( m_tr, 0 ); firstTd.getStyle().setPaddingLeft( getLevel() * this.treeTable.treePadding, Unit.PX ); // update child rows Element nextTR = DOM.getNextSibling( m_tr ); if( firstChildRow != null && lastTrToMove != null && hasChilds() ) { while( true ) { Element next = DOM.getNextSibling( firstChildRow ); DOM.insertBefore( this.treeTable.m_body, firstChildRow, nextTR ); if( firstChildRow == lastTrToMove ) break; firstChildRow = next; } } }
[ "public", "void", "moveBefore", "(", "Row", "item", ")", "{", "if", "(", "this", "==", "item", ")", "return", ";", "Element", "lastTrToMove", "=", "getLastLeafTR", "(", ")", ";", "Element", "firstChildRow", "=", "DOM", ".", "getNextSibling", "(", "m_tr", ...
move to position just before "item"
[ "move", "to", "position", "just", "before", "item" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/treetable/Row.java#L196-L259
train
ltearno/hexa.tools
hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/PropertyChanges.java
PropertyChanges.removeHandler
void removeHandler( Object handlerRegistration ) { // Through object's interface implementation if( handlerRegistration instanceof DirectHandlerInfo ) { DirectHandlerInfo info = (DirectHandlerInfo) handlerRegistration; info.source.removePropertyChangedHandler( info.registrationObject ); return; } if( ! ( handlerRegistration instanceof HandlerInfo ) ) return; HandlerInfo info = (HandlerInfo) handlerRegistration; HashMap<String, ArrayList<PropertyChangedHandler>> handlersMap = PlatformSpecificProvider.get().getObjectMetadata( info.source ); if( handlersMap == null ) return; ArrayList<PropertyChangedHandler> handlerList = handlersMap.get( info.propertyName ); if( handlerList == null ) return; handlerList.remove( info.handler ); if( handlerList.isEmpty() ) handlersMap.remove( info.propertyName ); if( handlersMap.isEmpty() ) PlatformSpecificProvider.get().setObjectMetadata( info.source, null ); stats.statsRemovedRegistration( info ); info.handler = null; info.propertyName = null; info.source = null; }
java
void removeHandler( Object handlerRegistration ) { // Through object's interface implementation if( handlerRegistration instanceof DirectHandlerInfo ) { DirectHandlerInfo info = (DirectHandlerInfo) handlerRegistration; info.source.removePropertyChangedHandler( info.registrationObject ); return; } if( ! ( handlerRegistration instanceof HandlerInfo ) ) return; HandlerInfo info = (HandlerInfo) handlerRegistration; HashMap<String, ArrayList<PropertyChangedHandler>> handlersMap = PlatformSpecificProvider.get().getObjectMetadata( info.source ); if( handlersMap == null ) return; ArrayList<PropertyChangedHandler> handlerList = handlersMap.get( info.propertyName ); if( handlerList == null ) return; handlerList.remove( info.handler ); if( handlerList.isEmpty() ) handlersMap.remove( info.propertyName ); if( handlersMap.isEmpty() ) PlatformSpecificProvider.get().setObjectMetadata( info.source, null ); stats.statsRemovedRegistration( info ); info.handler = null; info.propertyName = null; info.source = null; }
[ "void", "removeHandler", "(", "Object", "handlerRegistration", ")", "{", "// Through object's interface implementation", "if", "(", "handlerRegistration", "instanceof", "DirectHandlerInfo", ")", "{", "DirectHandlerInfo", "info", "=", "(", "DirectHandlerInfo", ")", "handlerR...
Unregisters a handler, freeing associated resources @param handlerRegistration The object received after a call to {@link PropertyChanges}
[ "Unregisters", "a", "handler", "freeing", "associated", "resources" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/PropertyChanges.java#L77-L113
train
hawkular/hawkular-commons
hawkular-cors-jaxrs-filter/src/main/java/org/hawkular/jaxrs/filter/cors/CorsFilters.java
CorsFilters.filterRequest
public static void filterRequest(ContainerRequestContext requestContext, Predicate<String> predicate) { //NOT a CORS request String requestOrigin = requestContext.getHeaderString(Headers.ORIGIN); if (requestOrigin == null) { return; } if (!predicate.test(requestOrigin)) { requestContext.abortWith(Response.status(Response.Status.BAD_REQUEST).build()); return; } //It is a CORS pre-flight request, there is no route for it, just return 200 if (requestContext.getMethod().equalsIgnoreCase(HttpMethod.OPTIONS)) { requestContext.abortWith(Response.status(Response.Status.OK).build()); } }
java
public static void filterRequest(ContainerRequestContext requestContext, Predicate<String> predicate) { //NOT a CORS request String requestOrigin = requestContext.getHeaderString(Headers.ORIGIN); if (requestOrigin == null) { return; } if (!predicate.test(requestOrigin)) { requestContext.abortWith(Response.status(Response.Status.BAD_REQUEST).build()); return; } //It is a CORS pre-flight request, there is no route for it, just return 200 if (requestContext.getMethod().equalsIgnoreCase(HttpMethod.OPTIONS)) { requestContext.abortWith(Response.status(Response.Status.OK).build()); } }
[ "public", "static", "void", "filterRequest", "(", "ContainerRequestContext", "requestContext", ",", "Predicate", "<", "String", ">", "predicate", ")", "{", "//NOT a CORS request", "String", "requestOrigin", "=", "requestContext", ".", "getHeaderString", "(", "Headers", ...
Apply CORS filter on request @param requestContext request context @param predicate must return {@code true} if the input origin is allowed, else {@code false}.
[ "Apply", "CORS", "filter", "on", "request" ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-cors-jaxrs-filter/src/main/java/org/hawkular/jaxrs/filter/cors/CorsFilters.java#L41-L57
train
hawkular/hawkular-commons
hawkular-cors-jaxrs-filter/src/main/java/org/hawkular/jaxrs/filter/cors/CorsFilters.java
CorsFilters.filterResponse
public static void filterResponse(ContainerRequestContext requestContext, ContainerResponseContext responseContext, String extraAccesControlAllowHeaders) { String requestOrigin = requestContext.getHeaderString(Headers.ORIGIN); if (requestOrigin == null) { return; } // CORS validation already checked on request filter, see AbstractCorsRequestFilter MultivaluedMap<String, Object> responseHeaders = responseContext.getHeaders(); responseHeaders.add(Headers.ACCESS_CONTROL_ALLOW_ORIGIN, requestOrigin); responseHeaders.add(Headers.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"); responseHeaders.add(Headers.ACCESS_CONTROL_ALLOW_METHODS, Headers.DEFAULT_CORS_ACCESS_CONTROL_ALLOW_METHODS); responseHeaders.add(Headers.ACCESS_CONTROL_MAX_AGE, 72 * 60 * 60); if (extraAccesControlAllowHeaders != null) { responseHeaders.add(Headers.ACCESS_CONTROL_ALLOW_HEADERS, Headers.DEFAULT_CORS_ACCESS_CONTROL_ALLOW_HEADERS + "," + extraAccesControlAllowHeaders.trim()); } else { responseHeaders.add(Headers.ACCESS_CONTROL_ALLOW_HEADERS, Headers.DEFAULT_CORS_ACCESS_CONTROL_ALLOW_HEADERS); } }
java
public static void filterResponse(ContainerRequestContext requestContext, ContainerResponseContext responseContext, String extraAccesControlAllowHeaders) { String requestOrigin = requestContext.getHeaderString(Headers.ORIGIN); if (requestOrigin == null) { return; } // CORS validation already checked on request filter, see AbstractCorsRequestFilter MultivaluedMap<String, Object> responseHeaders = responseContext.getHeaders(); responseHeaders.add(Headers.ACCESS_CONTROL_ALLOW_ORIGIN, requestOrigin); responseHeaders.add(Headers.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"); responseHeaders.add(Headers.ACCESS_CONTROL_ALLOW_METHODS, Headers.DEFAULT_CORS_ACCESS_CONTROL_ALLOW_METHODS); responseHeaders.add(Headers.ACCESS_CONTROL_MAX_AGE, 72 * 60 * 60); if (extraAccesControlAllowHeaders != null) { responseHeaders.add(Headers.ACCESS_CONTROL_ALLOW_HEADERS, Headers.DEFAULT_CORS_ACCESS_CONTROL_ALLOW_HEADERS + "," + extraAccesControlAllowHeaders.trim()); } else { responseHeaders.add(Headers.ACCESS_CONTROL_ALLOW_HEADERS, Headers.DEFAULT_CORS_ACCESS_CONTROL_ALLOW_HEADERS); } }
[ "public", "static", "void", "filterResponse", "(", "ContainerRequestContext", "requestContext", ",", "ContainerResponseContext", "responseContext", ",", "String", "extraAccesControlAllowHeaders", ")", "{", "String", "requestOrigin", "=", "requestContext", ".", "getHeaderStrin...
Apply CORS headers on response @param requestContext request context @param responseContext response context @param extraAccesControlAllowHeaders eventual extra allowed headers (nullable)
[ "Apply", "CORS", "headers", "on", "response" ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-cors-jaxrs-filter/src/main/java/org/hawkular/jaxrs/filter/cors/CorsFilters.java#L65-L90
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/other/HtmlTableTemplate.java
HtmlTableTemplate.getCell
public static TableCellElement getCell( Element root, int column, int row ) { TableSectionElement tbody = getTBodyElement( root ); TableRowElement tr = tbody.getChild( row ).cast(); TableCellElement td = tr.getChild( column ).cast(); return td; }
java
public static TableCellElement getCell( Element root, int column, int row ) { TableSectionElement tbody = getTBodyElement( root ); TableRowElement tr = tbody.getChild( row ).cast(); TableCellElement td = tr.getChild( column ).cast(); return td; }
[ "public", "static", "TableCellElement", "getCell", "(", "Element", "root", ",", "int", "column", ",", "int", "row", ")", "{", "TableSectionElement", "tbody", "=", "getTBodyElement", "(", "root", ")", ";", "TableRowElement", "tr", "=", "tbody", ".", "getChild",...
Get the TD element @param root @param column @param row @return
[ "Get", "the", "TD", "element" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/other/HtmlTableTemplate.java#L74-L82
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/other/HtmlTableTemplate.java
HtmlTableTemplate.getParentCellForElement
public static Pair<Integer, Integer> getParentCellForElement( Element root, Element element ) { Element tbody = getTBodyElement( root ); // Is the element in our table ? and what's the path from the table to it ? ArrayList<Element> path = TemplateUtils.isDescendant( tbody, element ); if( path == null ) return null; // we know that path[0] is tbody and that path[1] is a tr template int row = DOM.getChildIndex( path.get( 0 ), path.get( 1 ) ); int col = DOM.getChildIndex( path.get( 1 ), path.get( 2 ) ); return new Pair<Integer, Integer>( col, row ); }
java
public static Pair<Integer, Integer> getParentCellForElement( Element root, Element element ) { Element tbody = getTBodyElement( root ); // Is the element in our table ? and what's the path from the table to it ? ArrayList<Element> path = TemplateUtils.isDescendant( tbody, element ); if( path == null ) return null; // we know that path[0] is tbody and that path[1] is a tr template int row = DOM.getChildIndex( path.get( 0 ), path.get( 1 ) ); int col = DOM.getChildIndex( path.get( 1 ), path.get( 2 ) ); return new Pair<Integer, Integer>( col, row ); }
[ "public", "static", "Pair", "<", "Integer", ",", "Integer", ">", "getParentCellForElement", "(", "Element", "root", ",", "Element", "element", ")", "{", "Element", "tbody", "=", "getTBodyElement", "(", "root", ")", ";", "// Is the element in our table ? and what's t...
Returns the coordinate of the cell containing the element, given that root is the root of a HtmlTableTemplate @param root @param element @return
[ "Returns", "the", "coordinate", "of", "the", "cell", "containing", "the", "element", "given", "that", "root", "is", "the", "root", "of", "a", "HtmlTableTemplate" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/other/HtmlTableTemplate.java#L90-L104
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/dragdrop/DragUtils.java
DragUtils.setDragData
public static void setDragData( Object source, Object data ) { DragUtils.source = source; DragUtils.data = data; }
java
public static void setDragData( Object source, Object data ) { DragUtils.source = source; DragUtils.data = data; }
[ "public", "static", "void", "setDragData", "(", "Object", "source", ",", "Object", "data", ")", "{", "DragUtils", ".", "source", "=", "source", ";", "DragUtils", ".", "data", "=", "data", ";", "}" ]
Sets the drag and drop data and its source @param source @param data
[ "Sets", "the", "drag", "and", "drop", "data", "and", "its", "source" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/dragdrop/DragUtils.java#L30-L34
train
gtri/typesafeconfig-extensions
for-webapps/src/main/java/edu/gatech/gtri/typesafeconfigextensions/forwebapps/WebappConfigs.java
WebappConfigs.webappConfigFactory
public static ConfigFactory webappConfigFactory(ServletContext servletContext) { checkNotNull(servletContext); return webappConfigFactory() .bind(ServletContextPath.class) .toInstance(ServletContextPath.fromServletContext(servletContext)); }
java
public static ConfigFactory webappConfigFactory(ServletContext servletContext) { checkNotNull(servletContext); return webappConfigFactory() .bind(ServletContextPath.class) .toInstance(ServletContextPath.fromServletContext(servletContext)); }
[ "public", "static", "ConfigFactory", "webappConfigFactory", "(", "ServletContext", "servletContext", ")", "{", "checkNotNull", "(", "servletContext", ")", ";", "return", "webappConfigFactory", "(", ")", ".", "bind", "(", "ServletContextPath", ".", "class", ")", ".",...
A sensible default configuration factory for a web application. <p>Config sources, in order from highest to lowest precedence:</p> <ul> <li>System properties</li> <li>File: {@code JNDI(webapp.config.directory)/[servlet context path]}</li> <li>File: {@code ${webapp.config.directory}/[servlet context path]}</li> <li>File: {@code JNDI(webapp.config.file)}</li> <li>File: {@code ${webapp.config.file}}</li> <li>Classpath resource: {@code application.conf}</li> <li>Classpath resource: {@code resource.conf}</li> </ul>
[ "A", "sensible", "default", "configuration", "factory", "for", "a", "web", "application", "." ]
4ef126605f45c60041542a23b9f331b0575e9bd1
https://github.com/gtri/typesafeconfig-extensions/blob/4ef126605f45c60041542a23b9f331b0575e9bd1/for-webapps/src/main/java/edu/gatech/gtri/typesafeconfigextensions/forwebapps/WebappConfigs.java#L56-L64
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/containers/CenterPanel.java
CenterPanel.setWidget
@Override public void setWidget( Widget w ) { // Validate if( w == widget ) return; // Detach new child. if( w != null ) w.removeFromParent(); // Remove old child. if( widget != null ) remove( widget ); // Logical attach. widget = w; if( w != null ) { // Physical attach. DOM.appendChild( containerElement, widget.getElement() ); adopt( w ); } }
java
@Override public void setWidget( Widget w ) { // Validate if( w == widget ) return; // Detach new child. if( w != null ) w.removeFromParent(); // Remove old child. if( widget != null ) remove( widget ); // Logical attach. widget = w; if( w != null ) { // Physical attach. DOM.appendChild( containerElement, widget.getElement() ); adopt( w ); } }
[ "@", "Override", "public", "void", "setWidget", "(", "Widget", "w", ")", "{", "// Validate", "if", "(", "w", "==", "widget", ")", "return", ";", "// Detach new child.", "if", "(", "w", "!=", "null", ")", "w", ".", "removeFromParent", "(", ")", ";", "//...
Sets this panel's widget. Any existing child widget will be removed. @param w the panel's new widget, or <code>null</code> to clear the panel
[ "Sets", "this", "panel", "s", "widget", ".", "Any", "existing", "child", "widget", "will", "be", "removed", "." ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/containers/CenterPanel.java#L148-L173
train
ixa-ehu/ixa-pipe-parse
src/main/java/eus/ixa/ixa/pipe/parse/Annotate.java
Annotate.getSentenceFromTokens
private String getSentenceFromTokens(final String[] tokens) { final StringBuilder sb = new StringBuilder(); for (final String token : tokens) { sb.append(token).append(" "); } final String sentence = sb.toString(); return sentence; }
java
private String getSentenceFromTokens(final String[] tokens) { final StringBuilder sb = new StringBuilder(); for (final String token : tokens) { sb.append(token).append(" "); } final String sentence = sb.toString(); return sentence; }
[ "private", "String", "getSentenceFromTokens", "(", "final", "String", "[", "]", "tokens", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "final", "String", "token", ":", "tokens", ")", "{", "sb", ".", "a...
It takes an array of tokens and outputs a string with tokens joined by a whitespace. @param array of tokens @return string representing one sentence for each array
[ "It", "takes", "an", "array", "of", "tokens", "and", "outputs", "a", "string", "with", "tokens", "joined", "by", "a", "whitespace", "." ]
ce90ff17ff8846e7a055bcce8b516d976272f856
https://github.com/ixa-ehu/ixa-pipe-parse/blob/ce90ff17ff8846e7a055bcce8b516d976272f856/src/main/java/eus/ixa/ixa/pipe/parse/Annotate.java#L93-L100
train
ixa-ehu/ixa-pipe-parse
src/main/java/eus/ixa/ixa/pipe/parse/Annotate.java
Annotate.addHeadWordsToTreebank
private String addHeadWordsToTreebank(final List<String> inputTrees) { final StringBuffer parsedDoc = new StringBuffer(); for (final String parseSent : inputTrees) { final Parse parsedSentence = Parse.parseParse(parseSent); this.headFinder.printHeads(parsedSentence); parsedSentence.show(parsedDoc); parsedDoc.append("\n"); } return parsedDoc.toString(); }
java
private String addHeadWordsToTreebank(final List<String> inputTrees) { final StringBuffer parsedDoc = new StringBuffer(); for (final String parseSent : inputTrees) { final Parse parsedSentence = Parse.parseParse(parseSent); this.headFinder.printHeads(parsedSentence); parsedSentence.show(parsedDoc); parsedDoc.append("\n"); } return parsedDoc.toString(); }
[ "private", "String", "addHeadWordsToTreebank", "(", "final", "List", "<", "String", ">", "inputTrees", ")", "{", "final", "StringBuffer", "parsedDoc", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "final", "String", "parseSent", ":", "inputTrees", ")"...
Takes as input a list of parse strings, one for line, and annotates the headwords @param inputTrees @return a list of parse trees with headwords annotated
[ "Takes", "as", "input", "a", "list", "of", "parse", "strings", "one", "for", "line", "and", "annotates", "the", "headwords" ]
ce90ff17ff8846e7a055bcce8b516d976272f856
https://github.com/ixa-ehu/ixa-pipe-parse/blob/ce90ff17ff8846e7a055bcce8b516d976272f856/src/main/java/eus/ixa/ixa/pipe/parse/Annotate.java#L237-L246
train
ltearno/hexa.tools
hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/DataBinding.java
DataBinding.terminate
public void terminate() { log( "term" ); fActivated = false; converter = null; source.removePropertyChangedHandler( sourceHandler ); source = null; sourceHandler = null; destination.removePropertyChangedHandler( destinationHandler ); destination = null; destinationHandler = null; }
java
public void terminate() { log( "term" ); fActivated = false; converter = null; source.removePropertyChangedHandler( sourceHandler ); source = null; sourceHandler = null; destination.removePropertyChangedHandler( destinationHandler ); destination = null; destinationHandler = null; }
[ "public", "void", "terminate", "(", ")", "{", "log", "(", "\"term\"", ")", ";", "fActivated", "=", "false", ";", "converter", "=", "null", ";", "source", ".", "removePropertyChangedHandler", "(", "sourceHandler", ")", ";", "source", "=", "null", ";", "sour...
Terminates the Data Binding activation and cleans up all related resources. You should call this method when you want to free the binding, in order to lower memory usage.
[ "Terminates", "the", "Data", "Binding", "activation", "and", "cleans", "up", "all", "related", "resources", ".", "You", "should", "call", "this", "method", "when", "you", "want", "to", "free", "the", "binding", "in", "order", "to", "lower", "memory", "usage"...
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/DataBinding.java#L96-L111
train
recruit-mp/android-RMP-Appirater
library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java
RmpAppirater.tryToShowPrompt
public static void tryToShowPrompt(Context context, OnCompleteListener onCompleteListener) { tryToShowPrompt(context, null, null, onCompleteListener); }
java
public static void tryToShowPrompt(Context context, OnCompleteListener onCompleteListener) { tryToShowPrompt(context, null, null, onCompleteListener); }
[ "public", "static", "void", "tryToShowPrompt", "(", "Context", "context", ",", "OnCompleteListener", "onCompleteListener", ")", "{", "tryToShowPrompt", "(", "context", ",", "null", ",", "null", ",", "onCompleteListener", ")", ";", "}" ]
Show rating dialog. The dialog will be showed if the user hasn't declined to rate or hasn't rated current version. @param context Context @param onCompleteListener Listener which be called after process of review dialog finished.
[ "Show", "rating", "dialog", ".", "The", "dialog", "will", "be", "showed", "if", "the", "user", "hasn", "t", "declined", "to", "rate", "or", "hasn", "t", "rated", "current", "version", "." ]
14fcdf110dfb97120303f39aab1de9393e84b90a
https://github.com/recruit-mp/android-RMP-Appirater/blob/14fcdf110dfb97120303f39aab1de9393e84b90a/library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java#L192-L194
train
recruit-mp/android-RMP-Appirater
library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java
RmpAppirater.resetIfAppVersionChanged
public static void resetIfAppVersionChanged(Context context) { SharedPreferences prefs = getSharedPreferences(context); int appVersionCode = Integer.MIN_VALUE; final int previousAppVersionCode = prefs.getInt(PREF_KEY_APP_VERSION_CODE, Integer.MIN_VALUE); try { appVersionCode = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode; } catch (PackageManager.NameNotFoundException e) { Log.w(TAG, "Occurred PackageManager.NameNotFoundException", e); } if (previousAppVersionCode != appVersionCode) { SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putLong(PREF_KEY_APP_LAUNCH_COUNT, 0); prefsEditor.putLong(PREF_KEY_APP_THIS_VERSION_CODE_LAUNCH_COUNT, 0); prefsEditor.putLong(PREF_KEY_APP_FIRST_LAUNCHED_DATE, 0); prefsEditor.putInt(PREF_KEY_APP_VERSION_CODE, Integer.MIN_VALUE); prefsEditor.putLong(PREF_KEY_RATE_CLICK_DATE, 0); prefsEditor.putLong(PREF_KEY_REMINDER_CLICK_DATE, 0); prefsEditor.putBoolean(PREF_KEY_DO_NOT_SHOW_AGAIN, false); prefsEditor.commit(); } }
java
public static void resetIfAppVersionChanged(Context context) { SharedPreferences prefs = getSharedPreferences(context); int appVersionCode = Integer.MIN_VALUE; final int previousAppVersionCode = prefs.getInt(PREF_KEY_APP_VERSION_CODE, Integer.MIN_VALUE); try { appVersionCode = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode; } catch (PackageManager.NameNotFoundException e) { Log.w(TAG, "Occurred PackageManager.NameNotFoundException", e); } if (previousAppVersionCode != appVersionCode) { SharedPreferences.Editor prefsEditor = prefs.edit(); prefsEditor.putLong(PREF_KEY_APP_LAUNCH_COUNT, 0); prefsEditor.putLong(PREF_KEY_APP_THIS_VERSION_CODE_LAUNCH_COUNT, 0); prefsEditor.putLong(PREF_KEY_APP_FIRST_LAUNCHED_DATE, 0); prefsEditor.putInt(PREF_KEY_APP_VERSION_CODE, Integer.MIN_VALUE); prefsEditor.putLong(PREF_KEY_RATE_CLICK_DATE, 0); prefsEditor.putLong(PREF_KEY_REMINDER_CLICK_DATE, 0); prefsEditor.putBoolean(PREF_KEY_DO_NOT_SHOW_AGAIN, false); prefsEditor.commit(); } }
[ "public", "static", "void", "resetIfAppVersionChanged", "(", "Context", "context", ")", "{", "SharedPreferences", "prefs", "=", "getSharedPreferences", "(", "context", ")", ";", "int", "appVersionCode", "=", "Integer", ".", "MIN_VALUE", ";", "final", "int", "previ...
Reset saved conditions if app version changed. @param context Context
[ "Reset", "saved", "conditions", "if", "app", "version", "changed", "." ]
14fcdf110dfb97120303f39aab1de9393e84b90a
https://github.com/recruit-mp/android-RMP-Appirater/blob/14fcdf110dfb97120303f39aab1de9393e84b90a/library/src/main/java/jp/co/recruit_mp/android/rmp_appirater/RmpAppirater.java#L275-L297
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java
ReflectionUtils.getObjectClassOfPrimitve
public static Class<?> getObjectClassOfPrimitve(Class<?> primitive) { Class<?> objectClass = PRIMITIVE_TO_WRAPPER.get(primitive); if (objectClass != null) { return objectClass; } return primitive; }
java
public static Class<?> getObjectClassOfPrimitve(Class<?> primitive) { Class<?> objectClass = PRIMITIVE_TO_WRAPPER.get(primitive); if (objectClass != null) { return objectClass; } return primitive; }
[ "public", "static", "Class", "<", "?", ">", "getObjectClassOfPrimitve", "(", "Class", "<", "?", ">", "primitive", ")", "{", "Class", "<", "?", ">", "objectClass", "=", "PRIMITIVE_TO_WRAPPER", ".", "get", "(", "primitive", ")", ";", "if", "(", "objectClass"...
Returns the wrapper class of the given primitive class or the given class. @param primitive The primitive class @return The wrapper class or the given class
[ "Returns", "the", "wrapper", "class", "of", "the", "given", "primitive", "class", "or", "the", "given", "class", "." ]
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java#L100-L107
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java
ReflectionUtils.getTypeVariablePosition
public static int getTypeVariablePosition(GenericDeclaration genericDeclartion, TypeVariable<?> typeVariable) { int position = -1; TypeVariable<?>[] typeVariableDeclarationParameters = genericDeclartion .getTypeParameters(); // Try to find the position of the type variable in the class for (int i = 0; i < typeVariableDeclarationParameters.length; i++) { if (typeVariableDeclarationParameters[i].equals(typeVariable)) { position = i; break; } } return position; }
java
public static int getTypeVariablePosition(GenericDeclaration genericDeclartion, TypeVariable<?> typeVariable) { int position = -1; TypeVariable<?>[] typeVariableDeclarationParameters = genericDeclartion .getTypeParameters(); // Try to find the position of the type variable in the class for (int i = 0; i < typeVariableDeclarationParameters.length; i++) { if (typeVariableDeclarationParameters[i].equals(typeVariable)) { position = i; break; } } return position; }
[ "public", "static", "int", "getTypeVariablePosition", "(", "GenericDeclaration", "genericDeclartion", ",", "TypeVariable", "<", "?", ">", "typeVariable", ")", "{", "int", "position", "=", "-", "1", ";", "TypeVariable", "<", "?", ">", "[", "]", "typeVariableDecla...
Tries to find the position of the given type variable in the type parameters of the given class. This method iterates through the type parameters of the given class and tries to find the given type variable within the type parameters. When the type variable is found, the position is returned, otherwise -1. @param genericDeclartion The generic declartion type in which to look for the type variable @param typeVariable The type variable to look for in the given class type parameters @return The position of the given type variable within the type parameters of the given class if found, otherwise -1
[ "Tries", "to", "find", "the", "position", "of", "the", "given", "type", "variable", "in", "the", "type", "parameters", "of", "the", "given", "class", ".", "This", "method", "iterates", "through", "the", "type", "parameters", "of", "the", "given", "class", ...
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java#L494-L508
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java
ReflectionUtils.getMatchingFields
public static Field[] getMatchingFields(Class<?> clazz, final int modifiers) { final Set<Field> fields = new TreeSet<Field>( FIELD_NAME_AND_DECLARING_CLASS_COMPARATOR); traverseHierarchy(clazz, new TraverseTask<Field>() { @Override public Field run(Class<?> clazz) { Field[] fieldArray = clazz.getDeclaredFields(); for (int i = 0; i < fieldArray.length; i++) { if ((modifiers & fieldArray[i].getModifiers()) != 0) { fields.add(fieldArray[i]); } } return null; } }); return fields.toArray(new Field[fields.size()]); }
java
public static Field[] getMatchingFields(Class<?> clazz, final int modifiers) { final Set<Field> fields = new TreeSet<Field>( FIELD_NAME_AND_DECLARING_CLASS_COMPARATOR); traverseHierarchy(clazz, new TraverseTask<Field>() { @Override public Field run(Class<?> clazz) { Field[] fieldArray = clazz.getDeclaredFields(); for (int i = 0; i < fieldArray.length; i++) { if ((modifiers & fieldArray[i].getModifiers()) != 0) { fields.add(fieldArray[i]); } } return null; } }); return fields.toArray(new Field[fields.size()]); }
[ "public", "static", "Field", "[", "]", "getMatchingFields", "(", "Class", "<", "?", ">", "clazz", ",", "final", "int", "modifiers", ")", "{", "final", "Set", "<", "Field", ">", "fields", "=", "new", "TreeSet", "<", "Field", ">", "(", "FIELD_NAME_AND_DECL...
Returns the field objects that are declared in the given class or any of it's super types that have any of the given modifiers. The type hierarchy is traversed upwards and all declared fields that match the given modifiers are added to the result array. The elements in the array are sorted by their names and declaring classes. @param clazz The class within to look for the fields with the given modifiers @param modifiers The OR-ed together modifiers that a field must match to be included into the result @return The array of fields that match the modifiers and are within the type hierarchy of the given class
[ "Returns", "the", "field", "objects", "that", "are", "declared", "in", "the", "given", "class", "or", "any", "of", "it", "s", "super", "types", "that", "have", "any", "of", "the", "given", "modifiers", ".", "The", "type", "hierarchy", "is", "traversed", ...
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java#L564-L582
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java
ReflectionUtils.getField
public static Field getField(Class<?> clazz, String fieldName) { final String internedName = fieldName.intern(); return traverseHierarchy(clazz, new TraverseTask<Field>() { @Override public Field run(Class<?> clazz) { Field[] fields = clazz.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { if (fields[i].getName() == internedName) { return fields[i]; } } return null; } }); }
java
public static Field getField(Class<?> clazz, String fieldName) { final String internedName = fieldName.intern(); return traverseHierarchy(clazz, new TraverseTask<Field>() { @Override public Field run(Class<?> clazz) { Field[] fields = clazz.getDeclaredFields(); for (int i = 0; i < fields.length; i++) { if (fields[i].getName() == internedName) { return fields[i]; } } return null; } }); }
[ "public", "static", "Field", "getField", "(", "Class", "<", "?", ">", "clazz", ",", "String", "fieldName", ")", "{", "final", "String", "internedName", "=", "fieldName", ".", "intern", "(", ")", ";", "return", "traverseHierarchy", "(", "clazz", ",", "new",...
Returns the field object found for the given field name in the given class. This method traverses through the super classes of the given class and tries to find the field as declared field within these classes. When the object class is reached the traversing stops. If the field can not be found, null is returned. @param clazz The class within to look for the field with the given field name @param fieldName The name of the field to be returned @return The field object with the given field name if the field can be found, otherwise null
[ "Returns", "the", "field", "object", "found", "for", "the", "given", "field", "name", "in", "the", "given", "class", ".", "This", "method", "traverses", "through", "the", "super", "classes", "of", "the", "given", "class", "and", "tries", "to", "find", "the...
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java#L631-L646
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java
ReflectionUtils.getMethod
public static Method getMethod(Class<?> clazz, final String methodName, final Class<?>... parameterTypes) { final String internedName = methodName.intern(); return traverseHierarchy(clazz, new TraverseTask<Method>() { @Override public Method run(Class<?> clazz) { Method[] methods = clazz.getDeclaredMethods(); Method res = null; for (int i = 0; i < methods.length; i++) { Method m = methods[i]; if (m.getName() == internedName && arrayContentsEq(parameterTypes, m.getParameterTypes()) && (res == null || res.getReturnType().isAssignableFrom(m.getReturnType()))) { res = m; } } return res; } }); }
java
public static Method getMethod(Class<?> clazz, final String methodName, final Class<?>... parameterTypes) { final String internedName = methodName.intern(); return traverseHierarchy(clazz, new TraverseTask<Method>() { @Override public Method run(Class<?> clazz) { Method[] methods = clazz.getDeclaredMethods(); Method res = null; for (int i = 0; i < methods.length; i++) { Method m = methods[i]; if (m.getName() == internedName && arrayContentsEq(parameterTypes, m.getParameterTypes()) && (res == null || res.getReturnType().isAssignableFrom(m.getReturnType()))) { res = m; } } return res; } }); }
[ "public", "static", "Method", "getMethod", "(", "Class", "<", "?", ">", "clazz", ",", "final", "String", "methodName", ",", "final", "Class", "<", "?", ">", "...", "parameterTypes", ")", "{", "final", "String", "internedName", "=", "methodName", ".", "inte...
Returns the method object found for the given method name in the given class. This method traverses through the super classes of the given class and tries to find the method as declared method within these classes. When the object class is reached the traversing stops. If the method can not be found, null is returned. @param clazz The class within to look for the method with the given method name @param methodName The name of the method to be returned @param parameterTypes The accepting parameter types of the method @return The method object with the given method name if the method can be found, otherwise null
[ "Returns", "the", "method", "object", "found", "for", "the", "given", "method", "name", "in", "the", "given", "class", ".", "This", "method", "traverses", "through", "the", "super", "classes", "of", "the", "given", "class", "and", "tries", "to", "find", "t...
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java#L845-L867
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java
ReflectionUtils.getMethods
public static List<Method> getMethods(Class<?> clazz, final Class<? extends Annotation> annotation) { final List<Method> methods = new ArrayList<Method>(); traverseHierarchy(clazz, new TraverseTask<Method>() { @Override public Method run(Class<?> clazz) { Method[] methodArray = clazz.getDeclaredMethods(); for (int i = 0; i < methodArray.length; i++) { Method m = methodArray[i]; if (m.getAnnotation(annotation) != null) { methods.add(m); } } return null; } }); return methods; }
java
public static List<Method> getMethods(Class<?> clazz, final Class<? extends Annotation> annotation) { final List<Method> methods = new ArrayList<Method>(); traverseHierarchy(clazz, new TraverseTask<Method>() { @Override public Method run(Class<?> clazz) { Method[] methodArray = clazz.getDeclaredMethods(); for (int i = 0; i < methodArray.length; i++) { Method m = methodArray[i]; if (m.getAnnotation(annotation) != null) { methods.add(m); } } return null; } }); return methods; }
[ "public", "static", "List", "<", "Method", ">", "getMethods", "(", "Class", "<", "?", ">", "clazz", ",", "final", "Class", "<", "?", "extends", "Annotation", ">", "annotation", ")", "{", "final", "List", "<", "Method", ">", "methods", "=", "new", "Arra...
Returns the method objects for methods which are annotated with the given annotation of the given class. This method traverses through the super classes of the given class and tries to find methods as declared methods within these classes which are annotated with an annotation of the given annotation type. When the object class is reached the traversing stops. If no methods can be found, an empty list is returned. The order of the methods is random. @param clazz The class within to look for the methods @param annotation The annotation type a method must be annotated with to be included in the list @return A list of method objects for methods annotated with the given annotation type or an emtpy list
[ "Returns", "the", "method", "objects", "for", "methods", "which", "are", "annotated", "with", "the", "given", "annotation", "of", "the", "given", "class", ".", "This", "method", "traverses", "through", "the", "super", "classes", "of", "the", "given", "class", ...
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/reflection/ReflectionUtils.java#L975-L994
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/other/TemplateUtils.java
TemplateUtils.verifyPath
public static ArrayList<Element> verifyPath( Element root, ArrayList<Element> path ) { if( root == path.get( 0 ) ) return path; return null; }
java
public static ArrayList<Element> verifyPath( Element root, ArrayList<Element> path ) { if( root == path.get( 0 ) ) return path; return null; }
[ "public", "static", "ArrayList", "<", "Element", ">", "verifyPath", "(", "Element", "root", ",", "ArrayList", "<", "Element", ">", "path", ")", "{", "if", "(", "root", "==", "path", ".", "get", "(", "0", ")", ")", "return", "path", ";", "return", "nu...
asserts that a path's root is the waited element
[ "asserts", "that", "a", "path", "s", "root", "is", "the", "waited", "element" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/other/TemplateUtils.java#L10-L15
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/datatable/TableCollectionManager.java
TableCollectionManager.getRecordForRow
public T getRecordForRow( Row row ) { Integer recordId = rowToRecordIds.get( row ); if( recordId == null ) return null; return getRecordForId( recordId ); }
java
public T getRecordForRow( Row row ) { Integer recordId = rowToRecordIds.get( row ); if( recordId == null ) return null; return getRecordForId( recordId ); }
[ "public", "T", "getRecordForRow", "(", "Row", "row", ")", "{", "Integer", "recordId", "=", "rowToRecordIds", ".", "get", "(", "row", ")", ";", "if", "(", "recordId", "==", "null", ")", "return", "null", ";", "return", "getRecordForId", "(", "recordId", "...
Gets the record associated with a specific Row @param row The row @return The associated record, or null.
[ "Gets", "the", "record", "associated", "with", "a", "specific", "Row" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/datatable/TableCollectionManager.java#L297-L304
train
ltearno/hexa.tools
hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/Properties.java
Properties.getSetterPropertyType
public static Class<?> getSetterPropertyType( Clazz<?> clazz, String name ) { return propertyValues.getSetterPropertyType(clazz, name); }
java
public static Class<?> getSetterPropertyType( Clazz<?> clazz, String name ) { return propertyValues.getSetterPropertyType(clazz, name); }
[ "public", "static", "Class", "<", "?", ">", "getSetterPropertyType", "(", "Clazz", "<", "?", ">", "clazz", ",", "String", "name", ")", "{", "return", "propertyValues", ".", "getSetterPropertyType", "(", "clazz", ",", "name", ")", ";", "}" ]
Returns the class of the setter property. It can be the class of the first argument in the setter or the class of the field if no setter is found. If a virtual property is used, it returns null or the class of the current property's value
[ "Returns", "the", "class", "of", "the", "setter", "property", ".", "It", "can", "be", "the", "class", "of", "the", "first", "argument", "in", "the", "setter", "or", "the", "class", "of", "the", "field", "if", "no", "setter", "is", "found", ".", "If", ...
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/Properties.java#L141-L144
train
magott/spring-social-yammer
spring-social-yammer/src/main/java/org/springframework/social/yammer/api/impl/YammerErrorHandler.java
YammerErrorHandler.extractErrorDetailsFromResponse
private Map<String, Object> extractErrorDetailsFromResponse(ClientHttpResponse response) throws IOException { ObjectMapper mapper = new ObjectMapper(new JsonFactory()); try { return mapper.<Map<String, Object>> readValue(response.getBody(), new TypeReference<Map<String, Object>>() { }); } catch (JsonParseException e) { return null; } }
java
private Map<String, Object> extractErrorDetailsFromResponse(ClientHttpResponse response) throws IOException { ObjectMapper mapper = new ObjectMapper(new JsonFactory()); try { return mapper.<Map<String, Object>> readValue(response.getBody(), new TypeReference<Map<String, Object>>() { }); } catch (JsonParseException e) { return null; } }
[ "private", "Map", "<", "String", ",", "Object", ">", "extractErrorDetailsFromResponse", "(", "ClientHttpResponse", "response", ")", "throws", "IOException", "{", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", "new", "JsonFactory", "(", ")", ")", ";", ...
Error details are returned in the message body as JSON. Extract these in a map @param response from yammer @return json body as a map @throws IOException if ItemStream is closed
[ "Error", "details", "are", "returned", "in", "the", "message", "body", "as", "JSON", ".", "Extract", "these", "in", "a", "map" ]
a39dab7c33e40bfaa26c15b6336823edf57452c3
https://github.com/magott/spring-social-yammer/blob/a39dab7c33e40bfaa26c15b6336823edf57452c3/spring-social-yammer/src/main/java/org/springframework/social/yammer/api/impl/YammerErrorHandler.java#L93-L101
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/security/BCrypt.java
BCrypt.key
private void key(final byte key[]) { int i; final int koffp[] = {0}; final int lr[] = {0, 0}; final int plen = P.length, slen = S.length; for (i = 0; i < plen; i++) { P[i] = P[i] ^ streamtoword(key, koffp); } for (i = 0; i < plen; i += 2) { encipher(lr, 0); P[i] = lr[0]; P[i + 1] = lr[1]; } for (i = 0; i < slen; i += 2) { encipher(lr, 0); S[i] = lr[0]; S[i + 1] = lr[1]; } }
java
private void key(final byte key[]) { int i; final int koffp[] = {0}; final int lr[] = {0, 0}; final int plen = P.length, slen = S.length; for (i = 0; i < plen; i++) { P[i] = P[i] ^ streamtoword(key, koffp); } for (i = 0; i < plen; i += 2) { encipher(lr, 0); P[i] = lr[0]; P[i + 1] = lr[1]; } for (i = 0; i < slen; i += 2) { encipher(lr, 0); S[i] = lr[0]; S[i + 1] = lr[1]; } }
[ "private", "void", "key", "(", "final", "byte", "key", "[", "]", ")", "{", "int", "i", ";", "final", "int", "koffp", "[", "]", "=", "{", "0", "}", ";", "final", "int", "lr", "[", "]", "=", "{", "0", ",", "0", "}", ";", "final", "int", "plen...
Key the Blowfish cipher @param key an array containing the key
[ "Key", "the", "Blowfish", "cipher" ]
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/security/BCrypt.java#L491-L512
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/sql/SQLite.java
SQLite.createLocalId
public final static int createLocalId() { Storage storage = Storage.getLocalStorageIfSupported(); if( storage == null ) return 0; int increment = 0; String incrementString = storage.getItem( LOCAL_CURRENT_ID_INCREMENT ); try { increment = Integer.parseInt( incrementString ); } catch( Exception e ) { } increment += 1; storage.setItem( LOCAL_CURRENT_ID_INCREMENT, increment + "" ); return -increment; }
java
public final static int createLocalId() { Storage storage = Storage.getLocalStorageIfSupported(); if( storage == null ) return 0; int increment = 0; String incrementString = storage.getItem( LOCAL_CURRENT_ID_INCREMENT ); try { increment = Integer.parseInt( incrementString ); } catch( Exception e ) { } increment += 1; storage.setItem( LOCAL_CURRENT_ID_INCREMENT, increment + "" ); return -increment; }
[ "public", "final", "static", "int", "createLocalId", "(", ")", "{", "Storage", "storage", "=", "Storage", ".", "getLocalStorageIfSupported", "(", ")", ";", "if", "(", "storage", "==", "null", ")", "return", "0", ";", "int", "increment", "=", "0", ";", "S...
Create a negative ID.
[ "Create", "a", "negative", "ID", "." ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/sql/SQLite.java#L107-L128
train
ltearno/hexa.tools
hexa.binding.gwt/src/main/java/fr/lteconsulting/hexa/classinfo/gwt/ClassInfoGwt.java
ClassInfoGwt.RegisterClazz
public <T> void RegisterClazz( Clazz<T> clazz ) { _ensureMap(); if( clazzz.containsKey( clazz.getReflectedClass() ) ) return; clazzz.put( clazz.getReflectedClass(), clazz ); }
java
public <T> void RegisterClazz( Clazz<T> clazz ) { _ensureMap(); if( clazzz.containsKey( clazz.getReflectedClass() ) ) return; clazzz.put( clazz.getReflectedClass(), clazz ); }
[ "public", "<", "T", ">", "void", "RegisterClazz", "(", "Clazz", "<", "T", ">", "clazz", ")", "{", "_ensureMap", "(", ")", ";", "if", "(", "clazzz", ".", "containsKey", "(", "clazz", ".", "getReflectedClass", "(", ")", ")", ")", "return", ";", "clazzz...
Register a runtime type information provider
[ "Register", "a", "runtime", "type", "information", "provider" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.binding.gwt/src/main/java/fr/lteconsulting/hexa/classinfo/gwt/ClassInfoGwt.java#L39-L47
train
ltearno/hexa.tools
hexa.rpc/src/main/java/fr/lteconsulting/hexa/client/comm/RPCBatchRequestSender.java
RPCBatchRequestSender.init
public void init( String baseUrl, XRPCBatchRequestSender callback ) { this.url = baseUrl + "&locale=" + LocaleInfo.getCurrentLocale().getLocaleName(); this.callback = callback; }
java
public void init( String baseUrl, XRPCBatchRequestSender callback ) { this.url = baseUrl + "&locale=" + LocaleInfo.getCurrentLocale().getLocaleName(); this.callback = callback; }
[ "public", "void", "init", "(", "String", "baseUrl", ",", "XRPCBatchRequestSender", "callback", ")", "{", "this", ".", "url", "=", "baseUrl", "+", "\"&locale=\"", "+", "LocaleInfo", ".", "getCurrentLocale", "(", ")", ".", "getLocaleName", "(", ")", ";", "this...
initialize with url, and other needed information
[ "initialize", "with", "url", "and", "other", "needed", "information" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.rpc/src/main/java/fr/lteconsulting/hexa/client/comm/RPCBatchRequestSender.java#L56-L60
train
ltearno/hexa.tools
hexa.rpc/src/main/java/fr/lteconsulting/hexa/client/comm/RPCBatchRequestSender.java
RPCBatchRequestSender.checkCallService
private void checkCallService( RequestCallInfo info ) { String service = info.request.service; String interfaceChecksum = info.request.interfaceChecksum; String key = getServiceKey( info ); if( usedServices.containsKey( key ) ) return; ServiceInfo serviceInfo = new ServiceInfo( service, interfaceChecksum ); serviceInfo.id = usedServices.size(); usedServices.put( key, serviceInfo ); }
java
private void checkCallService( RequestCallInfo info ) { String service = info.request.service; String interfaceChecksum = info.request.interfaceChecksum; String key = getServiceKey( info ); if( usedServices.containsKey( key ) ) return; ServiceInfo serviceInfo = new ServiceInfo( service, interfaceChecksum ); serviceInfo.id = usedServices.size(); usedServices.put( key, serviceInfo ); }
[ "private", "void", "checkCallService", "(", "RequestCallInfo", "info", ")", "{", "String", "service", "=", "info", ".", "request", ".", "service", ";", "String", "interfaceChecksum", "=", "info", ".", "request", ".", "interfaceChecksum", ";", "String", "key", ...
necessary to be sure that call's service is referenced
[ "necessary", "to", "be", "sure", "that", "call", "s", "service", "is", "referenced" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.rpc/src/main/java/fr/lteconsulting/hexa/client/comm/RPCBatchRequestSender.java#L112-L125
train
ltearno/hexa.tools
hexa.rpc/src/main/java/fr/lteconsulting/hexa/client/comm/RPCBatchRequestSender.java
RPCBatchRequestSender.send
public boolean send() { assert sentRequests == null; sentRequests = new ArrayList<RequestCallInfo>(); // add prepended requests, addPrependedRequests( sentRequests ); // add requests to send while( !requestsToSend.isEmpty() ) sentRequests.add( requestsToSend.remove( 0 ) ); // add appended requests addAppendedRequests( sentRequests ); // prepare payload JSONArray payload = createPayload(); RequestBuilder builderPost = buildMultipart( "payload", payload.toString() ); nbSentBytes += builderPost.getRequestData().length(); try { sentRequest = builderPost.send(); } catch( RequestException e ) { callback.error( RPCErrorCodes.ERROR_REQUEST_SEND, e, this ); return false; } callback.sent( this ); return true; }
java
public boolean send() { assert sentRequests == null; sentRequests = new ArrayList<RequestCallInfo>(); // add prepended requests, addPrependedRequests( sentRequests ); // add requests to send while( !requestsToSend.isEmpty() ) sentRequests.add( requestsToSend.remove( 0 ) ); // add appended requests addAppendedRequests( sentRequests ); // prepare payload JSONArray payload = createPayload(); RequestBuilder builderPost = buildMultipart( "payload", payload.toString() ); nbSentBytes += builderPost.getRequestData().length(); try { sentRequest = builderPost.send(); } catch( RequestException e ) { callback.error( RPCErrorCodes.ERROR_REQUEST_SEND, e, this ); return false; } callback.sent( this ); return true; }
[ "public", "boolean", "send", "(", ")", "{", "assert", "sentRequests", "==", "null", ";", "sentRequests", "=", "new", "ArrayList", "<", "RequestCallInfo", ">", "(", ")", ";", "// add prepended requests,", "addPrependedRequests", "(", "sentRequests", ")", ";", "//...
when response arrives, it will be given back to each request callback
[ "when", "response", "arrives", "it", "will", "be", "given", "back", "to", "each", "request", "callback" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.rpc/src/main/java/fr/lteconsulting/hexa/client/comm/RPCBatchRequestSender.java#L134-L169
train
ltearno/hexa.tools
hexa.rpc/src/main/java/fr/lteconsulting/hexa/client/comm/RPCBatchRequestSender.java
RPCBatchRequestSender.buildMultipart
private RequestBuilder buildMultipart( String name, String value ) { String boundary = "AJAX------" + Math.random() + "" + new Date().getTime(); RequestBuilder builderPost = new RequestBuilder( RequestBuilder.POST, url ); builderPost.setHeader( "Content-Type", "multipart/form-data; charset=utf-8; boundary=" + boundary ); builderPost.setCallback( requestCallback ); String CRLF = "\r\n"; String data = "--" + boundary + CRLF; data += "--" + boundary + CRLF; data += "Content-Disposition: form-data; "; data += "name=\"" + name + "\"" + CRLF + CRLF; data += value + CRLF; data += "--" + boundary + "--" + CRLF; builderPost.setRequestData( data ); return builderPost; }
java
private RequestBuilder buildMultipart( String name, String value ) { String boundary = "AJAX------" + Math.random() + "" + new Date().getTime(); RequestBuilder builderPost = new RequestBuilder( RequestBuilder.POST, url ); builderPost.setHeader( "Content-Type", "multipart/form-data; charset=utf-8; boundary=" + boundary ); builderPost.setCallback( requestCallback ); String CRLF = "\r\n"; String data = "--" + boundary + CRLF; data += "--" + boundary + CRLF; data += "Content-Disposition: form-data; "; data += "name=\"" + name + "\"" + CRLF + CRLF; data += value + CRLF; data += "--" + boundary + "--" + CRLF; builderPost.setRequestData( data ); return builderPost; }
[ "private", "RequestBuilder", "buildMultipart", "(", "String", "name", ",", "String", "value", ")", "{", "String", "boundary", "=", "\"AJAX------\"", "+", "Math", ".", "random", "(", ")", "+", "\"\"", "+", "new", "Date", "(", ")", ".", "getTime", "(", ")"...
prepare a multipart form http request
[ "prepare", "a", "multipart", "form", "http", "request" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.rpc/src/main/java/fr/lteconsulting/hexa/client/comm/RPCBatchRequestSender.java#L240-L260
train
ltearno/hexa.tools
hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/formcreator/FormCreator.java
FormCreator.field
public FormCreator field( Widget widget ) { return field( widget, totalWidth - currentlyUsedWidth - (fFirstItem ? 0 : spacing) ); }
java
public FormCreator field( Widget widget ) { return field( widget, totalWidth - currentlyUsedWidth - (fFirstItem ? 0 : spacing) ); }
[ "public", "FormCreator", "field", "(", "Widget", "widget", ")", "{", "return", "field", "(", "widget", ",", "totalWidth", "-", "currentlyUsedWidth", "-", "(", "fFirstItem", "?", "0", ":", "spacing", ")", ")", ";", "}" ]
automatically fills the line to the end
[ "automatically", "fills", "the", "line", "to", "the", "end" ]
604c804901b1bb13fe10b3823cc4a639f8993363
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.core/src/main/java/fr/lteconsulting/hexa/client/ui/formcreator/FormCreator.java#L72-L75
train
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContext.java
ConnectionContext.copy
public void copy(ConnectionContext source) { this.connection = source.connection; this.session = source.session; this.destination = source.destination; }
java
public void copy(ConnectionContext source) { this.connection = source.connection; this.session = source.session; this.destination = source.destination; }
[ "public", "void", "copy", "(", "ConnectionContext", "source", ")", "{", "this", ".", "connection", "=", "source", ".", "connection", ";", "this", ".", "session", "=", "source", ".", "session", ";", "this", ".", "destination", "=", "source", ".", "destinati...
Sets this context object with the same data found in the source context. @param source the source context whose data is to be copied
[ "Sets", "this", "context", "object", "with", "the", "same", "data", "found", "in", "the", "source", "context", "." ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/ConnectionContext.java#L65-L69
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/annotation/AnnotationUtils.java
AnnotationUtils.getAllAnnotations
public static Set<Annotation> getAllAnnotations(Method m) { Set<Annotation> annotationSet = new LinkedHashSet<Annotation>(); Annotation[] annotations = m.getAnnotations(); List<Class<?>> annotationTypes = new ArrayList<Class<?>>(); // Iterate through all annotations of the current class for (Annotation a : annotations) { // Add the current annotation to the result and to the annotation types that needed to be examained for stereotype annotations annotationSet.add(a); annotationTypes.add(a.annotationType()); } if (stereotypeAnnotationClass != null) { while (!annotationTypes.isEmpty()) { Class<?> annotationType = annotationTypes.remove(annotationTypes.size() - 1); if (annotationType.isAnnotationPresent(stereotypeAnnotationClass)) { // If the stereotype annotation is present examine the 'inherited' annotations for (Annotation annotation : annotationType.getAnnotations()) { // add the 'inherited' annotations to be examined for further stereotype annotations annotationTypes.add(annotation.annotationType()); if (!annotation.annotationType().equals(stereotypeAnnotationClass)) { // add the stereotyped annotations to the set annotationSet.add(annotation); } } } } } return annotationSet; }
java
public static Set<Annotation> getAllAnnotations(Method m) { Set<Annotation> annotationSet = new LinkedHashSet<Annotation>(); Annotation[] annotations = m.getAnnotations(); List<Class<?>> annotationTypes = new ArrayList<Class<?>>(); // Iterate through all annotations of the current class for (Annotation a : annotations) { // Add the current annotation to the result and to the annotation types that needed to be examained for stereotype annotations annotationSet.add(a); annotationTypes.add(a.annotationType()); } if (stereotypeAnnotationClass != null) { while (!annotationTypes.isEmpty()) { Class<?> annotationType = annotationTypes.remove(annotationTypes.size() - 1); if (annotationType.isAnnotationPresent(stereotypeAnnotationClass)) { // If the stereotype annotation is present examine the 'inherited' annotations for (Annotation annotation : annotationType.getAnnotations()) { // add the 'inherited' annotations to be examined for further stereotype annotations annotationTypes.add(annotation.annotationType()); if (!annotation.annotationType().equals(stereotypeAnnotationClass)) { // add the stereotyped annotations to the set annotationSet.add(annotation); } } } } } return annotationSet; }
[ "public", "static", "Set", "<", "Annotation", ">", "getAllAnnotations", "(", "Method", "m", ")", "{", "Set", "<", "Annotation", ">", "annotationSet", "=", "new", "LinkedHashSet", "<", "Annotation", ">", "(", ")", ";", "Annotation", "[", "]", "annotations", ...
Returns all annotations of a class, also the annotations of the super classes, implemented interfaces and the annotations that are present in stereotype annotations. The stereotype annotation will not be included in the annotation set. @param m the class from which to get the annotations @return all annotations that are present for the given class
[ "Returns", "all", "annotations", "of", "a", "class", "also", "the", "annotations", "of", "the", "super", "classes", "implemented", "interfaces", "and", "the", "annotations", "that", "are", "present", "in", "stereotype", "annotations", ".", "The", "stereotype", "...
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/annotation/AnnotationUtils.java#L98-L130
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/annotation/AnnotationUtils.java
AnnotationUtils.findAnnotation
public static <T extends Annotation> T findAnnotation(Method m, Class<T> annotationClazz) { T annotation = m.getAnnotation(annotationClazz); if (annotation != null) { return annotation; } if (stereotypeAnnotationClass != null) { List<Class<?>> annotations = new ArrayList<>(); for (Annotation a : m.getAnnotations()) { annotations.add(a.annotationType()); } return findAnnotation(annotations, annotationClazz); } return null; }
java
public static <T extends Annotation> T findAnnotation(Method m, Class<T> annotationClazz) { T annotation = m.getAnnotation(annotationClazz); if (annotation != null) { return annotation; } if (stereotypeAnnotationClass != null) { List<Class<?>> annotations = new ArrayList<>(); for (Annotation a : m.getAnnotations()) { annotations.add(a.annotationType()); } return findAnnotation(annotations, annotationClazz); } return null; }
[ "public", "static", "<", "T", "extends", "Annotation", ">", "T", "findAnnotation", "(", "Method", "m", ",", "Class", "<", "T", ">", "annotationClazz", ")", "{", "T", "annotation", "=", "m", ".", "getAnnotation", "(", "annotationClazz", ")", ";", "if", "(...
Returns the annotation object for the specified annotation class of the method if it can be found, otherwise null. The annotation is searched in the method which and if a stereotype annotation is found, the annotations present on an annotation are also examined. If the annotation can not be found, null is returned. @param <T> The annotation type @param m The method in which to look for the annotation @param annotationClazz The type of the annotation to look for @return The annotation with the given type if found, otherwise null
[ "Returns", "the", "annotation", "object", "for", "the", "specified", "annotation", "class", "of", "the", "method", "if", "it", "can", "be", "found", "otherwise", "null", ".", "The", "annotation", "is", "searched", "in", "the", "method", "which", "and", "if",...
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/annotation/AnnotationUtils.java#L165-L180
train
Blazebit/blaze-utils
blaze-common-utils/src/main/java/com/blazebit/annotation/AnnotationUtils.java
AnnotationUtils.findAnnotation
public static <T extends Annotation> T findAnnotation(Class<?> clazz, Class<T> annotationClazz) { T annotation = clazz.getAnnotation(annotationClazz); if (annotation != null) { return annotation; } Set<Class<?>> superTypes = ReflectionUtils.getSuperTypes(clazz); for (Class<?> type : superTypes) { annotation = type.getAnnotation(annotationClazz); if (annotation != null) { return annotation; } } if (stereotypeAnnotationClass != null) { List<Class<?>> annotations = new ArrayList<>(); for (Class<?> type : superTypes) { for (Annotation a : type.getAnnotations()) { annotations.add(a.annotationType()); } } return findAnnotation(annotations, annotationClazz); } return null; }
java
public static <T extends Annotation> T findAnnotation(Class<?> clazz, Class<T> annotationClazz) { T annotation = clazz.getAnnotation(annotationClazz); if (annotation != null) { return annotation; } Set<Class<?>> superTypes = ReflectionUtils.getSuperTypes(clazz); for (Class<?> type : superTypes) { annotation = type.getAnnotation(annotationClazz); if (annotation != null) { return annotation; } } if (stereotypeAnnotationClass != null) { List<Class<?>> annotations = new ArrayList<>(); for (Class<?> type : superTypes) { for (Annotation a : type.getAnnotations()) { annotations.add(a.annotationType()); } } return findAnnotation(annotations, annotationClazz); } return null; }
[ "public", "static", "<", "T", "extends", "Annotation", ">", "T", "findAnnotation", "(", "Class", "<", "?", ">", "clazz", ",", "Class", "<", "T", ">", "annotationClazz", ")", "{", "T", "annotation", "=", "clazz", ".", "getAnnotation", "(", "annotationClazz"...
Returns the annotation object for the specified annotation class of the given class object. All super types of the given class are examined to find the annotation. If a stereotype annotation is found, the annotations present on an annotation are also examined. @param <T> The annotation type @param clazz The class in which to look for the annotation @param annotationClazz The type of the annotation to look for @return The annotation with the given type if found, otherwise null
[ "Returns", "the", "annotation", "object", "for", "the", "specified", "annotation", "class", "of", "the", "given", "class", "object", ".", "All", "super", "types", "of", "the", "given", "class", "are", "examined", "to", "find", "the", "annotation", ".", "If",...
3e35a694a8f71d515aad066196acd523994d6aaa
https://github.com/Blazebit/blaze-utils/blob/3e35a694a8f71d515aad066196acd523994d6aaa/blaze-common-utils/src/main/java/com/blazebit/annotation/AnnotationUtils.java#L193-L219
train
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java
MessageProcessor.listen
public <T extends BasicMessage> void listen(ConsumerConnectionContext context, AbstractBasicMessageListener<T> listener) throws JMSException { if (context == null) { throw new NullPointerException("context must not be null"); } if (listener == null) { throw new NullPointerException("listener must not be null"); } MessageConsumer consumer = context.getMessageConsumer(); if (consumer == null) { throw new NullPointerException("context had a null consumer"); } listener.setConsumerConnectionContext(context); consumer.setMessageListener(listener); }
java
public <T extends BasicMessage> void listen(ConsumerConnectionContext context, AbstractBasicMessageListener<T> listener) throws JMSException { if (context == null) { throw new NullPointerException("context must not be null"); } if (listener == null) { throw new NullPointerException("listener must not be null"); } MessageConsumer consumer = context.getMessageConsumer(); if (consumer == null) { throw new NullPointerException("context had a null consumer"); } listener.setConsumerConnectionContext(context); consumer.setMessageListener(listener); }
[ "public", "<", "T", "extends", "BasicMessage", ">", "void", "listen", "(", "ConsumerConnectionContext", "context", ",", "AbstractBasicMessageListener", "<", "T", ">", "listener", ")", "throws", "JMSException", "{", "if", "(", "context", "==", "null", ")", "{", ...
Listens for messages. @param context information that determines where to listen @param listener the listener that processes the incoming messages @throws JMSException any error @see org.hawkular.bus.common.ConnectionContextFactory#createConsumerConnectionContext(Endpoint)
[ "Listens", "for", "messages", "." ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java#L62-L78
train
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java
MessageProcessor.send
public MessageId send(ProducerConnectionContext context, BasicMessage basicMessage, Map<String, String> headers) throws JMSException { if (context == null) { throw new IllegalArgumentException("context must not be null"); } if (basicMessage == null) { throw new IllegalArgumentException("message must not be null"); } // create the JMS message to be sent Message msg = createMessage(context, basicMessage, headers); // if the message is correlated with another, put the correlation ID in the Message to be sent if (basicMessage.getCorrelationId() != null) { msg.setJMSCorrelationID(basicMessage.getCorrelationId().toString()); } if (basicMessage.getMessageId() != null) { log.debugf("Non-null message ID [%s] will be ignored and a new one generated", basicMessage.getMessageId()); basicMessage.setMessageId(null); } // now send the message to the broker MessageProducer producer = context.getMessageProducer(); if (producer == null) { throw new IllegalStateException("context had a null producer"); } producer.send(msg); // put message ID into the message in case the caller wants to correlate it with another record MessageId messageId = new MessageId(msg.getJMSMessageID()); basicMessage.setMessageId(messageId); return messageId; }
java
public MessageId send(ProducerConnectionContext context, BasicMessage basicMessage, Map<String, String> headers) throws JMSException { if (context == null) { throw new IllegalArgumentException("context must not be null"); } if (basicMessage == null) { throw new IllegalArgumentException("message must not be null"); } // create the JMS message to be sent Message msg = createMessage(context, basicMessage, headers); // if the message is correlated with another, put the correlation ID in the Message to be sent if (basicMessage.getCorrelationId() != null) { msg.setJMSCorrelationID(basicMessage.getCorrelationId().toString()); } if (basicMessage.getMessageId() != null) { log.debugf("Non-null message ID [%s] will be ignored and a new one generated", basicMessage.getMessageId()); basicMessage.setMessageId(null); } // now send the message to the broker MessageProducer producer = context.getMessageProducer(); if (producer == null) { throw new IllegalStateException("context had a null producer"); } producer.send(msg); // put message ID into the message in case the caller wants to correlate it with another record MessageId messageId = new MessageId(msg.getJMSMessageID()); basicMessage.setMessageId(messageId); return messageId; }
[ "public", "MessageId", "send", "(", "ProducerConnectionContext", "context", ",", "BasicMessage", "basicMessage", ",", "Map", "<", "String", ",", "String", ">", "headers", ")", "throws", "JMSException", "{", "if", "(", "context", "==", "null", ")", "{", "throw"...
Send the given message to its destinations across the message bus. Once sent, the message will get assigned a generated message ID. That message ID will also be returned by this method. Since this is fire-and-forget - no response is expected of the remote endpoint. @param context information that determines where the message is sent @param basicMessage the message to send with optional headers included @param headers headers for the JMS transport that will override same-named headers in the basic message @return the message ID @throws JMSException any error @see ConnectionContextFactory#createProducerConnectionContext(Endpoint)
[ "Send", "the", "given", "message", "to", "its", "destinations", "across", "the", "message", "bus", ".", "Once", "sent", "the", "message", "will", "get", "assigned", "a", "generated", "message", "ID", ".", "That", "message", "ID", "will", "also", "be", "ret...
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java#L101-L137
train
hawkular/hawkular-commons
hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java
MessageProcessor.sendAndListen
public <T extends BasicMessage> RPCConnectionContext sendAndListen(ProducerConnectionContext context, BasicMessage basicMessage, BasicMessageListener<T> responseListener, Map<String, String> headers) throws JMSException { if (context == null) { throw new IllegalArgumentException("context must not be null"); } if (basicMessage == null) { throw new IllegalArgumentException("message must not be null"); } if (responseListener == null) { throw new IllegalArgumentException("response listener must not be null"); } // create the JMS message to be sent Message msg = createMessage(context, basicMessage, headers); // if the message is correlated with another, put the correlation ID in the Message to be sent if (basicMessage.getCorrelationId() != null) { msg.setJMSCorrelationID(basicMessage.getCorrelationId().toString()); } if (basicMessage.getMessageId() != null) { log.debugf("Non-null message ID [%s] will be ignored and a new one generated", basicMessage.getMessageId()); basicMessage.setMessageId(null); } MessageProducer producer = context.getMessageProducer(); if (producer == null) { throw new NullPointerException("Cannot send request-response message - the producer is null"); } // prepare for the response prior to sending the request Session session = context.getSession(); if (session == null) { throw new NullPointerException("Cannot send request-response message - the session is null"); } TemporaryQueue responseQueue = session.createTemporaryQueue(); MessageConsumer responseConsumer = session.createConsumer(responseQueue); RPCConnectionContext rpcContext = new RPCConnectionContext(); rpcContext.copy(context); rpcContext.setDestination(responseQueue); rpcContext.setMessageConsumer(responseConsumer); rpcContext.setRequestMessage(msg); rpcContext.setResponseListener(responseListener); responseListener.setConsumerConnectionContext(rpcContext); responseConsumer.setMessageListener(responseListener); msg.setJMSReplyTo(responseQueue); // now send the message to the broker producer.send(msg); // put message ID into the message in case the caller wants to correlate it with another record MessageId messageId = new MessageId(msg.getJMSMessageID()); basicMessage.setMessageId(messageId); return rpcContext; }
java
public <T extends BasicMessage> RPCConnectionContext sendAndListen(ProducerConnectionContext context, BasicMessage basicMessage, BasicMessageListener<T> responseListener, Map<String, String> headers) throws JMSException { if (context == null) { throw new IllegalArgumentException("context must not be null"); } if (basicMessage == null) { throw new IllegalArgumentException("message must not be null"); } if (responseListener == null) { throw new IllegalArgumentException("response listener must not be null"); } // create the JMS message to be sent Message msg = createMessage(context, basicMessage, headers); // if the message is correlated with another, put the correlation ID in the Message to be sent if (basicMessage.getCorrelationId() != null) { msg.setJMSCorrelationID(basicMessage.getCorrelationId().toString()); } if (basicMessage.getMessageId() != null) { log.debugf("Non-null message ID [%s] will be ignored and a new one generated", basicMessage.getMessageId()); basicMessage.setMessageId(null); } MessageProducer producer = context.getMessageProducer(); if (producer == null) { throw new NullPointerException("Cannot send request-response message - the producer is null"); } // prepare for the response prior to sending the request Session session = context.getSession(); if (session == null) { throw new NullPointerException("Cannot send request-response message - the session is null"); } TemporaryQueue responseQueue = session.createTemporaryQueue(); MessageConsumer responseConsumer = session.createConsumer(responseQueue); RPCConnectionContext rpcContext = new RPCConnectionContext(); rpcContext.copy(context); rpcContext.setDestination(responseQueue); rpcContext.setMessageConsumer(responseConsumer); rpcContext.setRequestMessage(msg); rpcContext.setResponseListener(responseListener); responseListener.setConsumerConnectionContext(rpcContext); responseConsumer.setMessageListener(responseListener); msg.setJMSReplyTo(responseQueue); // now send the message to the broker producer.send(msg); // put message ID into the message in case the caller wants to correlate it with another record MessageId messageId = new MessageId(msg.getJMSMessageID()); basicMessage.setMessageId(messageId); return rpcContext; }
[ "public", "<", "T", "extends", "BasicMessage", ">", "RPCConnectionContext", "sendAndListen", "(", "ProducerConnectionContext", "context", ",", "BasicMessage", "basicMessage", ",", "BasicMessageListener", "<", "T", ">", "responseListener", ",", "Map", "<", "String", ",...
Send the given message to its destinations across the message bus and any response sent back will be passed to the given listener. Use this for request-response messages where you expect to get a non-void response back. The response listener should close its associated consumer since typically there is only a single response that is expected. This is left to the listener to do in case there are special circumstances where the listener does expect multiple response messages. If the caller merely wants to wait for a single response and obtain the response message to process it further, consider using instead the method {@link #sendRPC} and use its returned Future to wait for the response, rather than having to supply your own response listener. @param context information that determines where the message is sent @param basicMessage the request message to send with optional headers included @param responseListener The listener that will process the response of the request. This listener should close its associated consumer when appropriate. @param headers headers for the JMS transport that will override same-named headers in the basic message @return the RPC context which includes information about the handling of the expected response @throws JMSException any error @see org.hawkular.bus.common.ConnectionContextFactory#createProducerConnectionContext(Endpoint)
[ "Send", "the", "given", "message", "to", "its", "destinations", "across", "the", "message", "bus", "and", "any", "response", "sent", "back", "will", "be", "passed", "to", "the", "given", "listener", ".", "Use", "this", "for", "request", "-", "response", "m...
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-bus/hawkular-bus-common/src/main/java/org/hawkular/bus/common/MessageProcessor.java#L278-L339
train
hawkular/hawkular-commons
hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/WebSocketHelper.java
WebSocketHelper.sendBasicMessageAsync
public void sendBasicMessageAsync(Session session, BasicMessage msg) { String text = ApiDeserializer.toHawkularFormat(msg); sendTextAsync(session, text); }
java
public void sendBasicMessageAsync(Session session, BasicMessage msg) { String text = ApiDeserializer.toHawkularFormat(msg); sendTextAsync(session, text); }
[ "public", "void", "sendBasicMessageAsync", "(", "Session", "session", ",", "BasicMessage", "msg", ")", "{", "String", "text", "=", "ApiDeserializer", ".", "toHawkularFormat", "(", "msg", ")", ";", "sendTextAsync", "(", "session", ",", "text", ")", ";", "}" ]
Converts the given message to JSON and sends that JSON text to clients asynchronously. @param session the client session where the JSON message will be sent @param msg the message to be converted to JSON and sent
[ "Converts", "the", "given", "message", "to", "JSON", "and", "sends", "that", "JSON", "text", "to", "clients", "asynchronously", "." ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/WebSocketHelper.java#L80-L83
train
hawkular/hawkular-commons
hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/WebSocketHelper.java
WebSocketHelper.sendBinaryAsync
public void sendBinaryAsync(Session session, InputStream inputStream, ExecutorService threadPool) { if (session == null) { return; } if (inputStream == null) { throw new IllegalArgumentException("inputStream must not be null"); } log.debugf("Attempting to send async binary data to client [%s]", session.getId()); if (session.isOpen()) { if (this.asyncTimeout != null) { // TODO: what to do with timeout? } CopyStreamRunnable runnable = new CopyStreamRunnable(session, inputStream); threadPool.execute(runnable); } return; }
java
public void sendBinaryAsync(Session session, InputStream inputStream, ExecutorService threadPool) { if (session == null) { return; } if (inputStream == null) { throw new IllegalArgumentException("inputStream must not be null"); } log.debugf("Attempting to send async binary data to client [%s]", session.getId()); if (session.isOpen()) { if (this.asyncTimeout != null) { // TODO: what to do with timeout? } CopyStreamRunnable runnable = new CopyStreamRunnable(session, inputStream); threadPool.execute(runnable); } return; }
[ "public", "void", "sendBinaryAsync", "(", "Session", "session", ",", "InputStream", "inputStream", ",", "ExecutorService", "threadPool", ")", "{", "if", "(", "session", "==", "null", ")", "{", "return", ";", "}", "if", "(", "inputStream", "==", "null", ")", ...
Sends binary data to a client asynchronously. @param session the client session where the message will be sent @param inputStream the binary data to send @param threadPool where the job will be submitted so it can execute asynchronously
[ "Sends", "binary", "data", "to", "a", "client", "asynchronously", "." ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/WebSocketHelper.java#L113-L134
train
hawkular/hawkular-commons
hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/WebSocketHelper.java
WebSocketHelper.sendBinarySync
public void sendBinarySync(Session session, InputStream inputStream) throws IOException { if (session == null) { return; } if (inputStream == null) { throw new IllegalArgumentException("inputStream must not be null"); } log.debugf("Attempting to send binary data to client [%s]", session.getId()); if (session.isOpen()) { long size = new CopyStreamRunnable(session, inputStream).copyInputToOutput(); log.debugf("Finished sending binary data to client [%s]: size=[%s]", session.getId(), size); } return; }
java
public void sendBinarySync(Session session, InputStream inputStream) throws IOException { if (session == null) { return; } if (inputStream == null) { throw new IllegalArgumentException("inputStream must not be null"); } log.debugf("Attempting to send binary data to client [%s]", session.getId()); if (session.isOpen()) { long size = new CopyStreamRunnable(session, inputStream).copyInputToOutput(); log.debugf("Finished sending binary data to client [%s]: size=[%s]", session.getId(), size); } return; }
[ "public", "void", "sendBinarySync", "(", "Session", "session", ",", "InputStream", "inputStream", ")", "throws", "IOException", "{", "if", "(", "session", "==", "null", ")", "{", "return", ";", "}", "if", "(", "inputStream", "==", "null", ")", "{", "throw"...
Sends binary data to a client synchronously. @param session the client where the message will be sent @param inputStream the binary data to send @throws IOException if a problem occurred during delivery of the data to a session.
[ "Sends", "binary", "data", "to", "a", "client", "synchronously", "." ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/WebSocketHelper.java#L143-L160
train
hawkular/hawkular-commons
hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/UIClientWebSocket.java
UIClientWebSocket.uiClientSessionOpen
@OnOpen public void uiClientSessionOpen(Session session) { log.infoWsSessionOpened(session.getId(), endpoint); wsEndpoints.getUiClientSessions().addSession(session.getId(), session); WelcomeResponse welcomeResponse = new WelcomeResponse(); // FIXME we should not send the true sessionIds to clients to prevent spoofing. welcomeResponse.setSessionId(session.getId()); try { new WebSocketHelper().sendBasicMessageSync(session, welcomeResponse); } catch (IOException e) { log.warnf(e, "Could not send [%s] to UI client session [%s].", WelcomeResponse.class.getName(), session.getId()); } }
java
@OnOpen public void uiClientSessionOpen(Session session) { log.infoWsSessionOpened(session.getId(), endpoint); wsEndpoints.getUiClientSessions().addSession(session.getId(), session); WelcomeResponse welcomeResponse = new WelcomeResponse(); // FIXME we should not send the true sessionIds to clients to prevent spoofing. welcomeResponse.setSessionId(session.getId()); try { new WebSocketHelper().sendBasicMessageSync(session, welcomeResponse); } catch (IOException e) { log.warnf(e, "Could not send [%s] to UI client session [%s].", WelcomeResponse.class.getName(), session.getId()); } }
[ "@", "OnOpen", "public", "void", "uiClientSessionOpen", "(", "Session", "session", ")", "{", "log", ".", "infoWsSessionOpened", "(", "session", ".", "getId", "(", ")", ",", "endpoint", ")", ";", "wsEndpoints", ".", "getUiClientSessions", "(", ")", ".", "addS...
When a UI client connects, this method is called. This will immediately send a welcome message to the UI client. @param session the new UI client's session
[ "When", "a", "UI", "client", "connects", "this", "method", "is", "called", ".", "This", "will", "immediately", "send", "a", "welcome", "message", "to", "the", "UI", "client", "." ]
e4a832862b3446d7f4d629bb05790f2df578e035
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/UIClientWebSocket.java#L53-L66
train
bsblabs/embed-for-vaadin
com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/AbstractEmbedVaadinTomcat.java
AbstractEmbedVaadinTomcat.doStart
private void doStart() throws LifecycleException { tomcat.getServer().addLifecycleListener(new TomcatLifecycleListener()); logger.info("Deploying application to [" + getConfig().getDeployUrl() + "]"); tomcat.start(); // Let's set the port that was used to actually start the application if necessary if (getConfig().getPort() == EmbedVaadinConfig.DEFAULT_PORT) { getConfig().setPort(getTomcat().getConnector().getLocalPort()); } logger.info("Application has been deployed to [" + getConfig().getDeployUrl() + "]"); if (config.shouldOpenBrowser()) { BrowserUtils.openBrowser(getConfig().getOpenBrowserUrl()); } if (isWaiting()) { tomcat.getServer().await(); } }
java
private void doStart() throws LifecycleException { tomcat.getServer().addLifecycleListener(new TomcatLifecycleListener()); logger.info("Deploying application to [" + getConfig().getDeployUrl() + "]"); tomcat.start(); // Let's set the port that was used to actually start the application if necessary if (getConfig().getPort() == EmbedVaadinConfig.DEFAULT_PORT) { getConfig().setPort(getTomcat().getConnector().getLocalPort()); } logger.info("Application has been deployed to [" + getConfig().getDeployUrl() + "]"); if (config.shouldOpenBrowser()) { BrowserUtils.openBrowser(getConfig().getOpenBrowserUrl()); } if (isWaiting()) { tomcat.getServer().await(); } }
[ "private", "void", "doStart", "(", ")", "throws", "LifecycleException", "{", "tomcat", ".", "getServer", "(", ")", ".", "addLifecycleListener", "(", "new", "TomcatLifecycleListener", "(", ")", ")", ";", "logger", ".", "info", "(", "\"Deploying application to [\"",...
Fires the embedded tomcat that is assumed to be fully configured. @throws LifecycleException if tomcat failed to start
[ "Fires", "the", "embedded", "tomcat", "that", "is", "assumed", "to", "be", "fully", "configured", "." ]
f902e70def56ab54d287d2600f9c6eef9e66c225
https://github.com/bsblabs/embed-for-vaadin/blob/f902e70def56ab54d287d2600f9c6eef9e66c225/com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/AbstractEmbedVaadinTomcat.java#L173-L190
train
bsblabs/embed-for-vaadin
com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/AbstractEmbedVaadinTomcat.java
AbstractEmbedVaadinTomcat.doStop
private void doStop() throws LifecycleException { logger.info("Stopping tomcat."); long startTime = System.currentTimeMillis(); tomcat.stop(); long duration = System.currentTimeMillis() - startTime; logger.info("Tomcat shutdown finished in " + duration + " ms."); }
java
private void doStop() throws LifecycleException { logger.info("Stopping tomcat."); long startTime = System.currentTimeMillis(); tomcat.stop(); long duration = System.currentTimeMillis() - startTime; logger.info("Tomcat shutdown finished in " + duration + " ms."); }
[ "private", "void", "doStop", "(", ")", "throws", "LifecycleException", "{", "logger", ".", "info", "(", "\"Stopping tomcat.\"", ")", ";", "long", "startTime", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "tomcat", ".", "stop", "(", ")", ";", "lo...
Stops the embedded tomcat. @throws LifecycleException if tomcat failed to stop
[ "Stops", "the", "embedded", "tomcat", "." ]
f902e70def56ab54d287d2600f9c6eef9e66c225
https://github.com/bsblabs/embed-for-vaadin/blob/f902e70def56ab54d287d2600f9c6eef9e66c225/com.bsb.common.vaadin.embed/src/main/java/com/bsb/common/vaadin/embed/AbstractEmbedVaadinTomcat.java#L197-L203
train
CubeEngine/LogScribe
core/src/main/java/org/cubeengine/logscribe/Log.java
Log.addDelegate
public LogTarget addDelegate(Log log) { LogProxyTarget logProxyTarget = new LogProxyTarget(log); this.addTarget(logProxyTarget); return logProxyTarget; }
java
public LogTarget addDelegate(Log log) { LogProxyTarget logProxyTarget = new LogProxyTarget(log); this.addTarget(logProxyTarget); return logProxyTarget; }
[ "public", "LogTarget", "addDelegate", "(", "Log", "log", ")", "{", "LogProxyTarget", "logProxyTarget", "=", "new", "LogProxyTarget", "(", "log", ")", ";", "this", ".", "addTarget", "(", "logProxyTarget", ")", ";", "return", "logProxyTarget", ";", "}" ]
Adds a ProxyTarget for an other Logger @param log the logger to delegate to @return the created LogTarget
[ "Adds", "a", "ProxyTarget", "for", "an", "other", "Logger" ]
c3a449b82677d1d70c3efe77b68fdaaaf7525295
https://github.com/CubeEngine/LogScribe/blob/c3a449b82677d1d70c3efe77b68fdaaaf7525295/core/src/main/java/org/cubeengine/logscribe/Log.java#L103-L108
train
jbundle/webapp
base/src/main/java/org/jbundle/util/webapp/base/ResourceHttpServiceTracker.java
ResourceHttpServiceTracker.addingService
public Object addingService(ServiceReference reference) { HttpService httpService = (HttpService) context.getService(reference); String alias = this.getAlias(); String name = this.getProperty(RESOURCE_NAME); if (name == null) name = alias; try { httpService.registerResources(alias, name, httpContext); } catch (NamespaceException e) { e.printStackTrace(); } return httpService; }
java
public Object addingService(ServiceReference reference) { HttpService httpService = (HttpService) context.getService(reference); String alias = this.getAlias(); String name = this.getProperty(RESOURCE_NAME); if (name == null) name = alias; try { httpService.registerResources(alias, name, httpContext); } catch (NamespaceException e) { e.printStackTrace(); } return httpService; }
[ "public", "Object", "addingService", "(", "ServiceReference", "reference", ")", "{", "HttpService", "httpService", "=", "(", "HttpService", ")", "context", ".", "getService", "(", "reference", ")", ";", "String", "alias", "=", "this", ".", "getAlias", "(", ")"...
Http Service is up, add my resource.
[ "Http", "Service", "is", "up", "add", "my", "resource", "." ]
af2cf32bd92254073052f1f9b4bcd47c2f76ba7d
https://github.com/jbundle/webapp/blob/af2cf32bd92254073052f1f9b4bcd47c2f76ba7d/base/src/main/java/org/jbundle/util/webapp/base/ResourceHttpServiceTracker.java#L31-L46
train
fuinorg/utils4j
src/main/java/org/fuin/utils4j/filter/RegExprFilter.java
RegExprFilter.setTypeName
public final void setTypeName(final String typeName) { if (typeName == null) { type = LOOKING_AT; } else if (typeName.equalsIgnoreCase(TYPES[0])) { type = MATCHES; } else if (typeName.equalsIgnoreCase(TYPES[1])) { type = LOOKING_AT; } else if (typeName.equalsIgnoreCase(TYPES[2])) { type = FIND; } }
java
public final void setTypeName(final String typeName) { if (typeName == null) { type = LOOKING_AT; } else if (typeName.equalsIgnoreCase(TYPES[0])) { type = MATCHES; } else if (typeName.equalsIgnoreCase(TYPES[1])) { type = LOOKING_AT; } else if (typeName.equalsIgnoreCase(TYPES[2])) { type = FIND; } }
[ "public", "final", "void", "setTypeName", "(", "final", "String", "typeName", ")", "{", "if", "(", "typeName", "==", "null", ")", "{", "type", "=", "LOOKING_AT", ";", "}", "else", "if", "(", "typeName", ".", "equalsIgnoreCase", "(", "TYPES", "[", "0", ...
Sets the type name of the matching. @param typeName Type name ("matches", "lookingAt" or "find") or NULL (="lookingAt")
[ "Sets", "the", "type", "name", "of", "the", "matching", "." ]
71cf88e0a8d8ed67bbac513bf3cab165cd7e3280
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/filter/RegExprFilter.java#L131-L141
train
dbracewell/mango
src/main/java/com/davidbracewell/reflection/Reflect.java
Reflect.onObject
public static Reflect onObject(Object object) { if (object == null) { return new Reflect(null, null); } return new Reflect(object, object.getClass()); }
java
public static Reflect onObject(Object object) { if (object == null) { return new Reflect(null, null); } return new Reflect(object, object.getClass()); }
[ "public", "static", "Reflect", "onObject", "(", "Object", "object", ")", "{", "if", "(", "object", "==", "null", ")", "{", "return", "new", "Reflect", "(", "null", ",", "null", ")", ";", "}", "return", "new", "Reflect", "(", "object", ",", "object", ...
Creates an instance of Reflect associated with an object @param object The object for reflection @return The Reflect object
[ "Creates", "an", "instance", "of", "Reflect", "associated", "with", "an", "object" ]
2cec08826f1fccd658694dd03abce10fc97618ec
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/reflection/Reflect.java#L66-L71
train
dbracewell/mango
src/main/java/com/davidbracewell/reflection/Reflect.java
Reflect.onClass
public static Reflect onClass(String clazz) throws Exception { return new Reflect(null, ReflectionUtils.getClassForName(clazz)); }
java
public static Reflect onClass(String clazz) throws Exception { return new Reflect(null, ReflectionUtils.getClassForName(clazz)); }
[ "public", "static", "Reflect", "onClass", "(", "String", "clazz", ")", "throws", "Exception", "{", "return", "new", "Reflect", "(", "null", ",", "ReflectionUtils", ".", "getClassForName", "(", "clazz", ")", ")", ";", "}" ]
Creates an instance of Reflect associated with a class @param clazz The class for reflection as string @return The Reflect object @throws Exception the exception
[ "Creates", "an", "instance", "of", "Reflect", "associated", "with", "a", "class" ]
2cec08826f1fccd658694dd03abce10fc97618ec
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/reflection/Reflect.java#L90-L92
train
dbracewell/mango
src/main/java/com/davidbracewell/reflection/Reflect.java
Reflect.containsField
public boolean containsField(String name) { if (StringUtils.isNullOrBlank(name)) { return false; } return ClassDescriptorCache.getInstance() .getClassDescriptor(clazz) .getFields(accessAll) .stream() .anyMatch(f -> f.getName().equals(name)); }
java
public boolean containsField(String name) { if (StringUtils.isNullOrBlank(name)) { return false; } return ClassDescriptorCache.getInstance() .getClassDescriptor(clazz) .getFields(accessAll) .stream() .anyMatch(f -> f.getName().equals(name)); }
[ "public", "boolean", "containsField", "(", "String", "name", ")", "{", "if", "(", "StringUtils", ".", "isNullOrBlank", "(", "name", ")", ")", "{", "return", "false", ";", "}", "return", "ClassDescriptorCache", ".", "getInstance", "(", ")", ".", "getClassDesc...
Determines if a field with the given name is associated with the class @param name The field name @return True if there is a field with the given name
[ "Determines", "if", "a", "field", "with", "the", "given", "name", "is", "associated", "with", "the", "class" ]
2cec08826f1fccd658694dd03abce10fc97618ec
https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/reflection/Reflect.java#L181-L190
train