id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
47,700 | wstrange/GoogleAuth | src/main/java/com/warrenstrange/googleauth/GoogleAuthenticator.java | GoogleAuthenticator.getValidCredentialRepository | private ICredentialRepository getValidCredentialRepository()
{
ICredentialRepository repository = getCredentialRepository();
if (repository == null)
{
throw new UnsupportedOperationException(
String.format("An instance of the %s service must be " +
... | java | private ICredentialRepository getValidCredentialRepository()
{
ICredentialRepository repository = getCredentialRepository();
if (repository == null)
{
throw new UnsupportedOperationException(
String.format("An instance of the %s service must be " +
... | [
"private",
"ICredentialRepository",
"getValidCredentialRepository",
"(",
")",
"{",
"ICredentialRepository",
"repository",
"=",
"getCredentialRepository",
"(",
")",
";",
"if",
"(",
"repository",
"==",
"null",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"("... | This method loads the first available and valid ICredentialRepository
registered using the Java service loader API.
@return the first registered ICredentialRepository.
@throws java.lang.UnsupportedOperationException if no valid service is
found. | [
"This",
"method",
"loads",
"the",
"first",
"available",
"and",
"valid",
"ICredentialRepository",
"registered",
"using",
"the",
"Java",
"service",
"loader",
"API",
"."
] | 03f37333f8b3e411e10e63a7c85c4d2155929321 | https://github.com/wstrange/GoogleAuth/blob/03f37333f8b3e411e10e63a7c85c4d2155929321/src/main/java/com/warrenstrange/googleauth/GoogleAuthenticator.java#L577-L592 |
47,701 | wstrange/GoogleAuth | src/main/java/com/warrenstrange/googleauth/GoogleAuthenticator.java | GoogleAuthenticator.getCredentialRepository | public ICredentialRepository getCredentialRepository()
{
if (this.credentialRepositorySearched) return this.credentialRepository;
this.credentialRepositorySearched = true;
ServiceLoader<ICredentialRepository> loader =
ServiceLoader.load(ICredentialRepository.class);
... | java | public ICredentialRepository getCredentialRepository()
{
if (this.credentialRepositorySearched) return this.credentialRepository;
this.credentialRepositorySearched = true;
ServiceLoader<ICredentialRepository> loader =
ServiceLoader.load(ICredentialRepository.class);
... | [
"public",
"ICredentialRepository",
"getCredentialRepository",
"(",
")",
"{",
"if",
"(",
"this",
".",
"credentialRepositorySearched",
")",
"return",
"this",
".",
"credentialRepository",
";",
"this",
".",
"credentialRepositorySearched",
"=",
"true",
";",
"ServiceLoader",
... | This method loads the first available ICredentialRepository
registered using the Java service loader API.
@return the first registered ICredentialRepository or <code>null</code>
if none is found. | [
"This",
"method",
"loads",
"the",
"first",
"available",
"ICredentialRepository",
"registered",
"using",
"the",
"Java",
"service",
"loader",
"API",
"."
] | 03f37333f8b3e411e10e63a7c85c4d2155929321 | https://github.com/wstrange/GoogleAuth/blob/03f37333f8b3e411e10e63a7c85c4d2155929321/src/main/java/com/warrenstrange/googleauth/GoogleAuthenticator.java#L601-L618 |
47,702 | bbossgroups/bboss-elasticsearch | bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/BuildTool.java | BuildTool.buildMeta | public static void buildMeta(Writer writer ,String indexType,String indexName, Object params,String action,ClientOptions clientOption,boolean upper7) throws IOException {
if(params instanceof Map){
buildMapMeta( writer , indexType, indexName, (Map) params, action, clientOption, upper7);
return;
}
Obje... | java | public static void buildMeta(Writer writer ,String indexType,String indexName, Object params,String action,ClientOptions clientOption,boolean upper7) throws IOException {
if(params instanceof Map){
buildMapMeta( writer , indexType, indexName, (Map) params, action, clientOption, upper7);
return;
}
Obje... | [
"public",
"static",
"void",
"buildMeta",
"(",
"Writer",
"writer",
",",
"String",
"indexType",
",",
"String",
"indexName",
",",
"Object",
"params",
",",
"String",
"action",
",",
"ClientOptions",
"clientOption",
",",
"boolean",
"upper7",
")",
"throws",
"IOExceptio... | String docIdKey,String parentIdKey,String routingKey
@param writer
@param indexType
@param indexName
@param params
@param action
@throws IOException | [
"String",
"docIdKey",
"String",
"parentIdKey",
"String",
"routingKey"
] | 31717c8aa2c4c880987be53aeeb8a0cf5183c3a7 | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/BuildTool.java#L347-L369 |
47,703 | bbossgroups/bboss-elasticsearch | bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/template/ESTemplate.java | ESTemplate.process | public boolean process()
throws ResourceNotFoundException, ParseErrorException
{
if(processed)
return true;
synchronized(this)
{
if(processed)
return true;
data = null;
errorCondition = null;
Reader is = null;
/*
... | java | public boolean process()
throws ResourceNotFoundException, ParseErrorException
{
if(processed)
return true;
synchronized(this)
{
if(processed)
return true;
data = null;
errorCondition = null;
Reader is = null;
/*
... | [
"public",
"boolean",
"process",
"(",
")",
"throws",
"ResourceNotFoundException",
",",
"ParseErrorException",
"{",
"if",
"(",
"processed",
")",
"return",
"true",
";",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"processed",
")",
"return",
"true",
";",
"... | gets the named resource as a stream, parses and inits
@return true if successful
@throws ResourceNotFoundException if template not found
from any available source.
@throws ParseErrorException if template cannot be parsed due
to syntax (or other) error.
@throws IOException problem reading input stream | [
"gets",
"the",
"named",
"resource",
"as",
"a",
"stream",
"parses",
"and",
"inits"
] | 31717c8aa2c4c880987be53aeeb8a0cf5183c3a7 | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/template/ESTemplate.java#L116-L231 |
47,704 | bbossgroups/bboss-elasticsearch | bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ConfigRestClientUtil.java | ConfigRestClientUtil.addDateDocumentsNew | public String addDateDocumentsNew(String indexName, String addTemplate, List<?> beans, String refreshOption) throws ElasticSearchException{
return addDateDocuments( indexName, _doc, addTemplate, beans, refreshOption);
} | java | public String addDateDocumentsNew(String indexName, String addTemplate, List<?> beans, String refreshOption) throws ElasticSearchException{
return addDateDocuments( indexName, _doc, addTemplate, beans, refreshOption);
} | [
"public",
"String",
"addDateDocumentsNew",
"(",
"String",
"indexName",
",",
"String",
"addTemplate",
",",
"List",
"<",
"?",
">",
"beans",
",",
"String",
"refreshOption",
")",
"throws",
"ElasticSearchException",
"{",
"return",
"addDateDocuments",
"(",
"indexName",
... | For Elasticsearch 7 and 7+
@param indexName
@param addTemplate
@param beans
@param refreshOption
refresh=wait_for
refresh=false
refresh=true
refresh
Empty string or true
Refresh the relevant primary and replica shards (not the whole index) immediately after the operation occurs, so that the updated document appears in... | [
"For",
"Elasticsearch",
"7",
"and",
"7",
"+"
] | 31717c8aa2c4c880987be53aeeb8a0cf5183c3a7 | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ConfigRestClientUtil.java#L1452-L1454 |
47,705 | bbossgroups/bboss-elasticsearch | bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/BucketPath.java | BucketPath.getEscapeMapping | @Deprecated
public static Map<String, String> getEscapeMapping(String in,
Map<String, String> headers) {
return getEscapeMapping(in, headers, false, 0, 0);
} | java | @Deprecated
public static Map<String, String> getEscapeMapping(String in,
Map<String, String> headers) {
return getEscapeMapping(in, headers, false, 0, 0);
} | [
"@",
"Deprecated",
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"getEscapeMapping",
"(",
"String",
"in",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
")",
"{",
"return",
"getEscapeMapping",
"(",
"in",
",",
"headers",
",",
"f... | Instead of replacing escape sequences in a string, this method returns a
mapping of an attribute name to the value based on the escape sequence
found in the argument string. | [
"Instead",
"of",
"replacing",
"escape",
"sequences",
"in",
"a",
"string",
"this",
"method",
"returns",
"a",
"mapping",
"of",
"an",
"attribute",
"name",
"to",
"the",
"value",
"based",
"on",
"the",
"escape",
"sequence",
"found",
"in",
"the",
"argument",
"strin... | 31717c8aa2c4c880987be53aeeb8a0cf5183c3a7 | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/BucketPath.java#L487-L491 |
47,706 | bbossgroups/bboss-elasticsearch | bboss-elasticsearch/src/main/java/org/frameworkset/elasticsearch/client/ElasticSearchTransportClient.java | ElasticSearchTransportClient.openClient | private void openClient(String clusterName) {
logger.info("Using ElasticSearch hostnames: {} ", Arrays.toString(serverAddresses));
Settings settings = null;
Settings.Builder builder = Settings.builder();
if (this.elasticUser != null && !this.elasticUser.equals("")) {
builder.put("cluster.name", clusterName)
... | java | private void openClient(String clusterName) {
logger.info("Using ElasticSearch hostnames: {} ", Arrays.toString(serverAddresses));
Settings settings = null;
Settings.Builder builder = Settings.builder();
if (this.elasticUser != null && !this.elasticUser.equals("")) {
builder.put("cluster.name", clusterName)
... | [
"private",
"void",
"openClient",
"(",
"String",
"clusterName",
")",
"{",
"logger",
".",
"info",
"(",
"\"Using ElasticSearch hostnames: {} \"",
",",
"Arrays",
".",
"toString",
"(",
"serverAddresses",
")",
")",
";",
"Settings",
"settings",
"=",
"null",
";",
"Setti... | Open client to elaticsearch cluster
@param clusterName | [
"Open",
"client",
"to",
"elaticsearch",
"cluster"
] | 31717c8aa2c4c880987be53aeeb8a0cf5183c3a7 | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch/src/main/java/org/frameworkset/elasticsearch/client/ElasticSearchTransportClient.java#L226-L269 |
47,707 | bbossgroups/bboss-elasticsearch | bboss-elasticsearch-spring-boot-starter/src/main/java/org/frameworkset/elasticsearch/boot/BBossESStarter.java | BBossESStarter.getRestClient | public ClientInterface getRestClient(){
if(restClient == null) {
synchronized (this) {
if(restClient == null) {
restClient = ElasticSearchHelper.getRestClientUtil();
}
}
}
return restClient;
} | java | public ClientInterface getRestClient(){
if(restClient == null) {
synchronized (this) {
if(restClient == null) {
restClient = ElasticSearchHelper.getRestClientUtil();
}
}
}
return restClient;
} | [
"public",
"ClientInterface",
"getRestClient",
"(",
")",
"{",
"if",
"(",
"restClient",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"restClient",
"==",
"null",
")",
"{",
"restClient",
"=",
"ElasticSearchHelper",
".",
"getRestClien... | Get default elasticsearch server ClientInterface
@return | [
"Get",
"default",
"elasticsearch",
"server",
"ClientInterface"
] | 31717c8aa2c4c880987be53aeeb8a0cf5183c3a7 | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-spring-boot-starter/src/main/java/org/frameworkset/elasticsearch/boot/BBossESStarter.java#L60-L69 |
47,708 | bbossgroups/bboss-elasticsearch | bboss-elasticsearch-spring-boot-starter/src/main/java/org/frameworkset/elasticsearch/boot/BBossESStarter.java | BBossESStarter.getConfigRestClient | public ClientInterface getConfigRestClient(String elasticsearchName,String configFile){
return ElasticSearchHelper.getConfigRestClientUtil(elasticsearchName,configFile);
} | java | public ClientInterface getConfigRestClient(String elasticsearchName,String configFile){
return ElasticSearchHelper.getConfigRestClientUtil(elasticsearchName,configFile);
} | [
"public",
"ClientInterface",
"getConfigRestClient",
"(",
"String",
"elasticsearchName",
",",
"String",
"configFile",
")",
"{",
"return",
"ElasticSearchHelper",
".",
"getConfigRestClientUtil",
"(",
"elasticsearchName",
",",
"configFile",
")",
";",
"}"
] | Get Special elasticsearch server ConfigFile ClientInterface
@param elasticsearchName elasticsearch server name which defined in bboss spring boot application configfile
@param configFile
@return | [
"Get",
"Special",
"elasticsearch",
"server",
"ConfigFile",
"ClientInterface"
] | 31717c8aa2c4c880987be53aeeb8a0cf5183c3a7 | https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-spring-boot-starter/src/main/java/org/frameworkset/elasticsearch/boot/BBossESStarter.java#L77-L81 |
47,709 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/StyleClassedTextArea.java | StyleClassedTextArea.setStyleClass | public void setStyleClass(int from, int to, String styleClass) {
setStyle(from, to, Collections.singletonList(styleClass));
} | java | public void setStyleClass(int from, int to, String styleClass) {
setStyle(from, to, Collections.singletonList(styleClass));
} | [
"public",
"void",
"setStyleClass",
"(",
"int",
"from",
",",
"int",
"to",
",",
"String",
"styleClass",
")",
"{",
"setStyle",
"(",
"from",
",",
"to",
",",
"Collections",
".",
"singletonList",
"(",
"styleClass",
")",
")",
";",
"}"
] | Convenient method to assign a single style class. | [
"Convenient",
"method",
"to",
"assign",
"a",
"single",
"style",
"class",
"."
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/StyleClassedTextArea.java#L47-L49 |
47,710 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java | GenericStyledArea.currentLine | TwoDimensional.Position currentLine() {
int parIdx = getCurrentParagraph();
Cell<Paragraph<PS, SEG, S>, ParagraphBox<PS, SEG, S>> cell = virtualFlow.getCell(parIdx);
int lineIdx = cell.getNode().getCurrentLineIndex(caretSelectionBind.getUnderlyingCaret());
return paragraphLineNavigator.p... | java | TwoDimensional.Position currentLine() {
int parIdx = getCurrentParagraph();
Cell<Paragraph<PS, SEG, S>, ParagraphBox<PS, SEG, S>> cell = virtualFlow.getCell(parIdx);
int lineIdx = cell.getNode().getCurrentLineIndex(caretSelectionBind.getUnderlyingCaret());
return paragraphLineNavigator.p... | [
"TwoDimensional",
".",
"Position",
"currentLine",
"(",
")",
"{",
"int",
"parIdx",
"=",
"getCurrentParagraph",
"(",
")",
";",
"Cell",
"<",
"Paragraph",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
",",
"ParagraphBox",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
">... | Returns the current line as a two-level index.
The major number is the paragraph index, the minor
number is the line number within the paragraph.
<p>This method has a side-effect of bringing the current
paragraph to the viewport if it is not already visible. | [
"Returns",
"the",
"current",
"line",
"as",
"a",
"two",
"-",
"level",
"index",
".",
"The",
"major",
"number",
"is",
"the",
"paragraph",
"index",
"the",
"minor",
"number",
"is",
"the",
"line",
"number",
"within",
"the",
"paragraph",
"."
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java#L1271-L1276 |
47,711 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java | GenericStyledArea.getCaretOffsetX | final ParagraphBox.CaretOffsetX getCaretOffsetX(CaretNode caret) {
return getCell(caret.getParagraphIndex()).getCaretOffsetX(caret);
} | java | final ParagraphBox.CaretOffsetX getCaretOffsetX(CaretNode caret) {
return getCell(caret.getParagraphIndex()).getCaretOffsetX(caret);
} | [
"final",
"ParagraphBox",
".",
"CaretOffsetX",
"getCaretOffsetX",
"(",
"CaretNode",
"caret",
")",
"{",
"return",
"getCell",
"(",
"caret",
".",
"getParagraphIndex",
"(",
")",
")",
".",
"getCaretOffsetX",
"(",
"caret",
")",
";",
"}"
] | Returns x coordinate of the caret in the current paragraph. | [
"Returns",
"x",
"coordinate",
"of",
"the",
"caret",
"in",
"the",
"current",
"paragraph",
"."
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/GenericStyledArea.java#L1297-L1299 |
47,712 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/model/Paragraph.java | Paragraph.restyle | public Paragraph<PS, SEG, S> restyle(S style) {
return new Paragraph<>(paragraphStyle, segmentOps, segments, StyleSpans.singleton(style, length()));
} | java | public Paragraph<PS, SEG, S> restyle(S style) {
return new Paragraph<>(paragraphStyle, segmentOps, segments, StyleSpans.singleton(style, length()));
} | [
"public",
"Paragraph",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"restyle",
"(",
"S",
"style",
")",
"{",
"return",
"new",
"Paragraph",
"<>",
"(",
"paragraphStyle",
",",
"segmentOps",
",",
"segments",
",",
"StyleSpans",
".",
"singleton",
"(",
"style",
",",
... | Restyles every segment in the paragraph to have the given style.
Note: because Paragraph is immutable, this method returns a new Paragraph.
The current Paragraph is unchanged.
@param style The new style for each segment in the paragraph.
@return The new paragraph with the restyled segments. | [
"Restyles",
"every",
"segment",
"in",
"the",
"paragraph",
"to",
"have",
"the",
"given",
"style",
"."
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/model/Paragraph.java#L304-L306 |
47,713 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/model/Paragraph.java | Paragraph.setParagraphStyle | public Paragraph<PS, SEG, S> setParagraphStyle(PS paragraphStyle) {
return new Paragraph<>(paragraphStyle, segmentOps, segments, styles);
} | java | public Paragraph<PS, SEG, S> setParagraphStyle(PS paragraphStyle) {
return new Paragraph<>(paragraphStyle, segmentOps, segments, styles);
} | [
"public",
"Paragraph",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"setParagraphStyle",
"(",
"PS",
"paragraphStyle",
")",
"{",
"return",
"new",
"Paragraph",
"<>",
"(",
"paragraphStyle",
",",
"segmentOps",
",",
"segments",
",",
"styles",
")",
";",
"}"
] | Creates a new Paragraph which has the same contents as the current Paragraph,
but the given paragraph style.
Note that because Paragraph is immutable, a new Paragraph is returned.
Despite the setX name, the current object is unchanged.
@param paragraphStyle The new paragraph style
@return A new paragraph with the sam... | [
"Creates",
"a",
"new",
"Paragraph",
"which",
"has",
"the",
"same",
"contents",
"as",
"the",
"current",
"Paragraph",
"but",
"the",
"given",
"paragraph",
"style",
"."
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/model/Paragraph.java#L347-L349 |
47,714 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/model/Paragraph.java | Paragraph.getText | public String getText() {
if(text == null) {
StringBuilder sb = new StringBuilder(length());
for(SEG seg: segments)
sb.append(segmentOps.getText(seg));
text = sb.toString();
}
return text;
} | java | public String getText() {
if(text == null) {
StringBuilder sb = new StringBuilder(length());
for(SEG seg: segments)
sb.append(segmentOps.getText(seg));
text = sb.toString();
}
return text;
} | [
"public",
"String",
"getText",
"(",
")",
"{",
"if",
"(",
"text",
"==",
"null",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"length",
"(",
")",
")",
";",
"for",
"(",
"SEG",
"seg",
":",
"segments",
")",
"sb",
".",
"append",
"("... | Returns the plain text content of this paragraph,
not including the line terminator. | [
"Returns",
"the",
"plain",
"text",
"content",
"of",
"this",
"paragraph",
"not",
"including",
"the",
"line",
"terminator",
"."
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/model/Paragraph.java#L412-L420 |
47,715 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocument.java | ReadOnlyStyledDocument.split | public Tuple2<ReadOnlyStyledDocument<PS, SEG, S>, ReadOnlyStyledDocument<PS, SEG, S>> split(int position) {
return tree.locate(NAVIGATE, position).map(this::split);
} | java | public Tuple2<ReadOnlyStyledDocument<PS, SEG, S>, ReadOnlyStyledDocument<PS, SEG, S>> split(int position) {
return tree.locate(NAVIGATE, position).map(this::split);
} | [
"public",
"Tuple2",
"<",
"ReadOnlyStyledDocument",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
",",
"ReadOnlyStyledDocument",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
">",
"split",
"(",
"int",
"position",
")",
"{",
"return",
"tree",
".",
"locate",
"(",
"NAVIGAT... | Splits this document into two at the given position and returns both halves. | [
"Splits",
"this",
"document",
"into",
"two",
"at",
"the",
"given",
"position",
"and",
"returns",
"both",
"halves",
"."
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocument.java#L274-L276 |
47,716 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocument.java | ReadOnlyStyledDocument.split | public Tuple2<ReadOnlyStyledDocument<PS, SEG, S>, ReadOnlyStyledDocument<PS, SEG, S>> split(
int paragraphIndex, int columnPosition) {
return tree.splitAt(paragraphIndex).map((l, p, r) -> {
Paragraph<PS, SEG, S> p1 = p.trim(columnPosition);
Paragraph<PS, SEG, S> p2 = p.subSeq... | java | public Tuple2<ReadOnlyStyledDocument<PS, SEG, S>, ReadOnlyStyledDocument<PS, SEG, S>> split(
int paragraphIndex, int columnPosition) {
return tree.splitAt(paragraphIndex).map((l, p, r) -> {
Paragraph<PS, SEG, S> p1 = p.trim(columnPosition);
Paragraph<PS, SEG, S> p2 = p.subSeq... | [
"public",
"Tuple2",
"<",
"ReadOnlyStyledDocument",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
",",
"ReadOnlyStyledDocument",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
">",
"split",
"(",
"int",
"paragraphIndex",
",",
"int",
"columnPosition",
")",
"{",
"return",
"t... | Splits this document into two at the given paragraph's column position and returns both halves. | [
"Splits",
"this",
"document",
"into",
"two",
"at",
"the",
"given",
"paragraph",
"s",
"column",
"position",
"and",
"returns",
"both",
"halves",
"."
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocument.java#L281-L290 |
47,717 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocumentBuilder.java | ReadOnlyStyledDocumentBuilder.constructDocument | public static <PS, SEG, S> ReadOnlyStyledDocument<PS, SEG, S> constructDocument(
SegmentOps<SEG, S> segmentOps, PS defaultParagraphStyle,
Consumer<ReadOnlyStyledDocumentBuilder<PS, SEG, S>> configuration) {
ReadOnlyStyledDocumentBuilder<PS, SEG, S> builder = new ReadOnlyStyledDocumentBui... | java | public static <PS, SEG, S> ReadOnlyStyledDocument<PS, SEG, S> constructDocument(
SegmentOps<SEG, S> segmentOps, PS defaultParagraphStyle,
Consumer<ReadOnlyStyledDocumentBuilder<PS, SEG, S>> configuration) {
ReadOnlyStyledDocumentBuilder<PS, SEG, S> builder = new ReadOnlyStyledDocumentBui... | [
"public",
"static",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"ReadOnlyStyledDocument",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"constructDocument",
"(",
"SegmentOps",
"<",
"SEG",
",",
"S",
">",
"segmentOps",
",",
"PS",
"defaultParagraphStyle",
",",
"Consumer",
... | Constructs a list of paragraphs
@param segmentOps the {@link SegmentOps} object to use for one of the {@link Paragraph}'s constructors
@param defaultParagraphStyle the paragraph style object to use when it is not specified in the
"addParagraph" methods
@param configuration call the builder's {@link #addParagraph(Objec... | [
"Constructs",
"a",
"list",
"of",
"paragraphs"
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocumentBuilder.java#L29-L35 |
47,718 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocumentBuilder.java | ReadOnlyStyledDocumentBuilder.addParagraph | public ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraph(List<SEG> segments, StyleSpans<S> styles) {
return addParagraph(segments, styles, null);
} | java | public ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraph(List<SEG> segments, StyleSpans<S> styles) {
return addParagraph(segments, styles, null);
} | [
"public",
"ReadOnlyStyledDocumentBuilder",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"addParagraph",
"(",
"List",
"<",
"SEG",
">",
"segments",
",",
"StyleSpans",
"<",
"S",
">",
"styles",
")",
"{",
"return",
"addParagraph",
"(",
"segments",
",",
"styles",
",",
... | Adds to the list a paragraph that has multiple segments with multiple styles throughout those segments | [
"Adds",
"to",
"the",
"list",
"a",
"paragraph",
"that",
"has",
"multiple",
"segments",
"with",
"multiple",
"styles",
"throughout",
"those",
"segments"
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocumentBuilder.java#L134-L136 |
47,719 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocumentBuilder.java | ReadOnlyStyledDocumentBuilder.addParagraphs0 | public ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraphs0(List<Tuple2<PS, List<SEG>>> paragraphArgList,
StyleSpans<S> entireDocumentStyleSpans) {
return addParagraphList(paragraphArgList, entireDocumentStyleSpans, Tuple2::get1, Tuple2::get2);
} | java | public ReadOnlyStyledDocumentBuilder<PS, SEG, S> addParagraphs0(List<Tuple2<PS, List<SEG>>> paragraphArgList,
StyleSpans<S> entireDocumentStyleSpans) {
return addParagraphList(paragraphArgList, entireDocumentStyleSpans, Tuple2::get1, Tuple2::get2);
} | [
"public",
"ReadOnlyStyledDocumentBuilder",
"<",
"PS",
",",
"SEG",
",",
"S",
">",
"addParagraphs0",
"(",
"List",
"<",
"Tuple2",
"<",
"PS",
",",
"List",
"<",
"SEG",
">",
">",
">",
"paragraphArgList",
",",
"StyleSpans",
"<",
"S",
">",
"entireDocumentStyleSpans"... | Adds multiple paragraphs to the list, allowing one to specify each paragraph's paragraph style.
@param paragraphArgList each item is a Tuple2 that represents the paragraph style and segment list
for a single paragraph. If the paragraph style is {@code null},
the {@link #defaultParagraphStyle} will be used instead.
@pa... | [
"Adds",
"multiple",
"paragraphs",
"to",
"the",
"list",
"allowing",
"one",
"to",
"specify",
"each",
"paragraph",
"s",
"paragraph",
"style",
"."
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/model/ReadOnlyStyledDocumentBuilder.java#L167-L170 |
47,720 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/CaretNode.java | CaretNode.moveContentBreaks | private void moveContentBreaks(int numOfBreaks, BreakIterator breakIterator, boolean followingNotPreceding) {
if (area.getLength() == 0) {
return;
}
breakIterator.setText(area.getText());
if (followingNotPreceding) {
breakIterator.following(getPosition());
... | java | private void moveContentBreaks(int numOfBreaks, BreakIterator breakIterator, boolean followingNotPreceding) {
if (area.getLength() == 0) {
return;
}
breakIterator.setText(area.getText());
if (followingNotPreceding) {
breakIterator.following(getPosition());
... | [
"private",
"void",
"moveContentBreaks",
"(",
"int",
"numOfBreaks",
",",
"BreakIterator",
"breakIterator",
",",
"boolean",
"followingNotPreceding",
")",
"{",
"if",
"(",
"area",
".",
"getLength",
"(",
")",
"==",
"0",
")",
"{",
"return",
";",
"}",
"breakIterator"... | Helper method for reducing duplicate code
@param numOfBreaks the number of breaks
@param breakIterator the type of iterator to use
@param followingNotPreceding if true, use {@link BreakIterator#following(int)}.
Otherwise, use {@link BreakIterator#preceding(int)}. | [
"Helper",
"method",
"for",
"reducing",
"duplicate",
"code"
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/CaretNode.java#L372-L387 |
47,721 | FXMisc/RichTextFX | richtextfx-demos/src/main/java/org/fxmisc/richtext/demo/richtext/RichTextDemo.java | RichTextDemo.insertImage | private void insertImage() {
String initialDir = System.getProperty("user.dir");
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Insert image");
fileChooser.setInitialDirectory(new File(initialDir));
File selectedFile = fileChooser.showOpenDialog(mainStage);
... | java | private void insertImage() {
String initialDir = System.getProperty("user.dir");
FileChooser fileChooser = new FileChooser();
fileChooser.setTitle("Insert image");
fileChooser.setInitialDirectory(new File(initialDir));
File selectedFile = fileChooser.showOpenDialog(mainStage);
... | [
"private",
"void",
"insertImage",
"(",
")",
"{",
"String",
"initialDir",
"=",
"System",
".",
"getProperty",
"(",
"\"user.dir\"",
")",
";",
"FileChooser",
"fileChooser",
"=",
"new",
"FileChooser",
"(",
")",
";",
"fileChooser",
".",
"setTitle",
"(",
"\"Insert im... | Action listener which inserts a new image at the current caret position. | [
"Action",
"listener",
"which",
"inserts",
"a",
"new",
"image",
"at",
"the",
"current",
"caret",
"position",
"."
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx-demos/src/main/java/org/fxmisc/richtext/demo/richtext/RichTextDemo.java#L452-L466 |
47,722 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/ParagraphBox.java | ParagraphBox.hitTextLine | CharacterHit hitTextLine(CaretOffsetX x, int line) {
return text.hitLine(x.value, line);
} | java | CharacterHit hitTextLine(CaretOffsetX x, int line) {
return text.hitLine(x.value, line);
} | [
"CharacterHit",
"hitTextLine",
"(",
"CaretOffsetX",
"x",
",",
"int",
"line",
")",
"{",
"return",
"text",
".",
"hitLine",
"(",
"x",
".",
"value",
",",
"line",
")",
";",
"}"
] | Hits the embedded TextFlow at the given line and x offset.
@param x x coordinate relative to the embedded TextFlow.
@param line index of the line in the embedded TextFlow.
@return hit info for the given line and x coordinate | [
"Hits",
"the",
"embedded",
"TextFlow",
"at",
"the",
"given",
"line",
"and",
"x",
"offset",
"."
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/ParagraphBox.java#L263-L265 |
47,723 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/ParagraphBox.java | ParagraphBox.hitText | CharacterHit hitText(CaretOffsetX x, double y) {
return text.hit(x.value, y);
} | java | CharacterHit hitText(CaretOffsetX x, double y) {
return text.hit(x.value, y);
} | [
"CharacterHit",
"hitText",
"(",
"CaretOffsetX",
"x",
",",
"double",
"y",
")",
"{",
"return",
"text",
".",
"hit",
"(",
"x",
".",
"value",
",",
"y",
")",
";",
"}"
] | Hits the embedded TextFlow at the given x and y offset.
@return hit info for the given x and y coordinates | [
"Hits",
"the",
"embedded",
"TextFlow",
"at",
"the",
"given",
"x",
"and",
"y",
"offset",
"."
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/ParagraphBox.java#L272-L274 |
47,724 | FXMisc/RichTextFX | richtextfx/src/main/java/org/fxmisc/richtext/CaretSelectionBindImpl.java | CaretSelectionBindImpl.selectRangeExpl | @Override
public void selectRangeExpl(int anchorParagraph, int anchorColumn, int caretParagraph, int caretColumn) {
selectRangeExpl(textPosition(anchorParagraph, anchorColumn), textPosition(caretParagraph, caretColumn));
} | java | @Override
public void selectRangeExpl(int anchorParagraph, int anchorColumn, int caretParagraph, int caretColumn) {
selectRangeExpl(textPosition(anchorParagraph, anchorColumn), textPosition(caretParagraph, caretColumn));
} | [
"@",
"Override",
"public",
"void",
"selectRangeExpl",
"(",
"int",
"anchorParagraph",
",",
"int",
"anchorColumn",
",",
"int",
"caretParagraph",
",",
"int",
"caretColumn",
")",
"{",
"selectRangeExpl",
"(",
"textPosition",
"(",
"anchorParagraph",
",",
"anchorColumn",
... | caret selection bind | [
"caret",
"selection",
"bind"
] | bc7cab6a637855e0f37d9b9c12a9172c31545f0b | https://github.com/FXMisc/RichTextFX/blob/bc7cab6a637855e0f37d9b9c12a9172c31545f0b/richtextfx/src/main/java/org/fxmisc/richtext/CaretSelectionBindImpl.java#L346-L349 |
47,725 | dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/impl/LogMonitors.java | LogMonitors.logMonitor | public static LogMonitor logMonitor()
{
return new LogMonitor()
{
@Override
public void corruption(long bytes, String reason)
{
System.out.println(String.format("corruption of %s bytes: %s", bytes, reason));
}
@Override
... | java | public static LogMonitor logMonitor()
{
return new LogMonitor()
{
@Override
public void corruption(long bytes, String reason)
{
System.out.println(String.format("corruption of %s bytes: %s", bytes, reason));
}
@Override
... | [
"public",
"static",
"LogMonitor",
"logMonitor",
"(",
")",
"{",
"return",
"new",
"LogMonitor",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"corruption",
"(",
"long",
"bytes",
",",
"String",
"reason",
")",
"{",
"System",
".",
"out",
".",
"println",
"... | todo implement real logging | [
"todo",
"implement",
"real",
"logging"
] | 7994065b48eada2ef29e7fefd172c2ad1e0110eb | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/impl/LogMonitors.java#L41-L58 |
47,726 | dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/table/BlockIterator.java | BlockIterator.seek | @Override
public void seek(Slice targetKey)
{
if (restartCount == 0) {
return;
}
int left = 0;
int right = restartCount - 1;
// binary search restart positions to find the restart position immediately before the targetKey
while (left < right) {
... | java | @Override
public void seek(Slice targetKey)
{
if (restartCount == 0) {
return;
}
int left = 0;
int right = restartCount - 1;
// binary search restart positions to find the restart position immediately before the targetKey
while (left < right) {
... | [
"@",
"Override",
"public",
"void",
"seek",
"(",
"Slice",
"targetKey",
")",
"{",
"if",
"(",
"restartCount",
"==",
"0",
")",
"{",
"return",
";",
"}",
"int",
"left",
"=",
"0",
";",
"int",
"right",
"=",
"restartCount",
"-",
"1",
";",
"// binary search rest... | Repositions the iterator so the key of the next BlockElement returned greater than or equal to the specified targetKey. | [
"Repositions",
"the",
"iterator",
"so",
"the",
"key",
"of",
"the",
"next",
"BlockElement",
"returned",
"greater",
"than",
"or",
"equal",
"to",
"the",
"specified",
"targetKey",
"."
] | 7994065b48eada2ef29e7fefd172c2ad1e0110eb | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/table/BlockIterator.java#L118-L153 |
47,727 | dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/table/BlockIterator.java | BlockIterator.readEntry | private static BlockEntry readEntry(SliceInput data, BlockEntry previousEntry)
{
requireNonNull(data, "data is null");
// read entry header
int sharedKeyLength = VariableLengthQuantity.readVariableLengthInt(data);
int nonSharedKeyLength = VariableLengthQuantity.readVariableLengthInt... | java | private static BlockEntry readEntry(SliceInput data, BlockEntry previousEntry)
{
requireNonNull(data, "data is null");
// read entry header
int sharedKeyLength = VariableLengthQuantity.readVariableLengthInt(data);
int nonSharedKeyLength = VariableLengthQuantity.readVariableLengthInt... | [
"private",
"static",
"BlockEntry",
"readEntry",
"(",
"SliceInput",
"data",
",",
"BlockEntry",
"previousEntry",
")",
"{",
"requireNonNull",
"(",
"data",
",",
"\"data is null\"",
")",
";",
"// read entry header",
"int",
"sharedKeyLength",
"=",
"VariableLengthQuantity",
... | Reads the entry at the current data readIndex.
After this method, data readIndex is positioned at the beginning of the next entry
or at the end of data if there was not a next entry.
@return true if an entry was read | [
"Reads",
"the",
"entry",
"at",
"the",
"current",
"data",
"readIndex",
".",
"After",
"this",
"method",
"data",
"readIndex",
"is",
"positioned",
"at",
"the",
"beginning",
"of",
"the",
"next",
"entry",
"or",
"at",
"the",
"end",
"of",
"data",
"if",
"there",
... | 7994065b48eada2ef29e7fefd172c2ad1e0110eb | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/table/BlockIterator.java#L182-L204 |
47,728 | dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/impl/Filename.java | Filename.setCurrentFile | public static boolean setCurrentFile(File databaseDir, long descriptorNumber)
throws IOException
{
String manifest = descriptorFileName(descriptorNumber);
String temp = tempFileName(descriptorNumber);
File tempFile = new File(databaseDir, temp);
writeStringToFileSync(man... | java | public static boolean setCurrentFile(File databaseDir, long descriptorNumber)
throws IOException
{
String manifest = descriptorFileName(descriptorNumber);
String temp = tempFileName(descriptorNumber);
File tempFile = new File(databaseDir, temp);
writeStringToFileSync(man... | [
"public",
"static",
"boolean",
"setCurrentFile",
"(",
"File",
"databaseDir",
",",
"long",
"descriptorNumber",
")",
"throws",
"IOException",
"{",
"String",
"manifest",
"=",
"descriptorFileName",
"(",
"descriptorNumber",
")",
";",
"String",
"temp",
"=",
"tempFileName"... | Make the CURRENT file point to the descriptor file with the
specified number.
@return true if successful; false otherwise | [
"Make",
"the",
"CURRENT",
"file",
"point",
"to",
"the",
"descriptor",
"file",
"with",
"the",
"specified",
"number",
"."
] | 7994065b48eada2ef29e7fefd172c2ad1e0110eb | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/impl/Filename.java#L165-L181 |
47,729 | dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/impl/Compaction.java | Compaction.isBaseLevelForKey | public boolean isBaseLevelForKey(Slice userKey)
{
// Maybe use binary search to find right entry instead of linear search?
UserComparator userComparator = inputVersion.getInternalKeyComparator().getUserComparator();
for (int level = this.level + 2; level < NUM_LEVELS; level++) {
... | java | public boolean isBaseLevelForKey(Slice userKey)
{
// Maybe use binary search to find right entry instead of linear search?
UserComparator userComparator = inputVersion.getInternalKeyComparator().getUserComparator();
for (int level = this.level + 2; level < NUM_LEVELS; level++) {
... | [
"public",
"boolean",
"isBaseLevelForKey",
"(",
"Slice",
"userKey",
")",
"{",
"// Maybe use binary search to find right entry instead of linear search?",
"UserComparator",
"userComparator",
"=",
"inputVersion",
".",
"getInternalKeyComparator",
"(",
")",
".",
"getUserComparator",
... | in levels greater than "level+1". | [
"in",
"levels",
"greater",
"than",
"level",
"+",
"1",
"."
] | 7994065b48eada2ef29e7fefd172c2ad1e0110eb | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/impl/Compaction.java#L151-L171 |
47,730 | dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/impl/Compaction.java | Compaction.shouldStopBefore | public boolean shouldStopBefore(InternalKey internalKey)
{
// Scan to find earliest grandparent file that contains key.
InternalKeyComparator internalKeyComparator = inputVersion.getInternalKeyComparator();
while (grandparentIndex < grandparents.size() && internalKeyComparator.compare(intern... | java | public boolean shouldStopBefore(InternalKey internalKey)
{
// Scan to find earliest grandparent file that contains key.
InternalKeyComparator internalKeyComparator = inputVersion.getInternalKeyComparator();
while (grandparentIndex < grandparents.size() && internalKeyComparator.compare(intern... | [
"public",
"boolean",
"shouldStopBefore",
"(",
"InternalKey",
"internalKey",
")",
"{",
"// Scan to find earliest grandparent file that contains key.",
"InternalKeyComparator",
"internalKeyComparator",
"=",
"inputVersion",
".",
"getInternalKeyComparator",
"(",
")",
";",
"while",
... | before processing "internal_key". | [
"before",
"processing",
"internal_key",
"."
] | 7994065b48eada2ef29e7fefd172c2ad1e0110eb | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/impl/Compaction.java#L175-L195 |
47,731 | dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/util/Slice.java | Slice.copySlice | public Slice copySlice(int index, int length)
{
checkPositionIndexes(index, index + length, this.length);
index += offset;
byte[] copiedArray = new byte[length];
System.arraycopy(data, index, copiedArray, 0, length);
return new Slice(copiedArray);
} | java | public Slice copySlice(int index, int length)
{
checkPositionIndexes(index, index + length, this.length);
index += offset;
byte[] copiedArray = new byte[length];
System.arraycopy(data, index, copiedArray, 0, length);
return new Slice(copiedArray);
} | [
"public",
"Slice",
"copySlice",
"(",
"int",
"index",
",",
"int",
"length",
")",
"{",
"checkPositionIndexes",
"(",
"index",
",",
"index",
"+",
"length",
",",
"this",
".",
"length",
")",
";",
"index",
"+=",
"offset",
";",
"byte",
"[",
"]",
"copiedArray",
... | Returns a copy of this buffer's sub-region. Modifying the content of
the returned buffer or this buffer does not affect each other at all. | [
"Returns",
"a",
"copy",
"of",
"this",
"buffer",
"s",
"sub",
"-",
"region",
".",
"Modifying",
"the",
"content",
"of",
"the",
"returned",
"buffer",
"or",
"this",
"buffer",
"does",
"not",
"affect",
"each",
"other",
"at",
"all",
"."
] | 7994065b48eada2ef29e7fefd172c2ad1e0110eb | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/Slice.java#L527-L535 |
47,732 | dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/util/Slice.java | Slice.slice | public Slice slice(int index, int length)
{
if (index == 0 && length == this.length) {
return this;
}
checkPositionIndexes(index, index + length, this.length);
if (index >= 0 && length == 0) {
return Slices.EMPTY_SLICE;
}
return new Slice(data... | java | public Slice slice(int index, int length)
{
if (index == 0 && length == this.length) {
return this;
}
checkPositionIndexes(index, index + length, this.length);
if (index >= 0 && length == 0) {
return Slices.EMPTY_SLICE;
}
return new Slice(data... | [
"public",
"Slice",
"slice",
"(",
"int",
"index",
",",
"int",
"length",
")",
"{",
"if",
"(",
"index",
"==",
"0",
"&&",
"length",
"==",
"this",
".",
"length",
")",
"{",
"return",
"this",
";",
"}",
"checkPositionIndexes",
"(",
"index",
",",
"index",
"+"... | Returns a slice of this buffer's sub-region. Modifying the content of
the returned buffer or this buffer affects each other's content while
they maintain separate indexes and marks. | [
"Returns",
"a",
"slice",
"of",
"this",
"buffer",
"s",
"sub",
"-",
"region",
".",
"Modifying",
"the",
"content",
"of",
"the",
"returned",
"buffer",
"or",
"this",
"buffer",
"affects",
"each",
"other",
"s",
"content",
"while",
"they",
"maintain",
"separate",
... | 7994065b48eada2ef29e7fefd172c2ad1e0110eb | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/Slice.java#L571-L582 |
47,733 | dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/util/Slice.java | Slice.toByteBuffer | public ByteBuffer toByteBuffer(int index, int length)
{
checkPositionIndexes(index, index + length, this.length);
index += offset;
return ByteBuffer.wrap(data, index, length).order(LITTLE_ENDIAN);
} | java | public ByteBuffer toByteBuffer(int index, int length)
{
checkPositionIndexes(index, index + length, this.length);
index += offset;
return ByteBuffer.wrap(data, index, length).order(LITTLE_ENDIAN);
} | [
"public",
"ByteBuffer",
"toByteBuffer",
"(",
"int",
"index",
",",
"int",
"length",
")",
"{",
"checkPositionIndexes",
"(",
"index",
",",
"index",
"+",
"length",
",",
"this",
".",
"length",
")",
";",
"index",
"+=",
"offset",
";",
"return",
"ByteBuffer",
".",... | Converts this buffer's sub-region into a NIO buffer. The returned
buffer shares the content with this buffer. | [
"Converts",
"this",
"buffer",
"s",
"sub",
"-",
"region",
"into",
"a",
"NIO",
"buffer",
".",
"The",
"returned",
"buffer",
"shares",
"the",
"content",
"with",
"this",
"buffer",
"."
] | 7994065b48eada2ef29e7fefd172c2ad1e0110eb | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/util/Slice.java#L613-L618 |
47,734 | dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/impl/LogReader.java | LogReader.readNextChunk | private LogChunkType readNextChunk()
{
// clear the current chunk
currentChunk = Slices.EMPTY_SLICE;
// read the next block if necessary
if (currentBlock.available() < HEADER_SIZE) {
if (!readNextBlock()) {
if (eof) {
return EOF;
... | java | private LogChunkType readNextChunk()
{
// clear the current chunk
currentChunk = Slices.EMPTY_SLICE;
// read the next block if necessary
if (currentBlock.available() < HEADER_SIZE) {
if (!readNextBlock()) {
if (eof) {
return EOF;
... | [
"private",
"LogChunkType",
"readNextChunk",
"(",
")",
"{",
"// clear the current chunk",
"currentChunk",
"=",
"Slices",
".",
"EMPTY_SLICE",
";",
"// read the next block if necessary",
"if",
"(",
"currentBlock",
".",
"available",
"(",
")",
"<",
"HEADER_SIZE",
")",
"{",... | Return type, or one of the preceding special values | [
"Return",
"type",
"or",
"one",
"of",
"the",
"preceding",
"special",
"values"
] | 7994065b48eada2ef29e7fefd172c2ad1e0110eb | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/impl/LogReader.java#L231-L299 |
47,735 | dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/impl/LogReader.java | LogReader.reportCorruption | private void reportCorruption(long bytes, String reason)
{
if (monitor != null) {
monitor.corruption(bytes, reason);
}
} | java | private void reportCorruption(long bytes, String reason)
{
if (monitor != null) {
monitor.corruption(bytes, reason);
}
} | [
"private",
"void",
"reportCorruption",
"(",
"long",
"bytes",
",",
"String",
"reason",
")",
"{",
"if",
"(",
"monitor",
"!=",
"null",
")",
"{",
"monitor",
".",
"corruption",
"(",
"bytes",
",",
"reason",
")",
";",
"}",
"}"
] | Reports corruption to the monitor.
The buffer must be updated to remove the dropped bytes prior to invocation. | [
"Reports",
"corruption",
"to",
"the",
"monitor",
".",
"The",
"buffer",
"must",
"be",
"updated",
"to",
"remove",
"the",
"dropped",
"bytes",
"prior",
"to",
"invocation",
"."
] | 7994065b48eada2ef29e7fefd172c2ad1e0110eb | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/impl/LogReader.java#L337-L342 |
47,736 | dain/leveldb | leveldb/src/main/java/org/iq80/leveldb/impl/LogReader.java | LogReader.reportDrop | private void reportDrop(long bytes, Throwable reason)
{
if (monitor != null) {
monitor.corruption(bytes, reason);
}
} | java | private void reportDrop(long bytes, Throwable reason)
{
if (monitor != null) {
monitor.corruption(bytes, reason);
}
} | [
"private",
"void",
"reportDrop",
"(",
"long",
"bytes",
",",
"Throwable",
"reason",
")",
"{",
"if",
"(",
"monitor",
"!=",
"null",
")",
"{",
"monitor",
".",
"corruption",
"(",
"bytes",
",",
"reason",
")",
";",
"}",
"}"
] | Reports dropped bytes to the monitor.
The buffer must be updated to remove the dropped bytes prior to invocation. | [
"Reports",
"dropped",
"bytes",
"to",
"the",
"monitor",
".",
"The",
"buffer",
"must",
"be",
"updated",
"to",
"remove",
"the",
"dropped",
"bytes",
"prior",
"to",
"invocation",
"."
] | 7994065b48eada2ef29e7fefd172c2ad1e0110eb | https://github.com/dain/leveldb/blob/7994065b48eada2ef29e7fefd172c2ad1e0110eb/leveldb/src/main/java/org/iq80/leveldb/impl/LogReader.java#L348-L353 |
47,737 | spockframework/spock | spock-core/src/main/java/spock/util/concurrent/BlockingVariable.java | BlockingVariable.get | public T get() throws InterruptedException {
if (!valueReady.await((long) (timeout * 1000), TimeUnit.MILLISECONDS)) {
String msg = String.format("BlockingVariable.get() timed out after %1.2f seconds", timeout);
throw new SpockTimeoutError(timeout, msg);
}
return value;
} | java | public T get() throws InterruptedException {
if (!valueReady.await((long) (timeout * 1000), TimeUnit.MILLISECONDS)) {
String msg = String.format("BlockingVariable.get() timed out after %1.2f seconds", timeout);
throw new SpockTimeoutError(timeout, msg);
}
return value;
} | [
"public",
"T",
"get",
"(",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"!",
"valueReady",
".",
"await",
"(",
"(",
"long",
")",
"(",
"timeout",
"*",
"1000",
")",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
")",
"{",
"String",
"msg",
"=",
"St... | Blocks until a value has been set for this variable, or a timeout expires.
@return the variable's value
@throws InterruptedException if the calling thread is interrupted | [
"Blocks",
"until",
"a",
"value",
"has",
"been",
"set",
"for",
"this",
"variable",
"or",
"a",
"timeout",
"expires",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/util/concurrent/BlockingVariable.java#L110-L116 |
47,738 | spockframework/spock | spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java | SpecRewriter.handleWhereBlock | private void handleWhereBlock(Method method) {
Block block = method.getLastBlock();
if (!(block instanceof WhereBlock)) return;
new DeepBlockRewriter(this).visit(block);
WhereBlockRewriter.rewrite((WhereBlock) block, this);
} | java | private void handleWhereBlock(Method method) {
Block block = method.getLastBlock();
if (!(block instanceof WhereBlock)) return;
new DeepBlockRewriter(this).visit(block);
WhereBlockRewriter.rewrite((WhereBlock) block, this);
} | [
"private",
"void",
"handleWhereBlock",
"(",
"Method",
"method",
")",
"{",
"Block",
"block",
"=",
"method",
".",
"getLastBlock",
"(",
")",
";",
"if",
"(",
"!",
"(",
"block",
"instanceof",
"WhereBlock",
")",
")",
"return",
";",
"new",
"DeepBlockRewriter",
"(... | will then be used by DeepBlockRewriter | [
"will",
"then",
"be",
"used",
"by",
"DeepBlockRewriter"
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java#L285-L291 |
47,739 | spockframework/spock | spock-core/src/main/java/org/spockframework/runtime/extension/builtin/IncludeExcludeExtension.java | IncludeExcludeExtension.handleFeatureIncludes | private void handleFeatureIncludes(SpecInfo spec, IncludeExcludeCriteria criteria) {
if (criteria.isEmpty()) return;
for (FeatureInfo feature : spec.getAllFeatures())
if (hasAnyAnnotation(feature.getFeatureMethod(), criteria.annotations))
feature.setExcluded(false);
} | java | private void handleFeatureIncludes(SpecInfo spec, IncludeExcludeCriteria criteria) {
if (criteria.isEmpty()) return;
for (FeatureInfo feature : spec.getAllFeatures())
if (hasAnyAnnotation(feature.getFeatureMethod(), criteria.annotations))
feature.setExcluded(false);
} | [
"private",
"void",
"handleFeatureIncludes",
"(",
"SpecInfo",
"spec",
",",
"IncludeExcludeCriteria",
"criteria",
")",
"{",
"if",
"(",
"criteria",
".",
"isEmpty",
"(",
")",
")",
"return",
";",
"for",
"(",
"FeatureInfo",
"feature",
":",
"spec",
".",
"getAllFeatur... | in contrast to the three other handleXXX methods, this one includes nodes | [
"in",
"contrast",
"to",
"the",
"three",
"other",
"handleXXX",
"methods",
"this",
"one",
"includes",
"nodes"
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/runtime/extension/builtin/IncludeExcludeExtension.java#L58-L64 |
47,740 | spockframework/spock | spock-core/src/main/java/org/spockframework/compiler/SpecParser.java | SpecParser.visitField | @Override
public void visitField(FieldNode gField) {
PropertyNode owner = spec.getAst().getProperty(gField.getName());
if (gField.isStatic()) return;
Field field = new Field(spec, gField, fieldCount++);
field.setShared(AstUtil.hasAnnotation(gField, Shared.class));
field.setOwner(owner);
spec.... | java | @Override
public void visitField(FieldNode gField) {
PropertyNode owner = spec.getAst().getProperty(gField.getName());
if (gField.isStatic()) return;
Field field = new Field(spec, gField, fieldCount++);
field.setShared(AstUtil.hasAnnotation(gField, Shared.class));
field.setOwner(owner);
spec.... | [
"@",
"Override",
"public",
"void",
"visitField",
"(",
"FieldNode",
"gField",
")",
"{",
"PropertyNode",
"owner",
"=",
"spec",
".",
"getAst",
"(",
")",
".",
"getProperty",
"(",
"gField",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"gField",
".",
"isSt... | although it IS related to a user-provided definition | [
"although",
"it",
"IS",
"related",
"to",
"a",
"user",
"-",
"provided",
"definition"
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/compiler/SpecParser.java#L62-L71 |
47,741 | spockframework/spock | spock-core/src/main/java/org/spockframework/compiler/SpecParser.java | SpecParser.constructorMayHaveBeenAddedByCompiler | private boolean constructorMayHaveBeenAddedByCompiler(ConstructorNode constructor) {
Parameter[] params = constructor.getParameters();
Statement firstStat = constructor.getFirstStatement();
return AstUtil.isJointCompiled(spec.getAst()) && constructor.isPublic()
&& params != null && params.length == 0 ... | java | private boolean constructorMayHaveBeenAddedByCompiler(ConstructorNode constructor) {
Parameter[] params = constructor.getParameters();
Statement firstStat = constructor.getFirstStatement();
return AstUtil.isJointCompiled(spec.getAst()) && constructor.isPublic()
&& params != null && params.length == 0 ... | [
"private",
"boolean",
"constructorMayHaveBeenAddedByCompiler",
"(",
"ConstructorNode",
"constructor",
")",
"{",
"Parameter",
"[",
"]",
"params",
"=",
"constructor",
".",
"getParameters",
"(",
")",
";",
"Statement",
"firstStat",
"=",
"constructor",
".",
"getFirstStatem... | to add special logic to detect this case. | [
"to",
"add",
"special",
"logic",
"to",
"detect",
"this",
"case",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/compiler/SpecParser.java#L89-L94 |
47,742 | spockframework/spock | spock-core/src/main/java/org/spockframework/compiler/InteractionRewriter.java | InteractionRewriter.rewrite | @Nullable
public ExpressionStatement rewrite(ExpressionStatement stat) {
try {
if (!isInteraction(stat)) return null;
createBuilder();
setCount();
setCall();
addResponses();
build();
return register();
} catch (InvalidSpecCompileException e) {
resources.getErro... | java | @Nullable
public ExpressionStatement rewrite(ExpressionStatement stat) {
try {
if (!isInteraction(stat)) return null;
createBuilder();
setCount();
setCall();
addResponses();
build();
return register();
} catch (InvalidSpecCompileException e) {
resources.getErro... | [
"@",
"Nullable",
"public",
"ExpressionStatement",
"rewrite",
"(",
"ExpressionStatement",
"stat",
")",
"{",
"try",
"{",
"if",
"(",
"!",
"isInteraction",
"(",
"stat",
")",
")",
"return",
"null",
";",
"createBuilder",
"(",
")",
";",
"setCount",
"(",
")",
";",... | If the given statement is a valid interaction definition, returns the rewritten statement.
If the given statement is not an interaction definition, returns null.
If the given statement is an invalid interaction definition, records a compile error
and returns null. | [
"If",
"the",
"given",
"statement",
"is",
"a",
"valid",
"interaction",
"definition",
"returns",
"the",
"rewritten",
"statement",
".",
"If",
"the",
"given",
"statement",
"is",
"not",
"an",
"interaction",
"definition",
"returns",
"null",
".",
"If",
"the",
"given"... | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/compiler/InteractionRewriter.java#L62-L77 |
47,743 | spockframework/spock | spock-core/src/main/java/org/spockframework/mock/EmptyOrDummyResponse.java | EmptyOrDummyResponse.createEmptyWrapper | private Object createEmptyWrapper(Class<?> type) {
if (Number.class.isAssignableFrom(type)) {
Method method = ReflectionUtil.getDeclaredMethodBySignature(type, "valueOf", String.class);
if (method != null && method.getReturnType() == type) {
return ReflectionUtil.invokeMethod(type, method, "0");... | java | private Object createEmptyWrapper(Class<?> type) {
if (Number.class.isAssignableFrom(type)) {
Method method = ReflectionUtil.getDeclaredMethodBySignature(type, "valueOf", String.class);
if (method != null && method.getReturnType() == type) {
return ReflectionUtil.invokeMethod(type, method, "0");... | [
"private",
"Object",
"createEmptyWrapper",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"if",
"(",
"Number",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
")",
"{",
"Method",
"method",
"=",
"ReflectionUtil",
".",
"getDeclaredMethodBySignature",
... | also handles some numeric types which aren't primitive wrapper types | [
"also",
"handles",
"some",
"numeric",
"types",
"which",
"aren",
"t",
"primitive",
"wrapper",
"types"
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/mock/EmptyOrDummyResponse.java#L129-L142 |
47,744 | spockframework/spock | spock-core/src/main/java/spock/util/concurrent/AsyncConditions.java | AsyncConditions.await | @Deprecated
public void await(int value, TimeUnit unit) throws Throwable {
await(TimeUtil.toSeconds(value, unit));
} | java | @Deprecated
public void await(int value, TimeUnit unit) throws Throwable {
await(TimeUtil.toSeconds(value, unit));
} | [
"@",
"Deprecated",
"public",
"void",
"await",
"(",
"int",
"value",
",",
"TimeUnit",
"unit",
")",
"throws",
"Throwable",
"{",
"await",
"(",
"TimeUtil",
".",
"toSeconds",
"(",
"value",
",",
"unit",
")",
")",
";",
"}"
] | Waits until all evaluate blocks have completed or the specified timeout
expires. If one of the evaluate blocks throws an exception, it is rethrown
from this method.
@throws InterruptedException if the calling thread is interrupted
@throws Throwable the first exception thrown by an evaluate block
@deprecated use {@li... | [
"Waits",
"until",
"all",
"evaluate",
"blocks",
"have",
"completed",
"or",
"the",
"specified",
"timeout",
"expires",
".",
"If",
"one",
"of",
"the",
"evaluate",
"blocks",
"throws",
"an",
"exception",
"it",
"is",
"rethrown",
"from",
"this",
"method",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/util/concurrent/AsyncConditions.java#L158-L161 |
47,745 | spockframework/spock | spock-core/src/main/java/org/spockframework/runtime/RunContext.java | RunContext.createBottomContext | private static RunContext createBottomContext() {
File spockUserHome = SpockUserHomeUtil.getSpockUserHome();
DelegatingScript script = new ConfigurationScriptLoader(spockUserHome).loadAutoDetectedScript();
List<Class<?>> classes = new ExtensionClassesLoader().loadClassesFromDefaultLocation();
return new... | java | private static RunContext createBottomContext() {
File spockUserHome = SpockUserHomeUtil.getSpockUserHome();
DelegatingScript script = new ConfigurationScriptLoader(spockUserHome).loadAutoDetectedScript();
List<Class<?>> classes = new ExtensionClassesLoader().loadClassesFromDefaultLocation();
return new... | [
"private",
"static",
"RunContext",
"createBottomContext",
"(",
")",
"{",
"File",
"spockUserHome",
"=",
"SpockUserHomeUtil",
".",
"getSpockUserHome",
"(",
")",
";",
"DelegatingScript",
"script",
"=",
"new",
"ConfigurationScriptLoader",
"(",
"spockUserHome",
")",
".",
... | this shouldn't be much of a problem in practice. | [
"this",
"shouldn",
"t",
"be",
"much",
"of",
"a",
"problem",
"in",
"practice",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/runtime/RunContext.java#L182-L187 |
47,746 | spockframework/spock | spock-core/src/main/java/org/spockframework/util/IoUtil.java | IoUtil.closeQuietly | public static void closeQuietly(@Nullable final Socket... sockets) {
if (sockets == null) return;
for (Socket socket : sockets) {
if (socket == null) return;
try {
socket.close();
} catch (IOException ignored) {}
}
} | java | public static void closeQuietly(@Nullable final Socket... sockets) {
if (sockets == null) return;
for (Socket socket : sockets) {
if (socket == null) return;
try {
socket.close();
} catch (IOException ignored) {}
}
} | [
"public",
"static",
"void",
"closeQuietly",
"(",
"@",
"Nullable",
"final",
"Socket",
"...",
"sockets",
")",
"{",
"if",
"(",
"sockets",
"==",
"null",
")",
"return",
";",
"for",
"(",
"Socket",
"socket",
":",
"sockets",
")",
"{",
"if",
"(",
"socket",
"=="... | In JDK 1.6, java.net.Socket doesn't implement Closeable, so we have this overload. | [
"In",
"JDK",
"1",
".",
"6",
"java",
".",
"net",
".",
"Socket",
"doesn",
"t",
"implement",
"Closeable",
"so",
"we",
"have",
"this",
"overload",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/util/IoUtil.java#L35-L45 |
47,747 | spockframework/spock | spock-core/src/main/java/org/spockframework/util/IoUtil.java | IoUtil.getText | public static String getText(Reader reader) throws IOException {
try {
StringBuilder source = new StringBuilder();
BufferedReader buffered = new BufferedReader(reader);
String line = buffered.readLine();
while (line != null) {
source.append(line);
source.append('\n');
... | java | public static String getText(Reader reader) throws IOException {
try {
StringBuilder source = new StringBuilder();
BufferedReader buffered = new BufferedReader(reader);
String line = buffered.readLine();
while (line != null) {
source.append(line);
source.append('\n');
... | [
"public",
"static",
"String",
"getText",
"(",
"Reader",
"reader",
")",
"throws",
"IOException",
"{",
"try",
"{",
"StringBuilder",
"source",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"BufferedReader",
"buffered",
"=",
"new",
"BufferedReader",
"(",
"reader",
"... | Returns the text read from the given reader as a String.
Closes the given reader upon return. | [
"Returns",
"the",
"text",
"read",
"from",
"the",
"given",
"reader",
"as",
"a",
"String",
".",
"Closes",
"the",
"given",
"reader",
"upon",
"return",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/util/IoUtil.java#L63-L79 |
47,748 | spockframework/spock | spock-core/src/main/java/spock/util/environment/OperatingSystem.java | OperatingSystem.getCurrent | public static OperatingSystem getCurrent() {
String name = System.getProperty("os.name");
String version = System.getProperty("os.version");
String lowerName = name.toLowerCase();
if (lowerName.contains("linux")) return new OperatingSystem(name, version, Family.LINUX);
if (lowerName.contains("mac os... | java | public static OperatingSystem getCurrent() {
String name = System.getProperty("os.name");
String version = System.getProperty("os.version");
String lowerName = name.toLowerCase();
if (lowerName.contains("linux")) return new OperatingSystem(name, version, Family.LINUX);
if (lowerName.contains("mac os... | [
"public",
"static",
"OperatingSystem",
"getCurrent",
"(",
")",
"{",
"String",
"name",
"=",
"System",
".",
"getProperty",
"(",
"\"os.name\"",
")",
";",
"String",
"version",
"=",
"System",
".",
"getProperty",
"(",
"\"os.version\"",
")",
";",
"String",
"lowerName... | Returns the current operating system.
@return the current operating system | [
"Returns",
"the",
"current",
"operating",
"system",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/util/environment/OperatingSystem.java#L140-L149 |
47,749 | spockframework/spock | spock-core/src/main/java/org/spockframework/compiler/DeepBlockRewriter.java | DeepBlockRewriter.forbidUseOfSuperInFixtureMethod | private boolean forbidUseOfSuperInFixtureMethod(MethodCallExpression expr) {
Method currMethod = resources.getCurrentMethod();
Expression target = expr.getObjectExpression();
if (currMethod instanceof FixtureMethod
&& target instanceof VariableExpression
&& ((VariableExpression)target).isSu... | java | private boolean forbidUseOfSuperInFixtureMethod(MethodCallExpression expr) {
Method currMethod = resources.getCurrentMethod();
Expression target = expr.getObjectExpression();
if (currMethod instanceof FixtureMethod
&& target instanceof VariableExpression
&& ((VariableExpression)target).isSu... | [
"private",
"boolean",
"forbidUseOfSuperInFixtureMethod",
"(",
"MethodCallExpression",
"expr",
")",
"{",
"Method",
"currMethod",
"=",
"resources",
".",
"getCurrentMethod",
"(",
")",
";",
"Expression",
"target",
"=",
"expr",
".",
"getObjectExpression",
"(",
")",
";",
... | the base method and doesn't know that it will be run automatically) | [
"the",
"base",
"method",
"and",
"doesn",
"t",
"know",
"that",
"it",
"will",
"be",
"run",
"automatically",
")"
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/compiler/DeepBlockRewriter.java#L300-L315 |
47,750 | spockframework/spock | spock-core/src/main/groovy/spock/util/Exceptions.java | Exceptions.getRootCause | public static Throwable getRootCause(Throwable exception) {
Assert.notNull(exception);
return exception.getCause() == null ? exception : getRootCause(exception.getCause());
} | java | public static Throwable getRootCause(Throwable exception) {
Assert.notNull(exception);
return exception.getCause() == null ? exception : getRootCause(exception.getCause());
} | [
"public",
"static",
"Throwable",
"getRootCause",
"(",
"Throwable",
"exception",
")",
"{",
"Assert",
".",
"notNull",
"(",
"exception",
")",
";",
"return",
"exception",
".",
"getCause",
"(",
")",
"==",
"null",
"?",
"exception",
":",
"getRootCause",
"(",
"excep... | Returns the innermost cause of the specified exception. If the specified exception
has no cause, the exception itself is returned.
@param exception an exception
@return the root cause of the exception | [
"Returns",
"the",
"innermost",
"cause",
"of",
"the",
"specified",
"exception",
".",
"If",
"the",
"specified",
"exception",
"has",
"no",
"cause",
"the",
"exception",
"itself",
"is",
"returned",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/groovy/spock/util/Exceptions.java#L29-L32 |
47,751 | spockframework/spock | spock-core/src/main/groovy/spock/util/Exceptions.java | Exceptions.getCauseChain | public static List<Throwable> getCauseChain(Throwable exception) {
Assert.notNull(exception);
List<Throwable> result = new ArrayList<>();
collectCauseChain(exception, result);
return result;
} | java | public static List<Throwable> getCauseChain(Throwable exception) {
Assert.notNull(exception);
List<Throwable> result = new ArrayList<>();
collectCauseChain(exception, result);
return result;
} | [
"public",
"static",
"List",
"<",
"Throwable",
">",
"getCauseChain",
"(",
"Throwable",
"exception",
")",
"{",
"Assert",
".",
"notNull",
"(",
"exception",
")",
";",
"List",
"<",
"Throwable",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"col... | Returns a list of all causes of the specified exception. The first element of the
returned list is the specified exception itself; the last element is its root cause.
@param exception an exception
@return the exception's cause chain | [
"Returns",
"a",
"list",
"of",
"all",
"causes",
"of",
"the",
"specified",
"exception",
".",
"The",
"first",
"element",
"of",
"the",
"returned",
"list",
"is",
"the",
"specified",
"exception",
"itself",
";",
"the",
"last",
"element",
"is",
"its",
"root",
"cau... | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/groovy/spock/util/Exceptions.java#L42-L47 |
47,752 | spockframework/spock | spock-core/src/main/java/org/spockframework/gentyref/GenericTypeReflector.java | GenericTypeReflector.getArrayComponentType | public static Type getArrayComponentType(Type type) {
if (type instanceof Class) {
Class<?> clazz = (Class<?>)type;
return clazz.getComponentType();
} else if (type instanceof GenericArrayType) {
GenericArrayType aType = (GenericArrayType) type;
return aType.getGenericComponentType();
} else {
retu... | java | public static Type getArrayComponentType(Type type) {
if (type instanceof Class) {
Class<?> clazz = (Class<?>)type;
return clazz.getComponentType();
} else if (type instanceof GenericArrayType) {
GenericArrayType aType = (GenericArrayType) type;
return aType.getGenericComponentType();
} else {
retu... | [
"public",
"static",
"Type",
"getArrayComponentType",
"(",
"Type",
"type",
")",
"{",
"if",
"(",
"type",
"instanceof",
"Class",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"(",
"Class",
"<",
"?",
">",
")",
"type",
";",
"return",
"clazz",
".",
"getC... | If type is an array type, returns the type of the component of the array.
Otherwise, returns null. | [
"If",
"type",
"is",
"an",
"array",
"type",
"returns",
"the",
"type",
"of",
"the",
"component",
"of",
"the",
"array",
".",
"Otherwise",
"returns",
"null",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/gentyref/GenericTypeReflector.java#L221-L231 |
47,753 | spockframework/spock | spock-core/src/main/java/org/spockframework/gentyref/GenericTypeReflector.java | GenericTypeReflector.capture | public static Type capture(Type type) {
VarMap varMap = new VarMap();
List<CaptureTypeImpl> toInit = new ArrayList<>();
if (type instanceof ParameterizedType) {
ParameterizedType pType = (ParameterizedType)type;
Class<?> clazz = (Class<?>)pType.getRawType();
Type[] arguments = pType.getActualTypeArgument... | java | public static Type capture(Type type) {
VarMap varMap = new VarMap();
List<CaptureTypeImpl> toInit = new ArrayList<>();
if (type instanceof ParameterizedType) {
ParameterizedType pType = (ParameterizedType)type;
Class<?> clazz = (Class<?>)pType.getRawType();
Type[] arguments = pType.getActualTypeArgument... | [
"public",
"static",
"Type",
"capture",
"(",
"Type",
"type",
")",
"{",
"VarMap",
"varMap",
"=",
"new",
"VarMap",
"(",
")",
";",
"List",
"<",
"CaptureTypeImpl",
">",
"toInit",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"type",
"instanceof",... | Applies capture conversion to the given type. | [
"Applies",
"capture",
"conversion",
"to",
"the",
"given",
"type",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/gentyref/GenericTypeReflector.java#L364-L392 |
47,754 | spockframework/spock | spock-core/src/main/java/org/spockframework/gentyref/GenericTypeReflector.java | GenericTypeReflector.getTypeName | public static String getTypeName(Type type) {
if(type instanceof Class) {
Class<?> clazz = (Class<?>) type;
return clazz.isArray() ? (getTypeName(clazz.getComponentType()) + "[]") : clazz.getName();
} else {
return type.toString();
}
} | java | public static String getTypeName(Type type) {
if(type instanceof Class) {
Class<?> clazz = (Class<?>) type;
return clazz.isArray() ? (getTypeName(clazz.getComponentType()) + "[]") : clazz.getName();
} else {
return type.toString();
}
} | [
"public",
"static",
"String",
"getTypeName",
"(",
"Type",
"type",
")",
"{",
"if",
"(",
"type",
"instanceof",
"Class",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"(",
"Class",
"<",
"?",
">",
")",
"type",
";",
"return",
"clazz",
".",
"isArray",
... | Returns the display name of a Type. | [
"Returns",
"the",
"display",
"name",
"of",
"a",
"Type",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/gentyref/GenericTypeReflector.java#L397-L404 |
47,755 | spockframework/spock | spock-core/src/main/java/org/spockframework/gentyref/GenericTypeReflector.java | GenericTypeReflector.buildUpperBoundClassAndInterfaces | private static void buildUpperBoundClassAndInterfaces(Type type, Set<Class<?>> result) {
if (type instanceof ParameterizedType || type instanceof Class<?>) {
result.add(erase(type));
return;
}
for (Type superType: getExactDirectSuperTypes(type)) {
buildUpperBoundClassAndInterfaces(superType, result);
... | java | private static void buildUpperBoundClassAndInterfaces(Type type, Set<Class<?>> result) {
if (type instanceof ParameterizedType || type instanceof Class<?>) {
result.add(erase(type));
return;
}
for (Type superType: getExactDirectSuperTypes(type)) {
buildUpperBoundClassAndInterfaces(superType, result);
... | [
"private",
"static",
"void",
"buildUpperBoundClassAndInterfaces",
"(",
"Type",
"type",
",",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"result",
")",
"{",
"if",
"(",
"type",
"instanceof",
"ParameterizedType",
"||",
"type",
"instanceof",
"Class",
"<",
"?",
">",... | Helper method for getUpperBoundClassAndInterfaces, adding the result to the given set. | [
"Helper",
"method",
"for",
"getUpperBoundClassAndInterfaces",
"adding",
"the",
"result",
"to",
"the",
"given",
"set",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/gentyref/GenericTypeReflector.java#L431-L440 |
47,756 | spockframework/spock | spock-core/src/main/java/spock/mock/MockingApi.java | MockingApi.Mock | @Beta
public <T> T Mock(
@NamedParams({
@NamedParam(value = "name", type = String.class),
@NamedParam(value = "additionalInterfaces", type = List.class),
@NamedParam(value = "defaultResponse", type = IDefaultResponse.class),
@NamedParam(value = "verified", type = Boolean.class),
@Nam... | java | @Beta
public <T> T Mock(
@NamedParams({
@NamedParam(value = "name", type = String.class),
@NamedParam(value = "additionalInterfaces", type = List.class),
@NamedParam(value = "defaultResponse", type = IDefaultResponse.class),
@NamedParam(value = "verified", type = Boolean.class),
@Nam... | [
"@",
"Beta",
"public",
"<",
"T",
">",
"T",
"Mock",
"(",
"@",
"NamedParams",
"(",
"{",
"@",
"NamedParam",
"(",
"value",
"=",
"\"name\"",
",",
"type",
"=",
"String",
".",
"class",
")",
",",
"@",
"NamedParam",
"(",
"value",
"=",
"\"additionalInterfaces\""... | Creates a mock with the specified options whose type and name are inferred from the left-hand side of the
enclosing variable assignment.
Example:
<pre>
Person person = Mock(name: "myPerson") // type is Person.class, name is "myPerson"
</pre>
@param options optional options for creating the mock
@return a mock with ... | [
"Creates",
"a",
"mock",
"with",
"the",
"specified",
"options",
"whose",
"type",
"and",
"name",
"are",
"inferred",
"from",
"the",
"left",
"-",
"hand",
"side",
"of",
"the",
"enclosing",
"variable",
"assignment",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/mock/MockingApi.java#L167-L179 |
47,757 | spockframework/spock | spock-core/src/main/java/spock/mock/MockingApi.java | MockingApi.Mock | @Beta
public <T> T Mock(Map<String, Object> options, Closure interactions) {
invalidMockCreation();
return null;
} | java | @Beta
public <T> T Mock(Map<String, Object> options, Closure interactions) {
invalidMockCreation();
return null;
} | [
"@",
"Beta",
"public",
"<",
"T",
">",
"T",
"Mock",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
",",
"Closure",
"interactions",
")",
"{",
"invalidMockCreation",
"(",
")",
";",
"return",
"null",
";",
"}"
] | Creates a mock with the specified options and interactions whose type and name are inferred
from the left-hand side of the enclosing assignment.
Example:
<pre>
// type is Person.class, name is "myPerson", returns hard-coded value for {@code name}, expects one call to {@code sing()}
Person person = Mock(name: "myPerso... | [
"Creates",
"a",
"mock",
"with",
"the",
"specified",
"options",
"and",
"interactions",
"whose",
"type",
"and",
"name",
"are",
"inferred",
"from",
"the",
"left",
"-",
"hand",
"side",
"of",
"the",
"enclosing",
"assignment",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/mock/MockingApi.java#L278-L282 |
47,758 | spockframework/spock | spock-core/src/main/java/spock/mock/MockingApi.java | MockingApi.Stub | @Override
@Beta
public <T> T Stub(Class<T> type) {
invalidMockCreation();
return null;
} | java | @Override
@Beta
public <T> T Stub(Class<T> type) {
invalidMockCreation();
return null;
} | [
"@",
"Override",
"@",
"Beta",
"public",
"<",
"T",
">",
"T",
"Stub",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"invalidMockCreation",
"(",
")",
";",
"return",
"null",
";",
"}"
] | Creates a stub with the specified type. If enclosed in a variable assignment, the variable name will be
used as the stub's name.
Example:
<pre>
def person = Stub(Person) // type is Person.class, name is "person"
</pre>
@param type the interface or class type of the stub
@param <T> the interface or class type of the ... | [
"Creates",
"a",
"stub",
"with",
"the",
"specified",
"type",
".",
"If",
"enclosed",
"in",
"a",
"variable",
"assignment",
"the",
"variable",
"name",
"will",
"be",
"used",
"as",
"the",
"stub",
"s",
"name",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/mock/MockingApi.java#L416-L421 |
47,759 | spockframework/spock | spock-core/src/main/java/spock/mock/MockingApi.java | MockingApi.Spy | @Override
@Beta
public <T> T Spy(Class<T> type) {
invalidMockCreation();
return null;
} | java | @Override
@Beta
public <T> T Spy(Class<T> type) {
invalidMockCreation();
return null;
} | [
"@",
"Override",
"@",
"Beta",
"public",
"<",
"T",
">",
"T",
"Spy",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"invalidMockCreation",
"(",
")",
";",
"return",
"null",
";",
"}"
] | Creates a spy with the specified type. If enclosed in a variable assignment, the variable name will be
used as the spy's name.
Example:
<pre>
def person = Spy(Person) // type is Person.class, name is "person"
</pre>
@param type the class type of the spy
@param <T> the class type of the spy
@return a spy with the sp... | [
"Creates",
"a",
"spy",
"with",
"the",
"specified",
"type",
".",
"If",
"enclosed",
"in",
"a",
"variable",
"assignment",
"the",
"variable",
"name",
"will",
"be",
"used",
"as",
"the",
"spy",
"s",
"name",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/mock/MockingApi.java#L645-L650 |
47,760 | spockframework/spock | spock-core/src/main/java/org/spockframework/mock/constraint/PositionalArgumentListConstraint.java | PositionalArgumentListConstraint.hasExpandableVarArgs | private boolean hasExpandableVarArgs(IMockMethod method, List<Object> args) {
List<Class<?>> paramTypes = method.getParameterTypes();
return !paramTypes.isEmpty()
&& CollectionUtil.getLastElement(paramTypes).isArray()
&& CollectionUtil.getLastElement(args) != null;
} | java | private boolean hasExpandableVarArgs(IMockMethod method, List<Object> args) {
List<Class<?>> paramTypes = method.getParameterTypes();
return !paramTypes.isEmpty()
&& CollectionUtil.getLastElement(paramTypes).isArray()
&& CollectionUtil.getLastElement(args) != null;
} | [
"private",
"boolean",
"hasExpandableVarArgs",
"(",
"IMockMethod",
"method",
",",
"List",
"<",
"Object",
">",
"args",
")",
"{",
"List",
"<",
"Class",
"<",
"?",
">",
">",
"paramTypes",
"=",
"method",
".",
"getParameterTypes",
"(",
")",
";",
"return",
"!",
... | Tells if the given method call has expandable varargs. Note that Groovy
supports vararg syntax for all methods whose last parameter is of array type. | [
"Tells",
"if",
"the",
"given",
"method",
"call",
"has",
"expandable",
"varargs",
".",
"Note",
"that",
"Groovy",
"supports",
"vararg",
"syntax",
"for",
"all",
"methods",
"whose",
"last",
"parameter",
"is",
"of",
"array",
"type",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/mock/constraint/PositionalArgumentListConstraint.java#L80-L85 |
47,761 | spockframework/spock | spock-core/src/main/java/org/spockframework/util/inspector/AstInspector.java | AstInspector.load | public void load(@Language("Groovy") String sourceText) throws CompilationFailedException {
reset();
try {
classLoader.parseClass(sourceText);
} catch (AstSuccessfullyCaptured e) {
indexAstNodes();
return;
}
throw new AstInspectorException("internal error");
} | java | public void load(@Language("Groovy") String sourceText) throws CompilationFailedException {
reset();
try {
classLoader.parseClass(sourceText);
} catch (AstSuccessfullyCaptured e) {
indexAstNodes();
return;
}
throw new AstInspectorException("internal error");
} | [
"public",
"void",
"load",
"(",
"@",
"Language",
"(",
"\"Groovy\"",
")",
"String",
"sourceText",
")",
"throws",
"CompilationFailedException",
"{",
"reset",
"(",
")",
";",
"try",
"{",
"classLoader",
".",
"parseClass",
"(",
"sourceText",
")",
";",
"}",
"catch",... | Compiles the specified source text up to the configured compile
phase and stores the resulting AST for subsequent inspection.
@param sourceText the source text to compile
@throws CompilationFailedException if an error occurs during compilation | [
"Compiles",
"the",
"specified",
"source",
"text",
"up",
"to",
"the",
"configured",
"compile",
"phase",
"and",
"stores",
"the",
"resulting",
"AST",
"for",
"subsequent",
"inspection",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/util/inspector/AstInspector.java#L137-L148 |
47,762 | spockframework/spock | spock-core/src/main/java/org/spockframework/util/inspector/AstInspector.java | AstInspector.load | public void load(File sourceFile) throws CompilationFailedException {
reset();
try {
classLoader.parseClass(sourceFile);
} catch (IOException e) {
throw new AstInspectorException("cannot read source file", e);
} catch (AstSuccessfullyCaptured e) {
indexAstNodes();
return;
}
... | java | public void load(File sourceFile) throws CompilationFailedException {
reset();
try {
classLoader.parseClass(sourceFile);
} catch (IOException e) {
throw new AstInspectorException("cannot read source file", e);
} catch (AstSuccessfullyCaptured e) {
indexAstNodes();
return;
}
... | [
"public",
"void",
"load",
"(",
"File",
"sourceFile",
")",
"throws",
"CompilationFailedException",
"{",
"reset",
"(",
")",
";",
"try",
"{",
"classLoader",
".",
"parseClass",
"(",
"sourceFile",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"thro... | Compiles the source text in the specified file up to the
configured compile phase and stores the resulting AST for subsequent
inspection.
@param sourceFile the file containing the source text to compile
@throws CompilationFailedException if an error occurs during compilation
@throws AstInspectorException if an IOExcep... | [
"Compiles",
"the",
"source",
"text",
"in",
"the",
"specified",
"file",
"up",
"to",
"the",
"configured",
"compile",
"phase",
"and",
"stores",
"the",
"resulting",
"AST",
"for",
"subsequent",
"inspection",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/util/inspector/AstInspector.java#L160-L173 |
47,763 | spockframework/spock | spock-core/src/main/java/org/spockframework/runtime/ParameterizedSpecRunner.java | ParameterizedSpecRunner.estimateNumIterations | private int estimateNumIterations(Object[] dataProviders) {
if (runStatus != OK) return -1;
if (dataProviders.length == 0) return 1;
int result = Integer.MAX_VALUE;
for (Object prov : dataProviders) {
if (prov instanceof Iterator)
// unbelievably, DGM provides a size() method for Iterator... | java | private int estimateNumIterations(Object[] dataProviders) {
if (runStatus != OK) return -1;
if (dataProviders.length == 0) return 1;
int result = Integer.MAX_VALUE;
for (Object prov : dataProviders) {
if (prov instanceof Iterator)
// unbelievably, DGM provides a size() method for Iterator... | [
"private",
"int",
"estimateNumIterations",
"(",
"Object",
"[",
"]",
"dataProviders",
")",
"{",
"if",
"(",
"runStatus",
"!=",
"OK",
")",
"return",
"-",
"1",
";",
"if",
"(",
"dataProviders",
".",
"length",
"==",
"0",
")",
"return",
"1",
";",
"int",
"resu... | -1 => unknown | [
"-",
"1",
"=",
">",
"unknown"
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/runtime/ParameterizedSpecRunner.java#L112-L133 |
47,764 | spockframework/spock | spock-core/src/main/java/org/spockframework/runtime/ParameterizedSpecRunner.java | ParameterizedSpecRunner.nextArgs | private Object[] nextArgs(Iterator[] iterators) {
if (runStatus != OK) return null;
Object[] next = new Object[iterators.length];
for (int i = 0; i < iterators.length; i++)
try {
next[i] = iterators[i].next();
} catch (Throwable t) {
runStatus = supervisor.error(
new... | java | private Object[] nextArgs(Iterator[] iterators) {
if (runStatus != OK) return null;
Object[] next = new Object[iterators.length];
for (int i = 0; i < iterators.length; i++)
try {
next[i] = iterators[i].next();
} catch (Throwable t) {
runStatus = supervisor.error(
new... | [
"private",
"Object",
"[",
"]",
"nextArgs",
"(",
"Iterator",
"[",
"]",
"iterators",
")",
"{",
"if",
"(",
"runStatus",
"!=",
"OK",
")",
"return",
"null",
";",
"Object",
"[",
"]",
"next",
"=",
"new",
"Object",
"[",
"iterators",
".",
"length",
"]",
";",
... | advances iterators and computes args | [
"advances",
"iterators",
"and",
"computes",
"args"
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/runtime/ParameterizedSpecRunner.java#L195-L215 |
47,765 | spockframework/spock | spock-core/src/main/java/spock/mock/DetachedMockFactory.java | DetachedMockFactory.Mock | @Override
public <T> T Mock(Class<T> type) {
return createMock(inferNameFromType(type), type, MockNature.MOCK, Collections.<String, Object>emptyMap());
} | java | @Override
public <T> T Mock(Class<T> type) {
return createMock(inferNameFromType(type), type, MockNature.MOCK, Collections.<String, Object>emptyMap());
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"Mock",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"createMock",
"(",
"inferNameFromType",
"(",
"type",
")",
",",
"type",
",",
"MockNature",
".",
"MOCK",
",",
"Collections",
".",
"<",
"Stri... | Creates a mock with the specified type. The mock name will be the types simple name.
Example:
<pre>
def person = Mock(Person) // type is Person.class, name is "person"
</pre>
@param type the interface or class type of the mock
@param <T> the interface or class type of the mock
@return a mock with the specified type | [
"Creates",
"a",
"mock",
"with",
"the",
"specified",
"type",
".",
"The",
"mock",
"name",
"will",
"be",
"the",
"types",
"simple",
"name",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/mock/DetachedMockFactory.java#L45-L48 |
47,766 | spockframework/spock | spock-core/src/main/java/spock/mock/DetachedMockFactory.java | DetachedMockFactory.Mock | @Override
public <T> T Mock(Map<String, Object> options, Class<T> type) {
return createMock(inferNameFromType(type), type, MockNature.MOCK, options);
} | java | @Override
public <T> T Mock(Map<String, Object> options, Class<T> type) {
return createMock(inferNameFromType(type), type, MockNature.MOCK, options);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"Mock",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"createMock",
"(",
"inferNameFromType",
"(",
"type",
")",
",",
"type",
",",
"M... | Creates a mock with the specified options and type. The mock name will be the types simple name.
Example:
<pre>
def person = Mock(Person, name: "myPerson") // type is Person.class, name is "myPerson"
</pre>
@param options optional options for creating the mock
@param type the interface or class type of the mock
@par... | [
"Creates",
"a",
"mock",
"with",
"the",
"specified",
"options",
"and",
"type",
".",
"The",
"mock",
"name",
"will",
"be",
"the",
"types",
"simple",
"name",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/mock/DetachedMockFactory.java#L65-L68 |
47,767 | spockframework/spock | spock-core/src/main/java/spock/mock/DetachedMockFactory.java | DetachedMockFactory.Stub | @Override
public <T> T Stub(Class<T> type) {
return createMock(inferNameFromType(type), type, MockNature.STUB, Collections.<String, Object>emptyMap());
} | java | @Override
public <T> T Stub(Class<T> type) {
return createMock(inferNameFromType(type), type, MockNature.STUB, Collections.<String, Object>emptyMap());
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"Stub",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"createMock",
"(",
"inferNameFromType",
"(",
"type",
")",
",",
"type",
",",
"MockNature",
".",
"STUB",
",",
"Collections",
".",
"<",
"Stri... | Creates a stub with the specified type. The mock name will be the types simple name.
Example:
<pre>
def person = Stub(Person) // type is Person.class, name is "person"
</pre>
@param type the interface or class type of the stub
@param <T> the interface or class type of the stub
@return a stub with the specified type | [
"Creates",
"a",
"stub",
"with",
"the",
"specified",
"type",
".",
"The",
"mock",
"name",
"will",
"be",
"the",
"types",
"simple",
"name",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/mock/DetachedMockFactory.java#L84-L87 |
47,768 | spockframework/spock | spock-core/src/main/java/spock/mock/DetachedMockFactory.java | DetachedMockFactory.Stub | @Override
public <T> T Stub(Map<String, Object> options, Class<T> type) {
return createMock(inferNameFromType(type), type, MockNature.STUB, options);
} | java | @Override
public <T> T Stub(Map<String, Object> options, Class<T> type) {
return createMock(inferNameFromType(type), type, MockNature.STUB, options);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"Stub",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"createMock",
"(",
"inferNameFromType",
"(",
"type",
")",
",",
"type",
",",
"M... | Creates a stub with the specified options and type. The mock name will be the types simple name.
Example:
<pre>
def person = Stub(Person, name: "myPerson") // type is Person.class, name is "myPerson"
</pre>
@param options optional options for creating the stub
@param type the interface or class type of the stub
@par... | [
"Creates",
"a",
"stub",
"with",
"the",
"specified",
"options",
"and",
"type",
".",
"The",
"mock",
"name",
"will",
"be",
"the",
"types",
"simple",
"name",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/mock/DetachedMockFactory.java#L104-L107 |
47,769 | spockframework/spock | spock-core/src/main/java/spock/mock/DetachedMockFactory.java | DetachedMockFactory.Spy | @Override
public <T> T Spy(Class<T> type) {
return createMock(inferNameFromType(type), type, MockNature.SPY, Collections.<String, Object>emptyMap());
} | java | @Override
public <T> T Spy(Class<T> type) {
return createMock(inferNameFromType(type), type, MockNature.SPY, Collections.<String, Object>emptyMap());
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"Spy",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"createMock",
"(",
"inferNameFromType",
"(",
"type",
")",
",",
"type",
",",
"MockNature",
".",
"SPY",
",",
"Collections",
".",
"<",
"String... | Creates a spy with the specified type. The mock name will be the types simple name.
Example:
<pre>
def person = Spy(Person) // type is Person.class, name is "person"
</pre>
@param type the class type of the spy
@param <T> the class type of the spy
@return a spy with the specified type | [
"Creates",
"a",
"spy",
"with",
"the",
"specified",
"type",
".",
"The",
"mock",
"name",
"will",
"be",
"the",
"types",
"simple",
"name",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/mock/DetachedMockFactory.java#L123-L126 |
47,770 | spockframework/spock | spock-core/src/main/java/spock/mock/DetachedMockFactory.java | DetachedMockFactory.Spy | @Override
public <T> T Spy(Map<String, Object> options, Class<T> type) {
return createMock(inferNameFromType(type), type, MockNature.SPY, options);
} | java | @Override
public <T> T Spy(Map<String, Object> options, Class<T> type) {
return createMock(inferNameFromType(type), type, MockNature.SPY, options);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"Spy",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"createMock",
"(",
"inferNameFromType",
"(",
"type",
")",
",",
"type",
",",
"Mo... | Creates a spy with the specified options and type. The mock name will be the types simple name.
Example:
<pre>
def person = Spy(Person, name: "myPerson") // type is Person.class, name is "myPerson"
</pre>
@param options optional options for creating the spy
@param type the class type of the spy
@param <T> the class ... | [
"Creates",
"a",
"spy",
"with",
"the",
"specified",
"options",
"and",
"type",
".",
"The",
"mock",
"name",
"will",
"be",
"the",
"types",
"simple",
"name",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/spock/mock/DetachedMockFactory.java#L148-L151 |
47,771 | spockframework/spock | spock-core/src/main/java/org/spockframework/runtime/SpecUtil.java | SpecUtil.getFeatureCount | public static int getFeatureCount(Class<?> spec) {
checkIsSpec(spec);
int count = 0;
do {
for (Method method : spec.getDeclaredMethods())
if (method.isAnnotationPresent(FeatureMetadata.class))
count++;
spec = spec.getSuperclass();
} while (spec != null && isSpec(spec));
... | java | public static int getFeatureCount(Class<?> spec) {
checkIsSpec(spec);
int count = 0;
do {
for (Method method : spec.getDeclaredMethods())
if (method.isAnnotationPresent(FeatureMetadata.class))
count++;
spec = spec.getSuperclass();
} while (spec != null && isSpec(spec));
... | [
"public",
"static",
"int",
"getFeatureCount",
"(",
"Class",
"<",
"?",
">",
"spec",
")",
"{",
"checkIsSpec",
"(",
"spec",
")",
";",
"int",
"count",
"=",
"0",
";",
"do",
"{",
"for",
"(",
"Method",
"method",
":",
"spec",
".",
"getDeclaredMethods",
"(",
... | Returns the number of features contained in the given specification.
Because Spock allows for the dynamic creation of new features at
specification run time, this number is only an estimate. | [
"Returns",
"the",
"number",
"of",
"features",
"contained",
"in",
"the",
"given",
"specification",
".",
"Because",
"Spock",
"allows",
"for",
"the",
"dynamic",
"creation",
"of",
"new",
"features",
"at",
"specification",
"run",
"time",
"this",
"number",
"is",
"on... | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/runtime/SpecUtil.java#L76-L89 |
47,772 | spockframework/spock | spock-core/src/main/java/org/spockframework/runtime/model/FeatureInfo.java | FeatureInfo.hasBytecodeName | public boolean hasBytecodeName(String name) {
if (featureMethod.hasBytecodeName(name)) return true;
if (dataProcessorMethod != null && dataProcessorMethod.hasBytecodeName(name)) return true;
for (DataProviderInfo provider : dataProviders)
if (provider.getDataProviderMethod().hasBytecodeName(name)) ret... | java | public boolean hasBytecodeName(String name) {
if (featureMethod.hasBytecodeName(name)) return true;
if (dataProcessorMethod != null && dataProcessorMethod.hasBytecodeName(name)) return true;
for (DataProviderInfo provider : dataProviders)
if (provider.getDataProviderMethod().hasBytecodeName(name)) ret... | [
"public",
"boolean",
"hasBytecodeName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"featureMethod",
".",
"hasBytecodeName",
"(",
"name",
")",
")",
"return",
"true",
";",
"if",
"(",
"dataProcessorMethod",
"!=",
"null",
"&&",
"dataProcessorMethod",
".",
"hasByt... | Tells if any of the methods associated with this feature has the specified
name in bytecode.
@param name a method name in bytecode
@return <tt>true</tt iff any of the methods associated with this feature
has the specified name in bytecode | [
"Tells",
"if",
"any",
"of",
"the",
"methods",
"associated",
"with",
"this",
"feature",
"has",
"the",
"specified",
"name",
"in",
"bytecode",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/runtime/model/FeatureInfo.java#L133-L139 |
47,773 | spockframework/spock | spock-core/src/main/java/org/spockframework/compiler/AstUtil.java | AstUtil.getStatements | @SuppressWarnings("unchecked")
public static List<Statement> getStatements(MethodNode method) {
Statement code = method.getCode();
if (!(code instanceof BlockStatement)) { // null or single statement
BlockStatement block = new BlockStatement();
if (code != null) block.addStatement(code);
met... | java | @SuppressWarnings("unchecked")
public static List<Statement> getStatements(MethodNode method) {
Statement code = method.getCode();
if (!(code instanceof BlockStatement)) { // null or single statement
BlockStatement block = new BlockStatement();
if (code != null) block.addStatement(code);
met... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"Statement",
">",
"getStatements",
"(",
"MethodNode",
"method",
")",
"{",
"Statement",
"code",
"=",
"method",
".",
"getCode",
"(",
")",
";",
"if",
"(",
"!",
"(",
"code",
... | Returns a list of statements of the given method. Modifications to the returned list
will affect the method's statements.
@param method a method (node)
@return a list of statements of the given method | [
"Returns",
"a",
"list",
"of",
"statements",
"of",
"the",
"given",
"method",
".",
"Modifications",
"to",
"the",
"returned",
"list",
"will",
"affect",
"the",
"method",
"s",
"statements",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/compiler/AstUtil.java#L69-L78 |
47,774 | spockframework/spock | spock-core/src/main/java/org/spockframework/compiler/AstUtil.java | AstUtil.fixUpLocalVariables | public static void fixUpLocalVariables(List<? extends Variable> localVariables, VariableScope scope, boolean isClosureScope) {
for (Variable localVar : localVariables) {
Variable scopeVar = scope.getReferencedClassVariable(localVar.getName());
if (scopeVar instanceof DynamicVariable) {
scope.rem... | java | public static void fixUpLocalVariables(List<? extends Variable> localVariables, VariableScope scope, boolean isClosureScope) {
for (Variable localVar : localVariables) {
Variable scopeVar = scope.getReferencedClassVariable(localVar.getName());
if (scopeVar instanceof DynamicVariable) {
scope.rem... | [
"public",
"static",
"void",
"fixUpLocalVariables",
"(",
"List",
"<",
"?",
"extends",
"Variable",
">",
"localVariables",
",",
"VariableScope",
"scope",
",",
"boolean",
"isClosureScope",
")",
"{",
"for",
"(",
"Variable",
"localVar",
":",
"localVariables",
")",
"{"... | Fixes up scope references to variables that used to be free or class variables,
and have been changed to local variables. | [
"Fixes",
"up",
"scope",
"references",
"to",
"variables",
"that",
"used",
"to",
"be",
"free",
"or",
"class",
"variables",
"and",
"have",
"been",
"changed",
"to",
"local",
"variables",
"."
] | d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9 | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/compiler/AstUtil.java#L326-L336 |
47,775 | Twitter4J/Twitter4J | twitter4j-core/src/internal-json/java/twitter4j/JSONStringer.java | JSONStringer.beforeKey | private void beforeKey() throws JSONException {
Scope context = peek();
if (context == Scope.NONEMPTY_OBJECT) { // first in object
out.append(',');
} else if (context != Scope.EMPTY_OBJECT) { // not in an object!
throw new JSONException("Nesting problem");
}
... | java | private void beforeKey() throws JSONException {
Scope context = peek();
if (context == Scope.NONEMPTY_OBJECT) { // first in object
out.append(',');
} else if (context != Scope.EMPTY_OBJECT) { // not in an object!
throw new JSONException("Nesting problem");
}
... | [
"private",
"void",
"beforeKey",
"(",
")",
"throws",
"JSONException",
"{",
"Scope",
"context",
"=",
"peek",
"(",
")",
";",
"if",
"(",
"context",
"==",
"Scope",
".",
"NONEMPTY_OBJECT",
")",
"{",
"// first in object",
"out",
".",
"append",
"(",
"'",
"'",
")... | Inserts any necessary separators and whitespace before a name. Also
adjusts the stack to expect the key's value. | [
"Inserts",
"any",
"necessary",
"separators",
"and",
"whitespace",
"before",
"a",
"name",
".",
"Also",
"adjusts",
"the",
"stack",
"to",
"expect",
"the",
"key",
"s",
"value",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/internal-json/java/twitter4j/JSONStringer.java#L396-L405 |
47,776 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/auth/OAuthAuthorization.java | OAuthAuthorization.getAuthorizationHeader | @Override
public String getAuthorizationHeader(HttpRequest req) {
return generateAuthorizationHeader(req.getMethod().name(), req.getURL(), req.getParameters(), oauthToken);
} | java | @Override
public String getAuthorizationHeader(HttpRequest req) {
return generateAuthorizationHeader(req.getMethod().name(), req.getURL(), req.getParameters(), oauthToken);
} | [
"@",
"Override",
"public",
"String",
"getAuthorizationHeader",
"(",
"HttpRequest",
"req",
")",
"{",
"return",
"generateAuthorizationHeader",
"(",
"req",
".",
"getMethod",
"(",
")",
".",
"name",
"(",
")",
",",
"req",
".",
"getURL",
"(",
")",
",",
"req",
"."... | implementations for Authorization | [
"implementations",
"for",
"Authorization"
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/auth/OAuthAuthorization.java#L64-L67 |
47,777 | Twitter4J/Twitter4J | twitter4j-stream/src/main/java/twitter4j/TwitterStreamImpl.java | TwitterStreamImpl.getSampleStream | StatusStream getSampleStream() throws TwitterException {
ensureAuthorizationEnabled();
try {
return new StatusStreamImpl(getDispatcher(), http.get(conf.getStreamBaseURL() + "statuses/sample.json?"
+ stallWarningsGetParam, null, auth, null), conf);
} catch (IOExcep... | java | StatusStream getSampleStream() throws TwitterException {
ensureAuthorizationEnabled();
try {
return new StatusStreamImpl(getDispatcher(), http.get(conf.getStreamBaseURL() + "statuses/sample.json?"
+ stallWarningsGetParam, null, auth, null), conf);
} catch (IOExcep... | [
"StatusStream",
"getSampleStream",
"(",
")",
"throws",
"TwitterException",
"{",
"ensureAuthorizationEnabled",
"(",
")",
";",
"try",
"{",
"return",
"new",
"StatusStreamImpl",
"(",
"getDispatcher",
"(",
")",
",",
"http",
".",
"get",
"(",
"conf",
".",
"getStreamBas... | Returns a stream of random sample of all public statuses. The default access level provides a small proportion of the Firehose. The "Gardenhose" access level provides a proportion more suitable for data mining and research applications that desire a larger proportion to be statistically significant sample.
@return Sta... | [
"Returns",
"a",
"stream",
"of",
"random",
"sample",
"of",
"all",
"public",
"statuses",
".",
"The",
"default",
"access",
"level",
"provides",
"a",
"small",
"proportion",
"of",
"the",
"Firehose",
".",
"The",
"Gardenhose",
"access",
"level",
"provides",
"a",
"p... | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-stream/src/main/java/twitter4j/TwitterStreamImpl.java#L198-L206 |
47,778 | Twitter4J/Twitter4J | twitter4j-core/src/internal-http/java/twitter4j/HttpClientImpl.java | HttpClientImpl.setHeaders | private void setHeaders(HttpRequest req, HttpURLConnection connection) {
if (logger.isDebugEnabled()) {
logger.debug("Request: ");
logger.debug(req.getMethod().name() + " ", req.getURL());
}
String authorizationHeader;
if (req.getAuthorization() != null && (autho... | java | private void setHeaders(HttpRequest req, HttpURLConnection connection) {
if (logger.isDebugEnabled()) {
logger.debug("Request: ");
logger.debug(req.getMethod().name() + " ", req.getURL());
}
String authorizationHeader;
if (req.getAuthorization() != null && (autho... | [
"private",
"void",
"setHeaders",
"(",
"HttpRequest",
"req",
",",
"HttpURLConnection",
"connection",
")",
"{",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Request: \"",
")",
";",
"logger",
".",
"debug",
"(... | sets HTTP headers
@param req The request
@param connection HttpURLConnection | [
"sets",
"HTTP",
"headers"
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/internal-http/java/twitter4j/HttpClientImpl.java#L207-L226 |
47,779 | Twitter4J/Twitter4J | twitter4j-core/src/internal-http/java/twitter4j/HttpParameter.java | HttpParameter.decodeParameters | public static List<HttpParameter> decodeParameters(String queryParameters) {
List<HttpParameter> result=new ArrayList<HttpParameter>();
for (String pair : queryParameters.split("&")) {
String[] parts=pair.split("=", 2);
if(parts.length == 2) {
String name=decode(p... | java | public static List<HttpParameter> decodeParameters(String queryParameters) {
List<HttpParameter> result=new ArrayList<HttpParameter>();
for (String pair : queryParameters.split("&")) {
String[] parts=pair.split("=", 2);
if(parts.length == 2) {
String name=decode(p... | [
"public",
"static",
"List",
"<",
"HttpParameter",
">",
"decodeParameters",
"(",
"String",
"queryParameters",
")",
"{",
"List",
"<",
"HttpParameter",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"HttpParameter",
">",
"(",
")",
";",
"for",
"(",
"String",
"pair... | Parses a query string without the leading "?"
@param queryParameters a query parameter string, like a=hello&b=world
@return decoded parameters | [
"Parses",
"a",
"query",
"string",
"without",
"the",
"leading",
"?"
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/internal-http/java/twitter4j/HttpParameter.java#L332-L344 |
47,780 | Twitter4J/Twitter4J | twitter4j-async/src/main/java/twitter4j/AsyncTwitterImpl.java | AsyncTwitterImpl.getOAuthRequestTokenAsync | @Override
public void getOAuthRequestTokenAsync() {
getDispatcher().invokeLater(new AsyncTask(OAUTH_REQUEST_TOKEN, listeners) {
@Override
public void invoke(List<TwitterListener> listeners) throws TwitterException {
RequestToken token = twitter.getOAuthRequestToken();... | java | @Override
public void getOAuthRequestTokenAsync() {
getDispatcher().invokeLater(new AsyncTask(OAUTH_REQUEST_TOKEN, listeners) {
@Override
public void invoke(List<TwitterListener> listeners) throws TwitterException {
RequestToken token = twitter.getOAuthRequestToken();... | [
"@",
"Override",
"public",
"void",
"getOAuthRequestTokenAsync",
"(",
")",
"{",
"getDispatcher",
"(",
")",
".",
"invokeLater",
"(",
"new",
"AsyncTask",
"(",
"OAUTH_REQUEST_TOKEN",
",",
"listeners",
")",
"{",
"@",
"Override",
"public",
"void",
"invoke",
"(",
"Li... | implementation for AsyncOAuthSupport | [
"implementation",
"for",
"AsyncOAuthSupport"
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-async/src/main/java/twitter4j/AsyncTwitterImpl.java#L2578-L2593 |
47,781 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java | TwitterObjectFactory.createStatus | public static Status createStatus(String rawJSON) throws TwitterException {
try {
return new StatusJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | java | public static Status createStatus(String rawJSON) throws TwitterException {
try {
return new StatusJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | [
"public",
"static",
"Status",
"createStatus",
"(",
"String",
"rawJSON",
")",
"throws",
"TwitterException",
"{",
"try",
"{",
"return",
"new",
"StatusJSONImpl",
"(",
"new",
"JSONObject",
"(",
"rawJSON",
")",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
"... | Constructs a Status object from rawJSON string.
@param rawJSON raw JSON form as String
@return Status
@throws TwitterException when provided string is not a valid JSON string.
@since Twitter4J 2.1.7 | [
"Constructs",
"a",
"Status",
"object",
"from",
"rawJSON",
"string",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L53-L59 |
47,782 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java | TwitterObjectFactory.createUser | public static User createUser(String rawJSON) throws TwitterException {
try {
return new UserJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | java | public static User createUser(String rawJSON) throws TwitterException {
try {
return new UserJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | [
"public",
"static",
"User",
"createUser",
"(",
"String",
"rawJSON",
")",
"throws",
"TwitterException",
"{",
"try",
"{",
"return",
"new",
"UserJSONImpl",
"(",
"new",
"JSONObject",
"(",
"rawJSON",
")",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",
... | Constructs a User object from rawJSON string.
@param rawJSON raw JSON form as String
@return User
@throws TwitterException when provided string is not a valid JSON string.
@since Twitter4J 2.1.7 | [
"Constructs",
"a",
"User",
"object",
"from",
"rawJSON",
"string",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L69-L75 |
47,783 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java | TwitterObjectFactory.createAccountTotals | public static AccountTotals createAccountTotals(String rawJSON) throws TwitterException {
try {
return new AccountTotalsJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | java | public static AccountTotals createAccountTotals(String rawJSON) throws TwitterException {
try {
return new AccountTotalsJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | [
"public",
"static",
"AccountTotals",
"createAccountTotals",
"(",
"String",
"rawJSON",
")",
"throws",
"TwitterException",
"{",
"try",
"{",
"return",
"new",
"AccountTotalsJSONImpl",
"(",
"new",
"JSONObject",
"(",
"rawJSON",
")",
")",
";",
"}",
"catch",
"(",
"JSONE... | Constructs an AccountTotals object from rawJSON string.
@param rawJSON raw JSON form as String
@return AccountTotals
@throws TwitterException when provided string is not a valid JSON string.
@since Twitter4J 2.1.9 | [
"Constructs",
"an",
"AccountTotals",
"object",
"from",
"rawJSON",
"string",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L85-L91 |
47,784 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java | TwitterObjectFactory.createRelationship | public static Relationship createRelationship(String rawJSON) throws TwitterException {
try {
return new RelationshipJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | java | public static Relationship createRelationship(String rawJSON) throws TwitterException {
try {
return new RelationshipJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | [
"public",
"static",
"Relationship",
"createRelationship",
"(",
"String",
"rawJSON",
")",
"throws",
"TwitterException",
"{",
"try",
"{",
"return",
"new",
"RelationshipJSONImpl",
"(",
"new",
"JSONObject",
"(",
"rawJSON",
")",
")",
";",
"}",
"catch",
"(",
"JSONExce... | Constructs a Relationship object from rawJSON string.
@param rawJSON raw JSON form as String
@return Relationship
@throws TwitterException when provided string is not a valid JSON string.
@since Twitter4J 2.1.7 | [
"Constructs",
"a",
"Relationship",
"object",
"from",
"rawJSON",
"string",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L101-L107 |
47,785 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java | TwitterObjectFactory.createPlace | public static Place createPlace(String rawJSON) throws TwitterException {
try {
return new PlaceJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | java | public static Place createPlace(String rawJSON) throws TwitterException {
try {
return new PlaceJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | [
"public",
"static",
"Place",
"createPlace",
"(",
"String",
"rawJSON",
")",
"throws",
"TwitterException",
"{",
"try",
"{",
"return",
"new",
"PlaceJSONImpl",
"(",
"new",
"JSONObject",
"(",
"rawJSON",
")",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",... | Constructs a Place object from rawJSON string.
@param rawJSON raw JSON form as String
@return Place
@throws TwitterException when provided string is not a valid JSON string.
@since Twitter4J 2.1.7 | [
"Constructs",
"a",
"Place",
"object",
"from",
"rawJSON",
"string",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L117-L123 |
47,786 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java | TwitterObjectFactory.createSavedSearch | public static SavedSearch createSavedSearch(String rawJSON) throws TwitterException {
try {
return new SavedSearchJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | java | public static SavedSearch createSavedSearch(String rawJSON) throws TwitterException {
try {
return new SavedSearchJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | [
"public",
"static",
"SavedSearch",
"createSavedSearch",
"(",
"String",
"rawJSON",
")",
"throws",
"TwitterException",
"{",
"try",
"{",
"return",
"new",
"SavedSearchJSONImpl",
"(",
"new",
"JSONObject",
"(",
"rawJSON",
")",
")",
";",
"}",
"catch",
"(",
"JSONExcepti... | Constructs a SavedSearch object from rawJSON string.
@param rawJSON raw JSON form as String
@return SavedSearch
@throws TwitterException when provided string is not a valid JSON string.
@since Twitter4J 2.1.7 | [
"Constructs",
"a",
"SavedSearch",
"object",
"from",
"rawJSON",
"string",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L133-L139 |
47,787 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java | TwitterObjectFactory.createTrend | public static Trend createTrend(String rawJSON) throws TwitterException {
try {
return new TrendJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | java | public static Trend createTrend(String rawJSON) throws TwitterException {
try {
return new TrendJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | [
"public",
"static",
"Trend",
"createTrend",
"(",
"String",
"rawJSON",
")",
"throws",
"TwitterException",
"{",
"try",
"{",
"return",
"new",
"TrendJSONImpl",
"(",
"new",
"JSONObject",
"(",
"rawJSON",
")",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",... | Constructs a Trend object from rawJSON string.
@param rawJSON raw JSON form as String
@return Trend
@throws TwitterException when provided string is not a valid JSON string.
@since Twitter4J 2.1.7 | [
"Constructs",
"a",
"Trend",
"object",
"from",
"rawJSON",
"string",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L149-L155 |
47,788 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java | TwitterObjectFactory.createRateLimitStatus | public static Map<String, RateLimitStatus> createRateLimitStatus(String rawJSON) throws TwitterException {
try {
return RateLimitStatusJSONImpl.createRateLimitStatuses(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | java | public static Map<String, RateLimitStatus> createRateLimitStatus(String rawJSON) throws TwitterException {
try {
return RateLimitStatusJSONImpl.createRateLimitStatuses(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"RateLimitStatus",
">",
"createRateLimitStatus",
"(",
"String",
"rawJSON",
")",
"throws",
"TwitterException",
"{",
"try",
"{",
"return",
"RateLimitStatusJSONImpl",
".",
"createRateLimitStatuses",
"(",
"new",
"JSONObject",... | Constructs a RateLimitStatus object from rawJSON string.
@param rawJSON raw JSON form as String
@return RateLimitStatus
@throws TwitterException when provided string is not a valid JSON string.
@since Twitter4J 2.1.7 | [
"Constructs",
"a",
"RateLimitStatus",
"object",
"from",
"rawJSON",
"string",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L189-L195 |
47,789 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java | TwitterObjectFactory.createCategory | public static Category createCategory(String rawJSON) throws TwitterException {
try {
return new CategoryJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | java | public static Category createCategory(String rawJSON) throws TwitterException {
try {
return new CategoryJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | [
"public",
"static",
"Category",
"createCategory",
"(",
"String",
"rawJSON",
")",
"throws",
"TwitterException",
"{",
"try",
"{",
"return",
"new",
"CategoryJSONImpl",
"(",
"new",
"JSONObject",
"(",
"rawJSON",
")",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e... | Constructs a Category object from rawJSON string.
@param rawJSON raw JSON form as String
@return Category
@throws TwitterException when provided string is not a valid JSON string.
@since Twitter4J 2.1.7 | [
"Constructs",
"a",
"Category",
"object",
"from",
"rawJSON",
"string",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L205-L211 |
47,790 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java | TwitterObjectFactory.createDirectMessage | public static DirectMessage createDirectMessage(String rawJSON) throws TwitterException {
try {
return new DirectMessageJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | java | public static DirectMessage createDirectMessage(String rawJSON) throws TwitterException {
try {
return new DirectMessageJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | [
"public",
"static",
"DirectMessage",
"createDirectMessage",
"(",
"String",
"rawJSON",
")",
"throws",
"TwitterException",
"{",
"try",
"{",
"return",
"new",
"DirectMessageJSONImpl",
"(",
"new",
"JSONObject",
"(",
"rawJSON",
")",
")",
";",
"}",
"catch",
"(",
"JSONE... | Constructs a DirectMessage object from rawJSON string.
@param rawJSON raw JSON form as String
@return DirectMessage
@throws TwitterException when provided string is not a valid JSON string.
@since Twitter4J 2.1.7 | [
"Constructs",
"a",
"DirectMessage",
"object",
"from",
"rawJSON",
"string",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L221-L227 |
47,791 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java | TwitterObjectFactory.createLocation | public static Location createLocation(String rawJSON) throws TwitterException {
try {
return new LocationJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | java | public static Location createLocation(String rawJSON) throws TwitterException {
try {
return new LocationJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | [
"public",
"static",
"Location",
"createLocation",
"(",
"String",
"rawJSON",
")",
"throws",
"TwitterException",
"{",
"try",
"{",
"return",
"new",
"LocationJSONImpl",
"(",
"new",
"JSONObject",
"(",
"rawJSON",
")",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e... | Constructs a Location object from rawJSON string.
@param rawJSON raw JSON form as String
@return Location
@throws TwitterException when provided string is not a valid JSON string.
@since Twitter4J 2.1.7 | [
"Constructs",
"a",
"Location",
"object",
"from",
"rawJSON",
"string",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L237-L243 |
47,792 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java | TwitterObjectFactory.createUserList | public static UserList createUserList(String rawJSON) throws TwitterException {
try {
return new UserListJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | java | public static UserList createUserList(String rawJSON) throws TwitterException {
try {
return new UserListJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | [
"public",
"static",
"UserList",
"createUserList",
"(",
"String",
"rawJSON",
")",
"throws",
"TwitterException",
"{",
"try",
"{",
"return",
"new",
"UserListJSONImpl",
"(",
"new",
"JSONObject",
"(",
"rawJSON",
")",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e... | Constructs a UserList object from rawJSON string.
@param rawJSON raw JSON form as String
@return UserList
@throws TwitterException when provided string is not a valid JSON string.
@since Twitter4J 2.1.7 | [
"Constructs",
"a",
"UserList",
"object",
"from",
"rawJSON",
"string",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L253-L259 |
47,793 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java | TwitterObjectFactory.createOEmbed | public static OEmbed createOEmbed(String rawJSON) throws TwitterException {
try {
return new OEmbedJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | java | public static OEmbed createOEmbed(String rawJSON) throws TwitterException {
try {
return new OEmbedJSONImpl(new JSONObject(rawJSON));
} catch (JSONException e) {
throw new TwitterException(e);
}
} | [
"public",
"static",
"OEmbed",
"createOEmbed",
"(",
"String",
"rawJSON",
")",
"throws",
"TwitterException",
"{",
"try",
"{",
"return",
"new",
"OEmbedJSONImpl",
"(",
"new",
"JSONObject",
"(",
"rawJSON",
")",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
"... | Constructs an OEmbed object from rawJSON string.
@param rawJSON raw JSON form as String
@return OEmbed
@throws TwitterException when provided string is not a valid JSON string.
@since Twitter4J 3.0.2 | [
"Constructs",
"an",
"OEmbed",
"object",
"from",
"rawJSON",
"string",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterObjectFactory.java#L269-L275 |
47,794 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/conf/ConfigurationBase.java | ConfigurationBase.setHttpProxyHost | protected final void setHttpProxyHost(String proxyHost) {
httpConf = new MyHttpClientConfiguration(proxyHost
, httpConf.getHttpProxyUser()
, httpConf.getHttpProxyPassword()
, httpConf.getHttpProxyPort()
, httpConf.isHttpProxySocks()
... | java | protected final void setHttpProxyHost(String proxyHost) {
httpConf = new MyHttpClientConfiguration(proxyHost
, httpConf.getHttpProxyUser()
, httpConf.getHttpProxyPassword()
, httpConf.getHttpProxyPort()
, httpConf.isHttpProxySocks()
... | [
"protected",
"final",
"void",
"setHttpProxyHost",
"(",
"String",
"proxyHost",
")",
"{",
"httpConf",
"=",
"new",
"MyHttpClientConfiguration",
"(",
"proxyHost",
",",
"httpConf",
".",
"getHttpProxyUser",
"(",
")",
",",
"httpConf",
".",
"getHttpProxyPassword",
"(",
")... | methods for HttpClientConfiguration | [
"methods",
"for",
"HttpClientConfiguration"
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/conf/ConfigurationBase.java#L320-L330 |
47,795 | Twitter4J/Twitter4J | twitter4j-core/src/internal-async/java/twitter4j/DispatcherFactory.java | DispatcherFactory.getInstance | public Dispatcher getInstance() {
try {
return (Dispatcher) Class.forName(dispatcherImpl)
.getConstructor(Configuration.class).newInstance(conf);
} catch (InstantiationException e) {
throw new AssertionError(e);
} catch (IllegalAccessException e) {
... | java | public Dispatcher getInstance() {
try {
return (Dispatcher) Class.forName(dispatcherImpl)
.getConstructor(Configuration.class).newInstance(conf);
} catch (InstantiationException e) {
throw new AssertionError(e);
} catch (IllegalAccessException e) {
... | [
"public",
"Dispatcher",
"getInstance",
"(",
")",
"{",
"try",
"{",
"return",
"(",
"Dispatcher",
")",
"Class",
".",
"forName",
"(",
"dispatcherImpl",
")",
".",
"getConstructor",
"(",
"Configuration",
".",
"class",
")",
".",
"newInstance",
"(",
"conf",
")",
"... | returns a Dispatcher instance.
@return dispatcher instance | [
"returns",
"a",
"Dispatcher",
"instance",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/internal-async/java/twitter4j/DispatcherFactory.java#L46-L63 |
47,796 | Twitter4J/Twitter4J | twitter4j-core/src/internal-json/java/twitter4j/JSON.java | JSON.checkDouble | static double checkDouble(double d) throws JSONException {
if (Double.isInfinite(d) || Double.isNaN(d)) {
throw new JSONException("Forbidden numeric value: " + d);
}
return d;
} | java | static double checkDouble(double d) throws JSONException {
if (Double.isInfinite(d) || Double.isNaN(d)) {
throw new JSONException("Forbidden numeric value: " + d);
}
return d;
} | [
"static",
"double",
"checkDouble",
"(",
"double",
"d",
")",
"throws",
"JSONException",
"{",
"if",
"(",
"Double",
".",
"isInfinite",
"(",
"d",
")",
"||",
"Double",
".",
"isNaN",
"(",
"d",
")",
")",
"{",
"throw",
"new",
"JSONException",
"(",
"\"Forbidden n... | Returns the input if it is a JSON-permissible value; throws otherwise. | [
"Returns",
"the",
"input",
"if",
"it",
"is",
"a",
"JSON",
"-",
"permissible",
"value",
";",
"throws",
"otherwise",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/internal-json/java/twitter4j/JSON.java#L22-L27 |
47,797 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/conf/PropertyConfigurationFactory.java | PropertyConfigurationFactory.getInstance | @Override
public Configuration getInstance(String configTreePath) {
PropertyConfiguration conf = new PropertyConfiguration(configTreePath);
conf.dumpConfiguration();
return conf;
} | java | @Override
public Configuration getInstance(String configTreePath) {
PropertyConfiguration conf = new PropertyConfiguration(configTreePath);
conf.dumpConfiguration();
return conf;
} | [
"@",
"Override",
"public",
"Configuration",
"getInstance",
"(",
"String",
"configTreePath",
")",
"{",
"PropertyConfiguration",
"conf",
"=",
"new",
"PropertyConfiguration",
"(",
"configTreePath",
")",
";",
"conf",
".",
"dumpConfiguration",
"(",
")",
";",
"return",
... | It may be preferable to cache the config instance | [
"It",
"may",
"be",
"preferable",
"to",
"cache",
"the",
"config",
"instance"
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/conf/PropertyConfigurationFactory.java#L41-L46 |
47,798 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterImpl.java | TwitterImpl.uploadMediaChunkedFinalize | private UploadedMedia uploadMediaChunkedFinalize(long mediaId) throws TwitterException {
int tries = 0;
int maxTries = 20;
int lastProgressPercent = 0;
int currentProgressPercent = 0;
UploadedMedia uploadedMedia = uploadMediaChunkedFinalize0(mediaId);
while (tries < maxTries) {
if(lastProgressPercent == ... | java | private UploadedMedia uploadMediaChunkedFinalize(long mediaId) throws TwitterException {
int tries = 0;
int maxTries = 20;
int lastProgressPercent = 0;
int currentProgressPercent = 0;
UploadedMedia uploadedMedia = uploadMediaChunkedFinalize0(mediaId);
while (tries < maxTries) {
if(lastProgressPercent == ... | [
"private",
"UploadedMedia",
"uploadMediaChunkedFinalize",
"(",
"long",
"mediaId",
")",
"throws",
"TwitterException",
"{",
"int",
"tries",
"=",
"0",
";",
"int",
"maxTries",
"=",
"20",
";",
"int",
"lastProgressPercent",
"=",
"0",
";",
"int",
"currentProgressPercent"... | "command=FINALIZE&media_id=601413451156586496" | [
"command",
"=",
"FINALIZE&media_id",
"=",
"601413451156586496"
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterImpl.java#L346-L377 |
47,799 | Twitter4J/Twitter4J | twitter4j-core/src/main/java/twitter4j/TwitterImpl.java | TwitterImpl.checkFileValidity | private void checkFileValidity(File image) throws TwitterException {
if (!image.exists()) {
//noinspection ThrowableInstanceNeverThrown
throw new TwitterException(new FileNotFoundException(image + " is not found."));
}
if (!image.isFile()) {
//noinspection Thr... | java | private void checkFileValidity(File image) throws TwitterException {
if (!image.exists()) {
//noinspection ThrowableInstanceNeverThrown
throw new TwitterException(new FileNotFoundException(image + " is not found."));
}
if (!image.isFile()) {
//noinspection Thr... | [
"private",
"void",
"checkFileValidity",
"(",
"File",
"image",
")",
"throws",
"TwitterException",
"{",
"if",
"(",
"!",
"image",
".",
"exists",
"(",
")",
")",
"{",
"//noinspection ThrowableInstanceNeverThrown",
"throw",
"new",
"TwitterException",
"(",
"new",
"FileNo... | Check the existence, and the type of the specified file.
@param image image to be uploaded
@throws TwitterException when the specified file is not found (FileNotFoundException will be nested)
, or when the specified file object is not representing a file(IOException will be nested). | [
"Check",
"the",
"existence",
"and",
"the",
"type",
"of",
"the",
"specified",
"file",
"."
] | 8376fade8d557896bb9319fb46e39a55b134b166 | https://github.com/Twitter4J/Twitter4J/blob/8376fade8d557896bb9319fb46e39a55b134b166/twitter4j-core/src/main/java/twitter4j/TwitterImpl.java#L887-L896 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.