repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
Whiley/WhileyCompiler
src/main/java/wyil/type/util/ConcreteTypeExtractor.java
ConcreteTypeExtractor.apply
@Override public Type apply(SemanticType type, LifetimeRelation lifetimes) { switch (type.getOpcode()) { case SEMTYPE_array: return apply((SemanticType.Array) type, lifetimes); case SEMTYPE_reference: case SEMTYPE_staticreference: return apply((SemanticType.Reference) type, lifetimes); case SEMTYPE_record: return apply((SemanticType.Record) type, lifetimes); case SEMTYPE_union: return apply((SemanticType.Union) type, lifetimes); case SEMTYPE_intersection: return apply((SemanticType.Intersection) type, lifetimes); case SEMTYPE_difference: return apply((SemanticType.Difference) type, lifetimes); default: // NOTE: all other cases are already instances of Type return (Type) type; } }
java
@Override public Type apply(SemanticType type, LifetimeRelation lifetimes) { switch (type.getOpcode()) { case SEMTYPE_array: return apply((SemanticType.Array) type, lifetimes); case SEMTYPE_reference: case SEMTYPE_staticreference: return apply((SemanticType.Reference) type, lifetimes); case SEMTYPE_record: return apply((SemanticType.Record) type, lifetimes); case SEMTYPE_union: return apply((SemanticType.Union) type, lifetimes); case SEMTYPE_intersection: return apply((SemanticType.Intersection) type, lifetimes); case SEMTYPE_difference: return apply((SemanticType.Difference) type, lifetimes); default: // NOTE: all other cases are already instances of Type return (Type) type; } }
[ "@", "Override", "public", "Type", "apply", "(", "SemanticType", "type", ",", "LifetimeRelation", "lifetimes", ")", "{", "switch", "(", "type", ".", "getOpcode", "(", ")", ")", "{", "case", "SEMTYPE_array", ":", "return", "apply", "(", "(", "SemanticType", ...
Extract an instance of <code>Type</code> from <code>SemanticType</code> which is the best possible approximation. @param type The semantic type being converted into a concrete type. @return
[ "Extract", "an", "instance", "of", "<code", ">", "Type<", "/", "code", ">", "from", "<code", ">", "SemanticType<", "/", "code", ">", "which", "is", "the", "best", "possible", "approximation", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/type/util/ConcreteTypeExtractor.java#L83-L103
Impetus/Kundera
src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBDataHandler.java
KuduDBDataHandler.getEqualComparisonPredicate
public static KuduPredicate getEqualComparisonPredicate(ColumnSchema column, Type type, Object key) { return getPredicate(column, KuduPredicate.ComparisonOp.EQUAL, type, key); }
java
public static KuduPredicate getEqualComparisonPredicate(ColumnSchema column, Type type, Object key) { return getPredicate(column, KuduPredicate.ComparisonOp.EQUAL, type, key); }
[ "public", "static", "KuduPredicate", "getEqualComparisonPredicate", "(", "ColumnSchema", "column", ",", "Type", "type", ",", "Object", "key", ")", "{", "return", "getPredicate", "(", "column", ",", "KuduPredicate", ".", "ComparisonOp", ".", "EQUAL", ",", "type", ...
Gets the equal comparison predicate. @param column the column @param type the type @param key the key @return the equal comparison predicate
[ "Gets", "the", "equal", "comparison", "predicate", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-kudu/src/main/java/com/impetus/client/kudu/KuduDBDataHandler.java#L168-L172
noties/Handle
handle-library/src/main/java/ru/noties/handle/Handle.java
Handle.postAtTime
public static void postAtTime(Object what, long uptimeMillis) { Handle.getInstance().mHandler.postAtTime(what, uptimeMillis); }
java
public static void postAtTime(Object what, long uptimeMillis) { Handle.getInstance().mHandler.postAtTime(what, uptimeMillis); }
[ "public", "static", "void", "postAtTime", "(", "Object", "what", ",", "long", "uptimeMillis", ")", "{", "Handle", ".", "getInstance", "(", ")", ".", "mHandler", ".", "postAtTime", "(", "what", ",", "uptimeMillis", ")", ";", "}" ]
The same as {@link #post(Object)} but with a time when this event should be delivered @see SystemClock#elapsedRealtime() @see #post(Object) @param what an Object to be queued @param uptimeMillis the time when this event should be delivered
[ "The", "same", "as", "{" ]
train
https://github.com/noties/Handle/blob/257c5e71334ce442b5c55b50bae6d5ae3a667ab9/handle-library/src/main/java/ru/noties/handle/Handle.java#L135-L137
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/MappedField.java
MappedField.setFieldValue
public void setFieldValue(final Object instance, final Object value) { try { field.set(instance, value); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
java
public void setFieldValue(final Object instance, final Object value) { try { field.set(instance, value); } catch (IllegalAccessException e) { throw new RuntimeException(e); } }
[ "public", "void", "setFieldValue", "(", "final", "Object", "instance", ",", "final", "Object", "value", ")", "{", "try", "{", "field", ".", "set", "(", "instance", ",", "value", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw...
Sets the value for the java field @param instance the instance to update @param value the value to set
[ "Sets", "the", "value", "for", "the", "java", "field" ]
train
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/MappedField.java#L450-L456
OpenLiberty/open-liberty
dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/IndirectJndiLookupObjectFactory.java
IndirectJndiLookupObjectFactory.getJNDIServiceObjectInstance
@FFDCIgnore(PrivilegedActionException.class) private Object getJNDIServiceObjectInstance(final String className, final String bindingName, final Hashtable<?, ?> envmt) throws Exception { try { return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { return getJNDIServiceObjectInstancePrivileged(className, bindingName, envmt); } }); } catch (PrivilegedActionException paex) { Throwable cause = paex.getCause(); if (cause instanceof Exception) { throw (Exception) cause; } throw new Error(cause); } }
java
@FFDCIgnore(PrivilegedActionException.class) private Object getJNDIServiceObjectInstance(final String className, final String bindingName, final Hashtable<?, ?> envmt) throws Exception { try { return AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { return getJNDIServiceObjectInstancePrivileged(className, bindingName, envmt); } }); } catch (PrivilegedActionException paex) { Throwable cause = paex.getCause(); if (cause instanceof Exception) { throw (Exception) cause; } throw new Error(cause); } }
[ "@", "FFDCIgnore", "(", "PrivilegedActionException", ".", "class", ")", "private", "Object", "getJNDIServiceObjectInstance", "(", "final", "String", "className", ",", "final", "String", "bindingName", ",", "final", "Hashtable", "<", "?", ",", "?", ">", "envmt", ...
Try to get an object instance by looking in the OSGi service registry similar to how /com.ibm.ws.jndi/ implements the default namespace. @return the object instance, or null if an object could not be found
[ "Try", "to", "get", "an", "object", "instance", "by", "looking", "in", "the", "OSGi", "service", "registry", "similar", "to", "how", "/", "com", ".", "ibm", ".", "ws", ".", "jndi", "/", "implements", "the", "default", "namespace", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.injection/src/com/ibm/ws/injectionengine/osgi/internal/IndirectJndiLookupObjectFactory.java#L213-L229
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/ClassHelper.java
ClassHelper.newInstance
public static Object newInstance(Class target, Class[] types, Object[] args) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { return newInstance(target, types, args, false); }
java
public static Object newInstance(Class target, Class[] types, Object[] args) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { return newInstance(target, types, args, false); }
[ "public", "static", "Object", "newInstance", "(", "Class", "target", ",", "Class", "[", "]", "types", ",", "Object", "[", "]", "args", ")", "throws", "InstantiationException", ",", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTargetExce...
Returns a new instance of the given class, using the constructor with the specified parameter types. @param target The class to instantiate @param types The parameter types @param args The arguments @return The instance
[ "Returns", "a", "new", "instance", "of", "the", "given", "class", "using", "the", "constructor", "with", "the", "specified", "parameter", "types", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/ClassHelper.java#L180-L188
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/JobTracker.java
JobTracker.addJob
protected synchronized JobStatus addJob(JobID jobId, JobInProgress job) { totalSubmissions++; synchronized (jobs) { synchronized (taskScheduler) { jobs.put(job.getProfile().getJobID(), job); for (JobInProgressListener listener : jobInProgressListeners) { try { listener.jobAdded(job); } catch (IOException ioe) { LOG.warn("Failed to add and so skipping the job : " + job.getJobID() + ". Exception : " + ioe); } } } } myInstrumentation.submitJob(job.getJobConf(), jobId); String jobName = job.getJobConf().getJobName(); int jobNameLen = 64; if (jobName.length() > jobNameLen) { jobName = jobName.substring(0, jobNameLen); // Truncate for logging. } LOG.info("Job " + jobId + "(" + jobName + ") added successfully for user '" + job.getJobConf().getUser() + "' to queue '" + job.getJobConf().getQueueName() + "'" + ", source " + job.getJobConf().getJobSource()); return job.getStatus(); }
java
protected synchronized JobStatus addJob(JobID jobId, JobInProgress job) { totalSubmissions++; synchronized (jobs) { synchronized (taskScheduler) { jobs.put(job.getProfile().getJobID(), job); for (JobInProgressListener listener : jobInProgressListeners) { try { listener.jobAdded(job); } catch (IOException ioe) { LOG.warn("Failed to add and so skipping the job : " + job.getJobID() + ". Exception : " + ioe); } } } } myInstrumentation.submitJob(job.getJobConf(), jobId); String jobName = job.getJobConf().getJobName(); int jobNameLen = 64; if (jobName.length() > jobNameLen) { jobName = jobName.substring(0, jobNameLen); // Truncate for logging. } LOG.info("Job " + jobId + "(" + jobName + ") added successfully for user '" + job.getJobConf().getUser() + "' to queue '" + job.getJobConf().getQueueName() + "'" + ", source " + job.getJobConf().getJobSource()); return job.getStatus(); }
[ "protected", "synchronized", "JobStatus", "addJob", "(", "JobID", "jobId", ",", "JobInProgress", "job", ")", "{", "totalSubmissions", "++", ";", "synchronized", "(", "jobs", ")", "{", "synchronized", "(", "taskScheduler", ")", "{", "jobs", ".", "put", "(", "...
Adds a job to the jobtracker. Make sure that the checks are inplace before adding a job. This is the core job submission logic @param jobId The id for the job submitted which needs to be added
[ "Adds", "a", "job", "to", "the", "jobtracker", ".", "Make", "sure", "that", "the", "checks", "are", "inplace", "before", "adding", "a", "job", ".", "This", "is", "the", "core", "job", "submission", "logic" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/JobTracker.java#L3173-L3200
apache/incubator-atlas
client/src/main/java/org/apache/atlas/AtlasClient.java
AtlasClient.getEntityAuditEvents
public List<EntityAuditEvent> getEntityAuditEvents(String entityId, short numResults) throws AtlasServiceException { return getEntityAuditEvents(entityId, null, numResults); }
java
public List<EntityAuditEvent> getEntityAuditEvents(String entityId, short numResults) throws AtlasServiceException { return getEntityAuditEvents(entityId, null, numResults); }
[ "public", "List", "<", "EntityAuditEvent", ">", "getEntityAuditEvents", "(", "String", "entityId", ",", "short", "numResults", ")", "throws", "AtlasServiceException", "{", "return", "getEntityAuditEvents", "(", "entityId", ",", "null", ",", "numResults", ")", ";", ...
Get the latest numResults entity audit events in decreasing order of timestamp for the given entity id @param entityId entity id @param numResults number of results to be returned @return list of audit events for the entity id @throws AtlasServiceException
[ "Get", "the", "latest", "numResults", "entity", "audit", "events", "in", "decreasing", "order", "of", "timestamp", "for", "the", "given", "entity", "id" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/client/src/main/java/org/apache/atlas/AtlasClient.java#L774-L777
zutnop/telekom-workflow-engine
telekom-workflow-engine/src/main/java/ee/telekom/workflow/graph/node/gateway/AbstractConditionalGateway.java
AbstractConditionalGateway.addCondition
public void addCondition( Condition condition, String transitionName ){ conditions.add( Pair.of( condition, transitionName ) ); }
java
public void addCondition( Condition condition, String transitionName ){ conditions.add( Pair.of( condition, transitionName ) ); }
[ "public", "void", "addCondition", "(", "Condition", "condition", ",", "String", "transitionName", ")", "{", "conditions", ".", "add", "(", "Pair", ".", "of", "(", "condition", ",", "transitionName", ")", ")", ";", "}" ]
A <code>null</code> condition is interpreted as a <i>default</i> condition.
[ "A", "<code", ">", "null<", "/", "code", ">", "condition", "is", "interpreted", "as", "a", "<i", ">", "default<", "/", "i", ">", "condition", "." ]
train
https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/graph/node/gateway/AbstractConditionalGateway.java#L33-L35
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java
MicroWriter.getNodeAsString
@Nullable public static String getNodeAsString (@Nonnull final IMicroNode aNode) { return getNodeAsString (aNode, XMLWriterSettings.DEFAULT_XML_SETTINGS); }
java
@Nullable public static String getNodeAsString (@Nonnull final IMicroNode aNode) { return getNodeAsString (aNode, XMLWriterSettings.DEFAULT_XML_SETTINGS); }
[ "@", "Nullable", "public", "static", "String", "getNodeAsString", "(", "@", "Nonnull", "final", "IMicroNode", "aNode", ")", "{", "return", "getNodeAsString", "(", "aNode", ",", "XMLWriterSettings", ".", "DEFAULT_XML_SETTINGS", ")", ";", "}" ]
Convert the passed micro node to an XML string using {@link XMLWriterSettings#DEFAULT_XML_SETTINGS}. This is a specialized version of {@link #getNodeAsString(IMicroNode, IXMLWriterSettings)}. @param aNode The node to be converted to a string. May not be <code>null</code> . @return The string representation of the passed node. @since 8.6.3
[ "Convert", "the", "passed", "micro", "node", "to", "an", "XML", "string", "using", "{", "@link", "XMLWriterSettings#DEFAULT_XML_SETTINGS", "}", ".", "This", "is", "a", "specialized", "version", "of", "{", "@link", "#getNodeAsString", "(", "IMicroNode", "IXMLWriter...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/microdom/serialize/MicroWriter.java#L292-L296
crawljax/crawljax
core/src/main/java/com/crawljax/browser/WebDriverBackedEmbeddedBrowser.java
WebDriverBackedEmbeddedBrowser.fireEventWait
private boolean fireEventWait(WebElement webElement, Eventable eventable) throws ElementNotVisibleException, InterruptedException { switch (eventable.getEventType()) { case click: try { webElement.click(); } catch (ElementNotVisibleException e) { throw e; } catch (WebDriverException e) { throwIfConnectionException(e); return false; } break; case hover: LOGGER.info("EventType hover called but this isn't implemented yet"); break; default: LOGGER.info("EventType {} not supported in WebDriver.", eventable.getEventType()); return false; } Thread.sleep(this.crawlWaitEvent); return true; }
java
private boolean fireEventWait(WebElement webElement, Eventable eventable) throws ElementNotVisibleException, InterruptedException { switch (eventable.getEventType()) { case click: try { webElement.click(); } catch (ElementNotVisibleException e) { throw e; } catch (WebDriverException e) { throwIfConnectionException(e); return false; } break; case hover: LOGGER.info("EventType hover called but this isn't implemented yet"); break; default: LOGGER.info("EventType {} not supported in WebDriver.", eventable.getEventType()); return false; } Thread.sleep(this.crawlWaitEvent); return true; }
[ "private", "boolean", "fireEventWait", "(", "WebElement", "webElement", ",", "Eventable", "eventable", ")", "throws", "ElementNotVisibleException", ",", "InterruptedException", "{", "switch", "(", "eventable", ".", "getEventType", "(", ")", ")", "{", "case", "click"...
Fires the event and waits for a specified time. @param webElement the element to fire event on. @param eventable The HTML event type (onclick, onmouseover, ...). @return true if firing event is successful. @throws InterruptedException when interrupted during the wait.
[ "Fires", "the", "event", "and", "waits", "for", "a", "specified", "time", "." ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/browser/WebDriverBackedEmbeddedBrowser.java#L288-L311
line/armeria
grpc/src/main/java/com/linecorp/armeria/internal/grpc/GrpcLogUtil.java
GrpcLogUtil.rpcRequest
public static RpcRequest rpcRequest(MethodDescriptor<?, ?> method, Object message) { // We don't actually use the RpcRequest for request processing since it doesn't fit well with streaming. // We still populate it with a reasonable method name for use in logging. The service type is currently // arbitrarily set as gRPC doesn't use Class<?> to represent services - if this becomes a problem, we // would need to refactor it to take a Object instead. return RpcRequest.of(GrpcLogUtil.class, method.getFullMethodName(), message); }
java
public static RpcRequest rpcRequest(MethodDescriptor<?, ?> method, Object message) { // We don't actually use the RpcRequest for request processing since it doesn't fit well with streaming. // We still populate it with a reasonable method name for use in logging. The service type is currently // arbitrarily set as gRPC doesn't use Class<?> to represent services - if this becomes a problem, we // would need to refactor it to take a Object instead. return RpcRequest.of(GrpcLogUtil.class, method.getFullMethodName(), message); }
[ "public", "static", "RpcRequest", "rpcRequest", "(", "MethodDescriptor", "<", "?", ",", "?", ">", "method", ",", "Object", "message", ")", "{", "// We don't actually use the RpcRequest for request processing since it doesn't fit well with streaming.", "// We still populate it wit...
Returns a {@link RpcRequest} corresponding to the given {@link MethodDescriptor}.
[ "Returns", "a", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/grpc/src/main/java/com/linecorp/armeria/internal/grpc/GrpcLogUtil.java#L43-L49
mozilla/rhino
src/org/mozilla/javascript/ScriptRuntime.java
ScriptRuntime.getObjectIndex
public static Object getObjectIndex(Object obj, double dblIndex, Context cx, Scriptable scope) { Scriptable sobj = toObjectOrNull(cx, obj, scope); if (sobj == null) { throw undefReadError(obj, toString(dblIndex)); } int index = (int)dblIndex; if (index == dblIndex) { return getObjectIndex(sobj, index, cx); } String s = toString(dblIndex); return getObjectProp(sobj, s, cx); }
java
public static Object getObjectIndex(Object obj, double dblIndex, Context cx, Scriptable scope) { Scriptable sobj = toObjectOrNull(cx, obj, scope); if (sobj == null) { throw undefReadError(obj, toString(dblIndex)); } int index = (int)dblIndex; if (index == dblIndex) { return getObjectIndex(sobj, index, cx); } String s = toString(dblIndex); return getObjectProp(sobj, s, cx); }
[ "public", "static", "Object", "getObjectIndex", "(", "Object", "obj", ",", "double", "dblIndex", ",", "Context", "cx", ",", "Scriptable", "scope", ")", "{", "Scriptable", "sobj", "=", "toObjectOrNull", "(", "cx", ",", "obj", ",", "scope", ")", ";", "if", ...
A cheaper and less general version of the above for well-known argument types.
[ "A", "cheaper", "and", "less", "general", "version", "of", "the", "above", "for", "well", "-", "known", "argument", "types", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptRuntime.java#L1642-L1656
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/ChangeObjects.java
ChangeObjects.changePolymerNotation
public final static void changePolymerNotation(int position, PolymerNotation polymer, HELM2Notation helm2notation) { helm2notation.getListOfPolymers().set(position, polymer); }
java
public final static void changePolymerNotation(int position, PolymerNotation polymer, HELM2Notation helm2notation) { helm2notation.getListOfPolymers().set(position, polymer); }
[ "public", "final", "static", "void", "changePolymerNotation", "(", "int", "position", ",", "PolymerNotation", "polymer", ",", "HELM2Notation", "helm2notation", ")", "{", "helm2notation", ".", "getListOfPolymers", "(", ")", ".", "set", "(", "position", ",", "polyme...
method to change the PolymerNotation at a specific position of the HELM2Notation @param position position of the PolymerNotation @param polymer new PolymerNotation @param helm2notation input HELM2Notation
[ "method", "to", "change", "the", "PolymerNotation", "at", "a", "specific", "position", "of", "the", "HELM2Notation" ]
train
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L380-L382
salesforce/Argus
ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/UserResources.java
UserResources.checkOauthAccess
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/check_oauth_access") @Description("Returns redirectURI based on whether this user has previously accepted the authorization page") public OAuthAcceptResponseDto checkOauthAccess(@Context HttpServletRequest req) { String userName=findUserByToken(req); int result = authService.countByUserId(userName); OAuthAcceptResponseDto responseDto = new OAuthAcceptResponseDto(); if (result==0) { throw new OAuthException(ResponseCodes.ERR_FINDING_USERNAME, HttpResponseStatus.BAD_REQUEST); } else { responseDto.setRedirectURI(applicationRedirectURI); return responseDto; } }
java
@GET @Produces(MediaType.APPLICATION_JSON) @Path("/check_oauth_access") @Description("Returns redirectURI based on whether this user has previously accepted the authorization page") public OAuthAcceptResponseDto checkOauthAccess(@Context HttpServletRequest req) { String userName=findUserByToken(req); int result = authService.countByUserId(userName); OAuthAcceptResponseDto responseDto = new OAuthAcceptResponseDto(); if (result==0) { throw new OAuthException(ResponseCodes.ERR_FINDING_USERNAME, HttpResponseStatus.BAD_REQUEST); } else { responseDto.setRedirectURI(applicationRedirectURI); return responseDto; } }
[ "@", "GET", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Path", "(", "\"/check_oauth_access\"", ")", "@", "Description", "(", "\"Returns redirectURI based on whether this user has previously accepted the authorization page\"", ")", "public", "OAuthAc...
Returns redirectURI based on whether this user has previously accepted the authorization page @param req The Http Request with authorization header @return Returns either redirectURI or OauthException
[ "Returns", "redirectURI", "based", "on", "whether", "this", "user", "has", "previously", "accepted", "the", "authorization", "page" ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/UserResources.java#L388-L403
beihaifeiwu/dolphin
dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java
AnnotationUtils.getValue
public static Object getValue(Annotation annotation, String attributeName) { if (annotation == null || !StringUtils.hasLength(attributeName)) { return null; } try { Method method = annotation.annotationType().getDeclaredMethod(attributeName); ReflectionUtils.makeAccessible(method); return method.invoke(annotation); } catch (Exception ex) { return null; } }
java
public static Object getValue(Annotation annotation, String attributeName) { if (annotation == null || !StringUtils.hasLength(attributeName)) { return null; } try { Method method = annotation.annotationType().getDeclaredMethod(attributeName); ReflectionUtils.makeAccessible(method); return method.invoke(annotation); } catch (Exception ex) { return null; } }
[ "public", "static", "Object", "getValue", "(", "Annotation", "annotation", ",", "String", "attributeName", ")", "{", "if", "(", "annotation", "==", "null", "||", "!", "StringUtils", ".", "hasLength", "(", "attributeName", ")", ")", "{", "return", "null", ";"...
Retrieve the <em>value</em> of a named attribute, given an annotation instance. @param annotation the annotation instance from which to retrieve the value @param attributeName the name of the attribute value to retrieve @return the attribute value, or {@code null} if not found @see #getValue(Annotation)
[ "Retrieve", "the", "<em", ">", "value<", "/", "em", ">", "of", "a", "named", "attribute", "given", "an", "annotation", "instance", "." ]
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-common/src/main/java/com/freetmp/common/annotation/AnnotationUtils.java#L636-L648
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java
CommsLightTrace._traceMessageId
private static void _traceMessageId(TraceComponent callersTrace, String action, String messageText) { // Build the trace string String traceText = action + ": " + messageText; // Trace using the correct trace group if (light_tc.isDebugEnabled()) { SibTr.debug(light_tc, traceText); } else { SibTr.debug(callersTrace, traceText); } }
java
private static void _traceMessageId(TraceComponent callersTrace, String action, String messageText) { // Build the trace string String traceText = action + ": " + messageText; // Trace using the correct trace group if (light_tc.isDebugEnabled()) { SibTr.debug(light_tc, traceText); } else { SibTr.debug(callersTrace, traceText); } }
[ "private", "static", "void", "_traceMessageId", "(", "TraceComponent", "callersTrace", ",", "String", "action", ",", "String", "messageText", ")", "{", "// Build the trace string", "String", "traceText", "=", "action", "+", "\": \"", "+", "messageText", ";", "// Tra...
Allow minimal tracing of System Message IDs (along with a transaction if on exists) @param callersTrace The trace component of the caller @param action A string (no spaces) provided by the caller to prefix the keyword included in the trace line @param message The message to trace
[ "Allow", "minimal", "tracing", "of", "System", "Message", "IDs", "(", "along", "with", "a", "transaction", "if", "on", "exists", ")" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsLightTrace.java#L80-L92
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf.java
ns_conf.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_conf_responses result = (ns_conf_responses) service.get_payload_formatter().string_to_resource(ns_conf_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_conf_response_array); } ns_conf[] result_ns_conf = new ns_conf[result.ns_conf_response_array.length]; for(int i = 0; i < result.ns_conf_response_array.length; i++) { result_ns_conf[i] = result.ns_conf_response_array[i].ns_conf[0]; } return result_ns_conf; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { ns_conf_responses result = (ns_conf_responses) service.get_payload_formatter().string_to_resource(ns_conf_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.ns_conf_response_array); } ns_conf[] result_ns_conf = new ns_conf[result.ns_conf_response_array.length]; for(int i = 0; i < result.ns_conf_response_array.length; i++) { result_ns_conf[i] = result.ns_conf_response_array[i].ns_conf[0]; } return result_ns_conf; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "ns_conf_responses", "result", "=", "(", "ns_conf_responses", ")", "service", ".", "get_payload_formatter", ...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/ns/ns_conf.java#L269-L286
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java
Error.xmlAttributeInexistent
public static void xmlAttributeInexistent(String path, String attributeName, Class<?> aClass){ throw new XmlMappingAttributeDoesNotExistException (MSG.INSTANCE.message(xmlMappingAttributeDoesNotExistException2,attributeName,aClass.getSimpleName(),path)); }
java
public static void xmlAttributeInexistent(String path, String attributeName, Class<?> aClass){ throw new XmlMappingAttributeDoesNotExistException (MSG.INSTANCE.message(xmlMappingAttributeDoesNotExistException2,attributeName,aClass.getSimpleName(),path)); }
[ "public", "static", "void", "xmlAttributeInexistent", "(", "String", "path", ",", "String", "attributeName", ",", "Class", "<", "?", ">", "aClass", ")", "{", "throw", "new", "XmlMappingAttributeDoesNotExistException", "(", "MSG", ".", "INSTANCE", ".", "message", ...
Thrown if attribute is present in the xml file. @param path xml path @param attributeName attribute present @param aClass attribute's class
[ "Thrown", "if", "attribute", "is", "present", "in", "the", "xml", "file", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/Error.java#L294-L296
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ExecuteSQLQueryBuilder.java
ExecuteSQLQueryBuilder.validateScript
public ExecuteSQLQueryBuilder validateScript(String script, String type) { ScriptValidationContext scriptValidationContext = new ScriptValidationContext(type); scriptValidationContext.setValidationScript(script); action.setScriptValidationContext(scriptValidationContext); return this; }
java
public ExecuteSQLQueryBuilder validateScript(String script, String type) { ScriptValidationContext scriptValidationContext = new ScriptValidationContext(type); scriptValidationContext.setValidationScript(script); action.setScriptValidationContext(scriptValidationContext); return this; }
[ "public", "ExecuteSQLQueryBuilder", "validateScript", "(", "String", "script", ",", "String", "type", ")", "{", "ScriptValidationContext", "scriptValidationContext", "=", "new", "ScriptValidationContext", "(", "type", ")", ";", "scriptValidationContext", ".", "setValidati...
Validate SQL result set via validation script, for instance Groovy. @param script @param type
[ "Validate", "SQL", "result", "set", "via", "validation", "script", "for", "instance", "Groovy", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ExecuteSQLQueryBuilder.java#L175-L180
zk1931/jzab
src/main/java/com/github/zk1931/jzab/MessageBuilder.java
MessageBuilder.buildAckEpoch
public static Message buildAckEpoch(long epoch, Zxid lastZxid) { ZabMessage.Zxid zxid = toProtoZxid(lastZxid); AckEpoch ackEpoch = AckEpoch.newBuilder() .setAcknowledgedEpoch(epoch) .setLastZxid(zxid) .build(); return Message.newBuilder().setType(MessageType.ACK_EPOCH) .setAckEpoch(ackEpoch) .build(); }
java
public static Message buildAckEpoch(long epoch, Zxid lastZxid) { ZabMessage.Zxid zxid = toProtoZxid(lastZxid); AckEpoch ackEpoch = AckEpoch.newBuilder() .setAcknowledgedEpoch(epoch) .setLastZxid(zxid) .build(); return Message.newBuilder().setType(MessageType.ACK_EPOCH) .setAckEpoch(ackEpoch) .build(); }
[ "public", "static", "Message", "buildAckEpoch", "(", "long", "epoch", ",", "Zxid", "lastZxid", ")", "{", "ZabMessage", ".", "Zxid", "zxid", "=", "toProtoZxid", "(", "lastZxid", ")", ";", "AckEpoch", "ackEpoch", "=", "AckEpoch", ".", "newBuilder", "(", ")", ...
Creates a ACK_EPOCH message. @param epoch the last leader proposal the follower has acknowledged. @param lastZxid the last zxid of the follower. @return the protobuf message.
[ "Creates", "a", "ACK_EPOCH", "message", "." ]
train
https://github.com/zk1931/jzab/blob/2a8893bcc1a125f3aebdaddee80ad49c9761bba1/src/main/java/com/github/zk1931/jzab/MessageBuilder.java#L155-L166
burberius/eve-esi
src/main/java/net/troja/eve/esi/api/FleetsApi.java
FleetsApi.deleteFleetsFleetIdSquadsSquadId
public void deleteFleetsFleetIdSquadsSquadId(Long fleetId, Long squadId, String datasource, String token) throws ApiException { deleteFleetsFleetIdSquadsSquadIdWithHttpInfo(fleetId, squadId, datasource, token); }
java
public void deleteFleetsFleetIdSquadsSquadId(Long fleetId, Long squadId, String datasource, String token) throws ApiException { deleteFleetsFleetIdSquadsSquadIdWithHttpInfo(fleetId, squadId, datasource, token); }
[ "public", "void", "deleteFleetsFleetIdSquadsSquadId", "(", "Long", "fleetId", ",", "Long", "squadId", ",", "String", "datasource", ",", "String", "token", ")", "throws", "ApiException", "{", "deleteFleetsFleetIdSquadsSquadIdWithHttpInfo", "(", "fleetId", ",", "squadId",...
Delete fleet squad Delete a fleet squad, only empty squads can be deleted --- SSO Scope: esi-fleets.write_fleet.v1 @param fleetId ID for a fleet (required) @param squadId The squad to delete (required) @param datasource The server name you would like data from (optional, default to tranquility) @param token Access token to use if unable to set a header (optional) @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Delete", "fleet", "squad", "Delete", "a", "fleet", "squad", "only", "empty", "squads", "can", "be", "deleted", "---", "SSO", "Scope", ":", "esi", "-", "fleets", ".", "write_fleet", ".", "v1" ]
train
https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/FleetsApi.java#L317-L320
realtime-framework/RealtimeStorage-Android
library/src/main/java/co/realtime/storage/TableRef.java
TableRef.beginsWith
public TableRef beginsWith(String attributeName, ItemAttribute value){ filters.add(new Filter(StorageFilter.BEGINSWITH, attributeName, value, null)); return this; }
java
public TableRef beginsWith(String attributeName, ItemAttribute value){ filters.add(new Filter(StorageFilter.BEGINSWITH, attributeName, value, null)); return this; }
[ "public", "TableRef", "beginsWith", "(", "String", "attributeName", ",", "ItemAttribute", "value", ")", "{", "filters", ".", "add", "(", "new", "Filter", "(", "StorageFilter", ".", "BEGINSWITH", ",", "attributeName", ",", "value", ",", "null", ")", ")", ";",...
Applies a filter to the table. When fetched, it will return the items that begins with the filter property value. <pre> StorageRef storage = new StorageRef("your_app_key", "your_token"); TableRef tableRef = storage.table("your_table"); // Retrieve all items with property "itemProperty" value starting with "xpto" tableRef.beginsWith("itemProperty",new ItemAttribute("xpto")).getItems(new OnItemSnapshot() { &#064;Override public void run(ItemSnapshot itemSnapshot) { if (itemSnapshot != null) { Log.d("TableRef", "Item retrieved: " + itemSnapshot.val()); } } }, new OnError() { &#064;Override public void run(Integer code, String errorMessage) { Log.e("TableRef", "Error retrieving items: " + errorMessage); } }); </pre> @param attributeName The name of the property to filter. @param value The value of the property to filter. @return Current table reference
[ "Applies", "a", "filter", "to", "the", "table", ".", "When", "fetched", "it", "will", "return", "the", "items", "that", "begins", "with", "the", "filter", "property", "value", "." ]
train
https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/TableRef.java#L931-L934
hankcs/HanLP
src/main/java/com/hankcs/hanlp/dependency/perceptron/parser/KBeamArcEagerDependencyParser.java
KBeamArcEagerDependencyParser.parse
public CoNLLSentence parse(List<Term> termList, int beamWidth, int numOfThreads) { String[] words = new String[termList.size()]; String[] tags = new String[termList.size()]; int k = 0; for (Term term : termList) { words[k] = term.word; tags[k] = term.nature.toString(); ++k; } Configuration bestParse; try { bestParse = parser.parse(words, tags, false, beamWidth, numOfThreads); } catch (Exception e) { throw new RuntimeException(e); } CoNLLWord[] wordArray = new CoNLLWord[termList.size()]; for (int i = 0; i < words.length; i++) { wordArray[i] = new CoNLLWord(i + 1, words[i], tags[i]); } for (int i = 0; i < words.length; i++) { wordArray[i].DEPREL = parser.idWord(bestParse.state.getDependent(i + 1)); int index = bestParse.state.getHead(i + 1) - 1; if (index < 0 || index >= wordArray.length) { wordArray[i].HEAD = CoNLLWord.ROOT; } else { wordArray[i].HEAD = wordArray[index]; } } return new CoNLLSentence(wordArray); }
java
public CoNLLSentence parse(List<Term> termList, int beamWidth, int numOfThreads) { String[] words = new String[termList.size()]; String[] tags = new String[termList.size()]; int k = 0; for (Term term : termList) { words[k] = term.word; tags[k] = term.nature.toString(); ++k; } Configuration bestParse; try { bestParse = parser.parse(words, tags, false, beamWidth, numOfThreads); } catch (Exception e) { throw new RuntimeException(e); } CoNLLWord[] wordArray = new CoNLLWord[termList.size()]; for (int i = 0; i < words.length; i++) { wordArray[i] = new CoNLLWord(i + 1, words[i], tags[i]); } for (int i = 0; i < words.length; i++) { wordArray[i].DEPREL = parser.idWord(bestParse.state.getDependent(i + 1)); int index = bestParse.state.getHead(i + 1) - 1; if (index < 0 || index >= wordArray.length) { wordArray[i].HEAD = CoNLLWord.ROOT; } else { wordArray[i].HEAD = wordArray[index]; } } return new CoNLLSentence(wordArray); }
[ "public", "CoNLLSentence", "parse", "(", "List", "<", "Term", ">", "termList", ",", "int", "beamWidth", ",", "int", "numOfThreads", ")", "{", "String", "[", "]", "words", "=", "new", "String", "[", "termList", ".", "size", "(", ")", "]", ";", "String",...
执行句法分析 @param termList 分词结果 @param beamWidth 柱搜索宽度 @param numOfThreads 多线程数 @return 句法树
[ "执行句法分析" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/dependency/perceptron/parser/KBeamArcEagerDependencyParser.java#L125-L165
OpenLiberty/open-liberty
dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java
TwitterEndpointServices.executeRequest
@FFDCIgnore(SocialLoginException.class) @Sensitive public Map<String, Object> executeRequest(SocialLoginConfig config, String requestMethod, String authzHeaderString, String url, String endpointType, String verifierValue) { if (endpointType == null) { endpointType = TwitterConstants.TWITTER_ENDPOINT_REQUEST_TOKEN; if (tc.isDebugEnabled()) { Tr.debug(tc, "A Twitter endpoint path was not found; defaulting to using " + endpointType + " as the Twitter endpoint path."); } } try { SocialUtil.validateEndpointWithQuery(url); } catch (SocialLoginException e) { return createErrorResponse(e); } StringBuilder uri = new StringBuilder(url); if (endpointType.equals(TwitterConstants.TWITTER_ENDPOINT_VERIFY_CREDENTIALS)) { // Include the include_email and skip_status parameters for these endpoint requests uri.append("?").append(TwitterConstants.PARAM_INCLUDE_EMAIL).append("=").append(TwitterConstants.INCLUDE_EMAIL).append("&").append(TwitterConstants.PARAM_SKIP_STATUS).append("=").append(TwitterConstants.SKIP_STATUS); } try { Map<String, Object> result = getEndpointResponse(config, uri.toString(), requestMethod, authzHeaderString, endpointType, verifierValue); String responseContent = httpUtil.extractTokensFromResponse(result); return evaluateRequestResponse(responseContent, endpointType); } catch (SocialLoginException e) { return createErrorResponse("TWITTER_EXCEPTION_EXECUTING_REQUEST", new Object[] { url, e.getLocalizedMessage() }); } }
java
@FFDCIgnore(SocialLoginException.class) @Sensitive public Map<String, Object> executeRequest(SocialLoginConfig config, String requestMethod, String authzHeaderString, String url, String endpointType, String verifierValue) { if (endpointType == null) { endpointType = TwitterConstants.TWITTER_ENDPOINT_REQUEST_TOKEN; if (tc.isDebugEnabled()) { Tr.debug(tc, "A Twitter endpoint path was not found; defaulting to using " + endpointType + " as the Twitter endpoint path."); } } try { SocialUtil.validateEndpointWithQuery(url); } catch (SocialLoginException e) { return createErrorResponse(e); } StringBuilder uri = new StringBuilder(url); if (endpointType.equals(TwitterConstants.TWITTER_ENDPOINT_VERIFY_CREDENTIALS)) { // Include the include_email and skip_status parameters for these endpoint requests uri.append("?").append(TwitterConstants.PARAM_INCLUDE_EMAIL).append("=").append(TwitterConstants.INCLUDE_EMAIL).append("&").append(TwitterConstants.PARAM_SKIP_STATUS).append("=").append(TwitterConstants.SKIP_STATUS); } try { Map<String, Object> result = getEndpointResponse(config, uri.toString(), requestMethod, authzHeaderString, endpointType, verifierValue); String responseContent = httpUtil.extractTokensFromResponse(result); return evaluateRequestResponse(responseContent, endpointType); } catch (SocialLoginException e) { return createErrorResponse("TWITTER_EXCEPTION_EXECUTING_REQUEST", new Object[] { url, e.getLocalizedMessage() }); } }
[ "@", "FFDCIgnore", "(", "SocialLoginException", ".", "class", ")", "@", "Sensitive", "public", "Map", "<", "String", ",", "Object", ">", "executeRequest", "(", "SocialLoginConfig", "config", ",", "String", "requestMethod", ",", "String", "authzHeaderString", ",", ...
Sends a request to the specified Twitter endpoint and returns a Map object containing the evaluated response. @param config @param requestMethod @param authzHeaderString @param url @param endpointType @param verifierValue Only used for {@value TwitterConstants#TWITTER_ENDPOINT_ACCESS_TOKEN} requests @return
[ "Sends", "a", "request", "to", "the", "specified", "Twitter", "endpoint", "and", "returns", "a", "Map", "object", "containing", "the", "evaluated", "response", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.social/src/com/ibm/ws/security/social/twitter/TwitterEndpointServices.java#L832-L865
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/CollisionConfig.java
CollisionConfig.createCollision
public static Collision createCollision(XmlReader node) { Check.notNull(node); final String name = node.readString(ATT_NAME); final int offsetX = node.readInteger(ATT_OFFSETX); final int offsetY = node.readInteger(ATT_OFFSETY); final int width = node.readInteger(ATT_WIDTH); final int height = node.readInteger(ATT_HEIGHT); final boolean mirror = node.readBoolean(ATT_MIRROR); return new Collision(name, offsetX, offsetY, width, height, mirror); }
java
public static Collision createCollision(XmlReader node) { Check.notNull(node); final String name = node.readString(ATT_NAME); final int offsetX = node.readInteger(ATT_OFFSETX); final int offsetY = node.readInteger(ATT_OFFSETY); final int width = node.readInteger(ATT_WIDTH); final int height = node.readInteger(ATT_HEIGHT); final boolean mirror = node.readBoolean(ATT_MIRROR); return new Collision(name, offsetX, offsetY, width, height, mirror); }
[ "public", "static", "Collision", "createCollision", "(", "XmlReader", "node", ")", "{", "Check", ".", "notNull", "(", "node", ")", ";", "final", "String", "name", "=", "node", ".", "readString", "(", "ATT_NAME", ")", ";", "final", "int", "offsetX", "=", ...
Create an collision from its node. @param node The collision node (must not be <code>null</code>). @return The collision instance. @throws LionEngineException If error when reading collision data.
[ "Create", "an", "collision", "from", "its", "node", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/CollisionConfig.java#L89-L101
groves/yarrgs
src/main/java/com/bungleton/yarrgs/Yarrgs.java
Yarrgs.parseInMain
public static <T> T parseInMain (Class<T> argsType, String[] args, FieldParserFactory parsers) { try { return parse(argsType, args, parsers); } catch (YarrgParseException e) { System.err.println(e.getExitMessage()); System.exit(1); throw new IllegalStateException("Java continued past a System.exit call"); } }
java
public static <T> T parseInMain (Class<T> argsType, String[] args, FieldParserFactory parsers) { try { return parse(argsType, args, parsers); } catch (YarrgParseException e) { System.err.println(e.getExitMessage()); System.exit(1); throw new IllegalStateException("Java continued past a System.exit call"); } }
[ "public", "static", "<", "T", ">", "T", "parseInMain", "(", "Class", "<", "T", ">", "argsType", ",", "String", "[", "]", "args", ",", "FieldParserFactory", "parsers", ")", "{", "try", "{", "return", "parse", "(", "argsType", ",", "args", ",", "parsers"...
Parses <code>args</code> into an instance of <code>argsType</code> using <code>parsers</code>. Calls <code>System.exit(1)</code> if the user supplied bad arguments after printing a reason to <code>System.err</code>. Thus, this is suitable to be called from a <code>main</code> method that's parsing arguments.
[ "Parses", "<code", ">", "args<", "/", "code", ">", "into", "an", "instance", "of", "<code", ">", "argsType<", "/", "code", ">", "using", "<code", ">", "parsers<", "/", "code", ">", ".", "Calls", "<code", ">", "System", ".", "exit", "(", "1", ")", "...
train
https://github.com/groves/yarrgs/blob/5599e82b63db56db3b0c2f7668d9a535cde456e1/src/main/java/com/bungleton/yarrgs/Yarrgs.java#L36-L45
Codearte/catch-exception
catch-throwable/src/main/java/com/googlecode/catchexception/throwable/CatchThrowable.java
CatchThrowable.verifyThrowable
public static void verifyThrowable(ThrowingCallable actor, Class<? extends Throwable> clazz) { validateArguments(actor, clazz); catchThrowable(actor, clazz, true); }
java
public static void verifyThrowable(ThrowingCallable actor, Class<? extends Throwable> clazz) { validateArguments(actor, clazz); catchThrowable(actor, clazz, true); }
[ "public", "static", "void", "verifyThrowable", "(", "ThrowingCallable", "actor", ",", "Class", "<", "?", "extends", "Throwable", ">", "clazz", ")", "{", "validateArguments", "(", "actor", ",", "clazz", ")", ";", "catchThrowable", "(", "actor", ",", "clazz", ...
Use it to verify that an throwable of specific type is thrown and to get access to the thrown throwable (for further verifications). The following example verifies that obj.doX() throws a MyThrowable: <code>verifyThrowable(obj, MyThrowable.class).doX(); // catch and verify assert "foobar".equals(caughtThrowable().getMessage()); // further analysis </code> If <code>doX()</code> does not throw a <code>MyThrowable</code>, then a {@link ThrowableNotThrownAssertionError} is thrown. Otherwise the thrown throwable can be retrieved via {@link #caughtThrowable()}. @param actor The instance that shall be proxied. Must not be <code>null</code>. @param clazz The type of the throwable that shall be thrown by the underlying object. Must not be <code>null</code>
[ "Use", "it", "to", "verify", "that", "an", "throwable", "of", "specific", "type", "is", "thrown", "and", "to", "get", "access", "to", "the", "thrown", "throwable", "(", "for", "further", "verifications", ")", "." ]
train
https://github.com/Codearte/catch-exception/blob/8cfb1c0a68661ef622011484ff0061b41796b165/catch-throwable/src/main/java/com/googlecode/catchexception/throwable/CatchThrowable.java#L79-L82
sebastiangraf/jSCSI
bundles/initiator/src/main/java/org/jscsi/initiator/Configuration.java
Configuration.getSessionSetting
public final String getSessionSetting (final String targetName, final OperationalTextKey textKey) throws OperationalTextKeyException { return getSetting(targetName, -1, textKey); }
java
public final String getSessionSetting (final String targetName, final OperationalTextKey textKey) throws OperationalTextKeyException { return getSetting(targetName, -1, textKey); }
[ "public", "final", "String", "getSessionSetting", "(", "final", "String", "targetName", ",", "final", "OperationalTextKey", "textKey", ")", "throws", "OperationalTextKeyException", "{", "return", "getSetting", "(", "targetName", ",", "-", "1", ",", "textKey", ")", ...
Returns the value of a single parameter. It can only return session and global parameters. @param targetName Name of the iSCSI Target to connect. @param textKey The name of the parameter. @return The value of the given parameter. @throws OperationalTextKeyException If the given parameter cannot be found.
[ "Returns", "the", "value", "of", "a", "single", "parameter", ".", "It", "can", "only", "return", "session", "and", "global", "parameters", "." ]
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/initiator/src/main/java/org/jscsi/initiator/Configuration.java#L283-L286
j256/simplejmx
src/main/java/com/j256/simplejmx/client/JmxClient.java
JmxClient.getAttributesInfo
public MBeanAttributeInfo[] getAttributesInfo(String domainName, String beanName) throws JMException { return getAttributesInfo(ObjectNameUtil.makeObjectName(domainName, beanName)); }
java
public MBeanAttributeInfo[] getAttributesInfo(String domainName, String beanName) throws JMException { return getAttributesInfo(ObjectNameUtil.makeObjectName(domainName, beanName)); }
[ "public", "MBeanAttributeInfo", "[", "]", "getAttributesInfo", "(", "String", "domainName", ",", "String", "beanName", ")", "throws", "JMException", "{", "return", "getAttributesInfo", "(", "ObjectNameUtil", ".", "makeObjectName", "(", "domainName", ",", "beanName", ...
Return an array of the attributes associated with the bean name.
[ "Return", "an", "array", "of", "the", "attributes", "associated", "with", "the", "bean", "name", "." ]
train
https://github.com/j256/simplejmx/blob/1a04f52512dfa0a711ba0cc7023c604dbc82a352/src/main/java/com/j256/simplejmx/client/JmxClient.java#L240-L242
OpenLiberty/open-liberty
dev/com.ibm.ws.container.service/src/com/ibm/ws/container/service/app/deploy/ManifestClassPathUtils.java
ManifestClassPathUtils.addCompleteJarEntryUrls
public static void addCompleteJarEntryUrls(List<ContainerInfo> containers, Entry jarEntry, Collection<String> resolved) throws UnableToAdaptException { String entryIdentity = createEntryIdentity(jarEntry); if (!entryIdentity.isEmpty() && !resolved.contains(entryIdentity)) { resolved.add(entryIdentity); processMFClasspath(jarEntry, containers, resolved); } }
java
public static void addCompleteJarEntryUrls(List<ContainerInfo> containers, Entry jarEntry, Collection<String> resolved) throws UnableToAdaptException { String entryIdentity = createEntryIdentity(jarEntry); if (!entryIdentity.isEmpty() && !resolved.contains(entryIdentity)) { resolved.add(entryIdentity); processMFClasspath(jarEntry, containers, resolved); } }
[ "public", "static", "void", "addCompleteJarEntryUrls", "(", "List", "<", "ContainerInfo", ">", "containers", ",", "Entry", "jarEntry", ",", "Collection", "<", "String", ">", "resolved", ")", "throws", "UnableToAdaptException", "{", "String", "entryIdentity", "=", ...
Add the jar entry URLs and its class path URLs. We need deal with all the thrown exceptions so that it won't interrupt the caller's processing. @param urls @param jarEntry
[ "Add", "the", "jar", "entry", "URLs", "and", "its", "class", "path", "URLs", ".", "We", "need", "deal", "with", "all", "the", "thrown", "exceptions", "so", "that", "it", "won", "t", "interrupt", "the", "caller", "s", "processing", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.container.service/src/com/ibm/ws/container/service/app/deploy/ManifestClassPathUtils.java#L177-L183
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java
Currency.getName
public String getName(ULocale locale, int nameStyle, boolean[] isChoiceFormat) { if (!(nameStyle == SYMBOL_NAME || nameStyle == LONG_NAME)) { throw new IllegalArgumentException("bad name style: " + nameStyle); } // We no longer support choice format data in names. Data should not contain // choice patterns. if (isChoiceFormat != null) { isChoiceFormat[0] = false; } CurrencyDisplayNames names = CurrencyDisplayNames.getInstance(locale); return nameStyle == SYMBOL_NAME ? names.getSymbol(subType) : names.getName(subType); }
java
public String getName(ULocale locale, int nameStyle, boolean[] isChoiceFormat) { if (!(nameStyle == SYMBOL_NAME || nameStyle == LONG_NAME)) { throw new IllegalArgumentException("bad name style: " + nameStyle); } // We no longer support choice format data in names. Data should not contain // choice patterns. if (isChoiceFormat != null) { isChoiceFormat[0] = false; } CurrencyDisplayNames names = CurrencyDisplayNames.getInstance(locale); return nameStyle == SYMBOL_NAME ? names.getSymbol(subType) : names.getName(subType); }
[ "public", "String", "getName", "(", "ULocale", "locale", ",", "int", "nameStyle", ",", "boolean", "[", "]", "isChoiceFormat", ")", "{", "if", "(", "!", "(", "nameStyle", "==", "SYMBOL_NAME", "||", "nameStyle", "==", "LONG_NAME", ")", ")", "{", "throw", "...
Returns the display name for the given currency in the given locale. For example, the display name for the USD currency object in the en_US locale is "$". @param locale locale in which to display currency @param nameStyle selector for which kind of name to return. The nameStyle should be either SYMBOL_NAME or LONG_NAME. Otherwise, throw IllegalArgumentException. @param isChoiceFormat fill-in; isChoiceFormat[0] is set to true if the returned value is a ChoiceFormat pattern; otherwise it is set to false @return display string for this currency. If the resource data contains no entry for this currency, then the ISO 4217 code is returned. If isChoiceFormat[0] is true, then the result is a ChoiceFormat pattern. Otherwise it is a static string. <b>Note:</b> as of ICU 4.4, choice formats are not used, and the value returned in isChoiceFormat is always false. <p> @throws IllegalArgumentException if the nameStyle is not SYMBOL_NAME or LONG_NAME. @see #getName(ULocale, int, String, boolean[])
[ "Returns", "the", "display", "name", "for", "the", "given", "currency", "in", "the", "given", "locale", ".", "For", "example", "the", "display", "name", "for", "the", "USD", "currency", "object", "in", "the", "en_US", "locale", "is", "$", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Currency.java#L528-L541
apache/incubator-gobblin
gobblin-core-base/src/main/java/org/apache/gobblin/crypto/CredentialStoreFactory.java
CredentialStoreFactory.buildCredentialStore
@Synchronized public static CredentialStore buildCredentialStore(Map<String, Object> parameters) { String credType = EncryptionConfigParser.getKeystoreType(parameters); for (CredentialStoreProvider provider : credentialStoreProviderLoader) { log.debug("Looking for cred store type {} in provider {}", credType, provider.getClass().getName()); CredentialStore credStore = provider.buildCredentialStore(parameters); if (credStore != null) { log.debug("Found cred store type {} in provider {}", credType, provider.getClass().getName()); return credStore; } } throw new IllegalArgumentException("Could not find a provider to build algorithm " + credType + " - is gobblin-crypto-provider in classpath?"); }
java
@Synchronized public static CredentialStore buildCredentialStore(Map<String, Object> parameters) { String credType = EncryptionConfigParser.getKeystoreType(parameters); for (CredentialStoreProvider provider : credentialStoreProviderLoader) { log.debug("Looking for cred store type {} in provider {}", credType, provider.getClass().getName()); CredentialStore credStore = provider.buildCredentialStore(parameters); if (credStore != null) { log.debug("Found cred store type {} in provider {}", credType, provider.getClass().getName()); return credStore; } } throw new IllegalArgumentException("Could not find a provider to build algorithm " + credType + " - is gobblin-crypto-provider in classpath?"); }
[ "@", "Synchronized", "public", "static", "CredentialStore", "buildCredentialStore", "(", "Map", "<", "String", ",", "Object", ">", "parameters", ")", "{", "String", "credType", "=", "EncryptionConfigParser", ".", "getKeystoreType", "(", "parameters", ")", ";", "fo...
Build a CredentialStore with the given config parameters. The type will be extracted from the parameters. See {@link EncryptionConfigParser} for a set of standard configuration parameters, although each encryption provider may have its own arbitrary set. @return A CredentialStore for the given parameters @throws IllegalArgumentException If no provider exists that can build the requested encryption codec
[ "Build", "a", "CredentialStore", "with", "the", "given", "config", "parameters", ".", "The", "type", "will", "be", "extracted", "from", "the", "parameters", ".", "See", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/crypto/CredentialStoreFactory.java#L45-L59
vkostyukov/la4j
src/main/java/org/la4j/Matrices.java
Matrices.asMulFunction
public static MatrixFunction asMulFunction(final double arg) { return new MatrixFunction() { @Override public double evaluate(int i, int j, double value) { return value * arg; } }; }
java
public static MatrixFunction asMulFunction(final double arg) { return new MatrixFunction() { @Override public double evaluate(int i, int j, double value) { return value * arg; } }; }
[ "public", "static", "MatrixFunction", "asMulFunction", "(", "final", "double", "arg", ")", "{", "return", "new", "MatrixFunction", "(", ")", "{", "@", "Override", "public", "double", "evaluate", "(", "int", "i", ",", "int", "j", ",", "double", "value", ")"...
Creates a mul function that multiplies given {@code value} by it's argument. @param arg a value to be multiplied by function's argument @return a closure that does {@code _ * _}
[ "Creates", "a", "mul", "function", "that", "multiplies", "given", "{", "@code", "value", "}", "by", "it", "s", "argument", "." ]
train
https://github.com/vkostyukov/la4j/blob/dd1b917caf9606399a49afa6b0d738934cd3a7b3/src/main/java/org/la4j/Matrices.java#L471-L478
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Flowable.java
Flowable.onBackpressureBuffer
@CheckReturnValue @BackpressureSupport(BackpressureKind.SPECIAL) @SchedulerSupport(SchedulerSupport.NONE) public final Flowable<T> onBackpressureBuffer(int capacity, boolean delayError, boolean unbounded) { ObjectHelper.verifyPositive(capacity, "bufferSize"); return RxJavaPlugins.onAssembly(new FlowableOnBackpressureBuffer<T>(this, capacity, unbounded, delayError, Functions.EMPTY_ACTION)); }
java
@CheckReturnValue @BackpressureSupport(BackpressureKind.SPECIAL) @SchedulerSupport(SchedulerSupport.NONE) public final Flowable<T> onBackpressureBuffer(int capacity, boolean delayError, boolean unbounded) { ObjectHelper.verifyPositive(capacity, "bufferSize"); return RxJavaPlugins.onAssembly(new FlowableOnBackpressureBuffer<T>(this, capacity, unbounded, delayError, Functions.EMPTY_ACTION)); }
[ "@", "CheckReturnValue", "@", "BackpressureSupport", "(", "BackpressureKind", ".", "SPECIAL", ")", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "NONE", ")", "public", "final", "Flowable", "<", "T", ">", "onBackpressureBuffer", "(", "int", "capacity", ","...
Instructs a Publisher that is emitting items faster than its Subscriber can consume them to buffer up to a given amount of items until they can be emitted. The resulting Publisher will signal a {@code BufferOverflowException} via {@code onError} as soon as the buffer's capacity is exceeded, dropping all undelivered items, and canceling the source. <p> <img width="640" height="300" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/bp.obp.buffer.png" alt=""> <dl> <dt><b>Backpressure:</b></dt> <dd>The operator honors backpressure from downstream and consumes the source {@code Publisher} in an unbounded manner (i.e., not applying backpressure to it).</dd> <dt><b>Scheduler:</b></dt> <dd>{@code onBackpressureBuffer} does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param capacity number of slots available in the buffer. @param delayError if true, an exception from the current Flowable is delayed until all buffered elements have been consumed by the downstream; if false, an exception is immediately signaled to the downstream, skipping any buffered element @param unbounded if true, the capacity value is interpreted as the internal "island" size of the unbounded buffer @return the source {@code Publisher} modified to buffer items up to the given capacity. @see <a href="http://reactivex.io/documentation/operators/backpressure.html">ReactiveX operators documentation: backpressure operators</a> @since 1.1.0
[ "Instructs", "a", "Publisher", "that", "is", "emitting", "items", "faster", "than", "its", "Subscriber", "can", "consume", "them", "to", "buffer", "up", "to", "a", "given", "amount", "of", "items", "until", "they", "can", "be", "emitted", ".", "The", "resu...
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Flowable.java#L11461-L11467
auth0/auth0-java
src/main/java/com/auth0/client/auth/AuthAPI.java
AuthAPI.renewAuth
public AuthRequest renewAuth(String refreshToken) { Asserts.assertNotNull(refreshToken, "refresh token"); String url = baseUrl .newBuilder() .addPathSegment(PATH_OAUTH) .addPathSegment(PATH_TOKEN) .build() .toString(); TokenRequest request = new TokenRequest(client, url); request.addParameter(KEY_CLIENT_ID, clientId); request.addParameter(KEY_CLIENT_SECRET, clientSecret); request.addParameter(KEY_GRANT_TYPE, "refresh_token"); request.addParameter(KEY_REFRESH_TOKEN, refreshToken); return request; }
java
public AuthRequest renewAuth(String refreshToken) { Asserts.assertNotNull(refreshToken, "refresh token"); String url = baseUrl .newBuilder() .addPathSegment(PATH_OAUTH) .addPathSegment(PATH_TOKEN) .build() .toString(); TokenRequest request = new TokenRequest(client, url); request.addParameter(KEY_CLIENT_ID, clientId); request.addParameter(KEY_CLIENT_SECRET, clientSecret); request.addParameter(KEY_GRANT_TYPE, "refresh_token"); request.addParameter(KEY_REFRESH_TOKEN, refreshToken); return request; }
[ "public", "AuthRequest", "renewAuth", "(", "String", "refreshToken", ")", "{", "Asserts", ".", "assertNotNull", "(", "refreshToken", ",", "\"refresh token\"", ")", ";", "String", "url", "=", "baseUrl", ".", "newBuilder", "(", ")", ".", "addPathSegment", "(", "...
Creates a request to renew the authentication and get fresh new credentials using a valid Refresh Token and the 'refresh_token' grant. <pre> {@code AuthAPI auth = new AuthAPI("me.auth0.com", "B3c6RYhk1v9SbIJcRIOwu62gIUGsnze", "2679NfkaBn62e6w5E8zNEzjr-yWfkaBne"); try { TokenHolder result = auth.renewAuth("ej2E8zNEzjrcSD2edjaE") .execute(); } catch (Auth0Exception e) { //Something happened } } </pre> @param refreshToken the refresh token to use to get fresh new credentials. @return a Request to configure and execute.
[ "Creates", "a", "request", "to", "renew", "the", "authentication", "and", "get", "fresh", "new", "credentials", "using", "a", "valid", "Refresh", "Token", "and", "the", "refresh_token", "grant", ".", "<pre", ">", "{", "@code", "AuthAPI", "auth", "=", "new", ...
train
https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/auth/AuthAPI.java#L472-L487
UrielCh/ovh-java-sdk
ovh-java-sdk-core/src/main/java/net/minidev/ovh/core/ApiOvhCore.java
ApiOvhCore.setLoginInfo
public void setLoginInfo(String nic, String password, int timeInSec) { nic = nic.toLowerCase(); this.nic = nic; this.password = password; this.timeInSec = timeInSec; }
java
public void setLoginInfo(String nic, String password, int timeInSec) { nic = nic.toLowerCase(); this.nic = nic; this.password = password; this.timeInSec = timeInSec; }
[ "public", "void", "setLoginInfo", "(", "String", "nic", ",", "String", "password", ",", "int", "timeInSec", ")", "{", "nic", "=", "nic", ".", "toLowerCase", "(", ")", ";", "this", ".", "nic", "=", "nic", ";", "this", ".", "password", "=", "password", ...
Store password based credential for an automatic certificate generation @param nic @param password @param timeInSec
[ "Store", "password", "based", "credential", "for", "an", "automatic", "certificate", "generation" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-core/src/main/java/net/minidev/ovh/core/ApiOvhCore.java#L334-L339
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java
DfuBaseService.terminateConnection
protected void terminateConnection(@NonNull final BluetoothGatt gatt, final int error) { if (mConnectionState != STATE_DISCONNECTED) { // Disconnect from the device disconnect(gatt); } // Close the device refreshDeviceCache(gatt, false); // This should be set to true when DFU Version is 0.5 or lower close(gatt); waitFor(600); if (error != 0) report(error); }
java
protected void terminateConnection(@NonNull final BluetoothGatt gatt, final int error) { if (mConnectionState != STATE_DISCONNECTED) { // Disconnect from the device disconnect(gatt); } // Close the device refreshDeviceCache(gatt, false); // This should be set to true when DFU Version is 0.5 or lower close(gatt); waitFor(600); if (error != 0) report(error); }
[ "protected", "void", "terminateConnection", "(", "@", "NonNull", "final", "BluetoothGatt", "gatt", ",", "final", "int", "error", ")", "{", "if", "(", "mConnectionState", "!=", "STATE_DISCONNECTED", ")", "{", "// Disconnect from the device", "disconnect", "(", "gatt"...
Disconnects from the device and cleans local variables in case of error. This method is SYNCHRONOUS and wait until the disconnecting process will be completed. @param gatt the GATT device to be disconnected. @param error error number.
[ "Disconnects", "from", "the", "device", "and", "cleans", "local", "variables", "in", "case", "of", "error", ".", "This", "method", "is", "SYNCHRONOUS", "and", "wait", "until", "the", "disconnecting", "process", "will", "be", "completed", "." ]
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuBaseService.java#L1519-L1531
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/frames/FrameData.java
FrameData.buildFrameArrayForWrite
public WsByteBuffer[] buildFrameArrayForWrite() { WsByteBuffer[] output; int headerSize = SIZE_FRAME_BEFORE_PAYLOAD; if (PADDED_FLAG) { headerSize = SIZE_FRAME_BEFORE_PAYLOAD + 1; } WsByteBuffer frameHeaders = getBuffer(headerSize); byte[] frame; if (frameHeaders.hasArray()) { frame = frameHeaders.array(); } else { frame = super.createFrameArray(); } // add the first 9 bytes of the array setFrameHeaders(frame, utils.FRAME_TYPE_DATA); // set up the frame payload int frameIndex = SIZE_FRAME_BEFORE_PAYLOAD; // add pad length field if (PADDED_FLAG) { utils.Move8BitstoByteArray(paddingLength, frame, frameIndex); frameIndex++; } frameHeaders.put(frame, 0, headerSize); frameHeaders.flip(); // create padding and put in return buffer array if (PADDED_FLAG) { WsByteBuffer padding = getBuffer(paddingLength); for (int i = 0; i < paddingLength; i++) { padding.put((byte) 0); } padding.flip(); output = new WsByteBuffer[3]; output[0] = frameHeaders; output[1] = dataBuffer; output[2] = padding; } // create the output buffer array else { output = new WsByteBuffer[2]; output[0] = frameHeaders; output[1] = dataBuffer; } return output; }
java
public WsByteBuffer[] buildFrameArrayForWrite() { WsByteBuffer[] output; int headerSize = SIZE_FRAME_BEFORE_PAYLOAD; if (PADDED_FLAG) { headerSize = SIZE_FRAME_BEFORE_PAYLOAD + 1; } WsByteBuffer frameHeaders = getBuffer(headerSize); byte[] frame; if (frameHeaders.hasArray()) { frame = frameHeaders.array(); } else { frame = super.createFrameArray(); } // add the first 9 bytes of the array setFrameHeaders(frame, utils.FRAME_TYPE_DATA); // set up the frame payload int frameIndex = SIZE_FRAME_BEFORE_PAYLOAD; // add pad length field if (PADDED_FLAG) { utils.Move8BitstoByteArray(paddingLength, frame, frameIndex); frameIndex++; } frameHeaders.put(frame, 0, headerSize); frameHeaders.flip(); // create padding and put in return buffer array if (PADDED_FLAG) { WsByteBuffer padding = getBuffer(paddingLength); for (int i = 0; i < paddingLength; i++) { padding.put((byte) 0); } padding.flip(); output = new WsByteBuffer[3]; output[0] = frameHeaders; output[1] = dataBuffer; output[2] = padding; } // create the output buffer array else { output = new WsByteBuffer[2]; output[0] = frameHeaders; output[1] = dataBuffer; } return output; }
[ "public", "WsByteBuffer", "[", "]", "buildFrameArrayForWrite", "(", ")", "{", "WsByteBuffer", "[", "]", "output", ";", "int", "headerSize", "=", "SIZE_FRAME_BEFORE_PAYLOAD", ";", "if", "(", "PADDED_FLAG", ")", "{", "headerSize", "=", "SIZE_FRAME_BEFORE_PAYLOAD", "...
Builds an array of buffers representing this http2 data frame output[0] = http2 frame header data output[1] = payload data output[2] ?= padding @return WsByteBuffer[]
[ "Builds", "an", "array", "of", "buffers", "representing", "this", "http2", "data", "frame", "output", "[", "0", "]", "=", "http2", "frame", "header", "data", "output", "[", "1", "]", "=", "payload", "data", "output", "[", "2", "]", "?", "=", "padding" ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/h2internal/frames/FrameData.java#L173-L221
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/tools/BigramExtractor.java
BigramExtractor.getScore
private double getScore(int[] contingencyTable, SignificanceTest test) { switch (test) { case PMI: return pmi(contingencyTable); case CHI_SQUARED: return chiSq(contingencyTable); case LOG_LIKELIHOOD: return logLikelihood(contingencyTable); default: throw new Error(test + " not implemented yet"); } }
java
private double getScore(int[] contingencyTable, SignificanceTest test) { switch (test) { case PMI: return pmi(contingencyTable); case CHI_SQUARED: return chiSq(contingencyTable); case LOG_LIKELIHOOD: return logLikelihood(contingencyTable); default: throw new Error(test + " not implemented yet"); } }
[ "private", "double", "getScore", "(", "int", "[", "]", "contingencyTable", ",", "SignificanceTest", "test", ")", "{", "switch", "(", "test", ")", "{", "case", "PMI", ":", "return", "pmi", "(", "contingencyTable", ")", ";", "case", "CHI_SQUARED", ":", "retu...
Returns the score of the contingency table using the specified significance test @param contingencyTable a contingency table specified as four {@code int} values @param test the significance test to use in evaluating the table
[ "Returns", "the", "score", "of", "the", "contingency", "table", "using", "the", "specified", "significance", "test" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/tools/BigramExtractor.java#L332-L343
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/button/SegmentedButtonPainter.java
SegmentedButtonPainter.createOuterFocus
protected Shape createOuterFocus(final SegmentType segmentType, final int x, final int y, final int w, final int h) { switch (segmentType) { case FIRST: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS, CornerStyle.ROUNDED, CornerStyle.ROUNDED, CornerStyle.SQUARE, CornerStyle.SQUARE); case MIDDLE: return shapeGenerator.createRectangle(x - 2, y - 2, w + 3, h + 3); case LAST: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.ROUNDED, CornerStyle.ROUNDED); default: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS); } }
java
protected Shape createOuterFocus(final SegmentType segmentType, final int x, final int y, final int w, final int h) { switch (segmentType) { case FIRST: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS, CornerStyle.ROUNDED, CornerStyle.ROUNDED, CornerStyle.SQUARE, CornerStyle.SQUARE); case MIDDLE: return shapeGenerator.createRectangle(x - 2, y - 2, w + 3, h + 3); case LAST: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.ROUNDED, CornerStyle.ROUNDED); default: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS); } }
[ "protected", "Shape", "createOuterFocus", "(", "final", "SegmentType", "segmentType", ",", "final", "int", "x", ",", "final", "int", "y", ",", "final", "int", "w", ",", "final", "int", "h", ")", "{", "switch", "(", "segmentType", ")", "{", "case", "FIRST...
Create the shape for the outer focus ring. Designed to be drawn rather than filled. @param segmentType the segment type. @param x the x offset. @param y the y offset. @param w the width. @param h the height. @return the shape of the outer focus ring. Designed to be drawn rather than filled.
[ "Create", "the", "shape", "for", "the", "outer", "focus", "ring", ".", "Designed", "to", "be", "drawn", "rather", "than", "filled", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/button/SegmentedButtonPainter.java#L227-L244
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableInfo.java
TableInfo.newBuilder
public static Builder newBuilder(TableId tableId, TableDefinition definition) { return new BuilderImpl().setTableId(tableId).setDefinition(definition); }
java
public static Builder newBuilder(TableId tableId, TableDefinition definition) { return new BuilderImpl().setTableId(tableId).setDefinition(definition); }
[ "public", "static", "Builder", "newBuilder", "(", "TableId", "tableId", ",", "TableDefinition", "definition", ")", "{", "return", "new", "BuilderImpl", "(", ")", ".", "setTableId", "(", "tableId", ")", ".", "setDefinition", "(", "definition", ")", ";", "}" ]
Returns a builder for a {@code TableInfo} object given table identity and definition. Use {@link StandardTableDefinition} to create simple BigQuery table. Use {@link ViewDefinition} to create a BigQuery view. Use {@link ExternalTableDefinition} to create a BigQuery a table backed by external data.
[ "Returns", "a", "builder", "for", "a", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableInfo.java#L447-L449
tango-controls/JTango
server/src/main/java/org/tango/server/export/TangoExporter.java
TangoExporter.exportAll
@Override public void exportAll() throws DevFailed { // load tango db cache DatabaseFactory.getDatabase().loadCache(serverName, hostName); // special case for admin device final DeviceClassBuilder clazz = new DeviceClassBuilder(AdminDevice.class, Constants.ADMIN_SERVER_CLASS_NAME); deviceClassList.add(clazz); final DeviceImpl dev = buildDevice(Constants.ADMIN_DEVICE_DOMAIN + "/" + serverName, clazz); ((AdminDevice) dev.getBusinessObject()).setTangoExporter(this); ((AdminDevice) dev.getBusinessObject()).setClassList(deviceClassList); // load server class exportDevices(); // init polling pool config TangoCacheManager.initPoolConf(); // clear tango db cache (used only for server start-up phase) DatabaseFactory.getDatabase().clearCache(); }
java
@Override public void exportAll() throws DevFailed { // load tango db cache DatabaseFactory.getDatabase().loadCache(serverName, hostName); // special case for admin device final DeviceClassBuilder clazz = new DeviceClassBuilder(AdminDevice.class, Constants.ADMIN_SERVER_CLASS_NAME); deviceClassList.add(clazz); final DeviceImpl dev = buildDevice(Constants.ADMIN_DEVICE_DOMAIN + "/" + serverName, clazz); ((AdminDevice) dev.getBusinessObject()).setTangoExporter(this); ((AdminDevice) dev.getBusinessObject()).setClassList(deviceClassList); // load server class exportDevices(); // init polling pool config TangoCacheManager.initPoolConf(); // clear tango db cache (used only for server start-up phase) DatabaseFactory.getDatabase().clearCache(); }
[ "@", "Override", "public", "void", "exportAll", "(", ")", "throws", "DevFailed", "{", "// load tango db cache", "DatabaseFactory", ".", "getDatabase", "(", ")", ".", "loadCache", "(", "serverName", ",", "hostName", ")", ";", "// special case for admin device", "fina...
Build all devices of all classes that are is this executable @throws DevFailed
[ "Build", "all", "devices", "of", "all", "classes", "that", "are", "is", "this", "executable" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/export/TangoExporter.java#L75-L94
assertthat/selenium-shutterbug
src/main/java/com/assertthat/selenium_shutterbug/core/Shutterbug.java
Shutterbug.shootPage
public static PageSnapshot shootPage(WebDriver driver, ScrollStrategy scroll, int scrollTimeout, boolean useDevicePixelRatio) { Browser browser = new Browser(driver, useDevicePixelRatio); browser.setScrollTimeout(scrollTimeout); PageSnapshot pageScreenshot = new PageSnapshot(driver, browser.getDevicePixelRatio()); switch (scroll) { case VIEWPORT_ONLY: pageScreenshot.setImage(browser.takeScreenshot()); break; case WHOLE_PAGE: pageScreenshot.setImage(browser.takeScreenshotEntirePage()); break; } return pageScreenshot; }
java
public static PageSnapshot shootPage(WebDriver driver, ScrollStrategy scroll, int scrollTimeout, boolean useDevicePixelRatio) { Browser browser = new Browser(driver, useDevicePixelRatio); browser.setScrollTimeout(scrollTimeout); PageSnapshot pageScreenshot = new PageSnapshot(driver, browser.getDevicePixelRatio()); switch (scroll) { case VIEWPORT_ONLY: pageScreenshot.setImage(browser.takeScreenshot()); break; case WHOLE_PAGE: pageScreenshot.setImage(browser.takeScreenshotEntirePage()); break; } return pageScreenshot; }
[ "public", "static", "PageSnapshot", "shootPage", "(", "WebDriver", "driver", ",", "ScrollStrategy", "scroll", ",", "int", "scrollTimeout", ",", "boolean", "useDevicePixelRatio", ")", "{", "Browser", "browser", "=", "new", "Browser", "(", "driver", ",", "useDeviceP...
To be used when screen shooting the page and need to scroll while making screen shots, either vertically or horizontally or both directions (Chrome). @param driver WebDriver instance @param scroll ScrollStrategy How you need to scroll @param scrollTimeout Timeout to wait after scrolling and before taking screen shot @param useDevicePixelRatio whether or not take into account device pixel ratio @return PageSnapshot instance
[ "To", "be", "used", "when", "screen", "shooting", "the", "page", "and", "need", "to", "scroll", "while", "making", "screen", "shots", "either", "vertically", "or", "horizontally", "or", "both", "directions", "(", "Chrome", ")", "." ]
train
https://github.com/assertthat/selenium-shutterbug/blob/770d9b92423200d262c9ab70e40405921d81e262/src/main/java/com/assertthat/selenium_shutterbug/core/Shutterbug.java#L100-L114
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/Step.java
Step.displayConcernedElementsAtTheBeginningOfMethod
protected void displayConcernedElementsAtTheBeginningOfMethod(String methodName, List<String> concernedElements) { logger.debug("{}: with {} concernedElements", methodName, concernedElements.size()); int i = 0; for (final String element : concernedElements) { i++; logger.debug(" element N°{}={}", i, element); } }
java
protected void displayConcernedElementsAtTheBeginningOfMethod(String methodName, List<String> concernedElements) { logger.debug("{}: with {} concernedElements", methodName, concernedElements.size()); int i = 0; for (final String element : concernedElements) { i++; logger.debug(" element N°{}={}", i, element); } }
[ "protected", "void", "displayConcernedElementsAtTheBeginningOfMethod", "(", "String", "methodName", ",", "List", "<", "String", ">", "concernedElements", ")", "{", "logger", ".", "debug", "(", "\"{}: with {} concernedElements\"", ",", "methodName", ",", "concernedElements...
Display message (list of elements) at the beginning of method in logs. @param methodName is name of java method @param concernedElements is a list of concerned elements (example: authorized activities)
[ "Display", "message", "(", "list", "of", "elements", ")", "at", "the", "beginning", "of", "method", "in", "logs", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L861-L868
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.searchGuildID
public void searchGuildID(String name, Callback<List<String>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.GUILD, name)); gw2API.searchGuildID(name).enqueue(callback); }
java
public void searchGuildID(String name, Callback<List<String>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.GUILD, name)); gw2API.searchGuildID(name).enqueue(callback); }
[ "public", "void", "searchGuildID", "(", "String", "name", ",", "Callback", "<", "List", "<", "String", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ParamType", "."...
For more info on guild Search API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/search">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param name guild name @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see GuildPermission guild permission info
[ "For", "more", "info", "on", "guild", "Search", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "guild", "/", "search", ">", "here<", "/", "a", ">", "<br", "/", ...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1631-L1634
m-m-m/util
gwt/src/main/java/net/sf/mmm/util/gwt/base/rebind/AbstractIncrementalGenerator.java
AbstractIncrementalGenerator.isCachedResultObsolete
protected boolean isCachedResultObsolete(CachedGeneratorResult cachedGeneratorResult, String typeName) { try { URL javaFileUrl = Thread.currentThread().getContextClassLoader() .getResource(typeName.replace('.', '/') + ".java"); String protocol = javaFileUrl.getProtocol().toLowerCase(); if ("file".equals(protocol)) { String urlString = URLDecoder.decode(javaFileUrl.getFile(), "UTF-8"); File javaFile = new File(urlString); long lastModified = javaFile.lastModified(); long timeGenerated = cachedGeneratorResult.getTimeGenerated(); return (lastModified > timeGenerated); } else { throw new IllegalCaseException(protocol); } } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } }
java
protected boolean isCachedResultObsolete(CachedGeneratorResult cachedGeneratorResult, String typeName) { try { URL javaFileUrl = Thread.currentThread().getContextClassLoader() .getResource(typeName.replace('.', '/') + ".java"); String protocol = javaFileUrl.getProtocol().toLowerCase(); if ("file".equals(protocol)) { String urlString = URLDecoder.decode(javaFileUrl.getFile(), "UTF-8"); File javaFile = new File(urlString); long lastModified = javaFile.lastModified(); long timeGenerated = cachedGeneratorResult.getTimeGenerated(); return (lastModified > timeGenerated); } else { throw new IllegalCaseException(protocol); } } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } }
[ "protected", "boolean", "isCachedResultObsolete", "(", "CachedGeneratorResult", "cachedGeneratorResult", ",", "String", "typeName", ")", "{", "try", "{", "URL", "javaFileUrl", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", "."...
This method determines whether a {@link CachedGeneratorResult} is obsolete or can be reused. @param cachedGeneratorResult is the {@link CachedGeneratorResult}. @param typeName is the full-qualified name of the {@link Class} to generate. @return {@code true} if the {@link CachedGeneratorResult} is obsolete and has to be re-generated, {@code false} otherwise (if it can be reused).
[ "This", "method", "determines", "whether", "a", "{", "@link", "CachedGeneratorResult", "}", "is", "obsolete", "or", "can", "be", "reused", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/gwt/src/main/java/net/sf/mmm/util/gwt/base/rebind/AbstractIncrementalGenerator.java#L257-L275
Ordinastie/MalisisCore
src/main/java/net/malisis/core/registry/Registries.java
Registries.processPostSetBlock
public static void processPostSetBlock(Chunk chunk, BlockPos pos, IBlockState oldState, IBlockState newState) { postSetBlockRegistry.processCallbacks(chunk, pos, oldState, newState); }
java
public static void processPostSetBlock(Chunk chunk, BlockPos pos, IBlockState oldState, IBlockState newState) { postSetBlockRegistry.processCallbacks(chunk, pos, oldState, newState); }
[ "public", "static", "void", "processPostSetBlock", "(", "Chunk", "chunk", ",", "BlockPos", "pos", ",", "IBlockState", "oldState", ",", "IBlockState", "newState", ")", "{", "postSetBlockRegistry", ".", "processCallbacks", "(", "chunk", ",", "pos", ",", "oldState", ...
Processes {@link ISetBlockCallback ISetBlockCallbacks}.<br> Called by ASM from {@link Chunk#setBlockState(BlockPos, IBlockState)}. @param chunk the chunk @param pos the pos @param oldState the old state @param newState the new state
[ "Processes", "{", "@link", "ISetBlockCallback", "ISetBlockCallbacks", "}", ".", "<br", ">", "Called", "by", "ASM", "from", "{", "@link", "Chunk#setBlockState", "(", "BlockPos", "IBlockState", ")", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/registry/Registries.java#L151-L154
aws/aws-sdk-java
aws-java-sdk-logs/src/main/java/com/amazonaws/services/logs/model/ListTagsLogGroupResult.java
ListTagsLogGroupResult.withTags
public ListTagsLogGroupResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
java
public ListTagsLogGroupResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "ListTagsLogGroupResult", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags for the log group. </p> @param tags The tags for the log group. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "for", "the", "log", "group", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-logs/src/main/java/com/amazonaws/services/logs/model/ListTagsLogGroupResult.java#L71-L74
OpenTSDB/opentsdb
src/tsd/HttpQuery.java
HttpQuery.escapeJson
static void escapeJson(final String s, final StringBuilder buf) { final int length = s.length(); int extra = 0; // First count how many extra chars we'll need, if any. for (int i = 0; i < length; i++) { final char c = s.charAt(i); switch (c) { case '"': case '\\': case '\b': case '\f': case '\n': case '\r': case '\t': extra++; continue; } if (c < 0x001F) { extra += 4; } } if (extra == 0) { buf.append(s); // Nothing to escape. return; } buf.ensureCapacity(buf.length() + length + extra); for (int i = 0; i < length; i++) { final char c = s.charAt(i); switch (c) { case '"': buf.append('\\').append('"'); continue; case '\\': buf.append('\\').append('\\'); continue; case '\b': buf.append('\\').append('b'); continue; case '\f': buf.append('\\').append('f'); continue; case '\n': buf.append('\\').append('n'); continue; case '\r': buf.append('\\').append('r'); continue; case '\t': buf.append('\\').append('t'); continue; } if (c < 0x001F) { buf.append('\\').append('u').append('0').append('0') .append((char) Const.HEX[(c >>> 4) & 0x0F]) .append((char) Const.HEX[c & 0x0F]); } else { buf.append(c); } } }
java
static void escapeJson(final String s, final StringBuilder buf) { final int length = s.length(); int extra = 0; // First count how many extra chars we'll need, if any. for (int i = 0; i < length; i++) { final char c = s.charAt(i); switch (c) { case '"': case '\\': case '\b': case '\f': case '\n': case '\r': case '\t': extra++; continue; } if (c < 0x001F) { extra += 4; } } if (extra == 0) { buf.append(s); // Nothing to escape. return; } buf.ensureCapacity(buf.length() + length + extra); for (int i = 0; i < length; i++) { final char c = s.charAt(i); switch (c) { case '"': buf.append('\\').append('"'); continue; case '\\': buf.append('\\').append('\\'); continue; case '\b': buf.append('\\').append('b'); continue; case '\f': buf.append('\\').append('f'); continue; case '\n': buf.append('\\').append('n'); continue; case '\r': buf.append('\\').append('r'); continue; case '\t': buf.append('\\').append('t'); continue; } if (c < 0x001F) { buf.append('\\').append('u').append('0').append('0') .append((char) Const.HEX[(c >>> 4) & 0x0F]) .append((char) Const.HEX[c & 0x0F]); } else { buf.append(c); } } }
[ "static", "void", "escapeJson", "(", "final", "String", "s", ",", "final", "StringBuilder", "buf", ")", "{", "final", "int", "length", "=", "s", ".", "length", "(", ")", ";", "int", "extra", "=", "0", ";", "// First count how many extra chars we'll need, if an...
Escapes a string appropriately to be a valid in JSON. Valid JSON strings are defined in RFC 4627, Section 2.5. @param s The string to escape, which is assumed to be in . @param buf The buffer into which to write the escaped string.
[ "Escapes", "a", "string", "appropriately", "to", "be", "a", "valid", "in", "JSON", ".", "Valid", "JSON", "strings", "are", "defined", "in", "RFC", "4627", "Section", "2", ".", "5", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpQuery.java#L478-L523
Azure/azure-sdk-for-java
devspaces/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/devspaces/v2018_06_01_preview/implementation/ControllersInner.java
ControllersInner.listConnectionDetailsAsync
public Observable<ControllerConnectionDetailsListInner> listConnectionDetailsAsync(String resourceGroupName, String name) { return listConnectionDetailsWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<ControllerConnectionDetailsListInner>, ControllerConnectionDetailsListInner>() { @Override public ControllerConnectionDetailsListInner call(ServiceResponse<ControllerConnectionDetailsListInner> response) { return response.body(); } }); }
java
public Observable<ControllerConnectionDetailsListInner> listConnectionDetailsAsync(String resourceGroupName, String name) { return listConnectionDetailsWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<ControllerConnectionDetailsListInner>, ControllerConnectionDetailsListInner>() { @Override public ControllerConnectionDetailsListInner call(ServiceResponse<ControllerConnectionDetailsListInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ControllerConnectionDetailsListInner", ">", "listConnectionDetailsAsync", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "listConnectionDetailsWithServiceResponseAsync", "(", "resourceGroupName", ",", "name", ")", ...
Lists connection details for an Azure Dev Spaces Controller. Lists connection details for the underlying container resources of an Azure Dev Spaces Controller. @param resourceGroupName Resource group to which the resource belongs. @param name Name of the resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ControllerConnectionDetailsListInner object
[ "Lists", "connection", "details", "for", "an", "Azure", "Dev", "Spaces", "Controller", ".", "Lists", "connection", "details", "for", "the", "underlying", "container", "resources", "of", "an", "Azure", "Dev", "Spaces", "Controller", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/devspaces/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/devspaces/v2018_06_01_preview/implementation/ControllersInner.java#L1003-L1010
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/GenericResource.java
GenericResource.lockDiscovery
public static HierarchicalProperty lockDiscovery(String token, String lockOwner, String timeOut) { HierarchicalProperty lockDiscovery = new HierarchicalProperty(new QName("DAV:", "lockdiscovery")); HierarchicalProperty activeLock = lockDiscovery.addChild(new HierarchicalProperty(new QName("DAV:", "activelock"))); HierarchicalProperty lockType = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "locktype"))); lockType.addChild(new HierarchicalProperty(new QName("DAV:", "write"))); HierarchicalProperty lockScope = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "lockscope"))); lockScope.addChild(new HierarchicalProperty(new QName("DAV:", "exclusive"))); HierarchicalProperty depth = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "depth"))); depth.setValue("Infinity"); if (lockOwner != null) { HierarchicalProperty owner = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "owner"))); owner.setValue(lockOwner); } HierarchicalProperty timeout = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "timeout"))); timeout.setValue("Second-" + timeOut); if (token != null) { HierarchicalProperty lockToken = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "locktoken"))); HierarchicalProperty lockHref = lockToken.addChild(new HierarchicalProperty(new QName("DAV:", "href"))); lockHref.setValue(token); } return lockDiscovery; }
java
public static HierarchicalProperty lockDiscovery(String token, String lockOwner, String timeOut) { HierarchicalProperty lockDiscovery = new HierarchicalProperty(new QName("DAV:", "lockdiscovery")); HierarchicalProperty activeLock = lockDiscovery.addChild(new HierarchicalProperty(new QName("DAV:", "activelock"))); HierarchicalProperty lockType = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "locktype"))); lockType.addChild(new HierarchicalProperty(new QName("DAV:", "write"))); HierarchicalProperty lockScope = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "lockscope"))); lockScope.addChild(new HierarchicalProperty(new QName("DAV:", "exclusive"))); HierarchicalProperty depth = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "depth"))); depth.setValue("Infinity"); if (lockOwner != null) { HierarchicalProperty owner = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "owner"))); owner.setValue(lockOwner); } HierarchicalProperty timeout = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "timeout"))); timeout.setValue("Second-" + timeOut); if (token != null) { HierarchicalProperty lockToken = activeLock.addChild(new HierarchicalProperty(new QName("DAV:", "locktoken"))); HierarchicalProperty lockHref = lockToken.addChild(new HierarchicalProperty(new QName("DAV:", "href"))); lockHref.setValue(token); } return lockDiscovery; }
[ "public", "static", "HierarchicalProperty", "lockDiscovery", "(", "String", "token", ",", "String", "lockOwner", ",", "String", "timeOut", ")", "{", "HierarchicalProperty", "lockDiscovery", "=", "new", "HierarchicalProperty", "(", "new", "QName", "(", "\"DAV:\"", ",...
Returns the information about lock. @param token lock token @param lockOwner lockowner @param timeOut lock timeout @return lock information
[ "Returns", "the", "information", "about", "lock", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/GenericResource.java#L146-L179
haraldk/TwelveMonkeys
servlet/src/main/java/com/twelvemonkeys/servlet/ServletResponseStreamDelegate.java
ServletResponseStreamDelegate.getWriter
public final PrintWriter getWriter() throws IOException { if (out == null) { // NOTE: getCharacterEncoding may/should not return null OutputStream out = createOutputStream(); String charEncoding = response.getCharacterEncoding(); this.out = new PrintWriter(charEncoding != null ? new OutputStreamWriter(out, charEncoding) : new OutputStreamWriter(out)); } else if (out instanceof ServletOutputStream) { throw new IllegalStateException("getOutputStream() already called."); } return (PrintWriter) out; }
java
public final PrintWriter getWriter() throws IOException { if (out == null) { // NOTE: getCharacterEncoding may/should not return null OutputStream out = createOutputStream(); String charEncoding = response.getCharacterEncoding(); this.out = new PrintWriter(charEncoding != null ? new OutputStreamWriter(out, charEncoding) : new OutputStreamWriter(out)); } else if (out instanceof ServletOutputStream) { throw new IllegalStateException("getOutputStream() already called."); } return (PrintWriter) out; }
[ "public", "final", "PrintWriter", "getWriter", "(", ")", "throws", "IOException", "{", "if", "(", "out", "==", "null", ")", "{", "// NOTE: getCharacterEncoding may/should not return null\r", "OutputStream", "out", "=", "createOutputStream", "(", ")", ";", "String", ...
NOTE: Intentionally NOT thread safe, as one request/response should be handled by one thread ONLY.
[ "NOTE", ":", "Intentionally", "NOT", "thread", "safe", "as", "one", "request", "/", "response", "should", "be", "handled", "by", "one", "thread", "ONLY", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/ServletResponseStreamDelegate.java#L74-L86
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectCalendar.java
ProjectCalendar.getTime
private long getTime(Date start, Date end) { long total = 0; if (start != null && end != null) { Date startTime = DateHelper.getCanonicalTime(start); Date endTime = DateHelper.getCanonicalTime(end); Date startDay = DateHelper.getDayStartDate(start); Date finishDay = DateHelper.getDayStartDate(end); // // Handle the case where the end of the range is at midnight - // this will show up as the start and end days not matching // if (startDay.getTime() != finishDay.getTime()) { endTime = DateHelper.addDays(endTime, 1); } total = (endTime.getTime() - startTime.getTime()); } return (total); }
java
private long getTime(Date start, Date end) { long total = 0; if (start != null && end != null) { Date startTime = DateHelper.getCanonicalTime(start); Date endTime = DateHelper.getCanonicalTime(end); Date startDay = DateHelper.getDayStartDate(start); Date finishDay = DateHelper.getDayStartDate(end); // // Handle the case where the end of the range is at midnight - // this will show up as the start and end days not matching // if (startDay.getTime() != finishDay.getTime()) { endTime = DateHelper.addDays(endTime, 1); } total = (endTime.getTime() - startTime.getTime()); } return (total); }
[ "private", "long", "getTime", "(", "Date", "start", ",", "Date", "end", ")", "{", "long", "total", "=", "0", ";", "if", "(", "start", "!=", "null", "&&", "end", "!=", "null", ")", "{", "Date", "startTime", "=", "DateHelper", ".", "getCanonicalTime", ...
Retrieves the amount of time between two date time values. Note that these values are converted into canonical values to remove the date component. @param start start time @param end end time @return length of time
[ "Retrieves", "the", "amount", "of", "time", "between", "two", "date", "time", "values", ".", "Note", "that", "these", "values", "are", "converted", "into", "canonical", "values", "to", "remove", "the", "date", "component", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L1566-L1589
TheHortonMachine/hortonmachine
apps/src/main/java/org/hortonmachine/database/SqlDocument.java
SqlDocument.insertString
public void insertString( int offset, String str, AttributeSet a ) throws BadLocationException { if (str.equals("{")) str = addMatchingBrace(offset); super.insertString(offset, str, a); processChangedLines(offset, str.length()); }
java
public void insertString( int offset, String str, AttributeSet a ) throws BadLocationException { if (str.equals("{")) str = addMatchingBrace(offset); super.insertString(offset, str, a); processChangedLines(offset, str.length()); }
[ "public", "void", "insertString", "(", "int", "offset", ",", "String", "str", ",", "AttributeSet", "a", ")", "throws", "BadLocationException", "{", "if", "(", "str", ".", "equals", "(", "\"{\"", ")", ")", "str", "=", "addMatchingBrace", "(", "offset", ")",...
/* Override to apply syntax highlighting after the document has been updated
[ "/", "*", "Override", "to", "apply", "syntax", "highlighting", "after", "the", "document", "has", "been", "updated" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/apps/src/main/java/org/hortonmachine/database/SqlDocument.java#L87-L92
ykrasik/jaci
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/command/CliCommand.java
CliCommand.fromDef
public static CliCommand fromDef(CommandDef def) { final Identifier identifier = def.getIdentifier(); final List<CliParam> params = createParams(def.getParamDefs()); final CommandExecutor executor = def.getExecutor(); return from(identifier, params, executor); }
java
public static CliCommand fromDef(CommandDef def) { final Identifier identifier = def.getIdentifier(); final List<CliParam> params = createParams(def.getParamDefs()); final CommandExecutor executor = def.getExecutor(); return from(identifier, params, executor); }
[ "public", "static", "CliCommand", "fromDef", "(", "CommandDef", "def", ")", "{", "final", "Identifier", "identifier", "=", "def", ".", "getIdentifier", "(", ")", ";", "final", "List", "<", "CliParam", ">", "params", "=", "createParams", "(", "def", ".", "g...
Construct a CLI command from a {@link CommandDef}. @param def CommandDef to construct a CLI command from. @return A CLI command constructed from the CommandDef.
[ "Construct", "a", "CLI", "command", "from", "a", "{", "@link", "CommandDef", "}", "." ]
train
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/command/CliCommand.java#L103-L108
bingoohuang/excel2javabeans
src/main/java/com/github/bingoohuang/excel2maps/impl/ColumnRef.java
ColumnRef.wildMatch
public static boolean wildMatch(String text, String pattern) { if (pattern == null) return false; return text.matches(pattern.replace("?", ".?") .replace("*", ".*?")); }
java
public static boolean wildMatch(String text, String pattern) { if (pattern == null) return false; return text.matches(pattern.replace("?", ".?") .replace("*", ".*?")); }
[ "public", "static", "boolean", "wildMatch", "(", "String", "text", ",", "String", "pattern", ")", "{", "if", "(", "pattern", "==", "null", ")", "return", "false", ";", "return", "text", ".", "matches", "(", "pattern", ".", "replace", "(", "\"?\"", ",", ...
The following Java method tests if a string matches a wildcard expression (supporting ? for exactly one character or * for an arbitrary number of characters): @param text Text to test @param pattern (Wildcard) pattern to test @return True if the text matches the wildcard pattern
[ "The", "following", "Java", "method", "tests", "if", "a", "string", "matches", "a", "wildcard", "expression", "(", "supporting", "?", "for", "exactly", "one", "character", "or", "*", "for", "an", "arbitrary", "number", "of", "characters", ")", ":" ]
train
https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2maps/impl/ColumnRef.java#L31-L36
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java
ContentSpecProcessor.doesRelationshipMatch
protected boolean doesRelationshipMatch(final TargetRelationship relationship, final CSRelatedNodeWrapper relatedNode) { // If the relationship node is a node that can't be related to (ie a comment or meta data), than the relationship cannot match if (relatedNode.getNodeType().equals(CommonConstants.CS_NODE_COMMENT) || relatedNode.getNodeType().equals( CommonConstants.CS_NODE_META_DATA)) { return false; } // Check if the type matches first if (!RelationshipType.getRelationshipTypeId(relationship.getType()).equals(relatedNode.getRelationshipType())) return false; // If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare if (relationship.getSecondaryRelationship().getUniqueId() != null && relationship.getSecondaryRelationship().getUniqueId().matches( "^\\d.*")) { return relationship.getSecondaryRelationship().getUniqueId().equals(Integer.toString(relatedNode.getId())); } else if (relationship.getSecondaryRelationship() instanceof Level) { return ((Level) relationship.getSecondaryRelationship()).getTargetId().equals(relatedNode.getTargetId()); } else if (relationship.getSecondaryRelationship() instanceof SpecTopic) { return ((SpecTopic) relationship.getSecondaryRelationship()).getTargetId().equals(relatedNode.getTargetId()); } else { return false; } }
java
protected boolean doesRelationshipMatch(final TargetRelationship relationship, final CSRelatedNodeWrapper relatedNode) { // If the relationship node is a node that can't be related to (ie a comment or meta data), than the relationship cannot match if (relatedNode.getNodeType().equals(CommonConstants.CS_NODE_COMMENT) || relatedNode.getNodeType().equals( CommonConstants.CS_NODE_META_DATA)) { return false; } // Check if the type matches first if (!RelationshipType.getRelationshipTypeId(relationship.getType()).equals(relatedNode.getRelationshipType())) return false; // If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare if (relationship.getSecondaryRelationship().getUniqueId() != null && relationship.getSecondaryRelationship().getUniqueId().matches( "^\\d.*")) { return relationship.getSecondaryRelationship().getUniqueId().equals(Integer.toString(relatedNode.getId())); } else if (relationship.getSecondaryRelationship() instanceof Level) { return ((Level) relationship.getSecondaryRelationship()).getTargetId().equals(relatedNode.getTargetId()); } else if (relationship.getSecondaryRelationship() instanceof SpecTopic) { return ((SpecTopic) relationship.getSecondaryRelationship()).getTargetId().equals(relatedNode.getTargetId()); } else { return false; } }
[ "protected", "boolean", "doesRelationshipMatch", "(", "final", "TargetRelationship", "relationship", ",", "final", "CSRelatedNodeWrapper", "relatedNode", ")", "{", "// If the relationship node is a node that can't be related to (ie a comment or meta data), than the relationship cannot matc...
Checks to see if a ContentSpec topic relationship matches a Content Spec Entity topic. @param relationship The ContentSpec topic relationship object. @param relatedNode The related Content Spec Entity topic. @return True if the topic is determined to match otherwise false.
[ "Checks", "to", "see", "if", "a", "ContentSpec", "topic", "relationship", "matches", "a", "Content", "Spec", "Entity", "topic", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecProcessor.java#L2216-L2237
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/ContentModeratorManager.java
ContentModeratorManager.authenticate
public static ContentModeratorClient authenticate(AzureRegionBaseUrl baseUrl, String subscriptionKey) { return authenticate("https://{baseUrl}/", subscriptionKey) .withBaseUrl(baseUrl); }
java
public static ContentModeratorClient authenticate(AzureRegionBaseUrl baseUrl, String subscriptionKey) { return authenticate("https://{baseUrl}/", subscriptionKey) .withBaseUrl(baseUrl); }
[ "public", "static", "ContentModeratorClient", "authenticate", "(", "AzureRegionBaseUrl", "baseUrl", ",", "String", "subscriptionKey", ")", "{", "return", "authenticate", "(", "\"https://{baseUrl}/\"", ",", "subscriptionKey", ")", ".", "withBaseUrl", "(", "baseUrl", ")",...
Initializes an instance of Content Moderator API client. @param baseUrl sets Supported Azure regions for Content Moderator endpoints. @param subscriptionKey the Content Moderator API key @return the Content Moderator API client
[ "Initializes", "an", "instance", "of", "Content", "Moderator", "API", "client", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/ContentModeratorManager.java#L31-L34
Labs64/swid-generator
src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java
ExtendedSwidProcessor.setReleaseId
public ExtendedSwidProcessor setReleaseId(final String releaseId) { swidTag.setReleaseId(new Token(releaseId, idGenerator.nextId())); return this; }
java
public ExtendedSwidProcessor setReleaseId(final String releaseId) { swidTag.setReleaseId(new Token(releaseId, idGenerator.nextId())); return this; }
[ "public", "ExtendedSwidProcessor", "setReleaseId", "(", "final", "String", "releaseId", ")", "{", "swidTag", ".", "setReleaseId", "(", "new", "Token", "(", "releaseId", ",", "idGenerator", ".", "nextId", "(", ")", ")", ")", ";", "return", "this", ";", "}" ]
Defines product release identifier (tag: release_id). @param releaseId product release identifier @return a reference to this object.
[ "Defines", "product", "release", "identifier", "(", "tag", ":", "release_id", ")", "." ]
train
https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/ExtendedSwidProcessor.java#L176-L179
BlueBrain/bluima
modules/bluima_units/src/main/java/ch/epfl/bbp/uima/ae/RegExAnnotator.java
RegExAnnotator.matchRuleExceptions
private boolean matchRuleExceptions(RuleException[] exceptions, CAS aCAS, AnnotationFS annot) { // if we have already checked the exceptions for the current match type // annotation, return the // last result - this can happen in case of MATCH_ALL match strategy if (this.lastRuleExceptionAnnotation == annot) { return this.lastRuleExceptionMatch; } // loop over all rule exceptions for (int i = 0; i < exceptions.length; i++) { // store current match type annotation for performance reason. In case // of MATCH_ALL match // strategy maybe the matchRuleException() method is called multiple // times for the same // match type annotations and in that case the result of the rule // exception match is exactly // the same. this.lastRuleExceptionAnnotation = annot; // find covering annotation AnnotationFS coverFs = findCoverFS(aCAS, annot, exceptions[i].getType()); // check if covering annotation was found if (coverFs != null) { // check if the found coverFs annotation match the exception pattern if (exceptions[i].matchPattern(coverFs)) { this.lastRuleExceptionMatch = true; return this.lastRuleExceptionMatch; } } } this.lastRuleExceptionMatch = false; return false; }
java
private boolean matchRuleExceptions(RuleException[] exceptions, CAS aCAS, AnnotationFS annot) { // if we have already checked the exceptions for the current match type // annotation, return the // last result - this can happen in case of MATCH_ALL match strategy if (this.lastRuleExceptionAnnotation == annot) { return this.lastRuleExceptionMatch; } // loop over all rule exceptions for (int i = 0; i < exceptions.length; i++) { // store current match type annotation for performance reason. In case // of MATCH_ALL match // strategy maybe the matchRuleException() method is called multiple // times for the same // match type annotations and in that case the result of the rule // exception match is exactly // the same. this.lastRuleExceptionAnnotation = annot; // find covering annotation AnnotationFS coverFs = findCoverFS(aCAS, annot, exceptions[i].getType()); // check if covering annotation was found if (coverFs != null) { // check if the found coverFs annotation match the exception pattern if (exceptions[i].matchPattern(coverFs)) { this.lastRuleExceptionMatch = true; return this.lastRuleExceptionMatch; } } } this.lastRuleExceptionMatch = false; return false; }
[ "private", "boolean", "matchRuleExceptions", "(", "RuleException", "[", "]", "exceptions", ",", "CAS", "aCAS", ",", "AnnotationFS", "annot", ")", "{", "// if we have already checked the exceptions for the current match type", "// annotation, return the", "// last result - this ca...
Check if the rule exception match for the current match type annotation. @param exceptions current rule exceptions @param aCAS current CAS @param annot current match type annotation @return returns true if the rule exception match
[ "Check", "if", "the", "rule", "exception", "match", "for", "the", "current", "match", "type", "annotation", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_units/src/main/java/ch/epfl/bbp/uima/ae/RegExAnnotator.java#L499-L534
james-hu/jabb-core
src/main/java/net/sf/jabb/util/text/word/TextAnalyzer.java
TextAnalyzer.createInstance
static public TextAnalyzer createInstance(int type, Map<String, ? extends Object> keywordDefinitions, Map<Integer, ? extends Object> lengthDefinitions){ return createInstance(type, null, keywordDefinitions, lengthDefinitions); }
java
static public TextAnalyzer createInstance(int type, Map<String, ? extends Object> keywordDefinitions, Map<Integer, ? extends Object> lengthDefinitions){ return createInstance(type, null, keywordDefinitions, lengthDefinitions); }
[ "static", "public", "TextAnalyzer", "createInstance", "(", "int", "type", ",", "Map", "<", "String", ",", "?", "extends", "Object", ">", "keywordDefinitions", ",", "Map", "<", "Integer", ",", "?", "extends", "Object", ">", "lengthDefinitions", ")", "{", "ret...
Create an instance of TextAnalyzer.<br> 创建一个文本分析器实例。 @param type {@link #TYPE_MMSEG_SIMPLE} | {@link #TYPE_MMSEG_COMPLEX} | {@link #TYPE_MMSEG_MAXWORD} | {@link #TYPE_FAST} @param keywordDefinitions 关键词字的定义 @param lengthDefinitions 文本长度类别定义 @return A new instance of TextAnalyzer.<br>TextAnalyzer的一个实例。
[ "Create", "an", "instance", "of", "TextAnalyzer", ".", "<br", ">", "创建一个文本分析器实例。" ]
train
https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/text/word/TextAnalyzer.java#L86-L90
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.lineTo
public void lineTo (final float x, final float y) throws IOException { if (inTextMode) { throw new IllegalStateException ("Error: lineTo is not allowed within a text block."); } writeOperand (x); writeOperand (y); writeOperator ((byte) 'l'); }
java
public void lineTo (final float x, final float y) throws IOException { if (inTextMode) { throw new IllegalStateException ("Error: lineTo is not allowed within a text block."); } writeOperand (x); writeOperand (y); writeOperator ((byte) 'l'); }
[ "public", "void", "lineTo", "(", "final", "float", "x", ",", "final", "float", "y", ")", "throws", "IOException", "{", "if", "(", "inTextMode", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Error: lineTo is not allowed within a text block.\"", ")", ";...
Draw a line from the current position to the given coordinates. @param x The x coordinate. @param y The y coordinate. @throws IOException If the content stream could not be written. @throws IllegalStateException If the method was called within a text block.
[ "Draw", "a", "line", "from", "the", "current", "position", "to", "the", "given", "coordinates", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1245-L1254
wildfly/wildfly-core
controller-client/src/main/java/org/jboss/as/controller/client/helpers/Operations.java
Operations.createOperation
public static ModelNode createOperation(final String operation, final ModelNode address) { if (address.getType() != ModelType.LIST) { throw ControllerClientLogger.ROOT_LOGGER.invalidAddressType(); } final ModelNode op = createOperation(operation); op.get(OP_ADDR).set(address); return op; }
java
public static ModelNode createOperation(final String operation, final ModelNode address) { if (address.getType() != ModelType.LIST) { throw ControllerClientLogger.ROOT_LOGGER.invalidAddressType(); } final ModelNode op = createOperation(operation); op.get(OP_ADDR).set(address); return op; }
[ "public", "static", "ModelNode", "createOperation", "(", "final", "String", "operation", ",", "final", "ModelNode", "address", ")", "{", "if", "(", "address", ".", "getType", "(", ")", "!=", "ModelType", ".", "LIST", ")", "{", "throw", "ControllerClientLogger"...
Creates an operation. @param operation the operation name @param address the address for the operation @return the operation @throws IllegalArgumentException if the address is not of type {@link org.jboss.dmr.ModelType#LIST}
[ "Creates", "an", "operation", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller-client/src/main/java/org/jboss/as/controller/client/helpers/Operations.java#L364-L371
galenframework/galen
galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java
PageSpec.addSpec
public void addSpec(String sectionName, String objectName, String specText) { PageSection pageSection = findSection(sectionName); if (pageSection == null) { pageSection = new PageSection(sectionName); sections.add(pageSection); } ObjectSpecs objectSpecs = new ObjectSpecs(objectName); objectSpecs.addSpec(new SpecReader().read(specText)); pageSection.addObjects(objectSpecs); }
java
public void addSpec(String sectionName, String objectName, String specText) { PageSection pageSection = findSection(sectionName); if (pageSection == null) { pageSection = new PageSection(sectionName); sections.add(pageSection); } ObjectSpecs objectSpecs = new ObjectSpecs(objectName); objectSpecs.addSpec(new SpecReader().read(specText)); pageSection.addObjects(objectSpecs); }
[ "public", "void", "addSpec", "(", "String", "sectionName", ",", "String", "objectName", ",", "String", "specText", ")", "{", "PageSection", "pageSection", "=", "findSection", "(", "sectionName", ")", ";", "if", "(", "pageSection", "==", "null", ")", "{", "pa...
Parses the spec from specText and adds it to the page spec inside specified section. If section does not exit, it will create it @param sectionName @param objectName @param specText
[ "Parses", "the", "spec", "from", "specText", "and", "adds", "it", "to", "the", "page", "spec", "inside", "specified", "section", ".", "If", "section", "does", "not", "exit", "it", "will", "create", "it" ]
train
https://github.com/galenframework/galen/blob/6c7dc1f11d097e6aa49c45d6a77ee688741657a4/galen-core/src/main/java/com/galenframework/specs/page/PageSpec.java#L225-L236
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java
OrmLiteConfigUtil.writeConfigFile
public static void writeConfigFile(File configFile, File searchDir, boolean sortClasses) throws SQLException, IOException { List<Class<?>> classList = new ArrayList<Class<?>>(); findAnnotatedClasses(classList, searchDir, 0); writeConfigFile(configFile, classList.toArray(new Class[classList.size()]), sortClasses); }
java
public static void writeConfigFile(File configFile, File searchDir, boolean sortClasses) throws SQLException, IOException { List<Class<?>> classList = new ArrayList<Class<?>>(); findAnnotatedClasses(classList, searchDir, 0); writeConfigFile(configFile, classList.toArray(new Class[classList.size()]), sortClasses); }
[ "public", "static", "void", "writeConfigFile", "(", "File", "configFile", ",", "File", "searchDir", ",", "boolean", "sortClasses", ")", "throws", "SQLException", ",", "IOException", "{", "List", "<", "Class", "<", "?", ">", ">", "classList", "=", "new", "Arr...
Finds the annotated classes in the specified search directory or below and writes a configuration file. @param sortClasses Set to true to sort the classes by name before the file is generated.
[ "Finds", "the", "annotated", "classes", "in", "the", "specified", "search", "directory", "or", "below", "and", "writes", "a", "configuration", "file", "." ]
train
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java#L176-L181
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java
SARLQuickfixProvider.fixManualInlineDefinition
@Fix(io.sarl.lang.validation.IssueCodes.MANUAL_INLINE_DEFINITION) public void fixManualInlineDefinition(final Issue issue, IssueResolutionAcceptor acceptor) { AnnotationRemoveModification.accept(this, issue, acceptor); }
java
@Fix(io.sarl.lang.validation.IssueCodes.MANUAL_INLINE_DEFINITION) public void fixManualInlineDefinition(final Issue issue, IssueResolutionAcceptor acceptor) { AnnotationRemoveModification.accept(this, issue, acceptor); }
[ "@", "Fix", "(", "io", ".", "sarl", ".", "lang", ".", "validation", ".", "IssueCodes", ".", "MANUAL_INLINE_DEFINITION", ")", "public", "void", "fixManualInlineDefinition", "(", "final", "Issue", "issue", ",", "IssueResolutionAcceptor", "acceptor", ")", "{", "Ann...
Quick fix for the manual definition of inline statements. @param issue the issue. @param acceptor the quick fix acceptor.
[ "Quick", "fix", "for", "the", "manual", "definition", "of", "inline", "statements", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/SARLQuickfixProvider.java#L984-L987
joniles/mpxj
src/main/java/net/sf/mpxj/utility/MppCleanUtility.java
MppCleanUtility.processReplacements
private void processReplacements(DirectoryEntry parentDirectory, String fileName, Map<String, String> replacements, boolean unicode) throws IOException { // // Populate a list of keys and sort into descending order of length // List<String> keys = new ArrayList<String>(replacements.keySet()); Collections.sort(keys, new Comparator<String>() { @Override public int compare(String o1, String o2) { return (o2.length() - o1.length()); } }); // // Extract the raw file data // DocumentEntry targetFile = (DocumentEntry) parentDirectory.getEntry(fileName); DocumentInputStream dis = new DocumentInputStream(targetFile); int dataSize = dis.available(); byte[] data = new byte[dataSize]; dis.read(data); dis.close(); // // Replace the text // for (String findText : keys) { String replaceText = replacements.get(findText); replaceData(data, findText, replaceText, unicode); } // // Remove the document entry // targetFile.delete(); // // Replace it with a new one // parentDirectory.createDocument(fileName, new ByteArrayInputStream(data)); }
java
private void processReplacements(DirectoryEntry parentDirectory, String fileName, Map<String, String> replacements, boolean unicode) throws IOException { // // Populate a list of keys and sort into descending order of length // List<String> keys = new ArrayList<String>(replacements.keySet()); Collections.sort(keys, new Comparator<String>() { @Override public int compare(String o1, String o2) { return (o2.length() - o1.length()); } }); // // Extract the raw file data // DocumentEntry targetFile = (DocumentEntry) parentDirectory.getEntry(fileName); DocumentInputStream dis = new DocumentInputStream(targetFile); int dataSize = dis.available(); byte[] data = new byte[dataSize]; dis.read(data); dis.close(); // // Replace the text // for (String findText : keys) { String replaceText = replacements.get(findText); replaceData(data, findText, replaceText, unicode); } // // Remove the document entry // targetFile.delete(); // // Replace it with a new one // parentDirectory.createDocument(fileName, new ByteArrayInputStream(data)); }
[ "private", "void", "processReplacements", "(", "DirectoryEntry", "parentDirectory", ",", "String", "fileName", ",", "Map", "<", "String", ",", "String", ">", "replacements", ",", "boolean", "unicode", ")", "throws", "IOException", "{", "//", "// Populate a list of k...
Extracts a block of data from the MPP file, and iterates through the map of find/replace pairs to make the data anonymous. @param parentDirectory parent directory object @param fileName target file name @param replacements find/replace data @param unicode true for double byte text @throws IOException
[ "Extracts", "a", "block", "of", "data", "from", "the", "MPP", "file", "and", "iterates", "through", "the", "map", "of", "find", "/", "replace", "pairs", "to", "make", "the", "data", "anonymous", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/utility/MppCleanUtility.java#L231-L273
BioPAX/Paxtools
paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java
QueryExecuter.addEquivalentsComplexes
private static void addEquivalentsComplexes(PhysicalEntity pe, Set<PhysicalEntity> pes) { addEquivalentsComplexes(pe, true, pes); // Do not traverse to more specific. This was causing a bug so I commented out. Did not delete it just in case // later we realize that this is needed for another use case. // addEquivalentsComplexes(pe, false, pes); }
java
private static void addEquivalentsComplexes(PhysicalEntity pe, Set<PhysicalEntity> pes) { addEquivalentsComplexes(pe, true, pes); // Do not traverse to more specific. This was causing a bug so I commented out. Did not delete it just in case // later we realize that this is needed for another use case. // addEquivalentsComplexes(pe, false, pes); }
[ "private", "static", "void", "addEquivalentsComplexes", "(", "PhysicalEntity", "pe", ",", "Set", "<", "PhysicalEntity", ">", "pes", ")", "{", "addEquivalentsComplexes", "(", "pe", ",", "true", ",", "pes", ")", ";", "// Do not traverse to more specific. This was causin...
Adds equivalents and parent complexes of the given PhysicalEntity to the parameter set. @param pe The PhysicalEntity to add its equivalents and complexes @param pes Set to collect equivalents and complexes
[ "Adds", "equivalents", "and", "parent", "complexes", "of", "the", "given", "PhysicalEntity", "to", "the", "parameter", "set", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L705-L712
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java
MemberSummaryBuilder.buildAnnotationTypeRequiredMemberSummary
public void buildAnnotationTypeRequiredMemberSummary(XMLNode node, Content memberSummaryTree) { MemberSummaryWriter writer = memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_REQUIRED); VisibleMemberMap visibleMemberMap = getVisibleMemberMap(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_REQUIRED); addSummary(writer, visibleMemberMap, false, memberSummaryTree); }
java
public void buildAnnotationTypeRequiredMemberSummary(XMLNode node, Content memberSummaryTree) { MemberSummaryWriter writer = memberSummaryWriters.get(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_REQUIRED); VisibleMemberMap visibleMemberMap = getVisibleMemberMap(VisibleMemberMap.Kind.ANNOTATION_TYPE_MEMBER_REQUIRED); addSummary(writer, visibleMemberMap, false, memberSummaryTree); }
[ "public", "void", "buildAnnotationTypeRequiredMemberSummary", "(", "XMLNode", "node", ",", "Content", "memberSummaryTree", ")", "{", "MemberSummaryWriter", "writer", "=", "memberSummaryWriters", ".", "get", "(", "VisibleMemberMap", ".", "Kind", ".", "ANNOTATION_TYPE_MEMBE...
Build the summary for the optional members. @param node the XML element that specifies which components to document @param memberSummaryTree the content tree to which the documentation will be added
[ "Build", "the", "summary", "for", "the", "optional", "members", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/MemberSummaryBuilder.java#L251-L257
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/component/UIComponentBase.java
UIComponentBase.setValueBinding
public void setValueBinding(String name, ValueBinding binding) { if (name == null) { throw new NullPointerException(); } if (binding != null) { ValueExpressionValueBindingAdapter adapter = new ValueExpressionValueBindingAdapter(binding); setValueExpression(name, adapter); } else { setValueExpression(name, null); } }
java
public void setValueBinding(String name, ValueBinding binding) { if (name == null) { throw new NullPointerException(); } if (binding != null) { ValueExpressionValueBindingAdapter adapter = new ValueExpressionValueBindingAdapter(binding); setValueExpression(name, adapter); } else { setValueExpression(name, null); } }
[ "public", "void", "setValueBinding", "(", "String", "name", ",", "ValueBinding", "binding", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "if", "(", "binding", "!=", "null", ")", "{", "...
{@inheritDoc} @throws IllegalArgumentException {@inheritDoc} @throws NullPointerException {@inheritDoc} @deprecated This has been replaced by {@link #setValueExpression}.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/UIComponentBase.java#L300-L312
mguymon/model-citizen
core/src/main/java/com/tobedevoured/modelcitizen/ModelFactory.java
ModelFactory.createModel
public <T> T createModel(Class<T> clazz) throws CreateModelException { return createModel(clazz, true); }
java
public <T> T createModel(Class<T> clazz) throws CreateModelException { return createModel(clazz, true); }
[ "public", "<", "T", ">", "T", "createModel", "(", "Class", "<", "T", ">", "clazz", ")", "throws", "CreateModelException", "{", "return", "createModel", "(", "clazz", ",", "true", ")", ";", "}" ]
Create a Model for a registered Blueprint @param <T> model Class @param clazz Model class @return Model @throws CreateModelException model failed to create
[ "Create", "a", "Model", "for", "a", "registered", "Blueprint" ]
train
https://github.com/mguymon/model-citizen/blob/9078ab4121897a21e598dd4f0efa6996b46e4dea/core/src/main/java/com/tobedevoured/modelcitizen/ModelFactory.java#L451-L453
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/message/record/RecordMessage.java
RecordMessage.convertToThinMessage
public BaseMessage convertToThinMessage() { int iChangeType = ((RecordMessageHeader)this.getMessageHeader()).getRecordMessageType(); // See if this record is currently displayed or buffered, if so, refresh and display. Object data = this.getData(); BaseMessage messageTableUpdate = null; // NOTE: The only way I will send this message to the client is if the ModelMessageHandler.START_INDEX_PARAM has been added to this message by the TableSession // if (properties.get(ModelMessageHandler.START_INDEX_PARAM) != null) { BaseMessageHeader messageHeader = new SessionMessageHeader(this.getMessageHeader().getQueueName(), this.getMessageHeader().getQueueType(), null, this); messageTableUpdate = new MapMessage(messageHeader, data); messageTableUpdate.put(MessageConstants.MESSAGE_TYPE_PARAM, Integer.toString(iChangeType)); } return messageTableUpdate; }
java
public BaseMessage convertToThinMessage() { int iChangeType = ((RecordMessageHeader)this.getMessageHeader()).getRecordMessageType(); // See if this record is currently displayed or buffered, if so, refresh and display. Object data = this.getData(); BaseMessage messageTableUpdate = null; // NOTE: The only way I will send this message to the client is if the ModelMessageHandler.START_INDEX_PARAM has been added to this message by the TableSession // if (properties.get(ModelMessageHandler.START_INDEX_PARAM) != null) { BaseMessageHeader messageHeader = new SessionMessageHeader(this.getMessageHeader().getQueueName(), this.getMessageHeader().getQueueType(), null, this); messageTableUpdate = new MapMessage(messageHeader, data); messageTableUpdate.put(MessageConstants.MESSAGE_TYPE_PARAM, Integer.toString(iChangeType)); } return messageTableUpdate; }
[ "public", "BaseMessage", "convertToThinMessage", "(", ")", "{", "int", "iChangeType", "=", "(", "(", "RecordMessageHeader", ")", "this", ".", "getMessageHeader", "(", ")", ")", ".", "getRecordMessageType", "(", ")", ";", "// See if this record is currently displayed o...
If you are sending a thick message to a thin client, convert it first. Since BaseMessage is already, so conversion is necessary... return this message. @return this message.
[ "If", "you", "are", "sending", "a", "thick", "message", "to", "a", "thin", "client", "convert", "it", "first", ".", "Since", "BaseMessage", "is", "already", "so", "conversion", "is", "necessary", "...", "return", "this", "message", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/record/RecordMessage.java#L80-L95
shinesolutions/swagger-aem
java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/CustomApi.java
CustomApi.postConfigAemHealthCheckServletAsync
public com.squareup.okhttp.Call postConfigAemHealthCheckServletAsync(String runmode, List<String> bundlesIgnored, String bundlesIgnoredTypeHint, final ApiCallback<Void> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postConfigAemHealthCheckServletValidateBeforeCall(runmode, bundlesIgnored, bundlesIgnoredTypeHint, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; }
java
public com.squareup.okhttp.Call postConfigAemHealthCheckServletAsync(String runmode, List<String> bundlesIgnored, String bundlesIgnoredTypeHint, final ApiCallback<Void> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; if (callback != null) { progressListener = new ProgressResponseBody.ProgressListener() { @Override public void update(long bytesRead, long contentLength, boolean done) { callback.onDownloadProgress(bytesRead, contentLength, done); } }; progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { @Override public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { callback.onUploadProgress(bytesWritten, contentLength, done); } }; } com.squareup.okhttp.Call call = postConfigAemHealthCheckServletValidateBeforeCall(runmode, bundlesIgnored, bundlesIgnoredTypeHint, progressListener, progressRequestListener); apiClient.executeAsync(call, callback); return call; }
[ "public", "com", ".", "squareup", ".", "okhttp", ".", "Call", "postConfigAemHealthCheckServletAsync", "(", "String", "runmode", ",", "List", "<", "String", ">", "bundlesIgnored", ",", "String", "bundlesIgnoredTypeHint", ",", "final", "ApiCallback", "<", "Void", ">...
(asynchronously) @param runmode (required) @param bundlesIgnored (optional) @param bundlesIgnoredTypeHint (optional) @param callback The callback to be executed when the API call finishes @return The request call @throws ApiException If fail to process the API call, e.g. serializing the request body object
[ "(", "asynchronously", ")" ]
train
https://github.com/shinesolutions/swagger-aem/blob/ae7da4df93e817dc2bad843779b2069d9c4e7c6b/java/generated/src/main/java/com/shinesolutions/swaggeraem4j/api/CustomApi.java#L295-L319
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.sendDTMF
public void sendDTMF( String connId, String digits, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidsenddtmfData dtmfData = new VoicecallsidsenddtmfData(); dtmfData.setDtmfDigits(digits); dtmfData.setReasons(Util.toKVList(reasons)); dtmfData.setExtensions(Util.toKVList(extensions)); SendDTMFData data = new SendDTMFData(); data.data(dtmfData); ApiSuccessResponse response = this.voiceApi.sendDTMF(connId, data); throwIfNotOk("sendDTMF", response); } catch (ApiException e) { throw new WorkspaceApiException("sendDTMF failed", e); } }
java
public void sendDTMF( String connId, String digits, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidsenddtmfData dtmfData = new VoicecallsidsenddtmfData(); dtmfData.setDtmfDigits(digits); dtmfData.setReasons(Util.toKVList(reasons)); dtmfData.setExtensions(Util.toKVList(extensions)); SendDTMFData data = new SendDTMFData(); data.data(dtmfData); ApiSuccessResponse response = this.voiceApi.sendDTMF(connId, data); throwIfNotOk("sendDTMF", response); } catch (ApiException e) { throw new WorkspaceApiException("sendDTMF failed", e); } }
[ "public", "void", "sendDTMF", "(", "String", "connId", ",", "String", "digits", ",", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensions", ")", "throws", "WorkspaceApiException", "{", "try", "{", "VoicecallsidsenddtmfData", "dtmfData", "=", "new", ...
Send DTMF digits to the specified call. You can send DTMF digits individually with multiple requests or together with multiple digits in one request. @param connId The connection ID of the call. @param digits The DTMF digits to send to the call. @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "Send", "DTMF", "digits", "to", "the", "specified", "call", ".", "You", "can", "send", "DTMF", "digits", "individually", "with", "multiple", "requests", "or", "together", "with", "multiple", "digits", "in", "one", "request", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L1135-L1154
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java
AbstractBeanDefinition.containsValueForField
@Internal @UsedByGeneratedCode protected final boolean containsValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex) { if (context instanceof ApplicationContext) { FieldInjectionPoint injectionPoint = fieldInjectionPoints.get(fieldIndex); final AnnotationMetadata annotationMetadata = injectionPoint.getAnnotationMetadata(); String valueAnnVal = annotationMetadata.getValue(Value.class, String.class).orElse(null); String valString = resolvePropertyValueName(resolutionContext, injectionPoint, valueAnnVal, annotationMetadata); ApplicationContext applicationContext = (ApplicationContext) context; Class fieldType = injectionPoint.getType(); boolean isConfigProps = fieldType.isAnnotationPresent(ConfigurationProperties.class); boolean result = isConfigProps || Map.class.isAssignableFrom(fieldType) ? applicationContext.containsProperties(valString) : applicationContext.containsProperty(valString); if (!result && isConfigurationProperties()) { String cliOption = resolveCliOption(injectionPoint.getName()); if (cliOption != null) { return applicationContext.containsProperty(cliOption); } } return result; } return false; }
java
@Internal @UsedByGeneratedCode protected final boolean containsValueForField(BeanResolutionContext resolutionContext, BeanContext context, int fieldIndex) { if (context instanceof ApplicationContext) { FieldInjectionPoint injectionPoint = fieldInjectionPoints.get(fieldIndex); final AnnotationMetadata annotationMetadata = injectionPoint.getAnnotationMetadata(); String valueAnnVal = annotationMetadata.getValue(Value.class, String.class).orElse(null); String valString = resolvePropertyValueName(resolutionContext, injectionPoint, valueAnnVal, annotationMetadata); ApplicationContext applicationContext = (ApplicationContext) context; Class fieldType = injectionPoint.getType(); boolean isConfigProps = fieldType.isAnnotationPresent(ConfigurationProperties.class); boolean result = isConfigProps || Map.class.isAssignableFrom(fieldType) ? applicationContext.containsProperties(valString) : applicationContext.containsProperty(valString); if (!result && isConfigurationProperties()) { String cliOption = resolveCliOption(injectionPoint.getName()); if (cliOption != null) { return applicationContext.containsProperty(cliOption); } } return result; } return false; }
[ "@", "Internal", "@", "UsedByGeneratedCode", "protected", "final", "boolean", "containsValueForField", "(", "BeanResolutionContext", "resolutionContext", ",", "BeanContext", "context", ",", "int", "fieldIndex", ")", "{", "if", "(", "context", "instanceof", "ApplicationC...
Obtains a value for the given field argument. @param resolutionContext The resolution context @param context The bean context @param fieldIndex The field index @return True if it does
[ "Obtains", "a", "value", "for", "the", "given", "field", "argument", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L1239-L1260
MenoData/Time4J
base/src/main/java/net/time4j/range/Months.java
Months.between
public static <T extends TimePoint<? super CalendarUnit, T>> Months between(T t1, T t2) { long delta = CalendarUnit.MONTHS.between(t1, t2); return Months.of(MathUtils.safeCast(delta)); }
java
public static <T extends TimePoint<? super CalendarUnit, T>> Months between(T t1, T t2) { long delta = CalendarUnit.MONTHS.between(t1, t2); return Months.of(MathUtils.safeCast(delta)); }
[ "public", "static", "<", "T", "extends", "TimePoint", "<", "?", "super", "CalendarUnit", ",", "T", ">", ">", "Months", "between", "(", "T", "t1", ",", "T", "t2", ")", "{", "long", "delta", "=", "CalendarUnit", ".", "MONTHS", ".", "between", "(", "t1"...
/*[deutsch] <p>Bestimmt die gregorianische Monatsdifferenz zwischen den angegebenen Zeitpunkten. </p> @param <T> generic type of time-points @param t1 first time-point @param t2 second time-point @return result of month difference @see net.time4j.PlainDate @see net.time4j.PlainTimestamp
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Bestimmt", "die", "gregorianische", "Monatsdifferenz", "zwischen", "den", "angegebenen", "Zeitpunkten", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/Months.java#L118-L123
ThreeTen/threetenbp
src/main/java/org/threeten/bp/Instant.java
Instant.ofEpochMilli
public static Instant ofEpochMilli(long epochMilli) { long secs = Jdk8Methods.floorDiv(epochMilli, 1000); int mos = Jdk8Methods.floorMod(epochMilli, 1000); return create(secs, mos * NANOS_PER_MILLI); }
java
public static Instant ofEpochMilli(long epochMilli) { long secs = Jdk8Methods.floorDiv(epochMilli, 1000); int mos = Jdk8Methods.floorMod(epochMilli, 1000); return create(secs, mos * NANOS_PER_MILLI); }
[ "public", "static", "Instant", "ofEpochMilli", "(", "long", "epochMilli", ")", "{", "long", "secs", "=", "Jdk8Methods", ".", "floorDiv", "(", "epochMilli", ",", "1000", ")", ";", "int", "mos", "=", "Jdk8Methods", ".", "floorMod", "(", "epochMilli", ",", "1...
Obtains an instance of {@code Instant} using milliseconds from the epoch of 1970-01-01T00:00:00Z. <p> The seconds and nanoseconds are extracted from the specified milliseconds. @param epochMilli the number of milliseconds from 1970-01-01T00:00:00Z @return an instant, not null @throws DateTimeException if the instant exceeds the maximum or minimum instant
[ "Obtains", "an", "instance", "of", "{", "@code", "Instant", "}", "using", "milliseconds", "from", "the", "epoch", "of", "1970", "-", "01", "-", "01T00", ":", "00", ":", "00Z", ".", "<p", ">", "The", "seconds", "and", "nanoseconds", "are", "extracted", ...
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/Instant.java#L315-L319
mongodb/stitch-android-sdk
server/services/mongodb-remote/src/main/java/com/mongodb/stitch/server/services/mongodb/remote/internal/RemoteMongoCollectionImpl.java
RemoteMongoCollectionImpl.findOneAndReplace
public DocumentT findOneAndReplace(final Bson filter, final Bson replacement) { return proxy.findOneAndReplace(filter, replacement); }
java
public DocumentT findOneAndReplace(final Bson filter, final Bson replacement) { return proxy.findOneAndReplace(filter, replacement); }
[ "public", "DocumentT", "findOneAndReplace", "(", "final", "Bson", "filter", ",", "final", "Bson", "replacement", ")", "{", "return", "proxy", ".", "findOneAndReplace", "(", "filter", ",", "replacement", ")", ";", "}" ]
Finds a document in the collection and replaces it with the given document @param filter the query filter @param replacement the document to replace the matched document with @return the resulting document
[ "Finds", "a", "document", "in", "the", "collection", "and", "replaces", "it", "with", "the", "given", "document" ]
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/server/services/mongodb-remote/src/main/java/com/mongodb/stitch/server/services/mongodb/remote/internal/RemoteMongoCollectionImpl.java#L425-L427
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/SavedRevision.java
SavedRevision.createRevision
@InterfaceAudience.Public public SavedRevision createRevision(Map<String, Object> properties) throws CouchbaseLiteException { boolean allowConflict = false; return document.putProperties(properties, revisionInternal.getRevID(), allowConflict); }
java
@InterfaceAudience.Public public SavedRevision createRevision(Map<String, Object> properties) throws CouchbaseLiteException { boolean allowConflict = false; return document.putProperties(properties, revisionInternal.getRevID(), allowConflict); }
[ "@", "InterfaceAudience", ".", "Public", "public", "SavedRevision", "createRevision", "(", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "CouchbaseLiteException", "{", "boolean", "allowConflict", "=", "false", ";", "return", "document", "....
Creates and saves a new revision with the given properties. This will fail with a 412 error if the receiver is not the current revision of the document.
[ "Creates", "and", "saves", "a", "new", "revision", "with", "the", "given", "properties", ".", "This", "will", "fail", "with", "a", "412", "error", "if", "the", "receiver", "is", "not", "the", "current", "revision", "of", "the", "document", "." ]
train
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/SavedRevision.java#L121-L125
Alluxio/alluxio
core/server/common/src/main/java/alluxio/cli/validation/Utils.java
Utils.isAddressReachable
public static boolean isAddressReachable(String hostname, int port) { try (Socket socket = new Socket(hostname, port)) { return true; } catch (IOException e) { return false; } }
java
public static boolean isAddressReachable(String hostname, int port) { try (Socket socket = new Socket(hostname, port)) { return true; } catch (IOException e) { return false; } }
[ "public", "static", "boolean", "isAddressReachable", "(", "String", "hostname", ",", "int", "port", ")", "{", "try", "(", "Socket", "socket", "=", "new", "Socket", "(", "hostname", ",", "port", ")", ")", "{", "return", "true", ";", "}", "catch", "(", "...
Validates whether a network address is reachable. @param hostname host name of the network address @param port port of the network address @return whether the network address is reachable
[ "Validates", "whether", "a", "network", "address", "is", "reachable", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/cli/validation/Utils.java#L46-L52
apache/incubator-gobblin
gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/Instrumented.java
Instrumented.markMeter
public static void markMeter(Optional<Meter> meter, final long value) { meter.transform(new Function<Meter, Meter>() { @Override public Meter apply(@Nonnull Meter input) { input.mark(value); return input; } }); }
java
public static void markMeter(Optional<Meter> meter, final long value) { meter.transform(new Function<Meter, Meter>() { @Override public Meter apply(@Nonnull Meter input) { input.mark(value); return input; } }); }
[ "public", "static", "void", "markMeter", "(", "Optional", "<", "Meter", ">", "meter", ",", "final", "long", "value", ")", "{", "meter", ".", "transform", "(", "new", "Function", "<", "Meter", ",", "Meter", ">", "(", ")", "{", "@", "Override", "public",...
Marks a meter only if it is defined. @param meter an Optional&lt;{@link com.codahale.metrics.Meter}&gt; @param value value to mark
[ "Marks", "a", "meter", "only", "if", "it", "is", "defined", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/Instrumented.java#L263-L271
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/sort/linearlogarithmic/Quicksort.java
Quicksort.partitionDescending
private static <E extends Comparable<E>> int partitionDescending(E[] array, int start, int end) { E pivot = array[end]; int index = start - 1; for(int j = start; j < end; j++) { if(array[j].compareTo(pivot) >= 0) { index++; TrivialSwap.swap(array, index, j); } } TrivialSwap.swap(array, index + 1, end); return index + 1; }
java
private static <E extends Comparable<E>> int partitionDescending(E[] array, int start, int end) { E pivot = array[end]; int index = start - 1; for(int j = start; j < end; j++) { if(array[j].compareTo(pivot) >= 0) { index++; TrivialSwap.swap(array, index, j); } } TrivialSwap.swap(array, index + 1, end); return index + 1; }
[ "private", "static", "<", "E", "extends", "Comparable", "<", "E", ">", ">", "int", "partitionDescending", "(", "E", "[", "]", "array", ",", "int", "start", ",", "int", "end", ")", "{", "E", "pivot", "=", "array", "[", "end", "]", ";", "int", "index...
Routine that arranges the elements in descending order around a pivot. This routine runs in O(n) time. @param <E> the type of elements in this array. @param array array that we want to sort @param start index of the starting point to sort @param end index of the end point to sort @return an integer that represent the index of the pivot
[ "Routine", "that", "arranges", "the", "elements", "in", "descending", "order", "around", "a", "pivot", ".", "This", "routine", "runs", "in", "O", "(", "n", ")", "time", "." ]
train
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/sort/linearlogarithmic/Quicksort.java#L840-L854
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java
SDBaseOps.lt
public SDVariable lt(SDVariable x, SDVariable y) { return lt(null, x, y); }
java
public SDVariable lt(SDVariable x, SDVariable y) { return lt(null, x, y); }
[ "public", "SDVariable", "lt", "(", "SDVariable", "x", ",", "SDVariable", "y", ")", "{", "return", "lt", "(", "null", ",", "x", ",", "y", ")", ";", "}" ]
Less than operation: elementwise x < y<br> If x and y arrays have equal shape, the output shape is the same as these inputs.<br> Note: supports broadcasting if x and y have different shapes and are broadcastable.<br> Returns an array with values 1 where condition is satisfied, or value 0 otherwise. @param x Input 1 @param y Input 2 @return Output SDVariable with values 0 and 1 based on where the condition is satisfied
[ "Less", "than", "operation", ":", "elementwise", "x", "<", "y<br", ">", "If", "x", "and", "y", "arrays", "have", "equal", "shape", "the", "output", "shape", "is", "the", "same", "as", "these", "inputs", ".", "<br", ">", "Note", ":", "supports", "broadc...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDBaseOps.java#L886-L888
molgenis/molgenis
molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlUtils.java
PostgreSqlUtils.getPostgreSqlValue
static Object getPostgreSqlValue(Entity entity, Attribute attr) { String attrName = attr.getName(); AttributeType attrType = attr.getDataType(); switch (attrType) { case BOOL: return entity.getBoolean(attrName); case CATEGORICAL: case XREF: Entity xrefEntity = entity.getEntity(attrName); return xrefEntity != null ? getPostgreSqlValue(xrefEntity, xrefEntity.getEntityType().getIdAttribute()) : null; case CATEGORICAL_MREF: case MREF: case ONE_TO_MANY: Iterable<Entity> entities = entity.getEntities(attrName); return stream(entities) .map( mrefEntity -> getPostgreSqlValue(mrefEntity, mrefEntity.getEntityType().getIdAttribute())) .collect(toList()); case DATE: return entity.getLocalDate(attrName); case DATE_TIME: // As a workaround for #5674, we don't store milliseconds Instant instant = entity.getInstant(attrName); return instant != null ? instant.truncatedTo(ChronoUnit.SECONDS).atOffset(UTC) : null; case DECIMAL: return entity.getDouble(attrName); case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: return entity.getString(attrName); case FILE: FileMeta fileEntity = entity.getEntity(attrName, FileMeta.class); return fileEntity != null ? getPostgreSqlValue(fileEntity, fileEntity.getEntityType().getIdAttribute()) : null; case INT: return entity.getInt(attrName); case LONG: return entity.getLong(attrName); case COMPOUND: throw new IllegalAttributeTypeException(attrType); default: throw new UnexpectedEnumException(attrType); } }
java
static Object getPostgreSqlValue(Entity entity, Attribute attr) { String attrName = attr.getName(); AttributeType attrType = attr.getDataType(); switch (attrType) { case BOOL: return entity.getBoolean(attrName); case CATEGORICAL: case XREF: Entity xrefEntity = entity.getEntity(attrName); return xrefEntity != null ? getPostgreSqlValue(xrefEntity, xrefEntity.getEntityType().getIdAttribute()) : null; case CATEGORICAL_MREF: case MREF: case ONE_TO_MANY: Iterable<Entity> entities = entity.getEntities(attrName); return stream(entities) .map( mrefEntity -> getPostgreSqlValue(mrefEntity, mrefEntity.getEntityType().getIdAttribute())) .collect(toList()); case DATE: return entity.getLocalDate(attrName); case DATE_TIME: // As a workaround for #5674, we don't store milliseconds Instant instant = entity.getInstant(attrName); return instant != null ? instant.truncatedTo(ChronoUnit.SECONDS).atOffset(UTC) : null; case DECIMAL: return entity.getDouble(attrName); case EMAIL: case ENUM: case HTML: case HYPERLINK: case SCRIPT: case STRING: case TEXT: return entity.getString(attrName); case FILE: FileMeta fileEntity = entity.getEntity(attrName, FileMeta.class); return fileEntity != null ? getPostgreSqlValue(fileEntity, fileEntity.getEntityType().getIdAttribute()) : null; case INT: return entity.getInt(attrName); case LONG: return entity.getLong(attrName); case COMPOUND: throw new IllegalAttributeTypeException(attrType); default: throw new UnexpectedEnumException(attrType); } }
[ "static", "Object", "getPostgreSqlValue", "(", "Entity", "entity", ",", "Attribute", "attr", ")", "{", "String", "attrName", "=", "attr", ".", "getName", "(", ")", ";", "AttributeType", "attrType", "=", "attr", ".", "getDataType", "(", ")", ";", "switch", ...
Returns the PostgreSQL value for the given entity attribute @param entity entity @param attr attribute @return PostgreSQL value
[ "Returns", "the", "PostgreSQL", "value", "for", "the", "given", "entity", "attribute" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlUtils.java#L30-L82
facebook/fresco
fbcore/src/main/java/com/facebook/common/internal/Files.java
Files.toByteArray
public static byte[] toByteArray(File file) throws IOException { FileInputStream in = null; try { in = new FileInputStream(file); return readFile(in, in.getChannel().size()); } finally { if (in != null) { in.close(); } } }
java
public static byte[] toByteArray(File file) throws IOException { FileInputStream in = null; try { in = new FileInputStream(file); return readFile(in, in.getChannel().size()); } finally { if (in != null) { in.close(); } } }
[ "public", "static", "byte", "[", "]", "toByteArray", "(", "File", "file", ")", "throws", "IOException", "{", "FileInputStream", "in", "=", "null", ";", "try", "{", "in", "=", "new", "FileInputStream", "(", "file", ")", ";", "return", "readFile", "(", "in...
Reads all bytes from a file into a byte array. @param file the file to read from @return a byte array containing all the bytes from file @throws IllegalArgumentException if the file is bigger than the largest possible byte array (2^31 - 1) @throws IOException if an I/O error occurs
[ "Reads", "all", "bytes", "from", "a", "file", "into", "a", "byte", "array", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/fbcore/src/main/java/com/facebook/common/internal/Files.java#L64-L74
cdk/cdk
tool/group/src/main/java/org/openscience/cdk/group/Partition.java
Partition.addToCell
public void addToCell(int index, int element) { if (cells.size() < index + 1) { addSingletonCell(element); } else { cells.get(index).add(element); } }
java
public void addToCell(int index, int element) { if (cells.size() < index + 1) { addSingletonCell(element); } else { cells.get(index).add(element); } }
[ "public", "void", "addToCell", "(", "int", "index", ",", "int", "element", ")", "{", "if", "(", "cells", ".", "size", "(", ")", "<", "index", "+", "1", ")", "{", "addSingletonCell", "(", "element", ")", ";", "}", "else", "{", "cells", ".", "get", ...
Add an element to a particular cell. @param index the index of the cell to add to @param element the element to add
[ "Add", "an", "element", "to", "a", "particular", "cell", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/group/src/main/java/org/openscience/cdk/group/Partition.java#L358-L364
juebanlin/util4j
util4j/src/main/java/net/jueb/util4j/bytesStream/bytes/HexUtil.java
HexUtil.prettyHexDump
public static String prettyHexDump(byte[] buffer, int offset, int length) { if (length < 0) { throw new IllegalArgumentException("length: " + length); } if (length == 0) { return EMPTY_STRING; } else { int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4; StringBuilder buf = new StringBuilder(rows * 80); appendPrettyHexDump(buf, buffer, offset, length); return buf.toString(); } }
java
public static String prettyHexDump(byte[] buffer, int offset, int length) { if (length < 0) { throw new IllegalArgumentException("length: " + length); } if (length == 0) { return EMPTY_STRING; } else { int rows = length / 16 + (length % 15 == 0? 0 : 1) + 4; StringBuilder buf = new StringBuilder(rows * 80); appendPrettyHexDump(buf, buffer, offset, length); return buf.toString(); } }
[ "public", "static", "String", "prettyHexDump", "(", "byte", "[", "]", "buffer", ",", "int", "offset", ",", "int", "length", ")", "{", "if", "(", "length", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"length: \"", "+", "length", ...
<pre> 格式化为如下样式 +-------------------------------------------------+ | 0 1 2 3 4 5 6 7 8 9 a b c d e f | +--------+-------------------------------------------------+----------------+ |00000000| 4d 49 47 66 4d 41 30 47 43 53 71 47 53 49 62 33 |MIGfMA0GCSqGSIb3| |00000010| 44 51 45 42 41 51 55 41 41 34 47 4e 41 44 43 42 |DQEBAQUAA4GNADCB| |00000020| 69 51 4b 42 67 51 43 39 32 55 54 4f 61 51 48 55 |iQKBgQC92UTOaQHU| |00000030| 6d 4c 4f 2f 31 2b 73 43 6b 70 66 76 52 47 68 6d |mLO/1+sCkpfvRGhm| |00000040| 71 38 70 30 66 33 5a 79 42 71 6b 41 72 69 4d 6b |q8p0f3ZyBqkAriMk| |000000d0| 31 51 49 44 41 51 41 42 |1QIDAQAB | +--------+-------------------------------------------------+----------------+ </pre> @param buffer @param offset @param length @return
[ "<pre", ">", "格式化为如下样式", "+", "-------------------------------------------------", "+", "|", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f", "|", "+", "--------", "+", "-------------------------------------------------", "+", ...
train
https://github.com/juebanlin/util4j/blob/c404b2dbdedf7a8890533b351257fa8af4f1439f/util4j/src/main/java/net/jueb/util4j/bytesStream/bytes/HexUtil.java#L188-L200
instacount/appengine-counter
src/main/java/io/instacount/appengine/counter/service/ShardedCounterServiceImpl.java
ShardedCounterServiceImpl.assertCounterDetailsMutatable
@VisibleForTesting protected void assertCounterDetailsMutatable(final String counterName, final CounterStatus counterStatus) { Preconditions.checkNotNull(counterName); Preconditions.checkNotNull(counterStatus); if (counterStatus != CounterStatus.AVAILABLE && counterStatus != CounterStatus.READ_ONLY_COUNT) { final String msg = String.format("Can't mutate with status %s. Counter must be in in the %s or %s state!", counterStatus, CounterStatus.AVAILABLE, CounterStatus.READ_ONLY_COUNT); throw new CounterNotMutableException(counterName, msg); } }
java
@VisibleForTesting protected void assertCounterDetailsMutatable(final String counterName, final CounterStatus counterStatus) { Preconditions.checkNotNull(counterName); Preconditions.checkNotNull(counterStatus); if (counterStatus != CounterStatus.AVAILABLE && counterStatus != CounterStatus.READ_ONLY_COUNT) { final String msg = String.format("Can't mutate with status %s. Counter must be in in the %s or %s state!", counterStatus, CounterStatus.AVAILABLE, CounterStatus.READ_ONLY_COUNT); throw new CounterNotMutableException(counterName, msg); } }
[ "@", "VisibleForTesting", "protected", "void", "assertCounterDetailsMutatable", "(", "final", "String", "counterName", ",", "final", "CounterStatus", "counterStatus", ")", "{", "Preconditions", ".", "checkNotNull", "(", "counterName", ")", ";", "Preconditions", ".", "...
Helper method to determine if a counter's incrementAmount can be mutated (incremented or decremented). In order for that to happen, the counter's status must be {@link CounterStatus#AVAILABLE}. @param counterName The name of the counter. @param counterStatus The {@link CounterStatus} of a counter that is currently stored in the Datastore. @return
[ "Helper", "method", "to", "determine", "if", "a", "counter", "s", "incrementAmount", "can", "be", "mutated", "(", "incremented", "or", "decremented", ")", ".", "In", "order", "for", "that", "to", "happen", "the", "counter", "s", "status", "must", "be", "{"...
train
https://github.com/instacount/appengine-counter/blob/60aa86ab28f173ec1642539926b69924b8bda238/src/main/java/io/instacount/appengine/counter/service/ShardedCounterServiceImpl.java#L1448-L1460
knowm/XChart
xchart/src/main/java/org/knowm/xchart/BubbleChart.java
BubbleChart.addSeries
public BubbleSeries addSeries( String seriesName, double[] xData, double[] yData, double[] bubbleData) { // Sanity checks sanityCheck(seriesName, xData, yData, bubbleData); BubbleSeries series; if (xData != null) { // Sanity check if (xData.length != yData.length) { throw new IllegalArgumentException("X and Y-Axis sizes are not the same!!!"); } series = new BubbleSeries(seriesName, xData, yData, bubbleData); } else { // generate xData series = new BubbleSeries( seriesName, Utils.getGeneratedDataAsArray(yData.length), yData, bubbleData); } seriesMap.put(seriesName, series); return series; }
java
public BubbleSeries addSeries( String seriesName, double[] xData, double[] yData, double[] bubbleData) { // Sanity checks sanityCheck(seriesName, xData, yData, bubbleData); BubbleSeries series; if (xData != null) { // Sanity check if (xData.length != yData.length) { throw new IllegalArgumentException("X and Y-Axis sizes are not the same!!!"); } series = new BubbleSeries(seriesName, xData, yData, bubbleData); } else { // generate xData series = new BubbleSeries( seriesName, Utils.getGeneratedDataAsArray(yData.length), yData, bubbleData); } seriesMap.put(seriesName, series); return series; }
[ "public", "BubbleSeries", "addSeries", "(", "String", "seriesName", ",", "double", "[", "]", "xData", ",", "double", "[", "]", "yData", ",", "double", "[", "]", "bubbleData", ")", "{", "// Sanity checks", "sanityCheck", "(", "seriesName", ",", "xData", ",", ...
Add a series for a Bubble type chart using using Lists @param seriesName @param xData the X-Axis data @param xData the Y-Axis data @param bubbleData the bubble data @return
[ "Add", "a", "series", "for", "a", "Bubble", "type", "chart", "using", "using", "Lists" ]
train
https://github.com/knowm/XChart/blob/677a105753a855edf24782fab1bf1f5aec3e642b/xchart/src/main/java/org/knowm/xchart/BubbleChart.java#L103-L127
hawkular/hawkular-commons
hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/WebSocketHelper.java
WebSocketHelper.sendBasicMessageAsync
public void sendBasicMessageAsync(Session session, BasicMessage msg) { String text = ApiDeserializer.toHawkularFormat(msg); sendTextAsync(session, text); }
java
public void sendBasicMessageAsync(Session session, BasicMessage msg) { String text = ApiDeserializer.toHawkularFormat(msg); sendTextAsync(session, text); }
[ "public", "void", "sendBasicMessageAsync", "(", "Session", "session", ",", "BasicMessage", "msg", ")", "{", "String", "text", "=", "ApiDeserializer", ".", "toHawkularFormat", "(", "msg", ")", ";", "sendTextAsync", "(", "session", ",", "text", ")", ";", "}" ]
Converts the given message to JSON and sends that JSON text to clients asynchronously. @param session the client session where the JSON message will be sent @param msg the message to be converted to JSON and sent
[ "Converts", "the", "given", "message", "to", "JSON", "and", "sends", "that", "JSON", "text", "to", "clients", "asynchronously", "." ]
train
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-command-gateway/hawkular-command-gateway-war/src/main/java/org/hawkular/cmdgw/command/ws/server/WebSocketHelper.java#L80-L83
JadiraOrg/jadira
cloning/src/main/java/org/jadira/reflection/core/misc/ClassUtils.java
ClassUtils.collectInstanceFields
public static Field[] collectInstanceFields(Class<?> c, boolean excludePublic, boolean excludeProtected, boolean excludePrivate) { int inclusiveModifiers = 0; int exclusiveModifiers = Modifier.STATIC; if (excludePrivate) { exclusiveModifiers += Modifier.PRIVATE; } if (excludePublic) { exclusiveModifiers += Modifier.PUBLIC; } if (excludeProtected) { exclusiveModifiers += Modifier.PROTECTED; } return collectFields(c, inclusiveModifiers, exclusiveModifiers); }
java
public static Field[] collectInstanceFields(Class<?> c, boolean excludePublic, boolean excludeProtected, boolean excludePrivate) { int inclusiveModifiers = 0; int exclusiveModifiers = Modifier.STATIC; if (excludePrivate) { exclusiveModifiers += Modifier.PRIVATE; } if (excludePublic) { exclusiveModifiers += Modifier.PUBLIC; } if (excludeProtected) { exclusiveModifiers += Modifier.PROTECTED; } return collectFields(c, inclusiveModifiers, exclusiveModifiers); }
[ "public", "static", "Field", "[", "]", "collectInstanceFields", "(", "Class", "<", "?", ">", "c", ",", "boolean", "excludePublic", ",", "boolean", "excludeProtected", ",", "boolean", "excludePrivate", ")", "{", "int", "inclusiveModifiers", "=", "0", ";", "int"...
Produces an array with all the instance fields of the specified class which match the supplied rules @param c The class specified @param excludePublic Exclude public fields if true @param excludeProtected Exclude protected fields if true @param excludePrivate Exclude private fields if true @return The array of matched Fields
[ "Produces", "an", "array", "with", "all", "the", "instance", "fields", "of", "the", "specified", "class", "which", "match", "the", "supplied", "rules" ]
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/core/misc/ClassUtils.java#L146-L162
twilio/twilio-java
src/main/java/com/twilio/base/Page.java
Page.getFirstPageUrl
public String getFirstPageUrl(String domain, String region) { if (firstPageUrl != null) { return firstPageUrl; } return urlFromUri(domain, region, firstPageUri); }
java
public String getFirstPageUrl(String domain, String region) { if (firstPageUrl != null) { return firstPageUrl; } return urlFromUri(domain, region, firstPageUri); }
[ "public", "String", "getFirstPageUrl", "(", "String", "domain", ",", "String", "region", ")", "{", "if", "(", "firstPageUrl", "!=", "null", ")", "{", "return", "firstPageUrl", ";", "}", "return", "urlFromUri", "(", "domain", ",", "region", ",", "firstPageUri...
Generate first page url for a list result. @param domain domain to use @param region region to use @return the first page url
[ "Generate", "first", "page", "url", "for", "a", "list", "result", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/base/Page.java#L53-L59
heroku/heroku.jar
heroku-api/src/main/java/com/heroku/api/HerokuAPI.java
HerokuAPI.addAddon
public AddonChange addAddon(String appName, String addonName) { return connection.execute(new AddonInstall(appName, addonName), apiKey); }
java
public AddonChange addAddon(String appName, String addonName) { return connection.execute(new AddonInstall(appName, addonName), apiKey); }
[ "public", "AddonChange", "addAddon", "(", "String", "appName", ",", "String", "addonName", ")", "{", "return", "connection", ".", "execute", "(", "new", "AddonInstall", "(", "appName", ",", "addonName", ")", ",", "apiKey", ")", ";", "}" ]
Add an addon to the app. @param appName App name. See {@link #listApps} for a list of apps that can be used. @param addonName Addon name. See {@link #listAllAddons} to get a list of addons that can be used. @return The request object
[ "Add", "an", "addon", "to", "the", "app", "." ]
train
https://github.com/heroku/heroku.jar/blob/d9e52991293159498c10c498c6f91fcdd637378e/heroku-api/src/main/java/com/heroku/api/HerokuAPI.java#L214-L216
oboehm/jfachwert
src/main/java/de/jfachwert/bank/IBAN.java
IBAN.getLand
@SuppressWarnings({"squid:SwitchLastCaseIsDefaultCheck", "squid:S1301"}) public Locale getLand() { String country = this.getUnformatted().substring(0, 2); String language = country.toLowerCase(); switch (country) { case "AT": case "CH": language = "de"; break; } return new Locale(language, country); }
java
@SuppressWarnings({"squid:SwitchLastCaseIsDefaultCheck", "squid:S1301"}) public Locale getLand() { String country = this.getUnformatted().substring(0, 2); String language = country.toLowerCase(); switch (country) { case "AT": case "CH": language = "de"; break; } return new Locale(language, country); }
[ "@", "SuppressWarnings", "(", "{", "\"squid:SwitchLastCaseIsDefaultCheck\"", ",", "\"squid:S1301\"", "}", ")", "public", "Locale", "getLand", "(", ")", "{", "String", "country", "=", "this", ".", "getUnformatted", "(", ")", ".", "substring", "(", "0", ",", "2"...
Liefert das Land, zu dem die IBAN gehoert. @return z.B. "de_DE" (als Locale) @since 0.1.0
[ "Liefert", "das", "Land", "zu", "dem", "die", "IBAN", "gehoert", "." ]
train
https://github.com/oboehm/jfachwert/blob/67b513d29e3114c7aee65cd1ea7a5b7e540b0d1b/src/main/java/de/jfachwert/bank/IBAN.java#L132-L143
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/snmp_view.java
snmp_view.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { snmp_view_responses result = (snmp_view_responses) service.get_payload_formatter().string_to_resource(snmp_view_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.snmp_view_response_array); } snmp_view[] result_snmp_view = new snmp_view[result.snmp_view_response_array.length]; for(int i = 0; i < result.snmp_view_response_array.length; i++) { result_snmp_view[i] = result.snmp_view_response_array[i].snmp_view[0]; } return result_snmp_view; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { snmp_view_responses result = (snmp_view_responses) service.get_payload_formatter().string_to_resource(snmp_view_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.snmp_view_response_array); } snmp_view[] result_snmp_view = new snmp_view[result.snmp_view_response_array.length]; for(int i = 0; i < result.snmp_view_response_array.length; i++) { result_snmp_view[i] = result.snmp_view_response_array[i].snmp_view[0]; } return result_snmp_view; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "snmp_view_responses", "result", "=", "(", "snmp_view_responses", ")", "service", ".", "get_payload_formatter"...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/snmp_view.java#L368-L385
ltsopensource/light-task-scheduler
lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java
WebUtils.encode
public static String encode(String value, String charset) { String result = null; if (!StringUtils.isEmpty(value)) { try { result = URLEncoder.encode(value, charset); } catch (IOException e) { throw new RuntimeException(e); } } return result; }
java
public static String encode(String value, String charset) { String result = null; if (!StringUtils.isEmpty(value)) { try { result = URLEncoder.encode(value, charset); } catch (IOException e) { throw new RuntimeException(e); } } return result; }
[ "public", "static", "String", "encode", "(", "String", "value", ",", "String", "charset", ")", "{", "String", "result", "=", "null", ";", "if", "(", "!", "StringUtils", ".", "isEmpty", "(", "value", ")", ")", "{", "try", "{", "result", "=", "URLEncoder...
使用指定的字符集编码请求参数值。 @param value 参数值 @param charset 字符集 @return 编码后的参数值
[ "使用指定的字符集编码请求参数值。" ]
train
https://github.com/ltsopensource/light-task-scheduler/blob/64d3aa000ff5022be5e94f511b58f405e5f4c8eb/lts-core/src/main/java/com/github/ltsopensource/core/commons/utils/WebUtils.java#L332-L342
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ApplicationSecurityGroupsInner.java
ApplicationSecurityGroupsInner.beginDelete
public void beginDelete(String resourceGroupName, String applicationSecurityGroupName) { beginDeleteWithServiceResponseAsync(resourceGroupName, applicationSecurityGroupName).toBlocking().single().body(); }
java
public void beginDelete(String resourceGroupName, String applicationSecurityGroupName) { beginDeleteWithServiceResponseAsync(resourceGroupName, applicationSecurityGroupName).toBlocking().single().body(); }
[ "public", "void", "beginDelete", "(", "String", "resourceGroupName", ",", "String", "applicationSecurityGroupName", ")", "{", "beginDeleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "applicationSecurityGroupName", ")", ".", "toBlocking", "(", ")", ".", "sing...
Deletes the specified application security group. @param resourceGroupName The name of the resource group. @param applicationSecurityGroupName The name of the application security group. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "the", "specified", "application", "security", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/ApplicationSecurityGroupsInner.java#L180-L182
brettwooldridge/SansOrm
src/main/java/com/zaxxer/sansorm/OrmElf.java
OrmElf.getColumnsCsv
public static <T> String getColumnsCsv(Class<T> clazz, String... tablePrefix) { return OrmReader.getColumnsCsv(clazz, tablePrefix); }
java
public static <T> String getColumnsCsv(Class<T> clazz, String... tablePrefix) { return OrmReader.getColumnsCsv(clazz, tablePrefix); }
[ "public", "static", "<", "T", ">", "String", "getColumnsCsv", "(", "Class", "<", "T", ">", "clazz", ",", "String", "...", "tablePrefix", ")", "{", "return", "OrmReader", ".", "getColumnsCsv", "(", "clazz", ",", "tablePrefix", ")", ";", "}" ]
Get a comma separated values list of column names for the given class, suitable for inclusion into a SQL SELECT statement. @param clazz the annotated class @param tablePrefix an optional table prefix to append to each column @param <T> the class template @return a CSV of annotated column names
[ "Get", "a", "comma", "separated", "values", "list", "of", "column", "names", "for", "the", "given", "class", "suitable", "for", "inclusion", "into", "a", "SQL", "SELECT", "statement", "." ]
train
https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/OrmElf.java#L319-L322
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.postFileRequest
protected InputStream postFileRequest(String methodName, Map<String, CharSequence> params) throws IOException { assert (null != _uploadFile); try { BufferedInputStream bufin = new BufferedInputStream(new FileInputStream(_uploadFile)); String boundary = Long.toString(System.currentTimeMillis(), 16); URLConnection con = SERVER_URL.openConnection(); con.setDoInput(true); con.setDoOutput(true); con.setUseCaches(false); con.setRequestProperty("Content-Type", "multipart/form-data; charset=UTF-8; boundary=" + boundary); con.setRequestProperty("MIME-version", "1.0"); DataOutputStream out = new DataOutputStream(con.getOutputStream()); for (Map.Entry<String, CharSequence> entry : params.entrySet()) { out.writeBytes(PREF + boundary + CRLF); out.writeBytes("Content-disposition: form-data; name=\"" + entry.getKey() + "\""); out.writeBytes(CRLF + CRLF); byte[] bytes = entry.getValue().toString().getBytes("UTF-8"); out.write(bytes); out.writeBytes(CRLF); } out.writeBytes(PREF + boundary + CRLF); out.writeBytes("Content-disposition: form-data; filename=\"" + _uploadFile.getName() + "\"" + CRLF); out.writeBytes("Content-Type: image/jpeg" + CRLF); // out.writeBytes("Content-Transfer-Encoding: binary" + CRLF); // not necessary // Write the file out.writeBytes(CRLF); byte b[] = new byte[UPLOAD_BUFFER_SIZE]; int byteCounter = 0; int i; while (-1 != (i = bufin.read(b))) { byteCounter += i; out.write(b, 0, i); } out.writeBytes(CRLF + PREF + boundary + PREF + CRLF); out.flush(); out.close(); InputStream is = con.getInputStream(); return is; } catch (Exception e) { logException(e); return null; } }
java
protected InputStream postFileRequest(String methodName, Map<String, CharSequence> params) throws IOException { assert (null != _uploadFile); try { BufferedInputStream bufin = new BufferedInputStream(new FileInputStream(_uploadFile)); String boundary = Long.toString(System.currentTimeMillis(), 16); URLConnection con = SERVER_URL.openConnection(); con.setDoInput(true); con.setDoOutput(true); con.setUseCaches(false); con.setRequestProperty("Content-Type", "multipart/form-data; charset=UTF-8; boundary=" + boundary); con.setRequestProperty("MIME-version", "1.0"); DataOutputStream out = new DataOutputStream(con.getOutputStream()); for (Map.Entry<String, CharSequence> entry : params.entrySet()) { out.writeBytes(PREF + boundary + CRLF); out.writeBytes("Content-disposition: form-data; name=\"" + entry.getKey() + "\""); out.writeBytes(CRLF + CRLF); byte[] bytes = entry.getValue().toString().getBytes("UTF-8"); out.write(bytes); out.writeBytes(CRLF); } out.writeBytes(PREF + boundary + CRLF); out.writeBytes("Content-disposition: form-data; filename=\"" + _uploadFile.getName() + "\"" + CRLF); out.writeBytes("Content-Type: image/jpeg" + CRLF); // out.writeBytes("Content-Transfer-Encoding: binary" + CRLF); // not necessary // Write the file out.writeBytes(CRLF); byte b[] = new byte[UPLOAD_BUFFER_SIZE]; int byteCounter = 0; int i; while (-1 != (i = bufin.read(b))) { byteCounter += i; out.write(b, 0, i); } out.writeBytes(CRLF + PREF + boundary + PREF + CRLF); out.flush(); out.close(); InputStream is = con.getInputStream(); return is; } catch (Exception e) { logException(e); return null; } }
[ "protected", "InputStream", "postFileRequest", "(", "String", "methodName", ",", "Map", "<", "String", ",", "CharSequence", ">", "params", ")", "throws", "IOException", "{", "assert", "(", "null", "!=", "_uploadFile", ")", ";", "try", "{", "BufferedInputStream",...
Helper function for posting a request that includes raw file data, eg {@link #photos_upload(File)}. @param methodName the name of the method @param params request parameters (not including the file) @return an InputStream with the request response @see #photos_upload(File)
[ "Helper", "function", "for", "posting", "a", "request", "that", "includes", "raw", "file", "data", "eg", "{" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1056-L1107