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
square/rack-servlet
core/src/main/java/com/squareup/rack/jruby/JRubyRackApplication.java
JRubyRackApplication.call
@Override public RackResponse call(RackEnvironment environment) { RubyHash environmentHash = convertToRubyHash(environment.entrySet()); RubyArray response = callRackApplication(environmentHash); return convertToJavaRackResponse(response); }
java
@Override public RackResponse call(RackEnvironment environment) { RubyHash environmentHash = convertToRubyHash(environment.entrySet()); RubyArray response = callRackApplication(environmentHash); return convertToJavaRackResponse(response); }
[ "@", "Override", "public", "RackResponse", "call", "(", "RackEnvironment", "environment", ")", "{", "RubyHash", "environmentHash", "=", "convertToRubyHash", "(", "environment", ".", "entrySet", "(", ")", ")", ";", "RubyArray", "response", "=", "callRackApplication",...
Calls the delegate Rack application, translating into and back out of the JRuby interpreter. @param environment the Rack environment @return the Rack response
[ "Calls", "the", "delegate", "Rack", "application", "translating", "into", "and", "back", "out", "of", "the", "JRuby", "interpreter", "." ]
9d480e4953f8297436a73928c41e592bddc1556b
https://github.com/square/rack-servlet/blob/9d480e4953f8297436a73928c41e592bddc1556b/core/src/main/java/com/squareup/rack/jruby/JRubyRackApplication.java#L63-L69
train
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/request/impl/DefaultVOMSACService.java
DefaultVOMSACService.getACFromResponse
protected AttributeCertificate getACFromResponse(VOMSACRequest request, VOMSResponse response) { byte[] acBytes = response.getAC(); if (acBytes == null) return null; ASN1InputStream asn1InputStream = new ASN1InputStream(acBytes); AttributeCertificate attributeCertificate = null; try { attributeCertificate = AttributeCertificate.getInstance(asn1InputStream .readObject()); asn1InputStream.close(); return attributeCertificate; } catch (Throwable e) { requestListener.notifyVOMSRequestFailure(request, null, new VOMSError( "Error unmarshalling VOMS AC. Cause: " + e.getMessage(), e)); return null; } }
java
protected AttributeCertificate getACFromResponse(VOMSACRequest request, VOMSResponse response) { byte[] acBytes = response.getAC(); if (acBytes == null) return null; ASN1InputStream asn1InputStream = new ASN1InputStream(acBytes); AttributeCertificate attributeCertificate = null; try { attributeCertificate = AttributeCertificate.getInstance(asn1InputStream .readObject()); asn1InputStream.close(); return attributeCertificate; } catch (Throwable e) { requestListener.notifyVOMSRequestFailure(request, null, new VOMSError( "Error unmarshalling VOMS AC. Cause: " + e.getMessage(), e)); return null; } }
[ "protected", "AttributeCertificate", "getACFromResponse", "(", "VOMSACRequest", "request", ",", "VOMSResponse", "response", ")", "{", "byte", "[", "]", "acBytes", "=", "response", ".", "getAC", "(", ")", ";", "if", "(", "acBytes", "==", "null", ")", "return", ...
Extracts an AC from a VOMS response @param request the request @param response the received response @return a possibly <code>null</code> {@link AttributeCertificate} object
[ "Extracts", "an", "AC", "from", "a", "VOMS", "response" ]
b33d6cf98ca9449bed87b1cc307d411514589deb
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/request/impl/DefaultVOMSACService.java#L108-L135
train
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/request/impl/DefaultVOMSACService.java
DefaultVOMSACService.handleErrorsInResponse
protected void handleErrorsInResponse(VOMSACRequest request, VOMSServerInfo si, VOMSResponse response) { if (response.hasErrors()) requestListener.notifyErrorsInVOMSReponse(request, si, response.errorMessages()); }
java
protected void handleErrorsInResponse(VOMSACRequest request, VOMSServerInfo si, VOMSResponse response) { if (response.hasErrors()) requestListener.notifyErrorsInVOMSReponse(request, si, response.errorMessages()); }
[ "protected", "void", "handleErrorsInResponse", "(", "VOMSACRequest", "request", ",", "VOMSServerInfo", "si", ",", "VOMSResponse", "response", ")", "{", "if", "(", "response", ".", "hasErrors", "(", ")", ")", "requestListener", ".", "notifyErrorsInVOMSReponse", "(", ...
Handles errors included in the VOMS response @param request the request @param si the VOMS server endpoint information @param response the received {@link VOMSResponse}
[ "Handles", "errors", "included", "in", "the", "VOMS", "response" ]
b33d6cf98ca9449bed87b1cc307d411514589deb
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/request/impl/DefaultVOMSACService.java#L164-L171
train
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/request/impl/DefaultVOMSACService.java
DefaultVOMSACService.handleWarningsInResponse
protected void handleWarningsInResponse(VOMSACRequest request, VOMSServerInfo si, VOMSResponse response) { if (response.hasWarnings()) requestListener.notifyWarningsInVOMSResponse(request, si, response.warningMessages()); }
java
protected void handleWarningsInResponse(VOMSACRequest request, VOMSServerInfo si, VOMSResponse response) { if (response.hasWarnings()) requestListener.notifyWarningsInVOMSResponse(request, si, response.warningMessages()); }
[ "protected", "void", "handleWarningsInResponse", "(", "VOMSACRequest", "request", ",", "VOMSServerInfo", "si", ",", "VOMSResponse", "response", ")", "{", "if", "(", "response", ".", "hasWarnings", "(", ")", ")", "requestListener", ".", "notifyWarningsInVOMSResponse", ...
Handles warnings included in the VOMS response @param request the request @param si the VOMS server endpoint information @param response the received {@link VOMSResponse}
[ "Handles", "warnings", "included", "in", "the", "VOMS", "response" ]
b33d6cf98ca9449bed87b1cc307d411514589deb
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/request/impl/DefaultVOMSACService.java#L183-L189
train
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/ImagePanel.java
ImagePanel.drawCheckerBoard
protected void drawCheckerBoard(Graphics2D g2d) { g2d.setColor(getBackground()); g2d.fillRect(0, 0, getWidth(), getHeight()); g2d.setColor(getForeground()); final int checkSize = this.checkerSize; final int halfCheckSize = checkSize/2; final Stroke checker = this.checkerStroke; final Stroke backup = g2d.getStroke(); g2d.setStroke(checker); final int width = this.getWidth()+checkSize; final int height = this.getHeight()+checkSize; for(int i = halfCheckSize; i < height; i+=checkSize*2){ g2d.drawLine(halfCheckSize, i, width, i); g2d.drawLine(checkSize+halfCheckSize, i+checkSize, width, i+checkSize); } g2d.setStroke(backup); }
java
protected void drawCheckerBoard(Graphics2D g2d) { g2d.setColor(getBackground()); g2d.fillRect(0, 0, getWidth(), getHeight()); g2d.setColor(getForeground()); final int checkSize = this.checkerSize; final int halfCheckSize = checkSize/2; final Stroke checker = this.checkerStroke; final Stroke backup = g2d.getStroke(); g2d.setStroke(checker); final int width = this.getWidth()+checkSize; final int height = this.getHeight()+checkSize; for(int i = halfCheckSize; i < height; i+=checkSize*2){ g2d.drawLine(halfCheckSize, i, width, i); g2d.drawLine(checkSize+halfCheckSize, i+checkSize, width, i+checkSize); } g2d.setStroke(backup); }
[ "protected", "void", "drawCheckerBoard", "(", "Graphics2D", "g2d", ")", "{", "g2d", ".", "setColor", "(", "getBackground", "(", ")", ")", ";", "g2d", ".", "fillRect", "(", "0", ",", "0", ",", "getWidth", "(", ")", ",", "getHeight", "(", ")", ")", ";"...
Draws the checkerboard background to the specified graphics context. @param g2d graphics context to draw on @since 1.4
[ "Draws", "the", "checkerboard", "background", "to", "the", "specified", "graphics", "context", "." ]
3837c7d550a12cf4dc5718b644ced94b97f52668
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/ImagePanel.java#L304-L321
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/web/rest/RSEndpoint.java
RSEndpoint.getMessageToClient
@POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Override public String getMessageToClient(@FormParam(Constants.Message.MFC) String json) { HttpSession httpSession = getHttpSession(); setContext(httpSession); MessageFromClient message = MessageFromClient.createFromJson(json); MessageToClient mtc = getMessageToClientService().createMessageToClient(message, httpSession); return mtc.toJson(); }
java
@POST @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) @Override public String getMessageToClient(@FormParam(Constants.Message.MFC) String json) { HttpSession httpSession = getHttpSession(); setContext(httpSession); MessageFromClient message = MessageFromClient.createFromJson(json); MessageToClient mtc = getMessageToClientService().createMessageToClient(message, httpSession); return mtc.toJson(); }
[ "@", "POST", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Consumes", "(", "MediaType", ".", "APPLICATION_FORM_URLENCODED", ")", "@", "Override", "public", "String", "getMessageToClient", "(", "@", "FormParam", "(", "Constants", ".", "Me...
Retrieves representation of an instance of org.ocelotds.GenericResource @param json @return an instance of java.lang.String
[ "Retrieves", "representation", "of", "an", "instance", "of", "org", ".", "ocelotds", ".", "GenericResource" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/web/rest/RSEndpoint.java#L54-L64
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/OcelotServices.java
OcelotServices.setLocale
@JsCacheRemove(cls = OcelotServices.class, methodName = "getLocale", keys = {}, userScope = true) public void setLocale(@JsonUnmarshaller(LocaleMarshaller.class) Locale locale) { logger.debug("Receive setLocale call from client. {}", locale); ocelotContext.setLocale(locale); }
java
@JsCacheRemove(cls = OcelotServices.class, methodName = "getLocale", keys = {}, userScope = true) public void setLocale(@JsonUnmarshaller(LocaleMarshaller.class) Locale locale) { logger.debug("Receive setLocale call from client. {}", locale); ocelotContext.setLocale(locale); }
[ "@", "JsCacheRemove", "(", "cls", "=", "OcelotServices", ".", "class", ",", "methodName", "=", "\"getLocale\"", ",", "keys", "=", "{", "}", ",", "userScope", "=", "true", ")", "public", "void", "setLocale", "(", "@", "JsonUnmarshaller", "(", "LocaleMarshalle...
define locale for current user @param locale
[ "define", "locale", "for", "current", "user" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/OcelotServices.java#L66-L70
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/OcelotServices.java
OcelotServices.getLocale
@JsCacheResult(year = 1) @JsonMarshaller(LocaleMarshaller.class) public Locale getLocale() { logger.debug("Receive getLocale call from client."); return ocelotContext.getLocale(); }
java
@JsCacheResult(year = 1) @JsonMarshaller(LocaleMarshaller.class) public Locale getLocale() { logger.debug("Receive getLocale call from client."); return ocelotContext.getLocale(); }
[ "@", "JsCacheResult", "(", "year", "=", "1", ")", "@", "JsonMarshaller", "(", "LocaleMarshaller", ".", "class", ")", "public", "Locale", "getLocale", "(", ")", "{", "logger", ".", "debug", "(", "\"Receive getLocale call from client.\"", ")", ";", "return", "oc...
get current user locale @return
[ "get", "current", "user", "locale" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/OcelotServices.java#L77-L82
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/OcelotServices.java
OcelotServices.getOutDatedCache
public Collection<String> getOutDatedCache(Map<String, Long> states) { return updatedCacheManager.getOutDatedCache(states); }
java
public Collection<String> getOutDatedCache(Map<String, Long> states) { return updatedCacheManager.getOutDatedCache(states); }
[ "public", "Collection", "<", "String", ">", "getOutDatedCache", "(", "Map", "<", "String", ",", "Long", ">", "states", ")", "{", "return", "updatedCacheManager", ".", "getOutDatedCache", "(", "states", ")", ";", "}" ]
GEt outdated cache among list @param states @return
[ "GEt", "outdated", "cache", "among", "list" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/OcelotServices.java#L99-L101
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/OcelotServices.java
OcelotServices.subscribe
@JsTopic @WsDataService public Integer subscribe(@JsTopicName(prefix = Constants.Topic.SUBSCRIBERS) String topic, Session session) throws IllegalAccessException { return topicManager.registerTopicSession(topic, session); }
java
@JsTopic @WsDataService public Integer subscribe(@JsTopicName(prefix = Constants.Topic.SUBSCRIBERS) String topic, Session session) throws IllegalAccessException { return topicManager.registerTopicSession(topic, session); }
[ "@", "JsTopic", "@", "WsDataService", "public", "Integer", "subscribe", "(", "@", "JsTopicName", "(", "prefix", "=", "Constants", ".", "Topic", ".", "SUBSCRIBERS", ")", "String", "topic", ",", "Session", "session", ")", "throws", "IllegalAccessException", "{", ...
Subscribe to topic @param topic @param session @return @throws IllegalAccessException
[ "Subscribe", "to", "topic" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/OcelotServices.java#L111-L115
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/OcelotServices.java
OcelotServices.unsubscribe
@JsTopic @WsDataService public Integer unsubscribe(@JsTopicName(prefix = Constants.Topic.SUBSCRIBERS) String topic, Session session) { return topicManager.unregisterTopicSession(topic, session); }
java
@JsTopic @WsDataService public Integer unsubscribe(@JsTopicName(prefix = Constants.Topic.SUBSCRIBERS) String topic, Session session) { return topicManager.unregisterTopicSession(topic, session); }
[ "@", "JsTopic", "@", "WsDataService", "public", "Integer", "unsubscribe", "(", "@", "JsTopicName", "(", "prefix", "=", "Constants", ".", "Topic", ".", "SUBSCRIBERS", ")", "String", "topic", ",", "Session", "session", ")", "{", "return", "topicManager", ".", ...
Unsubscribe to topic @param topic @param session @return
[ "Unsubscribe", "to", "topic" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/OcelotServices.java#L123-L127
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/messageControl/MessageControllerManager.java
MessageControllerManager.getJsTopicMessageController
public JsTopicMessageController getJsTopicMessageController(String topic) { logger.debug("Looking for messageController for topic '{}'", topic); JsTopicMessageController messageController = messageControllerCache.loadFromCache(topic); if(null == messageController) { // not in cache messageController = getJsTopicMessageControllerFromJsTopicControl(topic); // get from JsTopicControl if(null == messageController) { messageController = getJsTopicMessageControllerFromJsTopicControls(topic); // get from JsTopicControls if(null == messageController) { messageController = new DefaultJsTopicMessageController(); } } messageControllerCache.saveToCache(topic, messageController.getClass()); // save in cache } return messageController; }
java
public JsTopicMessageController getJsTopicMessageController(String topic) { logger.debug("Looking for messageController for topic '{}'", topic); JsTopicMessageController messageController = messageControllerCache.loadFromCache(topic); if(null == messageController) { // not in cache messageController = getJsTopicMessageControllerFromJsTopicControl(topic); // get from JsTopicControl if(null == messageController) { messageController = getJsTopicMessageControllerFromJsTopicControls(topic); // get from JsTopicControls if(null == messageController) { messageController = new DefaultJsTopicMessageController(); } } messageControllerCache.saveToCache(topic, messageController.getClass()); // save in cache } return messageController; }
[ "public", "JsTopicMessageController", "getJsTopicMessageController", "(", "String", "topic", ")", "{", "logger", ".", "debug", "(", "\"Looking for messageController for topic '{}'\"", ",", "topic", ")", ";", "JsTopicMessageController", "messageController", "=", "messageContro...
Get jstopic message controller @param topic @return
[ "Get", "jstopic", "message", "controller" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/messageControl/MessageControllerManager.java#L42-L56
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/messageControl/MessageControllerManager.java
MessageControllerManager.getJsTopicMessageControllerFromJsTopicControl
JsTopicMessageController getJsTopicMessageControllerFromJsTopicControl(String topic) { logger.debug("Looking for messageController for topic '{}' from JsTopicControl annotation", topic); Instance<JsTopicMessageController<?>> select = topicMessageController.select(new JsTopicCtrlAnnotationLiteral(topic)); if(!select.isUnsatisfied()) { logger.debug("Found messageController for topic '{}' from JsTopicControl annotation", topic); return select.get(); } return null; }
java
JsTopicMessageController getJsTopicMessageControllerFromJsTopicControl(String topic) { logger.debug("Looking for messageController for topic '{}' from JsTopicControl annotation", topic); Instance<JsTopicMessageController<?>> select = topicMessageController.select(new JsTopicCtrlAnnotationLiteral(topic)); if(!select.isUnsatisfied()) { logger.debug("Found messageController for topic '{}' from JsTopicControl annotation", topic); return select.get(); } return null; }
[ "JsTopicMessageController", "getJsTopicMessageControllerFromJsTopicControl", "(", "String", "topic", ")", "{", "logger", ".", "debug", "(", "\"Looking for messageController for topic '{}' from JsTopicControl annotation\"", ",", "topic", ")", ";", "Instance", "<", "JsTopicMessageC...
Get jstopic message controller from JsTopicControl @param topic @return
[ "Get", "jstopic", "message", "controller", "from", "JsTopicControl" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/messageControl/MessageControllerManager.java#L63-L71
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicsMessagesBroadcaster.java
TopicsMessagesBroadcaster.sendMessageToTopicForSessions
int sendMessageToTopicForSessions(Collection<Session> sessions, MessageToClient mtc, Object payload) { int sended = 0; JsTopicMessageController msgControl = messageControllerManager.getJsTopicMessageController(mtc.getId()); Collection<Session> sessionsClosed = new ArrayList<>(); for (Session session : sessions) { try { sended += checkAndSendMtcToSession(session, msgControl, mtc, payload); } catch (SessionException se) { sessionsClosed.add(se.getSession()); } } if (logger.isDebugEnabled()) { logger.debug("Send message to '{}' topic {} client(s) : {}", new Object[]{mtc.getId(), sessions.size() - sessionsClosed.size(), mtc}); } topicManager.removeSessionsToTopic(sessionsClosed); return sended; }
java
int sendMessageToTopicForSessions(Collection<Session> sessions, MessageToClient mtc, Object payload) { int sended = 0; JsTopicMessageController msgControl = messageControllerManager.getJsTopicMessageController(mtc.getId()); Collection<Session> sessionsClosed = new ArrayList<>(); for (Session session : sessions) { try { sended += checkAndSendMtcToSession(session, msgControl, mtc, payload); } catch (SessionException se) { sessionsClosed.add(se.getSession()); } } if (logger.isDebugEnabled()) { logger.debug("Send message to '{}' topic {} client(s) : {}", new Object[]{mtc.getId(), sessions.size() - sessionsClosed.size(), mtc}); } topicManager.removeSessionsToTopic(sessionsClosed); return sended; }
[ "int", "sendMessageToTopicForSessions", "(", "Collection", "<", "Session", ">", "sessions", ",", "MessageToClient", "mtc", ",", "Object", "payload", ")", "{", "int", "sended", "=", "0", ";", "JsTopicMessageController", "msgControl", "=", "messageControllerManager", ...
send message to sessions apply msgControl to topic @param sessions @param mtc @param payload @return
[ "send", "message", "to", "sessions", "apply", "msgControl", "to", "topic" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicsMessagesBroadcaster.java#L86-L102
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicsMessagesBroadcaster.java
TopicsMessagesBroadcaster.checkAndSendMtcToSession
int checkAndSendMtcToSession(Session session, JsTopicMessageController msgControl, MessageToClient mtc, Object payload) throws SessionException { if (session != null) { if (session.isOpen()) { try { if (null != msgControl) { checkMessageTopic(userContextFactory.getUserContext(session.getId()), mtc.getId(), payload, msgControl); } mtc.setType(MessageType.MESSAGE); session.getAsyncRemote().sendObject(mtc); return 1; } catch (NotRecipientException ex) { logger.debug("{} is exclude to receive a message in {}", ex.getMessage(), mtc.getId()); } } else { throw new SessionException("CLOSED", null, session); } } return 0; }
java
int checkAndSendMtcToSession(Session session, JsTopicMessageController msgControl, MessageToClient mtc, Object payload) throws SessionException { if (session != null) { if (session.isOpen()) { try { if (null != msgControl) { checkMessageTopic(userContextFactory.getUserContext(session.getId()), mtc.getId(), payload, msgControl); } mtc.setType(MessageType.MESSAGE); session.getAsyncRemote().sendObject(mtc); return 1; } catch (NotRecipientException ex) { logger.debug("{} is exclude to receive a message in {}", ex.getMessage(), mtc.getId()); } } else { throw new SessionException("CLOSED", null, session); } } return 0; }
[ "int", "checkAndSendMtcToSession", "(", "Session", "session", ",", "JsTopicMessageController", "msgControl", ",", "MessageToClient", "mtc", ",", "Object", "payload", ")", "throws", "SessionException", "{", "if", "(", "session", "!=", "null", ")", "{", "if", "(", ...
Send Message to session, check right before @param session @param msgControl @param mtc @param payload @return @throws SessionException
[ "Send", "Message", "to", "session", "check", "right", "before" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicsMessagesBroadcaster.java#L114-L132
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicsMessagesBroadcaster.java
TopicsMessagesBroadcaster.checkMessageTopic
void checkMessageTopic(UserContext ctx, String topic, Object payload, JsTopicMessageController msgControl) throws NotRecipientException { if (null != msgControl) { msgControl.checkRight(ctx, topic, payload); } }
java
void checkMessageTopic(UserContext ctx, String topic, Object payload, JsTopicMessageController msgControl) throws NotRecipientException { if (null != msgControl) { msgControl.checkRight(ctx, topic, payload); } }
[ "void", "checkMessageTopic", "(", "UserContext", "ctx", ",", "String", "topic", ",", "Object", "payload", ",", "JsTopicMessageController", "msgControl", ")", "throws", "NotRecipientException", "{", "if", "(", "null", "!=", "msgControl", ")", "{", "msgControl", "."...
Check if message is granted by messageControl @param ctx @param mtc @param msgControl @return @throws NotRecipientException
[ "Check", "if", "message", "is", "granted", "by", "messageControl" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicsMessagesBroadcaster.java#L143-L147
train
osiam/connector4java
src/main/java/org/osiam/client/OsiamConnector.java
OsiamConnector.getMe
public User getMe(AccessToken accessToken, String... attributes) { return getUserService().getMe(accessToken, attributes); }
java
public User getMe(AccessToken accessToken, String... attributes) { return getUserService().getMe(accessToken, attributes); }
[ "public", "User", "getMe", "(", "AccessToken", "accessToken", ",", "String", "...", "attributes", ")", "{", "return", "getUserService", "(", ")", ".", "getMe", "(", "accessToken", ",", "attributes", ")", ";", "}" ]
Retrieves the User holding the given access token. @param accessToken the OSIAM access token from for the current session @param attributes the attributes that should be returned in the response. If none are given, all are returned @return the actual logged in user @throws UnauthorizedException if the request could not be authorized. @throws ForbiddenException if the scope doesn't allow this request @throws ConnectionInitializationException if no connection to the given OSIAM services could be initialized @throws IllegalStateException if OSIAM's endpoint(s) are not properly configured
[ "Retrieves", "the", "User", "holding", "the", "given", "access", "token", "." ]
a5e6ae1e706f4889d662a069fe2f3bf8e3848d12
https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L292-L294
train
osiam/connector4java
src/main/java/org/osiam/client/OsiamConnector.java
OsiamConnector.refreshAccessToken
public AccessToken refreshAccessToken(AccessToken accessToken, Scope... scopes) { return getAuthService().refreshAccessToken(accessToken, scopes); }
java
public AccessToken refreshAccessToken(AccessToken accessToken, Scope... scopes) { return getAuthService().refreshAccessToken(accessToken, scopes); }
[ "public", "AccessToken", "refreshAccessToken", "(", "AccessToken", "accessToken", ",", "Scope", "...", "scopes", ")", "{", "return", "getAuthService", "(", ")", ".", "refreshAccessToken", "(", "accessToken", ",", "scopes", ")", ";", "}" ]
Provides a new and refreshed access token by getting the refresh token from the given access token. @param accessToken the access token to be refreshed @param scopes an optional parameter if the scope of the token should be changed. Otherwise the scopes of the old token are used. @return the new access token with the refreshed lifetime @throws IllegalArgumentException in case the accessToken has an empty refresh token @throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized @throws UnauthorizedException if the request could not be authorized. @throws IllegalStateException if OSIAM's endpoint(s) are not properly configured
[ "Provides", "a", "new", "and", "refreshed", "access", "token", "by", "getting", "the", "refresh", "token", "from", "the", "given", "access", "token", "." ]
a5e6ae1e706f4889d662a069fe2f3bf8e3848d12
https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L381-L383
train
osiam/connector4java
src/main/java/org/osiam/client/OsiamConnector.java
OsiamConnector.updateUser
@Deprecated public User updateUser(String id, UpdateUser updateUser, AccessToken accessToken) { return getUserService().updateUser(id, updateUser, accessToken); }
java
@Deprecated public User updateUser(String id, UpdateUser updateUser, AccessToken accessToken) { return getUserService().updateUser(id, updateUser, accessToken); }
[ "@", "Deprecated", "public", "User", "updateUser", "(", "String", "id", ",", "UpdateUser", "updateUser", ",", "AccessToken", "accessToken", ")", "{", "return", "getUserService", "(", ")", ".", "updateUser", "(", "id", ",", "updateUser", ",", "accessToken", ")"...
update the user of the given id with the values given in the User Object. For more detailed information how to set new field, update Fields or to delete Fields please look in the documentation. This method is not compatible with OSIAM 3.x. @param id if of the User to be updated @param updateUser all Fields that need to be updated @param accessToken the OSIAM access token from for the current session @return the updated User Object with all new Fields @throws UnauthorizedException if the request could not be authorized. @throws ConflictException if the User could not be updated @throws NoResultException if no user with the given id can be found @throws ForbiddenException if the scope doesn't allow this request @throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized @throws IllegalStateException if OSIAM's endpoint(s) are not properly configured @see <a href="https://github.com/osiam/connector4java/docs/working-with-user.md">Working with user</a> @deprecated Updating with PATCH has been removed in OSIAM 3.0. This method is going to go away with version 1.12 or 2.0.
[ "update", "the", "user", "of", "the", "given", "id", "with", "the", "values", "given", "in", "the", "User", "Object", ".", "For", "more", "detailed", "information", "how", "to", "set", "new", "field", "update", "Fields", "or", "to", "delete", "Fields", "...
a5e6ae1e706f4889d662a069fe2f3bf8e3848d12
https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L524-L527
train
osiam/connector4java
src/main/java/org/osiam/client/OsiamConnector.java
OsiamConnector.updateGroup
@Deprecated public Group updateGroup(String id, UpdateGroup updateGroup, AccessToken accessToken) { return getGroupService().updateGroup(id, updateGroup, accessToken); }
java
@Deprecated public Group updateGroup(String id, UpdateGroup updateGroup, AccessToken accessToken) { return getGroupService().updateGroup(id, updateGroup, accessToken); }
[ "@", "Deprecated", "public", "Group", "updateGroup", "(", "String", "id", ",", "UpdateGroup", "updateGroup", ",", "AccessToken", "accessToken", ")", "{", "return", "getGroupService", "(", ")", ".", "updateGroup", "(", "id", ",", "updateGroup", ",", "accessToken"...
update the group of the given id with the values given in the Group Object. For more detailed information how to set new field. Update Fields or to delete Fields please look in the documentation @param id id of the Group to be updated @param updateGroup all Fields that need to be updated @param accessToken the OSIAM access token from for the current session @return the updated group Object @throws UnauthorizedException if the request could not be authorized. @throws ConflictException if the Group could not be updated @throws NoResultException if no group with the given id can be found @throws ForbiddenException if the scope doesn't allow this request @throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized @throws IllegalStateException if OSIAM's endpoint(s) are not properly configured @see <a href="https://github.com/osiam/connector4java/docs/working-with-groups .md#search-for-groups">Working with groups</a> @deprecated Updating with PATCH has been removed in OSIAM 3.0. This method is going to go away with version 1.12 or 2.0.
[ "update", "the", "group", "of", "the", "given", "id", "with", "the", "values", "given", "in", "the", "Group", "Object", ".", "For", "more", "detailed", "information", "how", "to", "set", "new", "field", ".", "Update", "Fields", "or", "to", "delete", "Fie...
a5e6ae1e706f4889d662a069fe2f3bf8e3848d12
https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L566-L569
train
osiam/connector4java
src/main/java/org/osiam/client/OsiamConnector.java
OsiamConnector.getClient
public Client getClient(String clientId, AccessToken accessToken) { return getAuthService().getClient(clientId, accessToken); }
java
public Client getClient(String clientId, AccessToken accessToken) { return getAuthService().getClient(clientId, accessToken); }
[ "public", "Client", "getClient", "(", "String", "clientId", ",", "AccessToken", "accessToken", ")", "{", "return", "getAuthService", "(", ")", ".", "getClient", "(", "clientId", ",", "accessToken", ")", ";", "}" ]
Get client by the given client id. @param clientId the client id @param accessToken the access token used to access the service @return The found client @throws UnauthorizedException if the accessToken is not valid @throws ForbiddenException if access to this resource is not allowed @throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized @throws ClientNotFoundException if no client with the given id can be found @throws IllegalStateException if OSIAM's endpoint(s) are not properly configured
[ "Get", "client", "by", "the", "given", "client", "id", "." ]
a5e6ae1e706f4889d662a069fe2f3bf8e3848d12
https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L636-L638
train
osiam/connector4java
src/main/java/org/osiam/client/OsiamConnector.java
OsiamConnector.createClient
public Client createClient(Client client, AccessToken accessToken) { return getAuthService().createClient(client, accessToken); }
java
public Client createClient(Client client, AccessToken accessToken) { return getAuthService().createClient(client, accessToken); }
[ "public", "Client", "createClient", "(", "Client", "client", ",", "AccessToken", "accessToken", ")", "{", "return", "getAuthService", "(", ")", ".", "createClient", "(", "client", ",", "accessToken", ")", ";", "}" ]
Create a client. @param client the client to create @param accessToken the access token used to access the service @return The created client @throws UnauthorizedException if the accessToken is not valid @throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized @throws ClientAlreadyExistsException if the client with the clientId already exists @throws IllegalStateException if OSIAM's endpoint(s) are not properly configured
[ "Create", "a", "client", "." ]
a5e6ae1e706f4889d662a069fe2f3bf8e3848d12
https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L665-L667
train
osiam/connector4java
src/main/java/org/osiam/client/OsiamConnector.java
OsiamConnector.updateClient
public Client updateClient(String clientId, Client client, AccessToken accessToken) { return getAuthService().updateClient(clientId, client, accessToken); }
java
public Client updateClient(String clientId, Client client, AccessToken accessToken) { return getAuthService().updateClient(clientId, client, accessToken); }
[ "public", "Client", "updateClient", "(", "String", "clientId", ",", "Client", "client", ",", "AccessToken", "accessToken", ")", "{", "return", "getAuthService", "(", ")", ".", "updateClient", "(", "clientId", ",", "client", ",", "accessToken", ")", ";", "}" ]
Get OSIAM OAuth client by the given ID. @param clientId the id of the client which should be updated @param client the client @param accessToken the access token used to access the service @return The updated client @throws UnauthorizedException if the accessToken is not valid @throws ConnectionInitializationException if the connection to the given OSIAM service could not be initialized @throws ConflictException if the client with the clientId already exists @throws IllegalStateException if OSIAM's endpoint(s) are not properly configured
[ "Get", "OSIAM", "OAuth", "client", "by", "the", "given", "ID", "." ]
a5e6ae1e706f4889d662a069fe2f3bf8e3848d12
https://github.com/osiam/connector4java/blob/a5e6ae1e706f4889d662a069fe2f3bf8e3848d12/src/main/java/org/osiam/client/OsiamConnector.java#L695-L697
train
dkpro/dkpro-statistics
dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/visualization/ContingencyMatrixPrinter.java
ContingencyMatrixPrinter.print
public void print(final PrintStream out, final ICodingAnnotationStudy study) { if (study.getRaterCount() > 2) throw new IllegalArgumentException("Contingency tables are only applicable for two rater studies."); //TODO: measure length of cats. maybe cut them. Map<Object, Integer> categories = new LinkedHashMap<Object, Integer>(); for (Object cat : study.getCategories()) categories.put(cat, categories.size()); int[][] frequencies = new int[study.getCategoryCount()][study.getCategoryCount()]; for (ICodingAnnotationItem item : study.getItems()) { int cat1 = categories.get(item.getUnit(0).getCategory()); int cat2 = categories.get(item.getUnit(1).getCategory()); frequencies[cat1][cat2]++; } final String DIVIDER = "\t"; for (Object category : categories.keySet()) out.print(DIVIDER + category); out.print(DIVIDER + "Σ"); out.println(); int i = 0; int[] colSum = new int[study.getCategoryCount()]; for (Object category1 : categories.keySet()) { out.print(category1); int rowSum = 0; for (int j = 0; j < categories.size(); j++) { out.printf(DIVIDER + "%3d", frequencies[i][j]); rowSum += frequencies[i][j]; colSum[j] += frequencies[i][j]; } out.printf(DIVIDER + "%3d", rowSum); out.println(); i++; } out.print("Σ"); int rowSum = 0; for (int j = 0; j < categories.size(); j++) { out.printf(DIVIDER + "%3d", colSum[j]); rowSum += colSum[j]; } out.printf(DIVIDER + "%3d", rowSum); out.println(); }
java
public void print(final PrintStream out, final ICodingAnnotationStudy study) { if (study.getRaterCount() > 2) throw new IllegalArgumentException("Contingency tables are only applicable for two rater studies."); //TODO: measure length of cats. maybe cut them. Map<Object, Integer> categories = new LinkedHashMap<Object, Integer>(); for (Object cat : study.getCategories()) categories.put(cat, categories.size()); int[][] frequencies = new int[study.getCategoryCount()][study.getCategoryCount()]; for (ICodingAnnotationItem item : study.getItems()) { int cat1 = categories.get(item.getUnit(0).getCategory()); int cat2 = categories.get(item.getUnit(1).getCategory()); frequencies[cat1][cat2]++; } final String DIVIDER = "\t"; for (Object category : categories.keySet()) out.print(DIVIDER + category); out.print(DIVIDER + "Σ"); out.println(); int i = 0; int[] colSum = new int[study.getCategoryCount()]; for (Object category1 : categories.keySet()) { out.print(category1); int rowSum = 0; for (int j = 0; j < categories.size(); j++) { out.printf(DIVIDER + "%3d", frequencies[i][j]); rowSum += frequencies[i][j]; colSum[j] += frequencies[i][j]; } out.printf(DIVIDER + "%3d", rowSum); out.println(); i++; } out.print("Σ"); int rowSum = 0; for (int j = 0; j < categories.size(); j++) { out.printf(DIVIDER + "%3d", colSum[j]); rowSum += colSum[j]; } out.printf(DIVIDER + "%3d", rowSum); out.println(); }
[ "public", "void", "print", "(", "final", "PrintStream", "out", ",", "final", "ICodingAnnotationStudy", "study", ")", "{", "if", "(", "study", ".", "getRaterCount", "(", ")", ">", "2", ")", "throw", "new", "IllegalArgumentException", "(", "\"Contingency tables ar...
Print the contingency matrix for the given coding study. @throws IllegalArgumentException if the given study has more than two raters.
[ "Print", "the", "contingency", "matrix", "for", "the", "given", "coding", "study", "." ]
0b0e93dc49223984964411cbc6df420ba796a8cb
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/visualization/ContingencyMatrixPrinter.java#L47-L91
train
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/util/VOMSFQANNamingScheme.java
VOMSFQANNamingScheme.checkSyntax
public static void checkSyntax(String fqan) { if (fqan.length() > 255) throw new VOMSError("fqan.length() > 255"); if (!fqanPattern.matcher(fqan).matches()) throw new VOMSError("Syntax error in fqan: " + fqan); }
java
public static void checkSyntax(String fqan) { if (fqan.length() > 255) throw new VOMSError("fqan.length() > 255"); if (!fqanPattern.matcher(fqan).matches()) throw new VOMSError("Syntax error in fqan: " + fqan); }
[ "public", "static", "void", "checkSyntax", "(", "String", "fqan", ")", "{", "if", "(", "fqan", ".", "length", "(", ")", ">", "255", ")", "throw", "new", "VOMSError", "(", "\"fqan.length() > 255\"", ")", ";", "if", "(", "!", "fqanPattern", ".", "matcher",...
This methods checks that the string passed as argument complies with the voms FQAN syntax. @param fqan the string that must be checked for compatibility with FQAN syntax. @throws VOMSError If there's an error in the FQAN syntax.
[ "This", "methods", "checks", "that", "the", "string", "passed", "as", "argument", "complies", "with", "the", "voms", "FQAN", "syntax", "." ]
b33d6cf98ca9449bed87b1cc307d411514589deb
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/util/VOMSFQANNamingScheme.java#L66-L73
train
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/util/VOMSFQANNamingScheme.java
VOMSFQANNamingScheme.checkRole
public static void checkRole(String roleName) { if (roleName.length() > 255) throw new VOMSError("roleName.length()>255"); if (!rolePattern.matcher(roleName).matches()) throw new VOMSError("Syntax error in role name: " + roleName); }
java
public static void checkRole(String roleName) { if (roleName.length() > 255) throw new VOMSError("roleName.length()>255"); if (!rolePattern.matcher(roleName).matches()) throw new VOMSError("Syntax error in role name: " + roleName); }
[ "public", "static", "void", "checkRole", "(", "String", "roleName", ")", "{", "if", "(", "roleName", ".", "length", "(", ")", ">", "255", ")", "throw", "new", "VOMSError", "(", "\"roleName.length()>255\"", ")", ";", "if", "(", "!", "rolePattern", ".", "m...
This methods checks that the string passed as argument complies with the syntax used by voms to identify roles. @param roleName the name of the role @throws VOMSError If the string passed as argument doens not comply with the voms sytax.
[ "This", "methods", "checks", "that", "the", "string", "passed", "as", "argument", "complies", "with", "the", "syntax", "used", "by", "voms", "to", "identify", "roles", "." ]
b33d6cf98ca9449bed87b1cc307d411514589deb
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/util/VOMSFQANNamingScheme.java#L105-L112
train
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/util/VOMSFQANNamingScheme.java
VOMSFQANNamingScheme.getRoleName
public static String getRoleName(String containerName) { if (!isRole(containerName) && !isQualifiedRole(containerName)) throw new VOMSError("No role specified in \"" + containerName + "\" voms syntax."); Matcher m = fqanPattern.matcher(containerName); if (m.matches()) { String roleGroup = m.group(4); return roleGroup .substring(roleGroup.indexOf('=') + 1, roleGroup.length()); } return null; }
java
public static String getRoleName(String containerName) { if (!isRole(containerName) && !isQualifiedRole(containerName)) throw new VOMSError("No role specified in \"" + containerName + "\" voms syntax."); Matcher m = fqanPattern.matcher(containerName); if (m.matches()) { String roleGroup = m.group(4); return roleGroup .substring(roleGroup.indexOf('=') + 1, roleGroup.length()); } return null; }
[ "public", "static", "String", "getRoleName", "(", "String", "containerName", ")", "{", "if", "(", "!", "isRole", "(", "containerName", ")", "&&", "!", "isQualifiedRole", "(", "containerName", ")", ")", "throw", "new", "VOMSError", "(", "\"No role specified in \\...
This method extracts the role name information from the FQAN passed as argument. @param containerName the FQAN @return <ul> <li>A string containing the role name, if found</li> <li>null, if no role information is contained in the FQAN passed as argument </ul>
[ "This", "method", "extracts", "the", "role", "name", "information", "from", "the", "FQAN", "passed", "as", "argument", "." ]
b33d6cf98ca9449bed87b1cc307d411514589deb
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/util/VOMSFQANNamingScheme.java#L179-L196
train
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/util/VOMSFQANNamingScheme.java
VOMSFQANNamingScheme.getGroupName
public static String getGroupName(String containerName) { checkSyntax(containerName); // If it's a container and it's not a role or a qualified role, then // it's a group! if (!isRole(containerName) && !isQualifiedRole(containerName)) return containerName; Matcher m = fqanPattern.matcher(containerName); if (m.matches()) { String groupName = m.group(2); if (groupName.endsWith("/")) return groupName.substring(0, groupName.length() - 1); else return groupName; } return null; }
java
public static String getGroupName(String containerName) { checkSyntax(containerName); // If it's a container and it's not a role or a qualified role, then // it's a group! if (!isRole(containerName) && !isQualifiedRole(containerName)) return containerName; Matcher m = fqanPattern.matcher(containerName); if (m.matches()) { String groupName = m.group(2); if (groupName.endsWith("/")) return groupName.substring(0, groupName.length() - 1); else return groupName; } return null; }
[ "public", "static", "String", "getGroupName", "(", "String", "containerName", ")", "{", "checkSyntax", "(", "containerName", ")", ";", "// If it's a container and it's not a role or a qualified role, then", "// it's a group!", "if", "(", "!", "isRole", "(", "containerName",...
This method extracts group name information from the FQAN passed as argument. @param containerName the FQAN @return <ul> <li>A string containing the group name, if found</li> <li>null, if no group information is contained in the FQAN passed as argument </ul>
[ "This", "method", "extracts", "group", "name", "information", "from", "the", "FQAN", "passed", "as", "argument", "." ]
b33d6cf98ca9449bed87b1cc307d411514589deb
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/util/VOMSFQANNamingScheme.java#L210-L232
train
xqbase/tuna
core/src/main/java/com/xqbase/tuna/ConnectionFilter.java
ConnectionFilter.send
@Override public void send(byte[] b, int off, int len) { handler.send(b, off, len); }
java
@Override public void send(byte[] b, int off, int len) { handler.send(b, off, len); }
[ "@", "Override", "public", "void", "send", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ")", "{", "handler", ".", "send", "(", "b", ",", "off", ",", "len", ")", ";", "}" ]
Wraps sent data, from the application side to the network side
[ "Wraps", "sent", "data", "from", "the", "application", "side", "to", "the", "network", "side" ]
60d05a9e03877a3daafe9de83dc4427c6cbb9995
https://github.com/xqbase/tuna/blob/60d05a9e03877a3daafe9de83dc4427c6cbb9995/core/src/main/java/com/xqbase/tuna/ConnectionFilter.java#L28-L31
train
jenkinsci/gmaven
gmaven-plugin/src/main/java/org/codehaus/gmaven/plugin/MojoSupport.java
MojoSupport.createArtifact
protected Artifact createArtifact(final ArtifactItem item) throws MojoExecutionException { assert item != null; if (item.getVersion() == null) { fillMissingArtifactVersion(item); if (item.getVersion() == null) { throw new MojoExecutionException("Unable to find artifact version of " + item.getGroupId() + ":" + item.getArtifactId() + " in either dependency list or in project's dependency management."); } } // Convert the string version to a range VersionRange range; try { range = VersionRange.createFromVersionSpec(item.getVersion()); log.trace("Using version range: {}", range); } catch (InvalidVersionSpecificationException e) { throw new MojoExecutionException("Could not create range for version: " + item.getVersion(), e); } return artifactFactory.createDependencyArtifact( item.getGroupId(), item.getArtifactId(), range, item.getType(), item.getClassifier(), Artifact.SCOPE_PROVIDED); }
java
protected Artifact createArtifact(final ArtifactItem item) throws MojoExecutionException { assert item != null; if (item.getVersion() == null) { fillMissingArtifactVersion(item); if (item.getVersion() == null) { throw new MojoExecutionException("Unable to find artifact version of " + item.getGroupId() + ":" + item.getArtifactId() + " in either dependency list or in project's dependency management."); } } // Convert the string version to a range VersionRange range; try { range = VersionRange.createFromVersionSpec(item.getVersion()); log.trace("Using version range: {}", range); } catch (InvalidVersionSpecificationException e) { throw new MojoExecutionException("Could not create range for version: " + item.getVersion(), e); } return artifactFactory.createDependencyArtifact( item.getGroupId(), item.getArtifactId(), range, item.getType(), item.getClassifier(), Artifact.SCOPE_PROVIDED); }
[ "protected", "Artifact", "createArtifact", "(", "final", "ArtifactItem", "item", ")", "throws", "MojoExecutionException", "{", "assert", "item", "!=", "null", ";", "if", "(", "item", ".", "getVersion", "(", ")", "==", "null", ")", "{", "fillMissingArtifactVersio...
Create a new artifact. If no version is specified, it will be retrieved from the dependency list or from the DependencyManagement section of the pom. @param item The item to create an artifact for @return An unresolved artifact for the given item. @throws MojoExecutionException Failed to create artifact
[ "Create", "a", "new", "artifact", ".", "If", "no", "version", "is", "specified", "it", "will", "be", "retrieved", "from", "the", "dependency", "list", "or", "from", "the", "DependencyManagement", "section", "of", "the", "pom", "." ]
80d5f6657e15b3e05ffbb82128ed8bb280836e10
https://github.com/jenkinsci/gmaven/blob/80d5f6657e15b3e05ffbb82128ed8bb280836e10/gmaven-plugin/src/main/java/org/codehaus/gmaven/plugin/MojoSupport.java#L196-L225
train
jenkinsci/gmaven
gmaven-plugin/src/main/java/org/codehaus/gmaven/plugin/MojoSupport.java
MojoSupport.fillMissingArtifactVersion
private void fillMissingArtifactVersion(final ArtifactItem item) { log.trace("Attempting to find missing version in {}:{}", item.getGroupId() , item.getArtifactId()); List list = project.getDependencies(); for (int i = 0; i < list.size(); ++i) { Dependency dependency = (Dependency) list.get(i); if (dependency.getGroupId().equals(item.getGroupId()) && dependency.getArtifactId().equals(item.getArtifactId()) && dependency.getType().equals(item.getType())) { log.trace("Found missing version: {} in dependency list", dependency.getVersion()); item.setVersion(dependency.getVersion()); return; } } list = project.getDependencyManagement().getDependencies(); for (int i = 0; i < list.size(); i++) { Dependency dependency = (Dependency) list.get(i); if (dependency.getGroupId().equals(item.getGroupId()) && dependency.getArtifactId().equals(item.getArtifactId()) && dependency.getType().equals(item.getType())) { log.trace("Found missing version: {} in dependency management list", dependency.getVersion()); item.setVersion(dependency.getVersion()); } } }
java
private void fillMissingArtifactVersion(final ArtifactItem item) { log.trace("Attempting to find missing version in {}:{}", item.getGroupId() , item.getArtifactId()); List list = project.getDependencies(); for (int i = 0; i < list.size(); ++i) { Dependency dependency = (Dependency) list.get(i); if (dependency.getGroupId().equals(item.getGroupId()) && dependency.getArtifactId().equals(item.getArtifactId()) && dependency.getType().equals(item.getType())) { log.trace("Found missing version: {} in dependency list", dependency.getVersion()); item.setVersion(dependency.getVersion()); return; } } list = project.getDependencyManagement().getDependencies(); for (int i = 0; i < list.size(); i++) { Dependency dependency = (Dependency) list.get(i); if (dependency.getGroupId().equals(item.getGroupId()) && dependency.getArtifactId().equals(item.getArtifactId()) && dependency.getType().equals(item.getType())) { log.trace("Found missing version: {} in dependency management list", dependency.getVersion()); item.setVersion(dependency.getVersion()); } } }
[ "private", "void", "fillMissingArtifactVersion", "(", "final", "ArtifactItem", "item", ")", "{", "log", ".", "trace", "(", "\"Attempting to find missing version in {}:{}\"", ",", "item", ".", "getGroupId", "(", ")", ",", "item", ".", "getArtifactId", "(", ")", ")"...
Tries to find missing version from dependency list and dependency management. If found, the artifact is updated with the correct version. @param item The item to fill in missing version details into
[ "Tries", "to", "find", "missing", "version", "from", "dependency", "list", "and", "dependency", "management", ".", "If", "found", "the", "artifact", "is", "updated", "with", "the", "correct", "version", "." ]
80d5f6657e15b3e05ffbb82128ed8bb280836e10
https://github.com/jenkinsci/gmaven/blob/80d5f6657e15b3e05ffbb82128ed8bb280836e10/gmaven-plugin/src/main/java/org/codehaus/gmaven/plugin/MojoSupport.java#L290-L324
train
xqbase/tuna
core/src/main/java/com/xqbase/tuna/ConnectionWrapper.java
ConnectionWrapper.onRecv
@Override public void onRecv(byte[] b, int off, int len) { connection.onRecv(b, off, len); }
java
@Override public void onRecv(byte[] b, int off, int len) { connection.onRecv(b, off, len); }
[ "@", "Override", "public", "void", "onRecv", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ")", "{", "connection", ".", "onRecv", "(", "b", ",", "off", ",", "len", ")", ";", "}" ]
Wraps received data, from the network side to the application side
[ "Wraps", "received", "data", "from", "the", "network", "side", "to", "the", "application", "side" ]
60d05a9e03877a3daafe9de83dc4427c6cbb9995
https://github.com/xqbase/tuna/blob/60d05a9e03877a3daafe9de83dc4427c6cbb9995/core/src/main/java/com/xqbase/tuna/ConnectionWrapper.java#L16-L19
train
riversun/finbin
src/main/java/org/riversun/finbin/BigBinarySearcher.java
BigBinarySearcher.searchBigBytes
public List<Integer> searchBigBytes(byte[] srcBytes, byte[] searchBytes) { int numOfThreadsOptimized = (srcBytes.length / analyzeByteArrayUnitSize); if (numOfThreadsOptimized == 0) { numOfThreadsOptimized = 1; } return searchBigBytes(srcBytes, searchBytes, numOfThreadsOptimized); }
java
public List<Integer> searchBigBytes(byte[] srcBytes, byte[] searchBytes) { int numOfThreadsOptimized = (srcBytes.length / analyzeByteArrayUnitSize); if (numOfThreadsOptimized == 0) { numOfThreadsOptimized = 1; } return searchBigBytes(srcBytes, searchBytes, numOfThreadsOptimized); }
[ "public", "List", "<", "Integer", ">", "searchBigBytes", "(", "byte", "[", "]", "srcBytes", ",", "byte", "[", "]", "searchBytes", ")", "{", "int", "numOfThreadsOptimized", "=", "(", "srcBytes", ".", "length", "/", "analyzeByteArrayUnitSize", ")", ";", "if", ...
Search bytes faster in a concurrent processing. @param srcBytes @param searchBytes @return
[ "Search", "bytes", "faster", "in", "a", "concurrent", "processing", "." ]
d1db86a0d2966dcf47087340bbd0727a9d508b3e
https://github.com/riversun/finbin/blob/d1db86a0d2966dcf47087340bbd0727a9d508b3e/src/main/java/org/riversun/finbin/BigBinarySearcher.java#L87-L96
train
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/credential/impl/DefaultLoadCredentialsStrategy.java
DefaultLoadCredentialsStrategy.getFromEnvOrSystemProperty
public String getFromEnvOrSystemProperty(String propName) { String val = System.getenv(propName); if (val == null) val = System.getProperty(propName); return val; }
java
public String getFromEnvOrSystemProperty(String propName) { String val = System.getenv(propName); if (val == null) val = System.getProperty(propName); return val; }
[ "public", "String", "getFromEnvOrSystemProperty", "(", "String", "propName", ")", "{", "String", "val", "=", "System", ".", "getenv", "(", "propName", ")", ";", "if", "(", "val", "==", "null", ")", "val", "=", "System", ".", "getProperty", "(", "propName",...
Looks for the value of a given property in the environment or in the system properties @param propName the property that will be looked for @return the property value, or null if no property was found
[ "Looks", "for", "the", "value", "of", "a", "given", "property", "in", "the", "environment", "or", "in", "the", "system", "properties" ]
b33d6cf98ca9449bed87b1cc307d411514589deb
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/credential/impl/DefaultLoadCredentialsStrategy.java#L110-L116
train
dkpro/dkpro-statistics
dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/visualization/ReliabilityMatrixPrinter.java
ReliabilityMatrixPrinter.print
public void print(final PrintStream out, final ICodingAnnotationStudy study) { //TODO: measure length of cats. maybe cut them. Map<Object, Integer> categories = new LinkedHashMap<Object, Integer>(); for (Object cat : study.getCategories()) categories.put(cat, categories.size()); final String DIVIDER = "\t"; for (int i = 0; i < study.getItemCount(); i++) out.print(DIVIDER + (i + 1)); out.print(DIVIDER + "Σ"); out.println(); for (int r = 0; r < study.getRaterCount(); r++) { out.print(r + 1); for (ICodingAnnotationItem item : study.getItems()) out.print(DIVIDER + item.getUnit(r).getCategory()); out.println(); } out.println(); for (Object category : study.getCategories()) { out.print(category); int catSum = 0; for (ICodingAnnotationItem item : study.getItems()) { int catCount = 0; for (IAnnotationUnit unit : item.getUnits()) if (category.equals(unit.getCategory())) catCount++; out.print(DIVIDER + (catCount > 0 ? catCount : "")); catSum += catCount; } out.println(DIVIDER + catSum); } /* for (Object category : categories.keySet()) out.print(DIVIDER + category); out.print(DIVIDER + "Σ"); out.println(); int i = 0; int[] colSum = new int[study.getCategoryCount()]; for (Object category1 : categories.keySet()) { out.print(category1); int rowSum = 0; for (int j = 0; j < categories.size(); j++) { out.printf(DIVIDER + "%3d", frequencies[i][j]); rowSum += frequencies[i][j]; colSum[j] += frequencies[i][j]; } out.printf(DIVIDER + "%3d", rowSum); out.println(); i++; } out.print("Σ"); int rowSum = 0; for (int j = 0; j < categories.size(); j++) { out.printf(DIVIDER + "%3d", colSum[j]); rowSum += colSum[j]; } out.printf(DIVIDER + "%3d", rowSum); out.println();*/ }
java
public void print(final PrintStream out, final ICodingAnnotationStudy study) { //TODO: measure length of cats. maybe cut them. Map<Object, Integer> categories = new LinkedHashMap<Object, Integer>(); for (Object cat : study.getCategories()) categories.put(cat, categories.size()); final String DIVIDER = "\t"; for (int i = 0; i < study.getItemCount(); i++) out.print(DIVIDER + (i + 1)); out.print(DIVIDER + "Σ"); out.println(); for (int r = 0; r < study.getRaterCount(); r++) { out.print(r + 1); for (ICodingAnnotationItem item : study.getItems()) out.print(DIVIDER + item.getUnit(r).getCategory()); out.println(); } out.println(); for (Object category : study.getCategories()) { out.print(category); int catSum = 0; for (ICodingAnnotationItem item : study.getItems()) { int catCount = 0; for (IAnnotationUnit unit : item.getUnits()) if (category.equals(unit.getCategory())) catCount++; out.print(DIVIDER + (catCount > 0 ? catCount : "")); catSum += catCount; } out.println(DIVIDER + catSum); } /* for (Object category : categories.keySet()) out.print(DIVIDER + category); out.print(DIVIDER + "Σ"); out.println(); int i = 0; int[] colSum = new int[study.getCategoryCount()]; for (Object category1 : categories.keySet()) { out.print(category1); int rowSum = 0; for (int j = 0; j < categories.size(); j++) { out.printf(DIVIDER + "%3d", frequencies[i][j]); rowSum += frequencies[i][j]; colSum[j] += frequencies[i][j]; } out.printf(DIVIDER + "%3d", rowSum); out.println(); i++; } out.print("Σ"); int rowSum = 0; for (int j = 0; j < categories.size(); j++) { out.printf(DIVIDER + "%3d", colSum[j]); rowSum += colSum[j]; } out.printf(DIVIDER + "%3d", rowSum); out.println();*/ }
[ "public", "void", "print", "(", "final", "PrintStream", "out", ",", "final", "ICodingAnnotationStudy", "study", ")", "{", "//TODO: measure length of cats. maybe cut them.\r", "Map", "<", "Object", ",", "Integer", ">", "categories", "=", "new", "LinkedHashMap", "<", ...
Print the reliability matrix for the given coding study.
[ "Print", "the", "reliability", "matrix", "for", "the", "given", "coding", "study", "." ]
0b0e93dc49223984964411cbc6df420ba796a8cb
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/visualization/ReliabilityMatrixPrinter.java#L53-L116
train
ocelotds/ocelot
ocelot-processor/src/main/java/org/ocelotds/processors/OcelotProcessor.java
OcelotProcessor.getPackagePath
String getPackagePath(TypeElement te) { return te.getQualifiedName().toString().replaceAll("." + te.getSimpleName(), ""); }
java
String getPackagePath(TypeElement te) { return te.getQualifiedName().toString().replaceAll("." + te.getSimpleName(), ""); }
[ "String", "getPackagePath", "(", "TypeElement", "te", ")", "{", "return", "te", ".", "getQualifiedName", "(", ")", ".", "toString", "(", ")", ".", "replaceAll", "(", "\".\"", "+", "te", ".", "getSimpleName", "(", ")", ",", "\"\"", ")", ";", "}" ]
Get pachage name of class @param te @return
[ "Get", "pachage", "name", "of", "class" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/OcelotProcessor.java#L251-L253
train
ocelotds/ocelot
ocelot-processor/src/main/java/org/ocelotds/processors/OcelotProcessor.java
OcelotProcessor.getFilename
String getFilename(TypeElement te, String fwk) { return getFilename(te.getSimpleName().toString(), fwk); }
java
String getFilename(TypeElement te, String fwk) { return getFilename(te.getSimpleName().toString(), fwk); }
[ "String", "getFilename", "(", "TypeElement", "te", ",", "String", "fwk", ")", "{", "return", "getFilename", "(", "te", ".", "getSimpleName", "(", ")", ".", "toString", "(", ")", ",", "fwk", ")", ";", "}" ]
Get Js filename from class @param te @return
[ "Get", "Js", "filename", "from", "class" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/OcelotProcessor.java#L261-L263
train
ocelotds/ocelot
ocelot-processor/src/main/java/org/ocelotds/processors/OcelotProcessor.java
OcelotProcessor.writeCoreInClassesOutput
void writeCoreInClassesOutput() { String resPath = ProcessorConstants.SEPARATORCHAR + "js"; fws.copyResourceToClassesOutput(resPath, "core.ng.min.js"); fws.copyResourceToClassesOutput(resPath, "core.ng.js"); fws.copyResourceToClassesOutput(resPath, "core.min.js"); fws.copyResourceToClassesOutput(resPath, "core.js"); }
java
void writeCoreInClassesOutput() { String resPath = ProcessorConstants.SEPARATORCHAR + "js"; fws.copyResourceToClassesOutput(resPath, "core.ng.min.js"); fws.copyResourceToClassesOutput(resPath, "core.ng.js"); fws.copyResourceToClassesOutput(resPath, "core.min.js"); fws.copyResourceToClassesOutput(resPath, "core.js"); }
[ "void", "writeCoreInClassesOutput", "(", ")", "{", "String", "resPath", "=", "ProcessorConstants", ".", "SEPARATORCHAR", "+", "\"js\"", ";", "fws", ".", "copyResourceToClassesOutput", "(", "resPath", ",", "\"core.ng.min.js\"", ")", ";", "fws", ".", "copyResourceToCl...
Write core in classes directory
[ "Write", "core", "in", "classes", "directory" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/OcelotProcessor.java#L284-L290
train
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/credential/impl/AbstractLoadCredentialsStrategy.java
AbstractLoadCredentialsStrategy.fileExistsAndIsReadable
protected boolean fileExistsAndIsReadable(String filename) { File f = new File(filename); return f.exists() && f.isFile() && f.canRead(); }
java
protected boolean fileExistsAndIsReadable(String filename) { File f = new File(filename); return f.exists() && f.isFile() && f.canRead(); }
[ "protected", "boolean", "fileExistsAndIsReadable", "(", "String", "filename", ")", "{", "File", "f", "=", "new", "File", "(", "filename", ")", ";", "return", "f", ".", "exists", "(", ")", "&&", "f", ".", "isFile", "(", ")", "&&", "f", ".", "canRead", ...
Convenience method to check if a file exists and is readable @param filename the file to be checked @return <code>true</code> if the file exists and is readable, <code>false</code> otherwise
[ "Convenience", "method", "to", "check", "if", "a", "file", "exists", "and", "is", "readable" ]
b33d6cf98ca9449bed87b1cc307d411514589deb
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/credential/impl/AbstractLoadCredentialsStrategy.java#L71-L75
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/web/ws/WSEndpoint.java
WSEndpoint.getWSController
WSController getWSController() { if (null == controller) { controller = CDI.current().select(WSController.class).get(); // controller = getCdiBeanResolver().getBean(WSController.class); } return controller; }
java
WSController getWSController() { if (null == controller) { controller = CDI.current().select(WSController.class).get(); // controller = getCdiBeanResolver().getBean(WSController.class); } return controller; }
[ "WSController", "getWSController", "(", ")", "{", "if", "(", "null", "==", "controller", ")", "{", "controller", "=", "CDI", ".", "current", "(", ")", ".", "select", "(", "WSController", ".", "class", ")", ".", "get", "(", ")", ";", "//\t\t\tcontroller =...
Fix OpenWebBean issues @return
[ "Fix", "OpenWebBean", "issues" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/web/ws/WSEndpoint.java#L57-L63
train
dkpro/dkpro-statistics
dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/coding/CohenKappaAgreement.java
CohenKappaAgreement.calculateExpectedAgreement
@Override public double calculateExpectedAgreement() { Map<Object, int[]> annotationsPerCategory = CodingAnnotationStudy.countAnnotationsPerCategory(study); BigDecimal result = BigDecimal.ZERO; for (Object category : study.getCategories()) { int[] annotations = annotationsPerCategory.get(category); if (annotations != null) { BigDecimal prod = BigDecimal.ONE; for (int rater = 0; rater < study.getRaterCount(); rater++) prod = prod.multiply(new BigDecimal(annotations[rater])); result = result.add(prod); } } result = result.divide(new BigDecimal(study.getItemCount()).pow(2), MathContext.DECIMAL128); return result.doubleValue(); }
java
@Override public double calculateExpectedAgreement() { Map<Object, int[]> annotationsPerCategory = CodingAnnotationStudy.countAnnotationsPerCategory(study); BigDecimal result = BigDecimal.ZERO; for (Object category : study.getCategories()) { int[] annotations = annotationsPerCategory.get(category); if (annotations != null) { BigDecimal prod = BigDecimal.ONE; for (int rater = 0; rater < study.getRaterCount(); rater++) prod = prod.multiply(new BigDecimal(annotations[rater])); result = result.add(prod); } } result = result.divide(new BigDecimal(study.getItemCount()).pow(2), MathContext.DECIMAL128); return result.doubleValue(); }
[ "@", "Override", "public", "double", "calculateExpectedAgreement", "(", ")", "{", "Map", "<", "Object", ",", "int", "[", "]", ">", "annotationsPerCategory", "=", "CodingAnnotationStudy", ".", "countAnnotationsPerCategory", "(", "study", ")", ";", "BigDecimal", "re...
Calculates the expected inter-rater agreement that assumes a different probability distribution for all raters. @throws NullPointerException if the annotation study is null. @throws ArithmeticException if there are no items in the annotation study.
[ "Calculates", "the", "expected", "inter", "-", "rater", "agreement", "that", "assumes", "a", "different", "probability", "distribution", "for", "all", "raters", "." ]
0b0e93dc49223984964411cbc6df420ba796a8cb
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/coding/CohenKappaAgreement.java#L55-L72
train
dkpro/dkpro-statistics
dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/coding/CohenKappaAgreement.java
CohenKappaAgreement.calculateCategoryAgreement
@Override public double calculateCategoryAgreement(final Object category) { // N = # subjects = #items -> index i // n = # ratings/subject = #raters // k = # categories -> index j // n_ij = # raters that annotated item i as category j // // k_j = (P_j - p_j) / (1 - p_j) // P_j = (sum( n_ij^2 ) - N n p_j) / (N n (n-1) p_j ) // p_j = 1/Nn sum n_ij int N = study.getItemCount(); int n = study.getRaterCount(); int sum_nij = 0; int sum_nij_2 = 0; for (ICodingAnnotationItem item : study.getItems()) { int nij = 0; for (IAnnotationUnit unit : item.getUnits()) if (unit.getCategory().equals(category)) nij++; sum_nij += nij; sum_nij_2 += (nij * nij); } double pj = 1 / (double) (N * n) * sum_nij; double Pj = (sum_nij_2 - N * n * pj) / (double) (N * n * (n - 1) * pj); double kappaj = (Pj - pj) / (double) (1 - pj); return kappaj; }
java
@Override public double calculateCategoryAgreement(final Object category) { // N = # subjects = #items -> index i // n = # ratings/subject = #raters // k = # categories -> index j // n_ij = # raters that annotated item i as category j // // k_j = (P_j - p_j) / (1 - p_j) // P_j = (sum( n_ij^2 ) - N n p_j) / (N n (n-1) p_j ) // p_j = 1/Nn sum n_ij int N = study.getItemCount(); int n = study.getRaterCount(); int sum_nij = 0; int sum_nij_2 = 0; for (ICodingAnnotationItem item : study.getItems()) { int nij = 0; for (IAnnotationUnit unit : item.getUnits()) if (unit.getCategory().equals(category)) nij++; sum_nij += nij; sum_nij_2 += (nij * nij); } double pj = 1 / (double) (N * n) * sum_nij; double Pj = (sum_nij_2 - N * n * pj) / (double) (N * n * (n - 1) * pj); double kappaj = (Pj - pj) / (double) (1 - pj); return kappaj; }
[ "@", "Override", "public", "double", "calculateCategoryAgreement", "(", "final", "Object", "category", ")", "{", "// N = # subjects = #items -> index i\r", "// n = # ratings/subject = #raters\r", "// k = # categories -> index j\r", "// n_ij = # raters that annotated item i as category j\...
Artstein&Poesio have a different definition!
[ "Artstein&Poesio", "have", "a", "different", "definition!" ]
0b0e93dc49223984964411cbc6df420ba796a8cb
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/coding/CohenKappaAgreement.java#L117-L145
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/marshalling/ArgumentServices.java
ArgumentServices.getIJsonMarshallerInstance
public IJsonMarshaller getIJsonMarshallerInstance(Class<? extends IJsonMarshaller> cls) throws JsonMarshallerException { if(logger.isDebugEnabled()) { logger.debug("Try to get {} by CDI.select Unsatisfied: {}", cls.getName(), CDI.current().select(cls).isUnsatisfied()); } if(CDI.current().select(cls).isUnsatisfied()) { throw new JsonMarshallerException(cls.getName()+" is Unsatisfied"); } return CDI.current().select(cls).get(); }
java
public IJsonMarshaller getIJsonMarshallerInstance(Class<? extends IJsonMarshaller> cls) throws JsonMarshallerException { if(logger.isDebugEnabled()) { logger.debug("Try to get {} by CDI.select Unsatisfied: {}", cls.getName(), CDI.current().select(cls).isUnsatisfied()); } if(CDI.current().select(cls).isUnsatisfied()) { throw new JsonMarshallerException(cls.getName()+" is Unsatisfied"); } return CDI.current().select(cls).get(); }
[ "public", "IJsonMarshaller", "getIJsonMarshallerInstance", "(", "Class", "<", "?", "extends", "IJsonMarshaller", ">", "cls", ")", "throws", "JsonMarshallerException", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(...
Get Instance of IJsonMarshaller from CDI @param cls @return @throws JsonMarshallerException
[ "Get", "Instance", "of", "IJsonMarshaller", "from", "CDI" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/marshalling/ArgumentServices.java#L75-L83
train
dkpro/dkpro-statistics
dkpro-statistics-significance/src/main/java/org/dkpro/statistics/significance/Significance.java
Significance.getSignificance
public static double getSignificance(double[] sample1, double[] sample2) throws IllegalArgumentException, MathException { double alpha = TestUtils.pairedTTest(sample1, sample2); boolean significance = TestUtils.pairedTTest(sample1, sample2, .30); System.err.println("sig: " + significance); return alpha; }
java
public static double getSignificance(double[] sample1, double[] sample2) throws IllegalArgumentException, MathException { double alpha = TestUtils.pairedTTest(sample1, sample2); boolean significance = TestUtils.pairedTTest(sample1, sample2, .30); System.err.println("sig: " + significance); return alpha; }
[ "public", "static", "double", "getSignificance", "(", "double", "[", "]", "sample1", ",", "double", "[", "]", "sample2", ")", "throws", "IllegalArgumentException", ",", "MathException", "{", "double", "alpha", "=", "TestUtils", ".", "pairedTTest", "(", "sample1"...
Uses a paired t-test to test whether the correlation value computed from these datasets is significant. @param sample1 The first dataset vector. @param sample2 The second dataset vector. @return The significance value p. @throws MathException @throws IllegalArgumentException
[ "Uses", "a", "paired", "t", "-", "test", "to", "test", "whether", "the", "correlation", "value", "computed", "from", "these", "datasets", "is", "significant", "." ]
0b0e93dc49223984964411cbc6df420ba796a8cb
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-significance/src/main/java/org/dkpro/statistics/significance/Significance.java#L93-L98
train
dkpro/dkpro-statistics
dkpro-statistics-significance/src/main/java/org/dkpro/statistics/significance/Significance.java
Significance.getSignificance
public static double getSignificance(double correlation1, double correlation2, int n1, int n2) throws MathException { // transform to Fisher Z-values double zv1 = FisherZTransformation.transform(correlation1); double zv2 = FisherZTransformation.transform(correlation2); // difference of the Z-values double zDifference = (zv1 - zv2) / Math.sqrt(2d) / Math.sqrt( (double)1/(n1-3) + (double)1/(n2-3)); // get p value from the complementary error function double p = Erf.erfc( Math.abs(zDifference)); return p; }
java
public static double getSignificance(double correlation1, double correlation2, int n1, int n2) throws MathException { // transform to Fisher Z-values double zv1 = FisherZTransformation.transform(correlation1); double zv2 = FisherZTransformation.transform(correlation2); // difference of the Z-values double zDifference = (zv1 - zv2) / Math.sqrt(2d) / Math.sqrt( (double)1/(n1-3) + (double)1/(n2-3)); // get p value from the complementary error function double p = Erf.erfc( Math.abs(zDifference)); return p; }
[ "public", "static", "double", "getSignificance", "(", "double", "correlation1", ",", "double", "correlation2", ",", "int", "n1", ",", "int", "n2", ")", "throws", "MathException", "{", "// transform to Fisher Z-values", "double", "zv1", "=", "FisherZTransformation", ...
Computes the significance of the difference between two correlations. @see org.tud.sir.util.statistics.Significance.testCorrelations
[ "Computes", "the", "significance", "of", "the", "difference", "between", "two", "correlations", "." ]
0b0e93dc49223984964411cbc6df420ba796a8cb
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-significance/src/main/java/org/dkpro/statistics/significance/Significance.java#L131-L143
train
jenkinsci/gmaven
gmaven-mojo/src/main/java/org/codehaus/gmaven/mojo/GroovyMojo.java
GroovyMojo.getAnt
private AntBuilder getAnt() { if (this.ant == null) { AntBuilder ant = new AntBuilder(); BuildLogger logger = (BuildLogger) ant.getAntProject().getBuildListeners().get(0); logger.setEmacsMode(true); this.ant = ant; } return this.ant; }
java
private AntBuilder getAnt() { if (this.ant == null) { AntBuilder ant = new AntBuilder(); BuildLogger logger = (BuildLogger) ant.getAntProject().getBuildListeners().get(0); logger.setEmacsMode(true); this.ant = ant; } return this.ant; }
[ "private", "AntBuilder", "getAnt", "(", ")", "{", "if", "(", "this", ".", "ant", "==", "null", ")", "{", "AntBuilder", "ant", "=", "new", "AntBuilder", "(", ")", ";", "BuildLogger", "logger", "=", "(", "BuildLogger", ")", "ant", ".", "getAntProject", "...
Lazily initialize the AntBuilder, so we can pick up the log impl correctly.
[ "Lazily", "initialize", "the", "AntBuilder", "so", "we", "can", "pick", "up", "the", "log", "impl", "correctly", "." ]
80d5f6657e15b3e05ffbb82128ed8bb280836e10
https://github.com/jenkinsci/gmaven/blob/80d5f6657e15b3e05ffbb82128ed8bb280836e10/gmaven-mojo/src/main/java/org/codehaus/gmaven/mojo/GroovyMojo.java#L45-L53
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/core/services/MethodServices.java
MethodServices.getMethodFromDataService
public Method getMethodFromDataService(final Class dsClass, final MessageFromClient message, List<Object> arguments) throws NoSuchMethodException { logger.debug("Try to find method {} on class {}", message.getOperation(), dsClass); List<String> parameters = message.getParameters(); int nbparam = parameters.size() - getNumberOfNullEnderParameter(parameters); // determine how many parameter is null at the end List<Method> candidates = getSortedCandidateMethods(message.getOperation(), dsClass.getMethods()); // take only method with the good name, and orderedby number of arguments if (!candidates.isEmpty()) { while (nbparam <= parameters.size()) { for (Method method : candidates) { if (method.getParameterTypes().length == nbparam) { logger.debug("Process method {}", method.getName()); try { checkMethod(method, arguments, parameters, nbparam); logger.debug("Method {}.{} with good signature found.", dsClass, message.getOperation()); return method; } catch (JsonMarshallerException | JsonUnmarshallingException | IllegalArgumentException iae) { logger.debug("Method {}.{} not found. Some arguments didn't match. {}.", new Object[]{dsClass, message.getOperation(), iae.getMessage()}); } arguments.clear(); } } nbparam++; } } throw new NoSuchMethodException(dsClass.getName() + "." + message.getOperation()); }
java
public Method getMethodFromDataService(final Class dsClass, final MessageFromClient message, List<Object> arguments) throws NoSuchMethodException { logger.debug("Try to find method {} on class {}", message.getOperation(), dsClass); List<String> parameters = message.getParameters(); int nbparam = parameters.size() - getNumberOfNullEnderParameter(parameters); // determine how many parameter is null at the end List<Method> candidates = getSortedCandidateMethods(message.getOperation(), dsClass.getMethods()); // take only method with the good name, and orderedby number of arguments if (!candidates.isEmpty()) { while (nbparam <= parameters.size()) { for (Method method : candidates) { if (method.getParameterTypes().length == nbparam) { logger.debug("Process method {}", method.getName()); try { checkMethod(method, arguments, parameters, nbparam); logger.debug("Method {}.{} with good signature found.", dsClass, message.getOperation()); return method; } catch (JsonMarshallerException | JsonUnmarshallingException | IllegalArgumentException iae) { logger.debug("Method {}.{} not found. Some arguments didn't match. {}.", new Object[]{dsClass, message.getOperation(), iae.getMessage()}); } arguments.clear(); } } nbparam++; } } throw new NoSuchMethodException(dsClass.getName() + "." + message.getOperation()); }
[ "public", "Method", "getMethodFromDataService", "(", "final", "Class", "dsClass", ",", "final", "MessageFromClient", "message", ",", "List", "<", "Object", ">", "arguments", ")", "throws", "NoSuchMethodException", "{", "logger", ".", "debug", "(", "\"Try to find met...
Get pertinent method and fill the argument list from message arguments @param dsClass @param message @param arguments @return @throws java.lang.NoSuchMethodException
[ "Get", "pertinent", "method", "and", "fill", "the", "argument", "list", "from", "message", "arguments" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/services/MethodServices.java#L44-L68
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/core/services/MethodServices.java
MethodServices.getNonProxiedMethod
public Method getNonProxiedMethod(Class cls, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException { return cls.getMethod(methodName, parameterTypes); }
java
public Method getNonProxiedMethod(Class cls, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException { return cls.getMethod(methodName, parameterTypes); }
[ "public", "Method", "getNonProxiedMethod", "(", "Class", "cls", ",", "String", "methodName", ",", "Class", "<", "?", ">", "...", "parameterTypes", ")", "throws", "NoSuchMethodException", "{", "return", "cls", ".", "getMethod", "(", "methodName", ",", "parameterT...
Get the method on origin class without proxies @param cls @param methodName @param parameterTypes @throws NoSuchMethodException @return
[ "Get", "the", "method", "on", "origin", "class", "without", "proxies" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/services/MethodServices.java#L79-L81
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/core/services/MethodServices.java
MethodServices.getNumberOfNullEnderParameter
int getNumberOfNullEnderParameter(List<String> parameters) { int nbnull = 0; for (int i = parameters.size() - 1; i >= 0; i--) { String parameter = parameters.get(i); if (parameter.equals("null")) { nbnull++; } else { break; } } return nbnull; }
java
int getNumberOfNullEnderParameter(List<String> parameters) { int nbnull = 0; for (int i = parameters.size() - 1; i >= 0; i--) { String parameter = parameters.get(i); if (parameter.equals("null")) { nbnull++; } else { break; } } return nbnull; }
[ "int", "getNumberOfNullEnderParameter", "(", "List", "<", "String", ">", "parameters", ")", "{", "int", "nbnull", "=", "0", ";", "for", "(", "int", "i", "=", "parameters", ".", "size", "(", ")", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", ...
Return the number of null parameter at the end of list @param parameters @return
[ "Return", "the", "number", "of", "null", "parameter", "at", "the", "end", "of", "list" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/services/MethodServices.java#L89-L100
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/core/services/MethodServices.java
MethodServices.checkMethod
void checkMethod(Method method, List<Object> arguments, List<String> parameters, int nbparam) throws IllegalArgumentException, JsonUnmarshallingException, JsonMarshallerException { Type[] paramTypes = method.getGenericParameterTypes(); Annotation[][] parametersAnnotations = method.getParameterAnnotations(); int idx = 0; for (Type paramType : paramTypes) { logger.debug("Try to convert argument ({}) {} : {}.", new Object[]{idx, paramType, parameters.get(idx)}); arguments.add(argumentConvertor.convertJsonToJava(parameters.get(idx), paramType, parametersAnnotations[idx])); idx++; if (idx > nbparam) { throw new IllegalArgumentException(); } } }
java
void checkMethod(Method method, List<Object> arguments, List<String> parameters, int nbparam) throws IllegalArgumentException, JsonUnmarshallingException, JsonMarshallerException { Type[] paramTypes = method.getGenericParameterTypes(); Annotation[][] parametersAnnotations = method.getParameterAnnotations(); int idx = 0; for (Type paramType : paramTypes) { logger.debug("Try to convert argument ({}) {} : {}.", new Object[]{idx, paramType, parameters.get(idx)}); arguments.add(argumentConvertor.convertJsonToJava(parameters.get(idx), paramType, parametersAnnotations[idx])); idx++; if (idx > nbparam) { throw new IllegalArgumentException(); } } }
[ "void", "checkMethod", "(", "Method", "method", ",", "List", "<", "Object", ">", "arguments", ",", "List", "<", "String", ">", "parameters", ",", "int", "nbparam", ")", "throws", "IllegalArgumentException", ",", "JsonUnmarshallingException", ",", "JsonMarshallerEx...
Check if for nbparam in parameters the method is correct. If yes, store parameters String converted to Java in arguments list @param method @param arguments @param parameters @param nbparam @throws IllegalArgumentException @throws JsonUnmarshallingException
[ "Check", "if", "for", "nbparam", "in", "parameters", "the", "method", "is", "correct", ".", "If", "yes", "store", "parameters", "String", "converted", "to", "Java", "in", "arguments", "list" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/services/MethodServices.java#L112-L124
train
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java
Pixel.setARGB
public void setARGB(int a, int r, int g, int b){ setValue(Pixel.argb(a, r, g, b)); }
java
public void setARGB(int a, int r, int g, int b){ setValue(Pixel.argb(a, r, g, b)); }
[ "public", "void", "setARGB", "(", "int", "a", ",", "int", "r", ",", "int", "g", ",", "int", "b", ")", "{", "setValue", "(", "Pixel", ".", "argb", "(", "a", ",", "r", ",", "g", ",", "b", ")", ")", ";", "}" ]
Sets an ARGB value at the position currently referenced by this Pixel. Each channel value is assumed to be 8bit and otherwise truncated. @param a alpha @param r red @param g green @param b blue @throws ArrayIndexOutOfBoundsException if this Pixel's index is not in range of the Img's data array. @see #setRGB(int, int, int) @see #setRGB_preserveAlpha(int, int, int) @see #argb(int, int, int, int) @see #argb_bounded(int, int, int, int) @see #argb_fast(int, int, int, int) @see #setValue(int) @since 1.0
[ "Sets", "an", "ARGB", "value", "at", "the", "position", "currently", "referenced", "by", "this", "Pixel", ".", "Each", "channel", "value", "is", "assumed", "to", "be", "8bit", "and", "otherwise", "truncated", "." ]
3837c7d550a12cf4dc5718b644ced94b97f52668
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java#L346-L348
train
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java
Pixel.setRGB
public void setRGB(int r, int g, int b){ setValue(Pixel.rgb(r, g, b)); }
java
public void setRGB(int r, int g, int b){ setValue(Pixel.rgb(r, g, b)); }
[ "public", "void", "setRGB", "(", "int", "r", ",", "int", "g", ",", "int", "b", ")", "{", "setValue", "(", "Pixel", ".", "rgb", "(", "r", ",", "g", ",", "b", ")", ")", ";", "}" ]
Sets an opaque RGB value at the position currently referenced by this Pixel. Each channel value is assumed to be 8bit and otherwise truncated. @param r red @param g green @param b blue @throws ArrayIndexOutOfBoundsException if this Pixel's index is not in range of the Img's data array. @see #setARGB(int, int, int, int) @see #setRGB_preserveAlpha(int, int, int) @see #argb(int, int, int, int) @see #argb_bounded(int, int, int, int) @see #argb_fast(int, int, int, int) @see #setValue(int) @since 1.0
[ "Sets", "an", "opaque", "RGB", "value", "at", "the", "position", "currently", "referenced", "by", "this", "Pixel", ".", "Each", "channel", "value", "is", "assumed", "to", "be", "8bit", "and", "otherwise", "truncated", "." ]
3837c7d550a12cf4dc5718b644ced94b97f52668
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java#L366-L368
train
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java
Pixel.setRGB_preserveAlpha
public void setRGB_preserveAlpha(int r, int g, int b){ setValue((getValue() & 0xff000000 ) | Pixel.argb(0, r, g, b)); }
java
public void setRGB_preserveAlpha(int r, int g, int b){ setValue((getValue() & 0xff000000 ) | Pixel.argb(0, r, g, b)); }
[ "public", "void", "setRGB_preserveAlpha", "(", "int", "r", ",", "int", "g", ",", "int", "b", ")", "{", "setValue", "(", "(", "getValue", "(", ")", "&", "0xff000000", ")", "|", "Pixel", ".", "argb", "(", "0", ",", "r", ",", "g", ",", "b", ")", "...
Sets an RGB value at the position currently referenced by this Pixel. The present alpha value will not be altered by this operation. Each channel value is assumed to be 8bit and otherwise truncated. @param r red @param g green @param b blue @throws ArrayIndexOutOfBoundsException if this Pixel's index is not in range of the Img's data array. @see #setRGB_fromDouble_preserveAlpha(double, double, double) @since 1.2
[ "Sets", "an", "RGB", "value", "at", "the", "position", "currently", "referenced", "by", "this", "Pixel", ".", "The", "present", "alpha", "value", "will", "not", "be", "altered", "by", "this", "operation", ".", "Each", "channel", "value", "is", "assumed", "...
3837c7d550a12cf4dc5718b644ced94b97f52668
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Pixel.java#L382-L384
train
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/BufferedImageFactory.java
BufferedImageFactory.get
public static BufferedImage get(Image img, int imgType){ Function<Integer, ImageObserver> obs = flags->{ return (image, infoflags, x, y, width, height)->(infoflags & flags)!=flags; }; BufferedImage bimg = new BufferedImage( img.getWidth(obs.apply(ImageObserver.WIDTH)), img.getHeight(obs.apply(ImageObserver.HEIGHT)), imgType); Graphics2D gr2D = bimg.createGraphics(); gr2D.drawImage(img, 0, 0, obs.apply(ImageObserver.ALLBITS)); gr2D.dispose(); return bimg; }
java
public static BufferedImage get(Image img, int imgType){ Function<Integer, ImageObserver> obs = flags->{ return (image, infoflags, x, y, width, height)->(infoflags & flags)!=flags; }; BufferedImage bimg = new BufferedImage( img.getWidth(obs.apply(ImageObserver.WIDTH)), img.getHeight(obs.apply(ImageObserver.HEIGHT)), imgType); Graphics2D gr2D = bimg.createGraphics(); gr2D.drawImage(img, 0, 0, obs.apply(ImageObserver.ALLBITS)); gr2D.dispose(); return bimg; }
[ "public", "static", "BufferedImage", "get", "(", "Image", "img", ",", "int", "imgType", ")", "{", "Function", "<", "Integer", ",", "ImageObserver", ">", "obs", "=", "flags", "->", "{", "return", "(", "image", ",", "infoflags", ",", "x", ",", "y", ",", ...
Creates a new BufferedImage of the specified imgType and same size as the provided image and draws the provided Image onto the new BufferedImage. @param img to be copied to BufferedImage @param imgType of the BufferedImage. See {@link BufferedImage#BufferedImage(int, int, int)} for details on the available imgTypes. @return a BufferedImage copy of the provided Image @since 1.0
[ "Creates", "a", "new", "BufferedImage", "of", "the", "specified", "imgType", "and", "same", "size", "as", "the", "provided", "image", "and", "draws", "the", "provided", "Image", "onto", "the", "new", "BufferedImage", "." ]
3837c7d550a12cf4dc5718b644ced94b97f52668
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/util/BufferedImageFactory.java#L60-L74
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java
TopicManagerImpl.registerTopicSession
@Override public int registerTopicSession(String topic, Session session) throws IllegalAccessException { if (isInconsistenceContext(topic, session)) { return 0; } Collection<Session> sessions; if (map.containsKey(topic)) { sessions = map.get(topic); } else { sessions = Collections.synchronizedCollection(new ArrayList<Session>()); map.put(topic, sessions); } topicAccessManager.checkAccessTopic(userContextFactory.getUserContext(session.getId()), topic); logger.debug("'{}' subscribe to '{}'", session.getId(), topic); if (session.isOpen()) { sessions.add(session); } return getNumberSubscribers(topic); }
java
@Override public int registerTopicSession(String topic, Session session) throws IllegalAccessException { if (isInconsistenceContext(topic, session)) { return 0; } Collection<Session> sessions; if (map.containsKey(topic)) { sessions = map.get(topic); } else { sessions = Collections.synchronizedCollection(new ArrayList<Session>()); map.put(topic, sessions); } topicAccessManager.checkAccessTopic(userContextFactory.getUserContext(session.getId()), topic); logger.debug("'{}' subscribe to '{}'", session.getId(), topic); if (session.isOpen()) { sessions.add(session); } return getNumberSubscribers(topic); }
[ "@", "Override", "public", "int", "registerTopicSession", "(", "String", "topic", ",", "Session", "session", ")", "throws", "IllegalAccessException", "{", "if", "(", "isInconsistenceContext", "(", "topic", ",", "session", ")", ")", "{", "return", "0", ";", "}"...
Register session for topic @param topic @param session @return int : number subscribers @throws IllegalAccessException
[ "Register", "session", "for", "topic" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java#L61-L79
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java
TopicManagerImpl.unregisterTopicSession
@Override public int unregisterTopicSession(String topic, Session session) { if (isInconsistenceContext(topic, session)) { return 0; } logger.debug("'{}' unsubscribe to '{}'", session.getId(), topic); if (Constants.Topic.ALL.equals(topic)) { for (Map.Entry<String, Collection<Session>> entry : map.entrySet()) { Collection<Session> sessions = entry.getValue(); removeSessionToSessions(session, sessions); if (sessions.isEmpty()) { map.remove(entry.getKey()); } } } else { Collection<Session> sessions = map.get(topic); removeSessionToSessions(session, sessions); if (sessions==null || sessions.isEmpty()) { map.remove(topic); } } return getNumberSubscribers(topic); }
java
@Override public int unregisterTopicSession(String topic, Session session) { if (isInconsistenceContext(topic, session)) { return 0; } logger.debug("'{}' unsubscribe to '{}'", session.getId(), topic); if (Constants.Topic.ALL.equals(topic)) { for (Map.Entry<String, Collection<Session>> entry : map.entrySet()) { Collection<Session> sessions = entry.getValue(); removeSessionToSessions(session, sessions); if (sessions.isEmpty()) { map.remove(entry.getKey()); } } } else { Collection<Session> sessions = map.get(topic); removeSessionToSessions(session, sessions); if (sessions==null || sessions.isEmpty()) { map.remove(topic); } } return getNumberSubscribers(topic); }
[ "@", "Override", "public", "int", "unregisterTopicSession", "(", "String", "topic", ",", "Session", "session", ")", "{", "if", "(", "isInconsistenceContext", "(", "topic", ",", "session", ")", ")", "{", "return", "0", ";", "}", "logger", ".", "debug", "(",...
Unregister session for topic. topic 'ALL' remove session for all topics @param topic @param session @return int : number subscribers remaining
[ "Unregister", "session", "for", "topic", ".", "topic", "ALL", "remove", "session", "for", "all", "topics" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java#L88-L110
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java
TopicManagerImpl.removeSessionToSessions
int removeSessionToSessions(Session session, Collection<Session> sessions) { if (sessions != null) { if (sessions.remove(session)) { return 1; } } return 0; }
java
int removeSessionToSessions(Session session, Collection<Session> sessions) { if (sessions != null) { if (sessions.remove(session)) { return 1; } } return 0; }
[ "int", "removeSessionToSessions", "(", "Session", "session", ",", "Collection", "<", "Session", ">", "sessions", ")", "{", "if", "(", "sessions", "!=", "null", ")", "{", "if", "(", "sessions", ".", "remove", "(", "session", ")", ")", "{", "return", "1", ...
Remove session in sessions @param session @param sessions @return 1 if session removed else 0
[ "Remove", "session", "in", "sessions" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java#L130-L137
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java
TopicManagerImpl.unregisterTopicSessions
boolean unregisterTopicSessions(String topic, Collection<Session> sessions) { boolean unregister = false; if (sessions != null && !sessions.isEmpty()) { Collection<Session> all = map.get(topic); if(all != null) { unregister = all.removeAll(sessions); if (all.isEmpty()) { map.remove(topic); } } } return unregister; }
java
boolean unregisterTopicSessions(String topic, Collection<Session> sessions) { boolean unregister = false; if (sessions != null && !sessions.isEmpty()) { Collection<Session> all = map.get(topic); if(all != null) { unregister = all.removeAll(sessions); if (all.isEmpty()) { map.remove(topic); } } } return unregister; }
[ "boolean", "unregisterTopicSessions", "(", "String", "topic", ",", "Collection", "<", "Session", ">", "sessions", ")", "{", "boolean", "unregister", "=", "false", ";", "if", "(", "sessions", "!=", "null", "&&", "!", "sessions", ".", "isEmpty", "(", ")", ")...
Unregister sessions for topic @param topic @param sessions @return
[ "Unregister", "sessions", "for", "topic" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java#L146-L158
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java
TopicManagerImpl.removeSessionsToTopic
@Override public Collection<String> removeSessionsToTopic(Collection<Session> sessions) { if (sessions != null && !sessions.isEmpty()) { Collection<String> topicUpdated = new ArrayList<>(); for (String topic : map.keySet()) { if(unregisterTopicSessions(topic, sessions)) { topicUpdated.add(topic); sendSubscriptionEvent(Constants.Topic.SUBSCRIBERS + Constants.Topic.COLON + topic, getNumberSubscribers(topic)); } } return topicUpdated; } return Collections.EMPTY_LIST; }
java
@Override public Collection<String> removeSessionsToTopic(Collection<Session> sessions) { if (sessions != null && !sessions.isEmpty()) { Collection<String> topicUpdated = new ArrayList<>(); for (String topic : map.keySet()) { if(unregisterTopicSessions(topic, sessions)) { topicUpdated.add(topic); sendSubscriptionEvent(Constants.Topic.SUBSCRIBERS + Constants.Topic.COLON + topic, getNumberSubscribers(topic)); } } return topicUpdated; } return Collections.EMPTY_LIST; }
[ "@", "Override", "public", "Collection", "<", "String", ">", "removeSessionsToTopic", "(", "Collection", "<", "Session", ">", "sessions", ")", "{", "if", "(", "sessions", "!=", "null", "&&", "!", "sessions", ".", "isEmpty", "(", ")", ")", "{", "Collection"...
Remove sessions cause they are closed @param sessions
[ "Remove", "sessions", "cause", "they", "are", "closed" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java#L165-L178
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java
TopicManagerImpl.removeSessionToTopics
@Override public Collection<String> removeSessionToTopics(Session session) { if (session != null) { return removeSessionsToTopic(Arrays.asList(session)); // for (String topic : map.keySet()) { // sendSubscriptionEvent(Constants.Topic.SUBSCRIBERS + Constants.Topic.COLON + topic, unregisterTopicSession(topic, session)); // } } return Collections.EMPTY_LIST; }
java
@Override public Collection<String> removeSessionToTopics(Session session) { if (session != null) { return removeSessionsToTopic(Arrays.asList(session)); // for (String topic : map.keySet()) { // sendSubscriptionEvent(Constants.Topic.SUBSCRIBERS + Constants.Topic.COLON + topic, unregisterTopicSession(topic, session)); // } } return Collections.EMPTY_LIST; }
[ "@", "Override", "public", "Collection", "<", "String", ">", "removeSessionToTopics", "(", "Session", "session", ")", "{", "if", "(", "session", "!=", "null", ")", "{", "return", "removeSessionsToTopic", "(", "Arrays", ".", "asList", "(", "session", ")", ")"...
Remove session cause it's closed by the endpoint @param session
[ "Remove", "session", "cause", "it", "s", "closed", "by", "the", "endpoint" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java#L185-L194
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java
TopicManagerImpl.sendSubscriptionEvent
void sendSubscriptionEvent(String topic, int nb) { Collection<Session> sessions = getSessionsForTopic(topic); if (!sessions.isEmpty()) { MessageToClient messageToClient = new MessageToClient(); messageToClient.setId(topic); messageToClient.setType(MessageType.MESSAGE); messageToClient.setResponse(nb); // Collection<Session> sessionsClosed = new ArrayList<>(); // throws java.lang.StackOverflowError for (Session session : sessions) { if (session.isOpen()) { session.getAsyncRemote().sendObject(messageToClient); // } else { // sessionsClosed.add(session); } } // removeSessionsToTopic(sessionsClosed); } }
java
void sendSubscriptionEvent(String topic, int nb) { Collection<Session> sessions = getSessionsForTopic(topic); if (!sessions.isEmpty()) { MessageToClient messageToClient = new MessageToClient(); messageToClient.setId(topic); messageToClient.setType(MessageType.MESSAGE); messageToClient.setResponse(nb); // Collection<Session> sessionsClosed = new ArrayList<>(); // throws java.lang.StackOverflowError for (Session session : sessions) { if (session.isOpen()) { session.getAsyncRemote().sendObject(messageToClient); // } else { // sessionsClosed.add(session); } } // removeSessionsToTopic(sessionsClosed); } }
[ "void", "sendSubscriptionEvent", "(", "String", "topic", ",", "int", "nb", ")", "{", "Collection", "<", "Session", ">", "sessions", "=", "getSessionsForTopic", "(", "topic", ")", ";", "if", "(", "!", "sessions", ".", "isEmpty", "(", ")", ")", "{", "Messa...
Send subscription event to all client @param topic @param session
[ "Send", "subscription", "event", "to", "all", "client" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java#L202-L219
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java
TopicManagerImpl.getSessionsForTopic
@Override public Collection<Session> getSessionsForTopic(String topic) { Collection<Session> result; if (map.containsKey(topic)) { return Collections.unmodifiableCollection(map.get(topic)); } else { result = Collections.EMPTY_LIST; } return result; }
java
@Override public Collection<Session> getSessionsForTopic(String topic) { Collection<Session> result; if (map.containsKey(topic)) { return Collections.unmodifiableCollection(map.get(topic)); } else { result = Collections.EMPTY_LIST; } return result; }
[ "@", "Override", "public", "Collection", "<", "Session", ">", "getSessionsForTopic", "(", "String", "topic", ")", "{", "Collection", "<", "Session", ">", "result", ";", "if", "(", "map", ".", "containsKey", "(", "topic", ")", ")", "{", "return", "Collectio...
Get Sessions for topics @param topic @return
[ "Get", "Sessions", "for", "topics" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java#L227-L236
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java
TopicManagerImpl.getNumberSubscribers
@Override public int getNumberSubscribers(String topic) { if (map.containsKey(topic)) { return map.get(topic).size(); } return 0; }
java
@Override public int getNumberSubscribers(String topic) { if (map.containsKey(topic)) { return map.get(topic).size(); } return 0; }
[ "@", "Override", "public", "int", "getNumberSubscribers", "(", "String", "topic", ")", "{", "if", "(", "map", ".", "containsKey", "(", "topic", ")", ")", "{", "return", "map", ".", "get", "(", "topic", ")", ".", "size", "(", ")", ";", "}", "return", ...
Get Number Sessions for topics @param topic @return
[ "Get", "Number", "Sessions", "for", "topics" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/TopicManagerImpl.java#L244-L250
train
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/request/SSLSocketFactoryProvider.java
SSLSocketFactoryProvider.getSSLSockectFactory
public SSLSocketFactory getSSLSockectFactory() { SSLContext context = null; try { context = SSLContext.getInstance("TLS"); } catch (NoSuchAlgorithmException e) { throw new VOMSError(e.getMessage(), e); } KeyManager[] keyManagers = new KeyManager[] { credential.getKeyManager() }; X509TrustManager trustManager = SocketFactoryCreator .getSSLTrustManager(validator); TrustManager[] trustManagers = new TrustManager[] { trustManager }; SecureRandom secureRandom = null; /* http://bugs.sun.com/view_bug.do?bug_id=6202721 */ /* * Use new SecureRandom instead of SecureRandom.getInstance("SHA1PRNG") to * avoid unnecessary blocking */ secureRandom = new SecureRandom(); try { context.init(keyManagers, trustManagers, secureRandom); } catch (KeyManagementException e) { throw new VOMSError(e.getMessage(), e); } return context.getSocketFactory(); }
java
public SSLSocketFactory getSSLSockectFactory() { SSLContext context = null; try { context = SSLContext.getInstance("TLS"); } catch (NoSuchAlgorithmException e) { throw new VOMSError(e.getMessage(), e); } KeyManager[] keyManagers = new KeyManager[] { credential.getKeyManager() }; X509TrustManager trustManager = SocketFactoryCreator .getSSLTrustManager(validator); TrustManager[] trustManagers = new TrustManager[] { trustManager }; SecureRandom secureRandom = null; /* http://bugs.sun.com/view_bug.do?bug_id=6202721 */ /* * Use new SecureRandom instead of SecureRandom.getInstance("SHA1PRNG") to * avoid unnecessary blocking */ secureRandom = new SecureRandom(); try { context.init(keyManagers, trustManagers, secureRandom); } catch (KeyManagementException e) { throw new VOMSError(e.getMessage(), e); } return context.getSocketFactory(); }
[ "public", "SSLSocketFactory", "getSSLSockectFactory", "(", ")", "{", "SSLContext", "context", "=", "null", ";", "try", "{", "context", "=", "SSLContext", ".", "getInstance", "(", "\"TLS\"", ")", ";", "}", "catch", "(", "NoSuchAlgorithmException", "e", ")", "{"...
Get the SSL socket factory. @return the {@link SSLSocketFactory} object
[ "Get", "the", "SSL", "socket", "factory", "." ]
b33d6cf98ca9449bed87b1cc307d411514589deb
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/request/SSLSocketFactoryProvider.java#L66-L105
train
hageldave/ImagingKit
ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/ArrayUtils.java
ArrayUtils.scaleArray
public static void scaleArray(final double[] array, final double factor){ for(int i = 0; i < array.length; i++){ array[i] *= factor; } }
java
public static void scaleArray(final double[] array, final double factor){ for(int i = 0; i < array.length; i++){ array[i] *= factor; } }
[ "public", "static", "void", "scaleArray", "(", "final", "double", "[", "]", "array", ",", "final", "double", "factor", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array", ".", "length", ";", "i", "++", ")", "{", "array", "[", "i",...
Multiplies elements of array by specified factor @param array of elements to scale @param factor to scale by
[ "Multiplies", "elements", "of", "array", "by", "specified", "factor" ]
3837c7d550a12cf4dc5718b644ced94b97f52668
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/ArrayUtils.java#L119-L123
train
dkpro/dkpro-statistics
dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/coding/WeightedKappaAgreement.java
WeightedKappaAgreement.calculateObservedDisagreement
@Override public double calculateObservedDisagreement() { ensureDistanceFunction(); double result = 0.0; double maxDistance = 1.0; for (ICodingAnnotationItem item : study.getItems()) { Map<Object, Integer> annotationsPerCategory = CodingAnnotationStudy.countTotalAnnotationsPerCategory(item); for (Entry<Object, Integer> category1 : annotationsPerCategory.entrySet()) for (Entry<Object, Integer> category2 : annotationsPerCategory.entrySet()) { if (category1.getValue() == null) continue; if (category2.getValue() == null) continue; double distance = distanceFunction.measureDistance(study, category1.getKey(), category2.getKey()); result += category1.getValue() * category2.getValue() * distance; if (distance > maxDistance) maxDistance = distance; } } result /= (double) (maxDistance * study.getItemCount() * study.getRaterCount() * (study.getRaterCount() - 1)); return result; }
java
@Override public double calculateObservedDisagreement() { ensureDistanceFunction(); double result = 0.0; double maxDistance = 1.0; for (ICodingAnnotationItem item : study.getItems()) { Map<Object, Integer> annotationsPerCategory = CodingAnnotationStudy.countTotalAnnotationsPerCategory(item); for (Entry<Object, Integer> category1 : annotationsPerCategory.entrySet()) for (Entry<Object, Integer> category2 : annotationsPerCategory.entrySet()) { if (category1.getValue() == null) continue; if (category2.getValue() == null) continue; double distance = distanceFunction.measureDistance(study, category1.getKey(), category2.getKey()); result += category1.getValue() * category2.getValue() * distance; if (distance > maxDistance) maxDistance = distance; } } result /= (double) (maxDistance * study.getItemCount() * study.getRaterCount() * (study.getRaterCount() - 1)); return result; }
[ "@", "Override", "public", "double", "calculateObservedDisagreement", "(", ")", "{", "ensureDistanceFunction", "(", ")", ";", "double", "result", "=", "0.0", ";", "double", "maxDistance", "=", "1.0", ";", "for", "(", "ICodingAnnotationItem", "item", ":", "study"...
Calculates the observed inter-rater agreement for the annotation study that was passed to the class constructor and the currently assigned distance function. @throws NullPointerException if the study is null. @throws ArithmeticException if the study does not contain any item or the number of raters is smaller than 2.
[ "Calculates", "the", "observed", "inter", "-", "rater", "agreement", "for", "the", "annotation", "study", "that", "was", "passed", "to", "the", "class", "constructor", "and", "the", "currently", "assigned", "distance", "function", "." ]
0b0e93dc49223984964411cbc6df420ba796a8cb
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/coding/WeightedKappaAgreement.java#L63-L92
train
ocelotds/ocelot
ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java
AbstractDataServiceVisitor.getJsInstancename
String getJsInstancename(String classname) { char chars[] = classname.toCharArray(); chars[0] = Character.toLowerCase(chars[0]); return new String(chars); //return Introspector.decapitalize(classname); }
java
String getJsInstancename(String classname) { char chars[] = classname.toCharArray(); chars[0] = Character.toLowerCase(chars[0]); return new String(chars); //return Introspector.decapitalize(classname); }
[ "String", "getJsInstancename", "(", "String", "classname", ")", "{", "char", "chars", "[", "]", "=", "classname", ".", "toCharArray", "(", ")", ";", "chars", "[", "0", "]", "=", "Character", ".", "toLowerCase", "(", "chars", "[", "0", "]", ")", ";", ...
Compute the name of instance class @param classname @return
[ "Compute", "the", "name", "of", "instance", "class" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java#L102-L107
train
ocelotds/ocelot
ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java
AbstractDataServiceVisitor.getJsClassname
String getJsClassname(TypeElement typeElement) { DataService dsAnno = typeElement.getAnnotation(DataService.class); String name = dsAnno.name(); if (name.isEmpty()) { name = typeElement.getSimpleName().toString(); } return name; }
java
String getJsClassname(TypeElement typeElement) { DataService dsAnno = typeElement.getAnnotation(DataService.class); String name = dsAnno.name(); if (name.isEmpty()) { name = typeElement.getSimpleName().toString(); } return name; }
[ "String", "getJsClassname", "(", "TypeElement", "typeElement", ")", "{", "DataService", "dsAnno", "=", "typeElement", ".", "getAnnotation", "(", "DataService", ".", "class", ")", ";", "String", "name", "=", "dsAnno", ".", "name", "(", ")", ";", "if", "(", ...
Compute the name of javascript class @param typeElement @return
[ "Compute", "the", "name", "of", "javascript", "class" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java#L115-L122
train
ocelotds/ocelot
ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java
AbstractDataServiceVisitor.browseAndWriteMethods
void browseAndWriteMethods(List<ExecutableElement> methodElements, String classname, Writer writer) throws IOException { Collection<String> methodProceeds = new ArrayList<>(); boolean first = true; for (ExecutableElement methodElement : methodElements) { if (isConsiderateMethod(methodProceeds, methodElement)) { if(!first) { writer.append(COMMA).append(CR); } visitMethodElement(classname, methodElement, writer); first = false; } } }
java
void browseAndWriteMethods(List<ExecutableElement> methodElements, String classname, Writer writer) throws IOException { Collection<String> methodProceeds = new ArrayList<>(); boolean first = true; for (ExecutableElement methodElement : methodElements) { if (isConsiderateMethod(methodProceeds, methodElement)) { if(!first) { writer.append(COMMA).append(CR); } visitMethodElement(classname, methodElement, writer); first = false; } } }
[ "void", "browseAndWriteMethods", "(", "List", "<", "ExecutableElement", ">", "methodElements", ",", "String", "classname", ",", "Writer", "writer", ")", "throws", "IOException", "{", "Collection", "<", "String", ">", "methodProceeds", "=", "new", "ArrayList", "<>"...
browse valid methods and write equivalent js methods in writer @param methodElements @param classname @param writer @return @throws IOException
[ "browse", "valid", "methods", "and", "write", "equivalent", "js", "methods", "in", "writer" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java#L133-L145
train
ocelotds/ocelot
ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java
AbstractDataServiceVisitor.getOrderedMethods
protected List<ExecutableElement> getOrderedMethods(TypeElement typeElement, Comparator<ExecutableElement> comparator) { List<ExecutableElement> methods = ElementFilter.methodsIn(typeElement.getEnclosedElements()); Collections.sort(methods, comparator); return methods; }
java
protected List<ExecutableElement> getOrderedMethods(TypeElement typeElement, Comparator<ExecutableElement> comparator) { List<ExecutableElement> methods = ElementFilter.methodsIn(typeElement.getEnclosedElements()); Collections.sort(methods, comparator); return methods; }
[ "protected", "List", "<", "ExecutableElement", ">", "getOrderedMethods", "(", "TypeElement", "typeElement", ",", "Comparator", "<", "ExecutableElement", ">", "comparator", ")", "{", "List", "<", "ExecutableElement", ">", "methods", "=", "ElementFilter", ".", "method...
Return methods from typeElement ordered by comparator @param typeElement @param comparator @return
[ "Return", "methods", "from", "typeElement", "ordered", "by", "comparator" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java#L153-L157
train
ocelotds/ocelot
ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java
AbstractDataServiceVisitor.getArgumentsType
List<String> getArgumentsType(ExecutableElement methodElement) { ExecutableType methodType = (ExecutableType) methodElement.asType(); List<String> res = new ArrayList<>(); for (TypeMirror argumentType : methodType.getParameterTypes()) { res.add(argumentType.toString()); } return res; }
java
List<String> getArgumentsType(ExecutableElement methodElement) { ExecutableType methodType = (ExecutableType) methodElement.asType(); List<String> res = new ArrayList<>(); for (TypeMirror argumentType : methodType.getParameterTypes()) { res.add(argumentType.toString()); } return res; }
[ "List", "<", "String", ">", "getArgumentsType", "(", "ExecutableElement", "methodElement", ")", "{", "ExecutableType", "methodType", "=", "(", "ExecutableType", ")", "methodElement", ".", "asType", "(", ")", ";", "List", "<", "String", ">", "res", "=", "new", ...
Get argument types list from method @param methodElement @return
[ "Get", "argument", "types", "list", "from", "method" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java#L202-L209
train
ocelotds/ocelot
ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java
AbstractDataServiceVisitor.getArguments
List<String> getArguments(ExecutableElement methodElement) { List<String> res = new ArrayList<>(); for (VariableElement variableElement : methodElement.getParameters()) { res.add(variableElement.toString()); } return res; }
java
List<String> getArguments(ExecutableElement methodElement) { List<String> res = new ArrayList<>(); for (VariableElement variableElement : methodElement.getParameters()) { res.add(variableElement.toString()); } return res; }
[ "List", "<", "String", ">", "getArguments", "(", "ExecutableElement", "methodElement", ")", "{", "List", "<", "String", ">", "res", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "VariableElement", "variableElement", ":", "methodElement", ".", "ge...
Get argument names list from method @param methodElement @return
[ "Get", "argument", "names", "list", "from", "method" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-processor/src/main/java/org/ocelotds/processors/visitors/AbstractDataServiceVisitor.java#L217-L223
train
dkpro/dkpro-statistics
dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/coding/CodingAnnotationStudy.java
CodingAnnotationStudy.stripCategories
public CodingAnnotationStudy stripCategories(final Object keepCategory, final Object nullCategory) { CodingAnnotationStudy result = new CodingAnnotationStudy(getRaterCount()); for (ICodingAnnotationItem item : getItems()) { CodingAnnotationItem newItem = new CodingAnnotationItem(raters.size()); for (IAnnotationUnit unit : item.getUnits()) { Object newCategory; if (!keepCategory.equals(unit.getCategory())) { newCategory = nullCategory; } else { newCategory = keepCategory; } newItem.addUnit(result.createUnit(result.items.size(), unit.getRaterIdx(), newCategory)); } result.items.add(newItem); } return result; }
java
public CodingAnnotationStudy stripCategories(final Object keepCategory, final Object nullCategory) { CodingAnnotationStudy result = new CodingAnnotationStudy(getRaterCount()); for (ICodingAnnotationItem item : getItems()) { CodingAnnotationItem newItem = new CodingAnnotationItem(raters.size()); for (IAnnotationUnit unit : item.getUnits()) { Object newCategory; if (!keepCategory.equals(unit.getCategory())) { newCategory = nullCategory; } else { newCategory = keepCategory; } newItem.addUnit(result.createUnit(result.items.size(), unit.getRaterIdx(), newCategory)); } result.items.add(newItem); } return result; }
[ "public", "CodingAnnotationStudy", "stripCategories", "(", "final", "Object", "keepCategory", ",", "final", "Object", "nullCategory", ")", "{", "CodingAnnotationStudy", "result", "=", "new", "CodingAnnotationStudy", "(", "getRaterCount", "(", ")", ")", ";", "for", "...
Returns a clone of the current annotation study in which all categories are replaced by the given nullCategory except the categories matching the specified keepCategory.
[ "Returns", "a", "clone", "of", "the", "current", "annotation", "study", "in", "which", "all", "categories", "are", "replaced", "by", "the", "given", "nullCategory", "except", "the", "categories", "matching", "the", "specified", "keepCategory", "." ]
0b0e93dc49223984964411cbc6df420ba796a8cb
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/coding/CodingAnnotationStudy.java#L188-L207
train
hageldave/ImagingKit
ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/ComplexImg.java
ComplexImg.computePhase
public double computePhase(int idx){ double r = real[idx]; double i = imag[idx]; return atan2(r, i); }
java
public double computePhase(int idx){ double r = real[idx]; double i = imag[idx]; return atan2(r, i); }
[ "public", "double", "computePhase", "(", "int", "idx", ")", "{", "double", "r", "=", "real", "[", "idx", "]", ";", "double", "i", "=", "imag", "[", "idx", "]", ";", "return", "atan2", "(", "r", ",", "i", ")", ";", "}" ]
Calculates the phase of the pixel at the specified index. The phase is the argument of the complex number, i.e. the angle of the complex vector in the complex plane. @param idx index @return the phase in [0,2pi] of the complex number at index
[ "Calculates", "the", "phase", "of", "the", "pixel", "at", "the", "specified", "index", ".", "The", "phase", "is", "the", "argument", "of", "the", "complex", "number", "i", ".", "e", ".", "the", "angle", "of", "the", "complex", "vector", "in", "the", "c...
3837c7d550a12cf4dc5718b644ced94b97f52668
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Fourier/src/main/java/hageldave/imagingkit/fourier/ComplexImg.java#L510-L514
train
jenkinsci/gmaven
gmaven-runtime/gmaven-runtime-loader/src/main/java/org/codehaus/gmaven/runtime/loader/DefaultProviderSelector.java
DefaultProviderSelector.findLoaders
private Map findLoaders() { Map loaders = getContainer().getComponentDescriptorMap(ProviderLoader.class.getName()); if (loaders == null) { throw new Error("No provider loaders found"); } Set keys = loaders.keySet(); Map found = null; ProviderLoader defaultLoader = null; for (Iterator iter = keys.iterator(); iter.hasNext();) { String key = (String)iter.next(); ProviderLoader loader; try { loader = (ProviderLoader) getContainer().lookup(ProviderLoader.class.getName(), key); } catch (Exception e) { log.warn("Failed to lookup provider loader for key: {}", key, e); continue; } if (loader != null) { if (found == null) { // we need an ordered map found = new LinkedHashMap(); } if (key.equals(SELECT_DEFAULT)) { defaultLoader = loader; } else { found.put(key, loader); } } } // the default should be added at the end (as fallback) assert defaultLoader != null; found.put(SELECT_DEFAULT, defaultLoader); return found; }
java
private Map findLoaders() { Map loaders = getContainer().getComponentDescriptorMap(ProviderLoader.class.getName()); if (loaders == null) { throw new Error("No provider loaders found"); } Set keys = loaders.keySet(); Map found = null; ProviderLoader defaultLoader = null; for (Iterator iter = keys.iterator(); iter.hasNext();) { String key = (String)iter.next(); ProviderLoader loader; try { loader = (ProviderLoader) getContainer().lookup(ProviderLoader.class.getName(), key); } catch (Exception e) { log.warn("Failed to lookup provider loader for key: {}", key, e); continue; } if (loader != null) { if (found == null) { // we need an ordered map found = new LinkedHashMap(); } if (key.equals(SELECT_DEFAULT)) { defaultLoader = loader; } else { found.put(key, loader); } } } // the default should be added at the end (as fallback) assert defaultLoader != null; found.put(SELECT_DEFAULT, defaultLoader); return found; }
[ "private", "Map", "findLoaders", "(", ")", "{", "Map", "loaders", "=", "getContainer", "(", ")", ".", "getComponentDescriptorMap", "(", "ProviderLoader", ".", "class", ".", "getName", "(", ")", ")", ";", "if", "(", "loaders", "==", "null", ")", "{", "thr...
Find any provider loaders which are available in the container.
[ "Find", "any", "provider", "loaders", "which", "are", "available", "in", "the", "container", "." ]
80d5f6657e15b3e05ffbb82128ed8bb280836e10
https://github.com/jenkinsci/gmaven/blob/80d5f6657e15b3e05ffbb82128ed8bb280836e10/gmaven-runtime/gmaven-runtime-loader/src/main/java/org/codehaus/gmaven/runtime/loader/DefaultProviderSelector.java#L233-L275
train
riversun/finbin
src/main/java/org/riversun/finbin/BinaryUtil.java
BinaryUtil.getBytes
public static byte[] getBytes(String text) { byte[] bytes = new byte[] {}; try { bytes = text.getBytes("utf-8"); } catch (UnsupportedEncodingException e) { } return bytes; }
java
public static byte[] getBytes(String text) { byte[] bytes = new byte[] {}; try { bytes = text.getBytes("utf-8"); } catch (UnsupportedEncodingException e) { } return bytes; }
[ "public", "static", "byte", "[", "]", "getBytes", "(", "String", "text", ")", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "]", "{", "}", ";", "try", "{", "bytes", "=", "text", ".", "getBytes", "(", "\"utf-8\"", ")", ";", "}", "catch"...
Get UTF-8 without BOM encoded bytes from String @param text @return
[ "Get", "UTF", "-", "8", "without", "BOM", "encoded", "bytes", "from", "String" ]
d1db86a0d2966dcf47087340bbd0727a9d508b3e
https://github.com/riversun/finbin/blob/d1db86a0d2966dcf47087340bbd0727a9d508b3e/src/main/java/org/riversun/finbin/BinaryUtil.java#L49-L56
train
riversun/finbin
src/main/java/org/riversun/finbin/BinaryUtil.java
BinaryUtil.loadBytesFromFile
public static byte[] loadBytesFromFile(File file) { byte[] bytes = null; try { bytes = Files.readAllBytes(Paths.get(file.getAbsolutePath())); } catch (IOException e) { e.printStackTrace(); } return bytes; }
java
public static byte[] loadBytesFromFile(File file) { byte[] bytes = null; try { bytes = Files.readAllBytes(Paths.get(file.getAbsolutePath())); } catch (IOException e) { e.printStackTrace(); } return bytes; }
[ "public", "static", "byte", "[", "]", "loadBytesFromFile", "(", "File", "file", ")", "{", "byte", "[", "]", "bytes", "=", "null", ";", "try", "{", "bytes", "=", "Files", ".", "readAllBytes", "(", "Paths", ".", "get", "(", "file", ".", "getAbsolutePath"...
load from file @param file @return
[ "load", "from", "file" ]
d1db86a0d2966dcf47087340bbd0727a9d508b3e
https://github.com/riversun/finbin/blob/d1db86a0d2966dcf47087340bbd0727a9d508b3e/src/main/java/org/riversun/finbin/BinaryUtil.java#L75-L84
train
riversun/finbin
src/main/java/org/riversun/finbin/BinaryUtil.java
BinaryUtil.saveBytesToFile
public static void saveBytesToFile(byte[] data, File file) { if (data == null) { return; } FileOutputStream fos = null; BufferedOutputStream bos = null; try { fos = new FileOutputStream(file); bos = new BufferedOutputStream(fos); bos.write(data); bos.flush(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (bos != null) { try { bos.close(); } catch (IOException e) { e.printStackTrace(); } } if (fos != null) { try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } } }
java
public static void saveBytesToFile(byte[] data, File file) { if (data == null) { return; } FileOutputStream fos = null; BufferedOutputStream bos = null; try { fos = new FileOutputStream(file); bos = new BufferedOutputStream(fos); bos.write(data); bos.flush(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (bos != null) { try { bos.close(); } catch (IOException e) { e.printStackTrace(); } } if (fos != null) { try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } } }
[ "public", "static", "void", "saveBytesToFile", "(", "byte", "[", "]", "data", ",", "File", "file", ")", "{", "if", "(", "data", "==", "null", ")", "{", "return", ";", "}", "FileOutputStream", "fos", "=", "null", ";", "BufferedOutputStream", "bos", "=", ...
save to file @param data @param file
[ "save", "to", "file" ]
d1db86a0d2966dcf47087340bbd0727a9d508b3e
https://github.com/riversun/finbin/blob/d1db86a0d2966dcf47087340bbd0727a9d508b3e/src/main/java/org/riversun/finbin/BinaryUtil.java#L92-L123
train
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageLoader.java
ImageLoader.loadImage
public static BufferedImage loadImage(String fileName){ File f = new File(fileName); if(f.exists()){ return loadImage(f); } throw new ImageLoaderException(new FileNotFoundException(fileName)); }
java
public static BufferedImage loadImage(String fileName){ File f = new File(fileName); if(f.exists()){ return loadImage(f); } throw new ImageLoaderException(new FileNotFoundException(fileName)); }
[ "public", "static", "BufferedImage", "loadImage", "(", "String", "fileName", ")", "{", "File", "f", "=", "new", "File", "(", "fileName", ")", ";", "if", "(", "f", ".", "exists", "(", ")", ")", "{", "return", "loadImage", "(", "f", ")", ";", "}", "t...
Tries to load Image from specified filename. @param fileName path of the image file @return loaded Image. @throws ImageLoaderException if the file does not exist or cannot be loaded. @since 1.0
[ "Tries", "to", "load", "Image", "from", "specified", "filename", "." ]
3837c7d550a12cf4dc5718b644ced94b97f52668
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageLoader.java#L63-L69
train
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageLoader.java
ImageLoader.loadImage
public static BufferedImage loadImage(File file){ try { BufferedImage bimg = ImageIO.read(file); if(bimg == null){ throw new ImageLoaderException("Could not load Image! ImageIO.read() returned null."); } return bimg; } catch (IOException e) { throw new ImageLoaderException(e); } }
java
public static BufferedImage loadImage(File file){ try { BufferedImage bimg = ImageIO.read(file); if(bimg == null){ throw new ImageLoaderException("Could not load Image! ImageIO.read() returned null."); } return bimg; } catch (IOException e) { throw new ImageLoaderException(e); } }
[ "public", "static", "BufferedImage", "loadImage", "(", "File", "file", ")", "{", "try", "{", "BufferedImage", "bimg", "=", "ImageIO", ".", "read", "(", "file", ")", ";", "if", "(", "bimg", "==", "null", ")", "{", "throw", "new", "ImageLoaderException", "...
Tries to load image from specified file. @param file the image file @return loaded Image. @throws ImageLoaderException if no image could be loaded from the file. @since 1.0
[ "Tries", "to", "load", "image", "from", "specified", "file", "." ]
3837c7d550a12cf4dc5718b644ced94b97f52668
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/io/ImageLoader.java#L78-L88
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/core/mtc/MessageToClientManager.java
MessageToClientManager._createMessageToClient
MessageToClient _createMessageToClient(MessageFromClient message, T session) { MessageToClient messageToClient = new MessageToClient(); messageToClient.setId(message.getId()); try { Class cls = Class.forName(message.getDataService()); Object dataService = this.getDataService(session, cls); logger.debug("Process message {}", message); List<Object> arguments = getArrayList(); Method method = methodServices.getMethodFromDataService(cls, message, arguments); injectSession(method.getParameterTypes(), arguments, session); messageToClient.setResult(method.invoke(dataService, arguments.toArray())); if (method.isAnnotationPresent(JsonMarshaller.class)) { messageToClient.setJson(argumentServices.getJsonResultFromSpecificMarshaller(method.getAnnotation(JsonMarshaller.class), messageToClient.getResponse())); } try { Method nonProxiedMethod = methodServices.getNonProxiedMethod(cls, method.getName(), method.getParameterTypes()); messageToClient.setDeadline(cacheManager.processCacheAnnotations(nonProxiedMethod, message.getParameters())); } catch (NoSuchMethodException ex) { logger.error("Fail to process extra annotations (JsCacheResult, JsCacheRemove) for method : " + method.getName(), ex); } logger.debug("Method {} proceed messageToClient : {}.", method.getName(), messageToClient); } catch (InvocationTargetException ex) { Throwable cause = ex.getCause(); if (ConstraintViolationException.class.isInstance(cause)) { messageToClient.setConstraints(constraintServices.extractViolations((ConstraintViolationException) cause)); } else { messageToClient.setFault(faultServices.buildFault(cause)); } } catch (Throwable ex) { messageToClient.setFault(faultServices.buildFault(ex)); } return messageToClient; }
java
MessageToClient _createMessageToClient(MessageFromClient message, T session) { MessageToClient messageToClient = new MessageToClient(); messageToClient.setId(message.getId()); try { Class cls = Class.forName(message.getDataService()); Object dataService = this.getDataService(session, cls); logger.debug("Process message {}", message); List<Object> arguments = getArrayList(); Method method = methodServices.getMethodFromDataService(cls, message, arguments); injectSession(method.getParameterTypes(), arguments, session); messageToClient.setResult(method.invoke(dataService, arguments.toArray())); if (method.isAnnotationPresent(JsonMarshaller.class)) { messageToClient.setJson(argumentServices.getJsonResultFromSpecificMarshaller(method.getAnnotation(JsonMarshaller.class), messageToClient.getResponse())); } try { Method nonProxiedMethod = methodServices.getNonProxiedMethod(cls, method.getName(), method.getParameterTypes()); messageToClient.setDeadline(cacheManager.processCacheAnnotations(nonProxiedMethod, message.getParameters())); } catch (NoSuchMethodException ex) { logger.error("Fail to process extra annotations (JsCacheResult, JsCacheRemove) for method : " + method.getName(), ex); } logger.debug("Method {} proceed messageToClient : {}.", method.getName(), messageToClient); } catch (InvocationTargetException ex) { Throwable cause = ex.getCause(); if (ConstraintViolationException.class.isInstance(cause)) { messageToClient.setConstraints(constraintServices.extractViolations((ConstraintViolationException) cause)); } else { messageToClient.setFault(faultServices.buildFault(cause)); } } catch (Throwable ex) { messageToClient.setFault(faultServices.buildFault(ex)); } return messageToClient; }
[ "MessageToClient", "_createMessageToClient", "(", "MessageFromClient", "message", ",", "T", "session", ")", "{", "MessageToClient", "messageToClient", "=", "new", "MessageToClient", "(", ")", ";", "messageToClient", ".", "setId", "(", "message", ".", "getId", "(", ...
Create a MessageToClient from MessageFromClient for session Only for available test use case @param message @param session @return
[ "Create", "a", "MessageToClient", "from", "MessageFromClient", "for", "session", "Only", "for", "available", "test", "use", "case" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/mtc/MessageToClientManager.java#L133-L165
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/core/mtc/MessageToClientManager.java
MessageToClientManager.injectSession
void injectSession(Class<?>[] parameterTypes, List<Object> arguments, T session) { if (parameterTypes != null) { int i = 0; for (Class<?> parameterType : parameterTypes) { if (parameterType.isInstance(session)) { arguments.set(i, session); break; } i++; } } }
java
void injectSession(Class<?>[] parameterTypes, List<Object> arguments, T session) { if (parameterTypes != null) { int i = 0; for (Class<?> parameterType : parameterTypes) { if (parameterType.isInstance(session)) { arguments.set(i, session); break; } i++; } } }
[ "void", "injectSession", "(", "Class", "<", "?", ">", "[", "]", "parameterTypes", ",", "List", "<", "Object", ">", "arguments", ",", "T", "session", ")", "{", "if", "(", "parameterTypes", "!=", "null", ")", "{", "int", "i", "=", "0", ";", "for", "(...
Inject Session or HttpSession if necessary @param parameterTypes @param arguments @param session
[ "Inject", "Session", "or", "HttpSession", "if", "necessary" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/mtc/MessageToClientManager.java#L174-L185
train
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/store/impl/DefaultVOMSTrustStore.java
DefaultVOMSTrustStore.loadCertificateFromFile
private void loadCertificateFromFile(File file) { certificateFileSanityChecks(file); try { X509Certificate aaCert = CertificateUtils.loadCertificate( new FileInputStream(file), Encoding.PEM); // Get certificate subject hash, using the CANL implementation for CA // files String aaCertHash = getOpensslCAHash(aaCert.getSubjectX500Principal()); // Store certificate in the local map localAACertificatesByHash.put(aaCertHash, aaCert); synchronized (listenerLock) { listener.notifyCertificateLoadEvent(aaCert, file); } } catch (IOException e) { String errorMessage = String.format( "Error parsing VOMS trusted certificate from %s. Reason: %s", file.getAbsolutePath(), e.getMessage()); throw new VOMSError(errorMessage, e); } }
java
private void loadCertificateFromFile(File file) { certificateFileSanityChecks(file); try { X509Certificate aaCert = CertificateUtils.loadCertificate( new FileInputStream(file), Encoding.PEM); // Get certificate subject hash, using the CANL implementation for CA // files String aaCertHash = getOpensslCAHash(aaCert.getSubjectX500Principal()); // Store certificate in the local map localAACertificatesByHash.put(aaCertHash, aaCert); synchronized (listenerLock) { listener.notifyCertificateLoadEvent(aaCert, file); } } catch (IOException e) { String errorMessage = String.format( "Error parsing VOMS trusted certificate from %s. Reason: %s", file.getAbsolutePath(), e.getMessage()); throw new VOMSError(errorMessage, e); } }
[ "private", "void", "loadCertificateFromFile", "(", "File", "file", ")", "{", "certificateFileSanityChecks", "(", "file", ")", ";", "try", "{", "X509Certificate", "aaCert", "=", "CertificateUtils", ".", "loadCertificate", "(", "new", "FileInputStream", "(", "file", ...
Loads a VOMS AA certificate from a given file and stores this certificate in the local map of trusted VOMS AA certificate. @param file
[ "Loads", "a", "VOMS", "AA", "certificate", "from", "a", "given", "file", "and", "stores", "this", "certificate", "in", "the", "local", "map", "of", "trusted", "VOMS", "AA", "certificate", "." ]
b33d6cf98ca9449bed87b1cc307d411514589deb
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/store/impl/DefaultVOMSTrustStore.java#L247-L274
train
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/store/impl/DefaultVOMSTrustStore.java
DefaultVOMSTrustStore.certificateFileSanityChecks
private void certificateFileSanityChecks(File certFile) { if (!certFile.exists()) throw new VOMSError("Local VOMS trusted certificate does not exist:" + certFile.getAbsolutePath()); if (!certFile.canRead()) throw new VOMSError("Local VOMS trusted certificate is not readable:" + certFile.getAbsolutePath()); }
java
private void certificateFileSanityChecks(File certFile) { if (!certFile.exists()) throw new VOMSError("Local VOMS trusted certificate does not exist:" + certFile.getAbsolutePath()); if (!certFile.canRead()) throw new VOMSError("Local VOMS trusted certificate is not readable:" + certFile.getAbsolutePath()); }
[ "private", "void", "certificateFileSanityChecks", "(", "File", "certFile", ")", "{", "if", "(", "!", "certFile", ".", "exists", "(", ")", ")", "throw", "new", "VOMSError", "(", "\"Local VOMS trusted certificate does not exist:\"", "+", "certFile", ".", "getAbsoluteP...
Performs basic sanity checks performed on a file supposed to hold a VOMS AA certificate. @param certFile
[ "Performs", "basic", "sanity", "checks", "performed", "on", "a", "file", "supposed", "to", "hold", "a", "VOMS", "AA", "certificate", "." ]
b33d6cf98ca9449bed87b1cc307d411514589deb
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/store/impl/DefaultVOMSTrustStore.java#L341-L351
train
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/store/impl/DefaultVOMSTrustStore.java
DefaultVOMSTrustStore.directorySanityChecks
private void directorySanityChecks(File directory) { if (!directory.exists()) throw new VOMSError("Local trust directory does not exists:" + directory.getAbsolutePath()); if (!directory.isDirectory()) throw new VOMSError("Local trust directory is not a directory:" + directory.getAbsolutePath()); if (!directory.canRead()) throw new VOMSError("Local trust directory is not readable:" + directory.getAbsolutePath()); if (!directory.canExecute()) throw new VOMSError("Local trust directory is not traversable:" + directory.getAbsolutePath()); }
java
private void directorySanityChecks(File directory) { if (!directory.exists()) throw new VOMSError("Local trust directory does not exists:" + directory.getAbsolutePath()); if (!directory.isDirectory()) throw new VOMSError("Local trust directory is not a directory:" + directory.getAbsolutePath()); if (!directory.canRead()) throw new VOMSError("Local trust directory is not readable:" + directory.getAbsolutePath()); if (!directory.canExecute()) throw new VOMSError("Local trust directory is not traversable:" + directory.getAbsolutePath()); }
[ "private", "void", "directorySanityChecks", "(", "File", "directory", ")", "{", "if", "(", "!", "directory", ".", "exists", "(", ")", ")", "throw", "new", "VOMSError", "(", "\"Local trust directory does not exists:\"", "+", "directory", ".", "getAbsolutePath", "("...
Performs basic sanity checks on a directory that is supposed to contain VOMS AA certificates and LSC files. @param directory
[ "Performs", "basic", "sanity", "checks", "on", "a", "directory", "that", "is", "supposed", "to", "contain", "VOMS", "AA", "certificates", "and", "LSC", "files", "." ]
b33d6cf98ca9449bed87b1cc307d411514589deb
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/store/impl/DefaultVOMSTrustStore.java#L359-L377
train
darcy-framework/darcy-ui
src/main/java/com/redhat/darcy/ui/matchers/LoadConditionMatcher.java
LoadConditionMatcher.doesItemMatchAppropriateCondition
private boolean doesItemMatchAppropriateCondition(Object item) { Matcher<?> matcher; if (item instanceof View) { matcher = loaded(); } else if (item instanceof Element) { matcher = displayed(); } else { matcher = present(); } return matcher.matches(item); }
java
private boolean doesItemMatchAppropriateCondition(Object item) { Matcher<?> matcher; if (item instanceof View) { matcher = loaded(); } else if (item instanceof Element) { matcher = displayed(); } else { matcher = present(); } return matcher.matches(item); }
[ "private", "boolean", "doesItemMatchAppropriateCondition", "(", "Object", "item", ")", "{", "Matcher", "<", "?", ">", "matcher", ";", "if", "(", "item", "instanceof", "View", ")", "{", "matcher", "=", "loaded", "(", ")", ";", "}", "else", "if", "(", "ite...
Takes an object, and determines a condition for that object that should satisfy the containing view is loaded. Different conditions are made depending on the type of object. <table> <thead> <tr> <td>Type</td> <td>Method</td> </tr> </thead> <tbody> <tr> <td>{@link com.redhat.darcy.ui.api.View}</td> <td>{@link com.redhat.darcy.ui.api.View#isLoaded()}</td> </tr> <tr> <td>{@link com.redhat.darcy.ui.api.elements.Element}</td> <td>{@link com.redhat.darcy.ui.api.elements.Element#isDisplayed()}</td> </tr> <tr> <td>{@link com.redhat.darcy.ui.api.elements.Findable}</td> <td>{@link com.redhat.darcy.ui.api.elements.Findable#isPresent()}</td> </tr> </tbody> </table>
[ "Takes", "an", "object", "and", "determines", "a", "condition", "for", "that", "object", "that", "should", "satisfy", "the", "containing", "view", "is", "loaded", ".", "Different", "conditions", "are", "made", "depending", "on", "the", "type", "of", "object", ...
ae0d89a1ca45f8257ef2764a01e4cfe68f432e33
https://github.com/darcy-framework/darcy-ui/blob/ae0d89a1ca45f8257ef2764a01e4cfe68f432e33/src/main/java/com/redhat/darcy/ui/matchers/LoadConditionMatcher.java#L80-L92
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/web/rest/RsJsServices.java
RsJsServices.getClassnameFromProxy
String getClassnameFromProxy(Object dataservice) { String ds = dataservice.toString(); return getClassnameFromProxyname(ds); }
java
String getClassnameFromProxy(Object dataservice) { String ds = dataservice.toString(); return getClassnameFromProxyname(ds); }
[ "String", "getClassnameFromProxy", "(", "Object", "dataservice", ")", "{", "String", "ds", "=", "dataservice", ".", "toString", "(", ")", ";", "return", "getClassnameFromProxyname", "(", "ds", ")", ";", "}" ]
Return classname from proxy instance @param dataservice @return
[ "Return", "classname", "from", "proxy", "instance" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/web/rest/RsJsServices.java#L80-L83
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/web/rest/RsJsServices.java
RsJsServices.getClassnameFromProxyname
String getClassnameFromProxyname(String proxyname) { Pattern pattern = Pattern.compile("[@$]"); Matcher matcher = pattern.matcher(proxyname); matcher.find(); matcher.start(); return proxyname.substring(0, matcher.start()); }
java
String getClassnameFromProxyname(String proxyname) { Pattern pattern = Pattern.compile("[@$]"); Matcher matcher = pattern.matcher(proxyname); matcher.find(); matcher.start(); return proxyname.substring(0, matcher.start()); }
[ "String", "getClassnameFromProxyname", "(", "String", "proxyname", ")", "{", "Pattern", "pattern", "=", "Pattern", ".", "compile", "(", "\"[@$]\"", ")", ";", "Matcher", "matcher", "=", "pattern", ".", "matcher", "(", "proxyname", ")", ";", "matcher", ".", "f...
Return classname from proxyname @param dataservice @return
[ "Return", "classname", "from", "proxyname" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/web/rest/RsJsServices.java#L91-L97
train
italiangrid/voms-api-java
src/main/java/org/italiangrid/voms/util/CertificateValidatorBuilder.java
CertificateValidatorBuilder.buildCertificateValidator
public static X509CertChainValidatorExt buildCertificateValidator() { return buildCertificateValidator( DefaultVOMSValidator.DEFAULT_TRUST_ANCHORS_DIR, null, null, 0L, DEFAULT_NS_CHECKS, DEFAULT_CRL_CHECKS, DEFAULT_OCSP_CHECKS); }
java
public static X509CertChainValidatorExt buildCertificateValidator() { return buildCertificateValidator( DefaultVOMSValidator.DEFAULT_TRUST_ANCHORS_DIR, null, null, 0L, DEFAULT_NS_CHECKS, DEFAULT_CRL_CHECKS, DEFAULT_OCSP_CHECKS); }
[ "public", "static", "X509CertChainValidatorExt", "buildCertificateValidator", "(", ")", "{", "return", "buildCertificateValidator", "(", "DefaultVOMSValidator", ".", "DEFAULT_TRUST_ANCHORS_DIR", ",", "null", ",", "null", ",", "0L", ",", "DEFAULT_NS_CHECKS", ",", "DEFAULT_...
Builds an Openssl-style certificate validator. @return an Openssl-style certificate validator configured as specified in the parameters @deprecated Create a {@link CertificateValidatorBuilder} object instead.
[ "Builds", "an", "Openssl", "-", "style", "certificate", "validator", "." ]
b33d6cf98ca9449bed87b1cc307d411514589deb
https://github.com/italiangrid/voms-api-java/blob/b33d6cf98ca9449bed87b1cc307d411514589deb/src/main/java/org/italiangrid/voms/util/CertificateValidatorBuilder.java#L541-L546
train
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorImg.java
ColorImg.getIndexOfMaxValue
public int getIndexOfMaxValue(int channel){ double[] values = getData()[channel]; int index = 0; double val = values[index]; for(int i = 1; i < numValues(); i++){ if(values[i] > val){ index = i; val = values[index]; } } return index; }
java
public int getIndexOfMaxValue(int channel){ double[] values = getData()[channel]; int index = 0; double val = values[index]; for(int i = 1; i < numValues(); i++){ if(values[i] > val){ index = i; val = values[index]; } } return index; }
[ "public", "int", "getIndexOfMaxValue", "(", "int", "channel", ")", "{", "double", "[", "]", "values", "=", "getData", "(", ")", "[", "channel", "]", ";", "int", "index", "=", "0", ";", "double", "val", "=", "values", "[", "index", "]", ";", "for", ...
Returns the index of the maximum value of the specified channel. @param channel one of {@link #channel_r},{@link #channel_g},{@link #channel_b},{@link #channel_a} (0,1,2,3) @return index of maximum value of specified channel @throws ArrayIndexOutOfBoundsException if the specified channel is not in [0,3] or is 3 but the image has no alpha (check using {@link #hasAlpha()}). @see #getIndexOfMaxValue(int) @see #getIndexOfMinValue(int) @see #getMaxValue(int) @see #getMinValue(int)
[ "Returns", "the", "index", "of", "the", "maximum", "value", "of", "the", "specified", "channel", "." ]
3837c7d550a12cf4dc5718b644ced94b97f52668
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorImg.java#L582-L593
train
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorImg.java
ColorImg.getIndexOfMinValue
public int getIndexOfMinValue(int channel){ double[] values = getData()[channel]; int index = 0; double val = values[index]; for(int i = 1; i < numValues(); i++){ if(values[i] < val){ index = i; val = values[index]; } } return index; }
java
public int getIndexOfMinValue(int channel){ double[] values = getData()[channel]; int index = 0; double val = values[index]; for(int i = 1; i < numValues(); i++){ if(values[i] < val){ index = i; val = values[index]; } } return index; }
[ "public", "int", "getIndexOfMinValue", "(", "int", "channel", ")", "{", "double", "[", "]", "values", "=", "getData", "(", ")", "[", "channel", "]", ";", "int", "index", "=", "0", ";", "double", "val", "=", "values", "[", "index", "]", ";", "for", ...
Returns the index of the minimum value of the specified channel. @param channel one of {@link #channel_r},{@link #channel_g},{@link #channel_b},{@link #channel_a} (0,1,2,3) @return index of minimum value of specified channel @throws ArrayIndexOutOfBoundsException if the specified channel is not in [0,3] or is 3 but the image has no alpha (check using {@link #hasAlpha()}). @see #getIndexOfMaxValue(int) @see #getIndexOfMinValue(int) @see #getMaxValue(int) @see #getMinValue(int)
[ "Returns", "the", "index", "of", "the", "minimum", "value", "of", "the", "specified", "channel", "." ]
3837c7d550a12cf4dc5718b644ced94b97f52668
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorImg.java#L621-L632
train
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorImg.java
ColorImg.setValue
public void setValue(final int channel, final int x, final int y, final double value){ this.data[channel][y*this.width + x] = value; }
java
public void setValue(final int channel, final int x, final int y, final double value){ this.data[channel][y*this.width + x] = value; }
[ "public", "void", "setValue", "(", "final", "int", "channel", ",", "final", "int", "x", ",", "final", "int", "y", ",", "final", "double", "value", ")", "{", "this", ".", "data", "[", "channel", "]", "[", "y", "*", "this", ".", "width", "+", "x", ...
Sets value at the specified position for the specified channel. No bounds checks will be performed, positions outside of this images dimension can either result in a value for a different position or an ArrayIndexOutOfBoundsException. @param channel the set value corresponds to @param x coordinate @param y coordinate @param value to be set at specified position. e.g. 0xff0000ff for blue color @throws ArrayIndexOutOfBoundsException if resulting index from x and y is not within the data arrays bounds or if the specified channel is not in [0,3] or is 3 but the image has no alpha (check using {@link #hasAlpha()}). @see #getValue(int channel, int x, int y)
[ "Sets", "value", "at", "the", "specified", "position", "for", "the", "specified", "channel", ".", "No", "bounds", "checks", "will", "be", "performed", "positions", "outside", "of", "this", "images", "dimension", "can", "either", "result", "in", "a", "value", ...
3837c7d550a12cf4dc5718b644ced94b97f52668
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorImg.java#L946-L948
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/core/mtc/RSMonitorDecorator.java
RSMonitorDecorator.isMonitored
boolean isMonitored(HttpSession session) { boolean monitor = false; if (null != session && session.getAttribute(Constants.Options.OPTIONS) != null) { monitor = ((Options) session.getAttribute(Constants.Options.OPTIONS)).isMonitor(); } return monitor; }
java
boolean isMonitored(HttpSession session) { boolean monitor = false; if (null != session && session.getAttribute(Constants.Options.OPTIONS) != null) { monitor = ((Options) session.getAttribute(Constants.Options.OPTIONS)).isMonitor(); } return monitor; }
[ "boolean", "isMonitored", "(", "HttpSession", "session", ")", "{", "boolean", "monitor", "=", "false", ";", "if", "(", "null", "!=", "session", "&&", "session", ".", "getAttribute", "(", "Constants", ".", "Options", ".", "OPTIONS", ")", "!=", "null", ")", ...
determine if request is monitored @param session @return
[ "determine", "if", "request", "is", "monitored" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/core/mtc/RSMonitorDecorator.java#L42-L48
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/messageControl/MessageControllerCache.java
MessageControllerCache.saveToCache
public void saveToCache(String topic, Class<? extends JsTopicMessageController> cls) { if(null != topic && null != cls) { messageControllers.put(topic, cls); } }
java
public void saveToCache(String topic, Class<? extends JsTopicMessageController> cls) { if(null != topic && null != cls) { messageControllers.put(topic, cls); } }
[ "public", "void", "saveToCache", "(", "String", "topic", ",", "Class", "<", "?", "extends", "JsTopicMessageController", ">", "cls", ")", "{", "if", "(", "null", "!=", "topic", "&&", "null", "!=", "cls", ")", "{", "messageControllers", ".", "put", "(", "t...
Save messageController Factory for topic @param topic @param cls
[ "Save", "messageController", "Factory", "for", "topic" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/messageControl/MessageControllerCache.java#L32-L36
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/messageControl/MessageControllerCache.java
MessageControllerCache.loadFromCache
public JsTopicMessageController loadFromCache(String topic) { if(null == topic) { return null; } if(messageControllers.containsKey(topic)) { Instance<? extends JsTopicMessageController> instances = getInstances(messageControllers.get(topic)); if(!instances.isUnsatisfied()) { return instances.get(); } } return null; }
java
public JsTopicMessageController loadFromCache(String topic) { if(null == topic) { return null; } if(messageControllers.containsKey(topic)) { Instance<? extends JsTopicMessageController> instances = getInstances(messageControllers.get(topic)); if(!instances.isUnsatisfied()) { return instances.get(); } } return null; }
[ "public", "JsTopicMessageController", "loadFromCache", "(", "String", "topic", ")", "{", "if", "(", "null", "==", "topic", ")", "{", "return", "null", ";", "}", "if", "(", "messageControllers", ".", "containsKey", "(", "topic", ")", ")", "{", "Instance", "...
Get CDI instance messageController from cache @param topic @return
[ "Get", "CDI", "instance", "messageController", "from", "cache" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/messageControl/MessageControllerCache.java#L43-L54
train
dkpro/dkpro-statistics
dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/unitizing/UnitizingAnnotationStudy.java
UnitizingAnnotationStudy.findNextUnit
public static IUnitizingAnnotationUnit findNextUnit( final Iterator<IUnitizingAnnotationUnit> units, int raterIdx) { return findNextUnit(units, raterIdx, null); }
java
public static IUnitizingAnnotationUnit findNextUnit( final Iterator<IUnitizingAnnotationUnit> units, int raterIdx) { return findNextUnit(units, raterIdx, null); }
[ "public", "static", "IUnitizingAnnotationUnit", "findNextUnit", "(", "final", "Iterator", "<", "IUnitizingAnnotationUnit", ">", "units", ",", "int", "raterIdx", ")", "{", "return", "findNextUnit", "(", "units", ",", "raterIdx", ",", "null", ")", ";", "}" ]
Utility method for moving on the cursor of the given iterator until a unit of the specified rater is returned.
[ "Utility", "method", "for", "moving", "on", "the", "cursor", "of", "the", "given", "iterator", "until", "a", "unit", "of", "the", "specified", "rater", "is", "returned", "." ]
0b0e93dc49223984964411cbc6df420ba796a8cb
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/unitizing/UnitizingAnnotationStudy.java#L120-L123
train
dkpro/dkpro-statistics
dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/unitizing/UnitizingAnnotationStudy.java
UnitizingAnnotationStudy.findNextUnit
public static IUnitizingAnnotationUnit findNextUnit( final Iterator<IUnitizingAnnotationUnit> units, final Object category) { return findNextUnit(units, -1, category); }
java
public static IUnitizingAnnotationUnit findNextUnit( final Iterator<IUnitizingAnnotationUnit> units, final Object category) { return findNextUnit(units, -1, category); }
[ "public", "static", "IUnitizingAnnotationUnit", "findNextUnit", "(", "final", "Iterator", "<", "IUnitizingAnnotationUnit", ">", "units", ",", "final", "Object", "category", ")", "{", "return", "findNextUnit", "(", "units", ",", "-", "1", ",", "category", ")", ";...
Utility method for moving on the cursor of the given iterator until a unit of the specified category is returned.
[ "Utility", "method", "for", "moving", "on", "the", "cursor", "of", "the", "given", "iterator", "until", "a", "unit", "of", "the", "specified", "category", "is", "returned", "." ]
0b0e93dc49223984964411cbc6df420ba796a8cb
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/unitizing/UnitizingAnnotationStudy.java#L127-L130
train
dkpro/dkpro-statistics
dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/unitizing/UnitizingAnnotationStudy.java
UnitizingAnnotationStudy.findNextUnit
public static IUnitizingAnnotationUnit findNextUnit( final Iterator<IUnitizingAnnotationUnit> units, int raterIdx, final Object category) { while (units.hasNext()) { IUnitizingAnnotationUnit result = units.next(); if (category != null && !category.equals(result.getCategory())) { continue; } if (raterIdx < 0 || result.getRaterIdx() == raterIdx) { return result; } } return null; }
java
public static IUnitizingAnnotationUnit findNextUnit( final Iterator<IUnitizingAnnotationUnit> units, int raterIdx, final Object category) { while (units.hasNext()) { IUnitizingAnnotationUnit result = units.next(); if (category != null && !category.equals(result.getCategory())) { continue; } if (raterIdx < 0 || result.getRaterIdx() == raterIdx) { return result; } } return null; }
[ "public", "static", "IUnitizingAnnotationUnit", "findNextUnit", "(", "final", "Iterator", "<", "IUnitizingAnnotationUnit", ">", "units", ",", "int", "raterIdx", ",", "final", "Object", "category", ")", "{", "while", "(", "units", ".", "hasNext", "(", ")", ")", ...
Utility method for moving on the cursor of the given iterator until a unit of the specified rater and category is returned. Both the rater index and the category may be null if those filter conditions are to be ignored.
[ "Utility", "method", "for", "moving", "on", "the", "cursor", "of", "the", "given", "iterator", "until", "a", "unit", "of", "the", "specified", "rater", "and", "category", "is", "returned", ".", "Both", "the", "rater", "index", "and", "the", "category", "ma...
0b0e93dc49223984964411cbc6df420ba796a8cb
https://github.com/dkpro/dkpro-statistics/blob/0b0e93dc49223984964411cbc6df420ba796a8cb/dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/unitizing/UnitizingAnnotationStudy.java#L136-L149
train
cortical-io/java-client-sdk
retina-service-java-api-client/src/main/java/io/cortical/services/api/client/ApiInvoker.java
ApiInvoker.deserialize
public static Object deserialize(String json, String containerType, Class cls, NestedContent nestedContent) throws ApiException { try{ if(("List".equals(containerType) || "Array".equals(containerType)) && nestedContent != null){ if(NestedContent.CONTEXT.equals(nestedContent)){ JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructFromCanonical("java.util.List<java.util.List<io.cortical.rest.model.Context>>"); Object response = (java.lang.Object) JsonUtil.getJsonMapper().readValue(json, typeInfo); return response; }else if(NestedContent.TERM.equals(nestedContent)){ JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructFromCanonical("java.util.List<java.util.List<io.cortical.rest.model.Term>>"); Object response = (java.lang.Object) JsonUtil.getJsonMapper().readValue(json, typeInfo); return response; }else{ return null; } } else if("List".equals(containerType) || "Array".equals(containerType)) { JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructCollectionType(List.class, cls); List response = (List<?>) JsonUtil.getJsonMapper().readValue(json, typeInfo); return response; } else if(String.class.equals(cls)) { if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1) return json.substring(1, json.length() - 2); else return json; } else { return JsonUtil.getJsonMapper().readValue(json, cls); } } catch (IOException e) { throw new ApiException(500, e.getMessage()); } }
java
public static Object deserialize(String json, String containerType, Class cls, NestedContent nestedContent) throws ApiException { try{ if(("List".equals(containerType) || "Array".equals(containerType)) && nestedContent != null){ if(NestedContent.CONTEXT.equals(nestedContent)){ JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructFromCanonical("java.util.List<java.util.List<io.cortical.rest.model.Context>>"); Object response = (java.lang.Object) JsonUtil.getJsonMapper().readValue(json, typeInfo); return response; }else if(NestedContent.TERM.equals(nestedContent)){ JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructFromCanonical("java.util.List<java.util.List<io.cortical.rest.model.Term>>"); Object response = (java.lang.Object) JsonUtil.getJsonMapper().readValue(json, typeInfo); return response; }else{ return null; } } else if("List".equals(containerType) || "Array".equals(containerType)) { JavaType typeInfo = JsonUtil.getJsonMapper().getTypeFactory().constructCollectionType(List.class, cls); List response = (List<?>) JsonUtil.getJsonMapper().readValue(json, typeInfo); return response; } else if(String.class.equals(cls)) { if(json != null && json.startsWith("\"") && json.endsWith("\"") && json.length() > 1) return json.substring(1, json.length() - 2); else return json; } else { return JsonUtil.getJsonMapper().readValue(json, cls); } } catch (IOException e) { throw new ApiException(500, e.getMessage()); } }
[ "public", "static", "Object", "deserialize", "(", "String", "json", ",", "String", "containerType", ",", "Class", "cls", ",", "NestedContent", "nestedContent", ")", "throws", "ApiException", "{", "try", "{", "if", "(", "(", "\"List\"", ".", "equals", "(", "c...
Deserialize a received response String. @param json the received json String @param containerType the containerType @param cls the class of the object @param nestedContent contains the name of the Pojo, contained in a List of Lists. <code>null</code> if no nested content is present. @throws APIException if an exception occurs during deserialization
[ "Deserialize", "a", "received", "response", "String", "." ]
7a1ee811cd7c221690dc0a7e643c286c56cab921
https://github.com/cortical-io/java-client-sdk/blob/7a1ee811cd7c221690dc0a7e643c286c56cab921/retina-service-java-api-client/src/main/java/io/cortical/services/api/client/ApiInvoker.java#L66-L101
train
ocelotds/ocelot
ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java
TopicAccessManager.checkAccessTopic
public void checkAccessTopic(UserContext ctx, String topic) throws IllegalAccessException { boolean tacPresent0 = checkAccessTopicGlobalAC(ctx, topic); boolean tacPresent1 = checkAccessTopicFromJsTopicControl(ctx, topic); boolean tacPresent2 = checkAccessTopicFromJsTopicControls(ctx, topic); if (logger.isDebugEnabled() && !(tacPresent0 | tacPresent1 | tacPresent2)) { logger.debug("No '{}' access control found in project, add {} implementation annotated with {}({}) in your project for add subscription security.", topic, JsTopicAccessController.class, JsTopicControl.class, topic); } }
java
public void checkAccessTopic(UserContext ctx, String topic) throws IllegalAccessException { boolean tacPresent0 = checkAccessTopicGlobalAC(ctx, topic); boolean tacPresent1 = checkAccessTopicFromJsTopicControl(ctx, topic); boolean tacPresent2 = checkAccessTopicFromJsTopicControls(ctx, topic); if (logger.isDebugEnabled() && !(tacPresent0 | tacPresent1 | tacPresent2)) { logger.debug("No '{}' access control found in project, add {} implementation annotated with {}({}) in your project for add subscription security.", topic, JsTopicAccessController.class, JsTopicControl.class, topic); } }
[ "public", "void", "checkAccessTopic", "(", "UserContext", "ctx", ",", "String", "topic", ")", "throws", "IllegalAccessException", "{", "boolean", "tacPresent0", "=", "checkAccessTopicGlobalAC", "(", "ctx", ",", "topic", ")", ";", "boolean", "tacPresent1", "=", "ch...
Process Access Topic Controller @param ctx @param topic @throws IllegalAccessException
[ "Process", "Access", "Topic", "Controller" ]
5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-web/src/main/java/org/ocelotds/topic/topicAccess/TopicAccessManager.java#L51-L58
train