id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
147,800
|
netceteragroup/trema-core
|
src/main/java/com/netcetera/trema/core/XMLDatabase.java
|
XMLDatabase.fireTextNodesRemoved
|
protected void fireTextNodesRemoved(ITextNode[] textNodes, int index) {
for (IDatabaseListener iDatabaseListener : listeners) {
iDatabaseListener.textNodesRemoved(this, textNodes, index);
}
}
|
java
|
protected void fireTextNodesRemoved(ITextNode[] textNodes, int index) {
for (IDatabaseListener iDatabaseListener : listeners) {
iDatabaseListener.textNodesRemoved(this, textNodes, index);
}
}
|
[
"protected",
"void",
"fireTextNodesRemoved",
"(",
"ITextNode",
"[",
"]",
"textNodes",
",",
"int",
"index",
")",
"{",
"for",
"(",
"IDatabaseListener",
"iDatabaseListener",
":",
"listeners",
")",
"{",
"iDatabaseListener",
".",
"textNodesRemoved",
"(",
"this",
",",
"textNodes",
",",
"index",
")",
";",
"}",
"}"
] |
Notifies the registered listeners that some text nodes have been
removed.
@param textNodes the text nodes that have been removed
@param index the position of the topmost text node that has been
removed
|
[
"Notifies",
"the",
"registered",
"listeners",
"that",
"some",
"text",
"nodes",
"have",
"been",
"removed",
"."
] |
e5367f4b80b38038d462627aa146a62bc34fc489
|
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/XMLDatabase.java#L572-L576
|
147,801
|
netceteragroup/trema-core
|
src/main/java/com/netcetera/trema/core/XMLDatabase.java
|
XMLDatabase.fireValueNodeAdded
|
@Override
public void fireValueNodeAdded(IValueNode valueNode) {
for (IDatabaseListener iDatabaseListener : listeners) {
iDatabaseListener.valueNodeAdded(valueNode);
}
}
|
java
|
@Override
public void fireValueNodeAdded(IValueNode valueNode) {
for (IDatabaseListener iDatabaseListener : listeners) {
iDatabaseListener.valueNodeAdded(valueNode);
}
}
|
[
"@",
"Override",
"public",
"void",
"fireValueNodeAdded",
"(",
"IValueNode",
"valueNode",
")",
"{",
"for",
"(",
"IDatabaseListener",
"iDatabaseListener",
":",
"listeners",
")",
"{",
"iDatabaseListener",
".",
"valueNodeAdded",
"(",
"valueNode",
")",
";",
"}",
"}"
] |
Notifies the registered listeners of an addition of a value node.
to
@param valueNode the value node that has been added
|
[
"Notifies",
"the",
"registered",
"listeners",
"of",
"an",
"addition",
"of",
"a",
"value",
"node",
".",
"to"
] |
e5367f4b80b38038d462627aa146a62bc34fc489
|
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/XMLDatabase.java#L606-L611
|
147,802
|
netceteragroup/trema-core
|
src/main/java/com/netcetera/trema/core/XMLDatabase.java
|
XMLDatabase.fireValueNodeRemoved
|
@Override
public void fireValueNodeRemoved(IValueNode valueNode) {
for (IDatabaseListener iDatabaseListener : listeners) {
iDatabaseListener.valueNodeRemoved(valueNode);
}
}
|
java
|
@Override
public void fireValueNodeRemoved(IValueNode valueNode) {
for (IDatabaseListener iDatabaseListener : listeners) {
iDatabaseListener.valueNodeRemoved(valueNode);
}
}
|
[
"@",
"Override",
"public",
"void",
"fireValueNodeRemoved",
"(",
"IValueNode",
"valueNode",
")",
"{",
"for",
"(",
"IDatabaseListener",
"iDatabaseListener",
":",
"listeners",
")",
"{",
"iDatabaseListener",
".",
"valueNodeRemoved",
"(",
"valueNode",
")",
";",
"}",
"}"
] |
Notifies the registered listeners of a removal of a value node.
removed from
@param valueNode the value node that has been removed
|
[
"Notifies",
"the",
"registered",
"listeners",
"of",
"a",
"removal",
"of",
"a",
"value",
"node",
".",
"removed",
"from"
] |
e5367f4b80b38038d462627aa146a62bc34fc489
|
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/XMLDatabase.java#L618-L623
|
147,803
|
awltech/org.parallelj
|
parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/launching/transport/tcp/TcpIpServer.java
|
TcpIpServer.start
|
public final synchronized void start() throws IOException {
if (this.acceptor != null) {
if (this.acceptor.getHandler() == null) {
this.acceptor.setHandler(new TcpIpHandlerAdapter());
}
LaunchingMessageKind.ITCPIP0001.format(this.host, this.port);
this.acceptor.bind(new InetSocketAddress(this.host, this.port));
}
}
|
java
|
public final synchronized void start() throws IOException {
if (this.acceptor != null) {
if (this.acceptor.getHandler() == null) {
this.acceptor.setHandler(new TcpIpHandlerAdapter());
}
LaunchingMessageKind.ITCPIP0001.format(this.host, this.port);
this.acceptor.bind(new InetSocketAddress(this.host, this.port));
}
}
|
[
"public",
"final",
"synchronized",
"void",
"start",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"acceptor",
"!=",
"null",
")",
"{",
"if",
"(",
"this",
".",
"acceptor",
".",
"getHandler",
"(",
")",
"==",
"null",
")",
"{",
"this",
".",
"acceptor",
".",
"setHandler",
"(",
"new",
"TcpIpHandlerAdapter",
"(",
")",
")",
";",
"}",
"LaunchingMessageKind",
".",
"ITCPIP0001",
".",
"format",
"(",
"this",
".",
"host",
",",
"this",
".",
"port",
")",
";",
"this",
".",
"acceptor",
".",
"bind",
"(",
"new",
"InetSocketAddress",
"(",
"this",
".",
"host",
",",
"this",
".",
"port",
")",
")",
";",
"}",
"}"
] |
Start the TcpIpServer
@throws IOException
|
[
"Start",
"the",
"TcpIpServer"
] |
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
|
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/launching/transport/tcp/TcpIpServer.java#L89-L98
|
147,804
|
kmi/iserve
|
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/DocumentManagerFileSystem.java
|
DocumentManagerFileSystem.clearDocuments
|
@Override
public boolean clearDocuments() throws DocumentException {
File internalFolder = new File(this.getDocumentsInternalPath());
File[] files = internalFolder.listFiles();
for (File file : files) {
if (file.isDirectory()) {
try {
FileUtils.deleteDirectory(file);
} catch (IOException e) {
e.printStackTrace();
throw new DocumentException("Unable to delete " + file.getAbsolutePath());
}
log.info("Folder deleted: {}", file.getAbsolutePath());
} else {
boolean deleted = file.delete();
if (deleted) {
log.info("File deleted: {}", file.getAbsolutePath());
} else {
log.warn("Unable to delete file: {}", file.getAbsolutePath());
}
}
}
// Clear media types index
File mapFile = new File(URI.create(new StringBuilder(documentsInternalPath.toString()).append("/" + MEDIA_TYPE_INDEX).toString()));
if (mapFile.exists()) {
mapFile.delete();
}
fileMediatypeMap.clear();
// Generate Event
this.getEventBus().post(new DocumentsClearedEvent(new Date()));
return true;
}
|
java
|
@Override
public boolean clearDocuments() throws DocumentException {
File internalFolder = new File(this.getDocumentsInternalPath());
File[] files = internalFolder.listFiles();
for (File file : files) {
if (file.isDirectory()) {
try {
FileUtils.deleteDirectory(file);
} catch (IOException e) {
e.printStackTrace();
throw new DocumentException("Unable to delete " + file.getAbsolutePath());
}
log.info("Folder deleted: {}", file.getAbsolutePath());
} else {
boolean deleted = file.delete();
if (deleted) {
log.info("File deleted: {}", file.getAbsolutePath());
} else {
log.warn("Unable to delete file: {}", file.getAbsolutePath());
}
}
}
// Clear media types index
File mapFile = new File(URI.create(new StringBuilder(documentsInternalPath.toString()).append("/" + MEDIA_TYPE_INDEX).toString()));
if (mapFile.exists()) {
mapFile.delete();
}
fileMediatypeMap.clear();
// Generate Event
this.getEventBus().post(new DocumentsClearedEvent(new Date()));
return true;
}
|
[
"@",
"Override",
"public",
"boolean",
"clearDocuments",
"(",
")",
"throws",
"DocumentException",
"{",
"File",
"internalFolder",
"=",
"new",
"File",
"(",
"this",
".",
"getDocumentsInternalPath",
"(",
")",
")",
";",
"File",
"[",
"]",
"files",
"=",
"internalFolder",
".",
"listFiles",
"(",
")",
";",
"for",
"(",
"File",
"file",
":",
"files",
")",
"{",
"if",
"(",
"file",
".",
"isDirectory",
"(",
")",
")",
"{",
"try",
"{",
"FileUtils",
".",
"deleteDirectory",
"(",
"file",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"new",
"DocumentException",
"(",
"\"Unable to delete \"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"log",
".",
"info",
"(",
"\"Folder deleted: {}\"",
",",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"else",
"{",
"boolean",
"deleted",
"=",
"file",
".",
"delete",
"(",
")",
";",
"if",
"(",
"deleted",
")",
"{",
"log",
".",
"info",
"(",
"\"File deleted: {}\"",
",",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"else",
"{",
"log",
".",
"warn",
"(",
"\"Unable to delete file: {}\"",
",",
"file",
".",
"getAbsolutePath",
"(",
")",
")",
";",
"}",
"}",
"}",
"// Clear media types index",
"File",
"mapFile",
"=",
"new",
"File",
"(",
"URI",
".",
"create",
"(",
"new",
"StringBuilder",
"(",
"documentsInternalPath",
".",
"toString",
"(",
")",
")",
".",
"append",
"(",
"\"/\"",
"+",
"MEDIA_TYPE_INDEX",
")",
".",
"toString",
"(",
")",
")",
")",
";",
"if",
"(",
"mapFile",
".",
"exists",
"(",
")",
")",
"{",
"mapFile",
".",
"delete",
"(",
")",
";",
"}",
"fileMediatypeMap",
".",
"clear",
"(",
")",
";",
"// Generate Event",
"this",
".",
"getEventBus",
"(",
")",
".",
"post",
"(",
"new",
"DocumentsClearedEvent",
"(",
"new",
"Date",
"(",
")",
")",
")",
";",
"return",
"true",
";",
"}"
] |
Deletes all the documents in iServe
@return
@throws uk.ac.open.kmi.iserve.sal.exception.DocumentException
|
[
"Deletes",
"all",
"the",
"documents",
"in",
"iServe"
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/DocumentManagerFileSystem.java#L434-L469
|
147,805
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/matchers/structure/tree/spsm/SPSMTreeMatcher.java
|
SPSMTreeMatcher.getFNSignatureFromIContext
|
private String getFNSignatureFromIContext(INode node) {
String ret = node.getNodeData().getName();
List<INode> children = node.getChildrenList();
if (children != null && children.size() > 0) {
ret += "(";
for (INode aChildren : children) {
ret += getFNSignatureFromIContext(aChildren) + ",";
}
ret = ret.substring(0, ret.length() - 1);
ret += ")";
}
return ret;
}
|
java
|
private String getFNSignatureFromIContext(INode node) {
String ret = node.getNodeData().getName();
List<INode> children = node.getChildrenList();
if (children != null && children.size() > 0) {
ret += "(";
for (INode aChildren : children) {
ret += getFNSignatureFromIContext(aChildren) + ",";
}
ret = ret.substring(0, ret.length() - 1);
ret += ")";
}
return ret;
}
|
[
"private",
"String",
"getFNSignatureFromIContext",
"(",
"INode",
"node",
")",
"{",
"String",
"ret",
"=",
"node",
".",
"getNodeData",
"(",
")",
".",
"getName",
"(",
")",
";",
"List",
"<",
"INode",
">",
"children",
"=",
"node",
".",
"getChildrenList",
"(",
")",
";",
"if",
"(",
"children",
"!=",
"null",
"&&",
"children",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"ret",
"+=",
"\"(\"",
";",
"for",
"(",
"INode",
"aChildren",
":",
"children",
")",
"{",
"ret",
"+=",
"getFNSignatureFromIContext",
"(",
"aChildren",
")",
"+",
"\",\"",
";",
"}",
"ret",
"=",
"ret",
".",
"substring",
"(",
"0",
",",
"ret",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"ret",
"+=",
"\")\"",
";",
"}",
"return",
"ret",
";",
"}"
] |
Creates a function-like tree from the given root node
@param node the root node
@return the string representation for the given tree in function-like representation
|
[
"Creates",
"a",
"function",
"-",
"like",
"tree",
"from",
"the",
"given",
"root",
"node"
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/structure/tree/spsm/SPSMTreeMatcher.java#L93-L108
|
147,806
|
awltech/org.parallelj
|
parallelj-legacy-launching-parent/parallelj-legacy-launching-api/src/main/java/org/parallelj/launching/quartz/Launcher.java
|
Launcher.newLaunch
|
public synchronized Launch newLaunch(final Class<?> jobClass, ExecutorService executorService) throws LaunchException {
return new Launch(jobClass, executorService);
}
|
java
|
public synchronized Launch newLaunch(final Class<?> jobClass, ExecutorService executorService) throws LaunchException {
return new Launch(jobClass, executorService);
}
|
[
"public",
"synchronized",
"Launch",
"newLaunch",
"(",
"final",
"Class",
"<",
"?",
">",
"jobClass",
",",
"ExecutorService",
"executorService",
")",
"throws",
"LaunchException",
"{",
"return",
"new",
"Launch",
"(",
"jobClass",
",",
"executorService",
")",
";",
"}"
] |
Create a new instance of Launch.
@param jobClass The Program Adapter class.
@param executorService The ExecutorService instance to use.
@return An instance of Launch.
@throws LaunchException
|
[
"Create",
"a",
"new",
"instance",
"of",
"Launch",
"."
] |
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
|
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-legacy-launching-parent/parallelj-legacy-launching-api/src/main/java/org/parallelj/launching/quartz/Launcher.java#L82-L84
|
147,807
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/util/converter/ConverterRegistry.java
|
ConverterRegistry.addConverter
|
@Override
public void addConverter(Class<?> from, Class<?> to, Converter converter) {
Map toMap = fromMap.get(from);
if (toMap == null) {
toMap = new HashMap<Class<?>, Map<Class<?>, Converter>>();
fromMap.put(from, toMap);
}
toMap.put(to, converter);
}
|
java
|
@Override
public void addConverter(Class<?> from, Class<?> to, Converter converter) {
Map toMap = fromMap.get(from);
if (toMap == null) {
toMap = new HashMap<Class<?>, Map<Class<?>, Converter>>();
fromMap.put(from, toMap);
}
toMap.put(to, converter);
}
|
[
"@",
"Override",
"public",
"void",
"addConverter",
"(",
"Class",
"<",
"?",
">",
"from",
",",
"Class",
"<",
"?",
">",
"to",
",",
"Converter",
"converter",
")",
"{",
"Map",
"toMap",
"=",
"fromMap",
".",
"get",
"(",
"from",
")",
";",
"if",
"(",
"toMap",
"==",
"null",
")",
"{",
"toMap",
"=",
"new",
"HashMap",
"<",
"Class",
"<",
"?",
">",
",",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"Converter",
">",
">",
"(",
")",
";",
"fromMap",
".",
"put",
"(",
"from",
",",
"toMap",
")",
";",
"}",
"toMap",
".",
"put",
"(",
"to",
",",
"converter",
")",
";",
"}"
] |
Converter calls this method to register conversion path.
@param from
@param to
@param converter
|
[
"Converter",
"calls",
"this",
"method",
"to",
"register",
"conversion",
"path",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/util/converter/ConverterRegistry.java#L52-L60
|
147,808
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/util/converter/ConverterRegistry.java
|
ConverterRegistry.getConverter
|
@Override
public Converter getConverter(Class<?> from, Class<?> to) {
Map<Class<?>, Converter> toMap = fromMap.get(from);
if (toMap != null) {
return toMap.get(to);
} else {
return null;
}
}
|
java
|
@Override
public Converter getConverter(Class<?> from, Class<?> to) {
Map<Class<?>, Converter> toMap = fromMap.get(from);
if (toMap != null) {
return toMap.get(to);
} else {
return null;
}
}
|
[
"@",
"Override",
"public",
"Converter",
"getConverter",
"(",
"Class",
"<",
"?",
">",
"from",
",",
"Class",
"<",
"?",
">",
"to",
")",
"{",
"Map",
"<",
"Class",
"<",
"?",
">",
",",
"Converter",
">",
"toMap",
"=",
"fromMap",
".",
"get",
"(",
"from",
")",
";",
"if",
"(",
"toMap",
"!=",
"null",
")",
"{",
"return",
"toMap",
".",
"get",
"(",
"to",
")",
";",
"}",
"else",
"{",
"return",
"null",
";",
"}",
"}"
] |
Get the desired converter.
@param from
@param to
@return
|
[
"Get",
"the",
"desired",
"converter",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/util/converter/ConverterRegistry.java#L69-L77
|
147,809
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/util/converter/ConverterRegistry.java
|
ConverterRegistry.convert
|
public Object convert(Class<?> targetType, Object value) {
if (value == null) {
return null;
}
Converter converter = getConverter(value.getClass(), targetType);
if (converter == null) {
throw new IllegalArgumentException(
"No converter from " + value.getClass() + " to " + targetType.getName());
} else {
return converter.convert(targetType, value);
}
}
|
java
|
public Object convert(Class<?> targetType, Object value) {
if (value == null) {
return null;
}
Converter converter = getConverter(value.getClass(), targetType);
if (converter == null) {
throw new IllegalArgumentException(
"No converter from " + value.getClass() + " to " + targetType.getName());
} else {
return converter.convert(targetType, value);
}
}
|
[
"public",
"Object",
"convert",
"(",
"Class",
"<",
"?",
">",
"targetType",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Converter",
"converter",
"=",
"getConverter",
"(",
"value",
".",
"getClass",
"(",
")",
",",
"targetType",
")",
";",
"if",
"(",
"converter",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"No converter from \"",
"+",
"value",
".",
"getClass",
"(",
")",
"+",
"\" to \"",
"+",
"targetType",
".",
"getName",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"converter",
".",
"convert",
"(",
"targetType",
",",
"value",
")",
";",
"}",
"}"
] |
Do Conversion.
@param targetType
@param value
@return
|
[
"Do",
"Conversion",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/util/converter/ConverterRegistry.java#L86-L98
|
147,810
|
kmi/iserve
|
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/CrawlCallable.java
|
CrawlCallable.call
|
@Override
public Boolean call() {
// If the model has not been uploaded fetch it and upload the graph
if (!this.graphStoreManager.containsGraph(this.modelUri)) {
Model model = fetchModel(this.modelUri, this.syntax);
if (model == null || model.isEmpty()) {
return Boolean.FALSE;
}
this.graphStoreManager.putGraph(this.modelUri, model);
}
return Boolean.TRUE;
}
|
java
|
@Override
public Boolean call() {
// If the model has not been uploaded fetch it and upload the graph
if (!this.graphStoreManager.containsGraph(this.modelUri)) {
Model model = fetchModel(this.modelUri, this.syntax);
if (model == null || model.isEmpty()) {
return Boolean.FALSE;
}
this.graphStoreManager.putGraph(this.modelUri, model);
}
return Boolean.TRUE;
}
|
[
"@",
"Override",
"public",
"Boolean",
"call",
"(",
")",
"{",
"// If the model has not been uploaded fetch it and upload the graph",
"if",
"(",
"!",
"this",
".",
"graphStoreManager",
".",
"containsGraph",
"(",
"this",
".",
"modelUri",
")",
")",
"{",
"Model",
"model",
"=",
"fetchModel",
"(",
"this",
".",
"modelUri",
",",
"this",
".",
"syntax",
")",
";",
"if",
"(",
"model",
"==",
"null",
"||",
"model",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Boolean",
".",
"FALSE",
";",
"}",
"this",
".",
"graphStoreManager",
".",
"putGraph",
"(",
"this",
".",
"modelUri",
",",
"model",
")",
";",
"}",
"return",
"Boolean",
".",
"TRUE",
";",
"}"
] |
Given the model uri, this method takes care of retrieving the remote model and any imported documents
and uploads them all to the graph store within the same graph. This implementation relies on Jena's embedded
support for retrieving ontologies and their imports.
ATTENTION: When deleting models (in cases where several models import a common model) we may remove the
first ontology uploaded, with it the imported model will also be deleted and as a result any other model
that imported the common one will not have it available any more.
TODO: To be fixed
@return True if the model was fetched or is already uploaded. False if it could not be obtained
|
[
"Given",
"the",
"model",
"uri",
"this",
"method",
"takes",
"care",
"of",
"retrieving",
"the",
"remote",
"model",
"and",
"any",
"imported",
"documents",
"and",
"uploads",
"them",
"all",
"to",
"the",
"graph",
"store",
"within",
"the",
"same",
"graph",
".",
"This",
"implementation",
"relies",
"on",
"Jena",
"s",
"embedded",
"support",
"for",
"retrieving",
"ontologies",
"and",
"their",
"imports",
"."
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/CrawlCallable.java#L70-L83
|
147,811
|
wkgcass/Style
|
src/main/java/net/cassite/style/reflect/MethodSupport.java
|
MethodSupport.annotation
|
public <A extends Annotation> A annotation(Class<A> annoCls) {
return method.getAnnotation(annoCls);
}
|
java
|
public <A extends Annotation> A annotation(Class<A> annoCls) {
return method.getAnnotation(annoCls);
}
|
[
"public",
"<",
"A",
"extends",
"Annotation",
">",
"A",
"annotation",
"(",
"Class",
"<",
"A",
">",
"annoCls",
")",
"{",
"return",
"method",
".",
"getAnnotation",
"(",
"annoCls",
")",
";",
"}"
] |
Returns this element's annotation for the specified type if such an
annotation is present, else null.
@param annoCls the Class object corresponding to the annotation type
@return this element's annotation for the specified annotation type
if present on this element, else null
|
[
"Returns",
"this",
"element",
"s",
"annotation",
"for",
"the",
"specified",
"type",
"if",
"such",
"an",
"annotation",
"is",
"present",
"else",
"null",
"."
] |
db3ea64337251f46f734279480e365293bececbd
|
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/reflect/MethodSupport.java#L41-L43
|
147,812
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/GeneratedMessage.java
|
GeneratedMessage.getAllFieldsMutable
|
private Map<FieldDescriptor, Object> getAllFieldsMutable() {
final TreeMap<FieldDescriptor, Object> result =
new TreeMap<FieldDescriptor, Object>();
final Descriptor descriptor = internalGetFieldAccessorTable().descriptor;
for (final FieldDescriptor field : descriptor.getFields()) {
if (field.isRepeated()) {
final List<?> value = (List<?>) getField(field);
if (!value.isEmpty()) {
result.put(field, value);
}
} else {
if (hasField(field)) {
result.put(field, getField(field));
}
}
}
return result;
}
|
java
|
private Map<FieldDescriptor, Object> getAllFieldsMutable() {
final TreeMap<FieldDescriptor, Object> result =
new TreeMap<FieldDescriptor, Object>();
final Descriptor descriptor = internalGetFieldAccessorTable().descriptor;
for (final FieldDescriptor field : descriptor.getFields()) {
if (field.isRepeated()) {
final List<?> value = (List<?>) getField(field);
if (!value.isEmpty()) {
result.put(field, value);
}
} else {
if (hasField(field)) {
result.put(field, getField(field));
}
}
}
return result;
}
|
[
"private",
"Map",
"<",
"FieldDescriptor",
",",
"Object",
">",
"getAllFieldsMutable",
"(",
")",
"{",
"final",
"TreeMap",
"<",
"FieldDescriptor",
",",
"Object",
">",
"result",
"=",
"new",
"TreeMap",
"<",
"FieldDescriptor",
",",
"Object",
">",
"(",
")",
";",
"final",
"Descriptor",
"descriptor",
"=",
"internalGetFieldAccessorTable",
"(",
")",
".",
"descriptor",
";",
"for",
"(",
"final",
"FieldDescriptor",
"field",
":",
"descriptor",
".",
"getFields",
"(",
")",
")",
"{",
"if",
"(",
"field",
".",
"isRepeated",
"(",
")",
")",
"{",
"final",
"List",
"<",
"?",
">",
"value",
"=",
"(",
"List",
"<",
"?",
">",
")",
"getField",
"(",
"field",
")",
";",
"if",
"(",
"!",
"value",
".",
"isEmpty",
"(",
")",
")",
"{",
"result",
".",
"put",
"(",
"field",
",",
"value",
")",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"hasField",
"(",
"field",
")",
")",
"{",
"result",
".",
"put",
"(",
"field",
",",
"getField",
"(",
"field",
")",
")",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] |
Internal helper which returns a mutable map.
|
[
"Internal",
"helper",
"which",
"returns",
"a",
"mutable",
"map",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/GeneratedMessage.java#L102-L119
|
147,813
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/GeneratedMessage.java
|
GeneratedMessage.getMethodOrDie
|
@SuppressWarnings("unchecked")
private static Method getMethodOrDie(
final Class clazz, final String name, final Class... params) {
try {
return clazz.getMethod(name, params);
} catch (NoSuchMethodException e) {
throw new RuntimeException(
"Generated message class \"" + clazz.getName() +
"\" missing method \"" + name + "\".", e);
}
}
|
java
|
@SuppressWarnings("unchecked")
private static Method getMethodOrDie(
final Class clazz, final String name, final Class... params) {
try {
return clazz.getMethod(name, params);
} catch (NoSuchMethodException e) {
throw new RuntimeException(
"Generated message class \"" + clazz.getName() +
"\" missing method \"" + name + "\".", e);
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"Method",
"getMethodOrDie",
"(",
"final",
"Class",
"clazz",
",",
"final",
"String",
"name",
",",
"final",
"Class",
"...",
"params",
")",
"{",
"try",
"{",
"return",
"clazz",
".",
"getMethod",
"(",
"name",
",",
"params",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Generated message class \\\"\"",
"+",
"clazz",
".",
"getName",
"(",
")",
"+",
"\"\\\" missing method \\\"\"",
"+",
"name",
"+",
"\"\\\".\"",
",",
"e",
")",
";",
"}",
"}"
] |
Calls Class.getMethod and throws a RuntimeException if it fails.
|
[
"Calls",
"Class",
".",
"getMethod",
"and",
"throws",
"a",
"RuntimeException",
"if",
"it",
"fails",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/GeneratedMessage.java#L1411-L1421
|
147,814
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/GeneratedMessage.java
|
GeneratedMessage.invokeOrDie
|
private static Object invokeOrDie(
final Method method, final Object object, final Object... params) {
try {
return method.invoke(object, params);
} catch (IllegalAccessException e) {
throw new RuntimeException(
"Couldn't use Java reflection to implement protocol message " +
"reflection.", e);
} catch (InvocationTargetException e) {
final Throwable cause = e.getCause();
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
} else if (cause instanceof Error) {
throw (Error) cause;
} else {
throw new RuntimeException(
"Unexpected exception thrown by generated accessor method.", cause);
}
}
}
|
java
|
private static Object invokeOrDie(
final Method method, final Object object, final Object... params) {
try {
return method.invoke(object, params);
} catch (IllegalAccessException e) {
throw new RuntimeException(
"Couldn't use Java reflection to implement protocol message " +
"reflection.", e);
} catch (InvocationTargetException e) {
final Throwable cause = e.getCause();
if (cause instanceof RuntimeException) {
throw (RuntimeException) cause;
} else if (cause instanceof Error) {
throw (Error) cause;
} else {
throw new RuntimeException(
"Unexpected exception thrown by generated accessor method.", cause);
}
}
}
|
[
"private",
"static",
"Object",
"invokeOrDie",
"(",
"final",
"Method",
"method",
",",
"final",
"Object",
"object",
",",
"final",
"Object",
"...",
"params",
")",
"{",
"try",
"{",
"return",
"method",
".",
"invoke",
"(",
"object",
",",
"params",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Couldn't use Java reflection to implement protocol message \"",
"+",
"\"reflection.\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"InvocationTargetException",
"e",
")",
"{",
"final",
"Throwable",
"cause",
"=",
"e",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"cause",
"instanceof",
"RuntimeException",
")",
"{",
"throw",
"(",
"RuntimeException",
")",
"cause",
";",
"}",
"else",
"if",
"(",
"cause",
"instanceof",
"Error",
")",
"{",
"throw",
"(",
"Error",
")",
"cause",
";",
"}",
"else",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Unexpected exception thrown by generated accessor method.\"",
",",
"cause",
")",
";",
"}",
"}",
"}"
] |
Calls invoke and throws a RuntimeException if it fails.
|
[
"Calls",
"invoke",
"and",
"throws",
"a",
"RuntimeException",
"if",
"it",
"fails",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/GeneratedMessage.java#L1424-L1443
|
147,815
|
kmi/iserve
|
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/KnowledgeBaseManagerSparql.java
|
KnowledgeBaseManagerSparql.clearKnowledgeBase
|
@Override
public boolean clearKnowledgeBase() {
if (!this.graphStoreManager.canBeModified()) {
log.warn("The dataset cannot be modified.");
return false;
}
log.info("Clearing knowledge base.");
this.graphStoreManager.clearDataset();
// Generate Event
this.getEventBus().post(new KnowledgeBaseClearedEvent(new Date()));
return true;
}
|
java
|
@Override
public boolean clearKnowledgeBase() {
if (!this.graphStoreManager.canBeModified()) {
log.warn("The dataset cannot be modified.");
return false;
}
log.info("Clearing knowledge base.");
this.graphStoreManager.clearDataset();
// Generate Event
this.getEventBus().post(new KnowledgeBaseClearedEvent(new Date()));
return true;
}
|
[
"@",
"Override",
"public",
"boolean",
"clearKnowledgeBase",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"graphStoreManager",
".",
"canBeModified",
"(",
")",
")",
"{",
"log",
".",
"warn",
"(",
"\"The dataset cannot be modified.\"",
")",
";",
"return",
"false",
";",
"}",
"log",
".",
"info",
"(",
"\"Clearing knowledge base.\"",
")",
";",
"this",
".",
"graphStoreManager",
".",
"clearDataset",
"(",
")",
";",
"// Generate Event",
"this",
".",
"getEventBus",
"(",
")",
".",
"post",
"(",
"new",
"KnowledgeBaseClearedEvent",
"(",
"new",
"Date",
"(",
")",
")",
")",
";",
"return",
"true",
";",
"}"
] |
Deletes all the ontologies from a Knowledge Base.
This operation cannot be undone. Use with care.
@return
|
[
"Deletes",
"all",
"the",
"ontologies",
"from",
"a",
"Knowledge",
"Base",
".",
"This",
"operation",
"cannot",
"be",
"undone",
".",
"Use",
"with",
"care",
"."
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/KnowledgeBaseManagerSparql.java#L115-L130
|
147,816
|
kmi/iserve
|
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/KnowledgeBaseManagerSparql.java
|
KnowledgeBaseManagerSparql.fetchModelsForService
|
private boolean fetchModelsForService(Service svc) {
boolean result = true;
Set<URI> modelUris = obtainReferencedModelUris(svc);
for (URI modelUri : modelUris) {
// Only fetch those that are not there and have not been unsucessfully fetched in the last 24 hours
if (!this.graphStoreManager.containsGraph(modelUri)) {
boolean fetch = true;
// If it was previously unreachable we need to check how long ago we tried
if (this.unreachableModels.containsKey(modelUri)) {
Date now = new Date();
Date lastAttempt = this.unreachableModels.get(modelUri);
long diffHours = (now.getTime() - lastAttempt.getTime()) / (60 * 60 * 1000) % 24;
fetch = (diffHours >= 24 ? true : false);
}
if (fetch) {
boolean isStored = this.graphStoreManager.fetchAndStore(modelUri);
if (!isStored) {
this.unreachableModels.put(modelUri, new Date());
} else {
this.getEventBus().post(new OntologyCreatedEvent(new Date(), modelUri));
}
result = result & isStored;
}
}
}
return result;
}
|
java
|
private boolean fetchModelsForService(Service svc) {
boolean result = true;
Set<URI> modelUris = obtainReferencedModelUris(svc);
for (URI modelUri : modelUris) {
// Only fetch those that are not there and have not been unsucessfully fetched in the last 24 hours
if (!this.graphStoreManager.containsGraph(modelUri)) {
boolean fetch = true;
// If it was previously unreachable we need to check how long ago we tried
if (this.unreachableModels.containsKey(modelUri)) {
Date now = new Date();
Date lastAttempt = this.unreachableModels.get(modelUri);
long diffHours = (now.getTime() - lastAttempt.getTime()) / (60 * 60 * 1000) % 24;
fetch = (diffHours >= 24 ? true : false);
}
if (fetch) {
boolean isStored = this.graphStoreManager.fetchAndStore(modelUri);
if (!isStored) {
this.unreachableModels.put(modelUri, new Date());
} else {
this.getEventBus().post(new OntologyCreatedEvent(new Date(), modelUri));
}
result = result & isStored;
}
}
}
return result;
}
|
[
"private",
"boolean",
"fetchModelsForService",
"(",
"Service",
"svc",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"Set",
"<",
"URI",
">",
"modelUris",
"=",
"obtainReferencedModelUris",
"(",
"svc",
")",
";",
"for",
"(",
"URI",
"modelUri",
":",
"modelUris",
")",
"{",
"// Only fetch those that are not there and have not been unsucessfully fetched in the last 24 hours",
"if",
"(",
"!",
"this",
".",
"graphStoreManager",
".",
"containsGraph",
"(",
"modelUri",
")",
")",
"{",
"boolean",
"fetch",
"=",
"true",
";",
"// If it was previously unreachable we need to check how long ago we tried",
"if",
"(",
"this",
".",
"unreachableModels",
".",
"containsKey",
"(",
"modelUri",
")",
")",
"{",
"Date",
"now",
"=",
"new",
"Date",
"(",
")",
";",
"Date",
"lastAttempt",
"=",
"this",
".",
"unreachableModels",
".",
"get",
"(",
"modelUri",
")",
";",
"long",
"diffHours",
"=",
"(",
"now",
".",
"getTime",
"(",
")",
"-",
"lastAttempt",
".",
"getTime",
"(",
")",
")",
"/",
"(",
"60",
"*",
"60",
"*",
"1000",
")",
"%",
"24",
";",
"fetch",
"=",
"(",
"diffHours",
">=",
"24",
"?",
"true",
":",
"false",
")",
";",
"}",
"if",
"(",
"fetch",
")",
"{",
"boolean",
"isStored",
"=",
"this",
".",
"graphStoreManager",
".",
"fetchAndStore",
"(",
"modelUri",
")",
";",
"if",
"(",
"!",
"isStored",
")",
"{",
"this",
".",
"unreachableModels",
".",
"put",
"(",
"modelUri",
",",
"new",
"Date",
"(",
")",
")",
";",
"}",
"else",
"{",
"this",
".",
"getEventBus",
"(",
")",
".",
"post",
"(",
"new",
"OntologyCreatedEvent",
"(",
"new",
"Date",
"(",
")",
",",
"modelUri",
")",
")",
";",
"}",
"result",
"=",
"result",
"&",
"isStored",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] |
Given a service, this method will fetch and upload the models referred to by the service.
This is a synchronous implementation that will therefore wait until its fetched and uploaded.
@param svc the service to be checked for referred models.
@return True if all the models were properly fetched, false otherwise
|
[
"Given",
"a",
"service",
"this",
"method",
"will",
"fetch",
"and",
"upload",
"the",
"models",
"referred",
"to",
"by",
"the",
"service",
".",
"This",
"is",
"a",
"synchronous",
"implementation",
"that",
"will",
"therefore",
"wait",
"until",
"its",
"fetched",
"and",
"uploaded",
"."
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/KnowledgeBaseManagerSparql.java#L202-L231
|
147,817
|
kmi/iserve
|
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/KnowledgeBaseManagerSparql.java
|
KnowledgeBaseManagerSparql.checkFetchingTasks
|
private boolean checkFetchingTasks(Map<URI, Future<Boolean>> concurrentTasks) {
boolean result = true;
Boolean fetched;
for (URI modelUri : concurrentTasks.keySet()) {
Future<Boolean> f = concurrentTasks.get(modelUri);
try {
fetched = f.get();
result = result && fetched;
// Track unreachability
if (fetched && this.unreachableModels.containsKey(modelUri)) {
this.unreachableModels.remove(modelUri);
log.info("A previously unreachable model has finally been obtained - {}", modelUri);
}
if (!fetched) {
this.unreachableModels.put(modelUri, new Date());
log.error("Cannot load " + modelUri + ". Marked as invalid");
}
} catch (Exception e) {
// Mark as invalid
log.error("There was an error while trying to fetch a remote model", e);
this.unreachableModels.put(modelUri, new Date());
log.info("Added {} to the unreachable models list.", modelUri);
result = false;
}
}
return result;
}
|
java
|
private boolean checkFetchingTasks(Map<URI, Future<Boolean>> concurrentTasks) {
boolean result = true;
Boolean fetched;
for (URI modelUri : concurrentTasks.keySet()) {
Future<Boolean> f = concurrentTasks.get(modelUri);
try {
fetched = f.get();
result = result && fetched;
// Track unreachability
if (fetched && this.unreachableModels.containsKey(modelUri)) {
this.unreachableModels.remove(modelUri);
log.info("A previously unreachable model has finally been obtained - {}", modelUri);
}
if (!fetched) {
this.unreachableModels.put(modelUri, new Date());
log.error("Cannot load " + modelUri + ". Marked as invalid");
}
} catch (Exception e) {
// Mark as invalid
log.error("There was an error while trying to fetch a remote model", e);
this.unreachableModels.put(modelUri, new Date());
log.info("Added {} to the unreachable models list.", modelUri);
result = false;
}
}
return result;
}
|
[
"private",
"boolean",
"checkFetchingTasks",
"(",
"Map",
"<",
"URI",
",",
"Future",
"<",
"Boolean",
">",
">",
"concurrentTasks",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"Boolean",
"fetched",
";",
"for",
"(",
"URI",
"modelUri",
":",
"concurrentTasks",
".",
"keySet",
"(",
")",
")",
"{",
"Future",
"<",
"Boolean",
">",
"f",
"=",
"concurrentTasks",
".",
"get",
"(",
"modelUri",
")",
";",
"try",
"{",
"fetched",
"=",
"f",
".",
"get",
"(",
")",
";",
"result",
"=",
"result",
"&&",
"fetched",
";",
"// Track unreachability",
"if",
"(",
"fetched",
"&&",
"this",
".",
"unreachableModels",
".",
"containsKey",
"(",
"modelUri",
")",
")",
"{",
"this",
".",
"unreachableModels",
".",
"remove",
"(",
"modelUri",
")",
";",
"log",
".",
"info",
"(",
"\"A previously unreachable model has finally been obtained - {}\"",
",",
"modelUri",
")",
";",
"}",
"if",
"(",
"!",
"fetched",
")",
"{",
"this",
".",
"unreachableModels",
".",
"put",
"(",
"modelUri",
",",
"new",
"Date",
"(",
")",
")",
";",
"log",
".",
"error",
"(",
"\"Cannot load \"",
"+",
"modelUri",
"+",
"\". Marked as invalid\"",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// Mark as invalid",
"log",
".",
"error",
"(",
"\"There was an error while trying to fetch a remote model\"",
",",
"e",
")",
";",
"this",
".",
"unreachableModels",
".",
"put",
"(",
"modelUri",
",",
"new",
"Date",
"(",
")",
")",
";",
"log",
".",
"info",
"(",
"\"Added {} to the unreachable models list.\"",
",",
"modelUri",
")",
";",
"result",
"=",
"false",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
This method checks a set of fetching tasks that are pending to validate their adequate conclusion.
For each of the fetching tasks launched we will track the models that were not adequately loaded for ulterior
uploading.
@param concurrentTasks the Map with the models to fetch and the Future providing the state of the uploading
@return True if all the models were adequately uploaded. False otherwise.
|
[
"This",
"method",
"checks",
"a",
"set",
"of",
"fetching",
"tasks",
"that",
"are",
"pending",
"to",
"validate",
"their",
"adequate",
"conclusion",
".",
"For",
"each",
"of",
"the",
"fetching",
"tasks",
"launched",
"we",
"will",
"track",
"the",
"models",
"that",
"were",
"not",
"adequately",
"loaded",
"for",
"ulterior",
"uploading",
"."
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/KnowledgeBaseManagerSparql.java#L241-L269
|
147,818
|
kmi/iserve
|
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/KnowledgeBaseManagerSparql.java
|
KnowledgeBaseManagerSparql.handleServiceCreated
|
@Override
@Subscribe
public void handleServiceCreated(ServiceCreatedEvent event) {
log.debug("Processing Service Created Event {}", event);
this.fetchModelsForService(event.getService());
}
|
java
|
@Override
@Subscribe
public void handleServiceCreated(ServiceCreatedEvent event) {
log.debug("Processing Service Created Event {}", event);
this.fetchModelsForService(event.getService());
}
|
[
"@",
"Override",
"@",
"Subscribe",
"public",
"void",
"handleServiceCreated",
"(",
"ServiceCreatedEvent",
"event",
")",
"{",
"log",
".",
"debug",
"(",
"\"Processing Service Created Event {}\"",
",",
"event",
")",
";",
"this",
".",
"fetchModelsForService",
"(",
"event",
".",
"getService",
"(",
")",
")",
";",
"}"
] |
Event Processing of internal changes
|
[
"Event",
"Processing",
"of",
"internal",
"changes"
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/KnowledgeBaseManagerSparql.java#L436-L441
|
147,819
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/oracles/wordnet/WordNet.java
|
WordNet.traverseTree
|
private static boolean traverseTree(PointerTargetTree syn, PointerTargetNodeList ptnl, Synset source) {
java.util.List MGListsList = syn.toList();
for (Object aMGListsList : MGListsList) {
PointerTargetNodeList MGList = (PointerTargetNodeList) aMGListsList;
for (Object aMGList : MGList) {
Synset toAdd = ((PointerTargetNode) aMGList).getSynset();
if (toAdd.equals(source)) {
return true;
}
}
}
for (Object aPtnl : ptnl) {
Synset toAdd = ((PointerTargetNode) aPtnl).getSynset();
if (toAdd.equals(source)) {
return true;
}
}
return false;
}
|
java
|
private static boolean traverseTree(PointerTargetTree syn, PointerTargetNodeList ptnl, Synset source) {
java.util.List MGListsList = syn.toList();
for (Object aMGListsList : MGListsList) {
PointerTargetNodeList MGList = (PointerTargetNodeList) aMGListsList;
for (Object aMGList : MGList) {
Synset toAdd = ((PointerTargetNode) aMGList).getSynset();
if (toAdd.equals(source)) {
return true;
}
}
}
for (Object aPtnl : ptnl) {
Synset toAdd = ((PointerTargetNode) aPtnl).getSynset();
if (toAdd.equals(source)) {
return true;
}
}
return false;
}
|
[
"private",
"static",
"boolean",
"traverseTree",
"(",
"PointerTargetTree",
"syn",
",",
"PointerTargetNodeList",
"ptnl",
",",
"Synset",
"source",
")",
"{",
"java",
".",
"util",
".",
"List",
"MGListsList",
"=",
"syn",
".",
"toList",
"(",
")",
";",
"for",
"(",
"Object",
"aMGListsList",
":",
"MGListsList",
")",
"{",
"PointerTargetNodeList",
"MGList",
"=",
"(",
"PointerTargetNodeList",
")",
"aMGListsList",
";",
"for",
"(",
"Object",
"aMGList",
":",
"MGList",
")",
"{",
"Synset",
"toAdd",
"=",
"(",
"(",
"PointerTargetNode",
")",
"aMGList",
")",
".",
"getSynset",
"(",
")",
";",
"if",
"(",
"toAdd",
".",
"equals",
"(",
"source",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"for",
"(",
"Object",
"aPtnl",
":",
"ptnl",
")",
"{",
"Synset",
"toAdd",
"=",
"(",
"(",
"PointerTargetNode",
")",
"aPtnl",
")",
".",
"getSynset",
"(",
")",
";",
"if",
"(",
"toAdd",
".",
"equals",
"(",
"source",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
traverses PointerTargetTree.
@param syn synonyms
@param ptnl target node list
@param source source synset
@return if source was found
|
[
"traverses",
"PointerTargetTree",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/oracles/wordnet/WordNet.java#L436-L454
|
147,820
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/oracles/wordnet/WordNet.java
|
WordNet.isUnidirestionalList
|
private boolean isUnidirestionalList(RelationshipList list) {
if (list.size() > 0) {
try {
if (((AsymmetricRelationship) list.get(0)).getCommonParentIndex() == 0) {
return true;
}
} catch (java.lang.IndexOutOfBoundsException ex) {
return true;
}
}
return false;
}
|
java
|
private boolean isUnidirestionalList(RelationshipList list) {
if (list.size() > 0) {
try {
if (((AsymmetricRelationship) list.get(0)).getCommonParentIndex() == 0) {
return true;
}
} catch (java.lang.IndexOutOfBoundsException ex) {
return true;
}
}
return false;
}
|
[
"private",
"boolean",
"isUnidirestionalList",
"(",
"RelationshipList",
"list",
")",
"{",
"if",
"(",
"list",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"try",
"{",
"if",
"(",
"(",
"(",
"AsymmetricRelationship",
")",
"list",
".",
"get",
"(",
"0",
")",
")",
".",
"getCommonParentIndex",
"(",
")",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"}",
"catch",
"(",
"java",
".",
"lang",
".",
"IndexOutOfBoundsException",
"ex",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Checks unidirectionality of semantic relations in the list.
@param list a list with relations
@return true if relations in the list are unidirectional
|
[
"Checks",
"unidirectionality",
"of",
"semantic",
"relations",
"in",
"the",
"list",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/oracles/wordnet/WordNet.java#L462-L473
|
147,821
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntArrayList.java
|
IntArrayList.add
|
public void add(int idx, int ele) {
ensureCapacity(size + 1);
System.arraycopy(data, idx, data, idx + 1, size - idx);
data[idx] = ele;
size++;
}
|
java
|
public void add(int idx, int ele) {
ensureCapacity(size + 1);
System.arraycopy(data, idx, data, idx + 1, size - idx);
data[idx] = ele;
size++;
}
|
[
"public",
"void",
"add",
"(",
"int",
"idx",
",",
"int",
"ele",
")",
"{",
"ensureCapacity",
"(",
"size",
"+",
"1",
")",
";",
"System",
".",
"arraycopy",
"(",
"data",
",",
"idx",
",",
"data",
",",
"idx",
"+",
"1",
",",
"size",
"-",
"idx",
")",
";",
"data",
"[",
"idx",
"]",
"=",
"ele",
";",
"size",
"++",
";",
"}"
] |
Adds an element to the List. All following elements
are moved up by one index.
@param idx where to insert the new element
@param ele new element
|
[
"Adds",
"an",
"element",
"to",
"the",
"List",
".",
"All",
"following",
"elements",
"are",
"moved",
"up",
"by",
"one",
"index",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntArrayList.java#L135-L140
|
147,822
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntArrayList.java
|
IntArrayList.remove
|
public void remove(int idx) {
size--;
System.arraycopy(data, idx + 1, data, idx, size - idx);
}
|
java
|
public void remove(int idx) {
size--;
System.arraycopy(data, idx + 1, data, idx, size - idx);
}
|
[
"public",
"void",
"remove",
"(",
"int",
"idx",
")",
"{",
"size",
"--",
";",
"System",
".",
"arraycopy",
"(",
"data",
",",
"idx",
"+",
"1",
",",
"data",
",",
"idx",
",",
"size",
"-",
"idx",
")",
";",
"}"
] |
Removes an element from the List. All following elements
are moved down by one index.
@param idx index of the element to remove
|
[
"Removes",
"an",
"element",
"from",
"the",
"List",
".",
"All",
"following",
"elements",
"are",
"moved",
"down",
"by",
"one",
"index",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntArrayList.java#L163-L166
|
147,823
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntArrayList.java
|
IntArrayList.indexOf
|
public int indexOf(int ele) {
int i;
for (i = 0; i < size; i++) {
if (data[i] == ele) {
return i;
}
}
return -1;
}
|
java
|
public int indexOf(int ele) {
int i;
for (i = 0; i < size; i++) {
if (data[i] == ele) {
return i;
}
}
return -1;
}
|
[
"public",
"int",
"indexOf",
"(",
"int",
"ele",
")",
"{",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"if",
"(",
"data",
"[",
"i",
"]",
"==",
"ele",
")",
"{",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
Searches an element.
@param ele element to look for
@return index of the first element found; -1 if nothing was found
|
[
"Searches",
"an",
"element",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntArrayList.java#L180-L189
|
147,824
|
ykrasik/jaci
|
jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java
|
ReflectionUtils.createInstanceNoArgs
|
public static Object createInstanceNoArgs(Class<?> clazz) {
assertReflectionAccessor();
try {
return accessor.newInstance(clazz);
} catch (Exception e) {
throw SneakyException.sneakyThrow(e);
}
}
|
java
|
public static Object createInstanceNoArgs(Class<?> clazz) {
assertReflectionAccessor();
try {
return accessor.newInstance(clazz);
} catch (Exception e) {
throw SneakyException.sneakyThrow(e);
}
}
|
[
"public",
"static",
"Object",
"createInstanceNoArgs",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"assertReflectionAccessor",
"(",
")",
";",
"try",
"{",
"return",
"accessor",
".",
"newInstance",
"(",
"clazz",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"SneakyException",
".",
"sneakyThrow",
"(",
"e",
")",
";",
"}",
"}"
] |
Creates an instance of this class through reflection. Class must have a no-args constructor.
Any exceptions thrown during the process will be re-thrown as unchecked.
@param clazz Class to instantiate.
@return An instance of the provided class.
@throws RuntimeException If an error occurred while instantiating an object of the class (for example, if the
class doesn't have a no-args constructor).
|
[
"Creates",
"an",
"instance",
"of",
"this",
"class",
"through",
"reflection",
".",
"Class",
"must",
"have",
"a",
"no",
"-",
"args",
"constructor",
".",
"Any",
"exceptions",
"thrown",
"during",
"the",
"process",
"will",
"be",
"re",
"-",
"thrown",
"as",
"unchecked",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java#L57-L64
|
147,825
|
ykrasik/jaci
|
jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java
|
ReflectionUtils.getDeclaredClasses
|
public static Class<?>[] getDeclaredClasses(Class<?> clazz) {
assertReflectionAccessor();
try {
return accessor.getDeclaredClasses(clazz);
} catch (Exception e) {
throw SneakyException.sneakyThrow(e);
}
}
|
java
|
public static Class<?>[] getDeclaredClasses(Class<?> clazz) {
assertReflectionAccessor();
try {
return accessor.getDeclaredClasses(clazz);
} catch (Exception e) {
throw SneakyException.sneakyThrow(e);
}
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"[",
"]",
"getDeclaredClasses",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"assertReflectionAccessor",
"(",
")",
";",
"try",
"{",
"return",
"accessor",
".",
"getDeclaredClasses",
"(",
"clazz",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"SneakyException",
".",
"sneakyThrow",
"(",
"e",
")",
";",
"}",
"}"
] |
Get all inner classes and interfaces declared by the given class.
@param clazz Class to reflect inner classes from.
@return An {@code Array} of inner classes and interfaces declared by the given class.
@throws RuntimeException If any error occurs.
|
[
"Get",
"all",
"inner",
"classes",
"and",
"interfaces",
"declared",
"by",
"the",
"given",
"class",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java#L73-L80
|
147,826
|
ykrasik/jaci
|
jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java
|
ReflectionUtils.getDeclaredConstructor
|
public static <T> ReflectionConstructor<T> getDeclaredConstructor(Class<T> clazz, Class<?>... parameterTypes) {
assertReflectionAccessor();
try {
return accessor.getDeclaredConstructor(clazz, parameterTypes);
} catch (Exception e) {
throw SneakyException.sneakyThrow(e);
}
}
|
java
|
public static <T> ReflectionConstructor<T> getDeclaredConstructor(Class<T> clazz, Class<?>... parameterTypes) {
assertReflectionAccessor();
try {
return accessor.getDeclaredConstructor(clazz, parameterTypes);
} catch (Exception e) {
throw SneakyException.sneakyThrow(e);
}
}
|
[
"public",
"static",
"<",
"T",
">",
"ReflectionConstructor",
"<",
"T",
">",
"getDeclaredConstructor",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"Class",
"<",
"?",
">",
"...",
"parameterTypes",
")",
"{",
"assertReflectionAccessor",
"(",
")",
";",
"try",
"{",
"return",
"accessor",
".",
"getDeclaredConstructor",
"(",
"clazz",
",",
"parameterTypes",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"SneakyException",
".",
"sneakyThrow",
"(",
"e",
")",
";",
"}",
"}"
] |
Returns a constructor of the given class that takes the given parameter types.
@param clazz Class to reflect constructor for.
@param parameterTypes Parameter types of the constructor.
@param <T> Class type.
@return A constructor of the given class that takes the given parameter types.
@throws RuntimeException If the class doesn't have a constructor with the given parameter types.
|
[
"Returns",
"a",
"constructor",
"of",
"the",
"given",
"class",
"that",
"takes",
"the",
"given",
"parameter",
"types",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java#L91-L98
|
147,827
|
ykrasik/jaci
|
jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java
|
ReflectionUtils.getNoArgsMethod
|
public static ReflectionMethod getNoArgsMethod(Class<?> clazz, String methodName) {
assertReflectionAccessor();
try {
// TODO: Support inheritance?
return accessor.getDeclaredMethod(clazz, methodName, NO_ARGS_TYPE);
} catch (Exception e) {
throw SneakyException.sneakyThrow(e);
}
}
|
java
|
public static ReflectionMethod getNoArgsMethod(Class<?> clazz, String methodName) {
assertReflectionAccessor();
try {
// TODO: Support inheritance?
return accessor.getDeclaredMethod(clazz, methodName, NO_ARGS_TYPE);
} catch (Exception e) {
throw SneakyException.sneakyThrow(e);
}
}
|
[
"public",
"static",
"ReflectionMethod",
"getNoArgsMethod",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"methodName",
")",
"{",
"assertReflectionAccessor",
"(",
")",
";",
"try",
"{",
"// TODO: Support inheritance?",
"return",
"accessor",
".",
"getDeclaredMethod",
"(",
"clazz",
",",
"methodName",
",",
"NO_ARGS_TYPE",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"SneakyException",
".",
"sneakyThrow",
"(",
"e",
")",
";",
"}",
"}"
] |
Returns a method with the provided name that takes no-args.
@param clazz Class to search.
@param methodName Method name.
@return A method with the provided name that takes no-args.
@throws RuntimeException If the class doesn't contain a no-args method with the given name.
|
[
"Returns",
"a",
"method",
"with",
"the",
"provided",
"name",
"that",
"takes",
"no",
"-",
"args",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java#L108-L116
|
147,828
|
ykrasik/jaci
|
jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java
|
ReflectionUtils.isAssignableFrom
|
public static boolean isAssignableFrom(Class<?> c1, Class<?> c2) {
assertReflectionAccessor();
return accessor.isAssignableFrom(c1, c2);
}
|
java
|
public static boolean isAssignableFrom(Class<?> c1, Class<?> c2) {
assertReflectionAccessor();
return accessor.isAssignableFrom(c1, c2);
}
|
[
"public",
"static",
"boolean",
"isAssignableFrom",
"(",
"Class",
"<",
"?",
">",
"c1",
",",
"Class",
"<",
"?",
">",
"c2",
")",
"{",
"assertReflectionAccessor",
"(",
")",
";",
"return",
"accessor",
".",
"isAssignableFrom",
"(",
"c1",
",",
"c2",
")",
";",
"}"
] |
Determines if the class or interface represented by first Class parameter is either the same as, or is a superclass or
superinterface of, the class or interface represented by the second Class parameter.
@param c1 Class to check.
@param c2 Class to check against.
@return {@code true} if the first class parameter is either the same as or a superinterface of the second class parameter.
|
[
"Determines",
"if",
"the",
"class",
"or",
"interface",
"represented",
"by",
"first",
"Class",
"parameter",
"is",
"either",
"the",
"same",
"as",
"or",
"is",
"a",
"superclass",
"or",
"superinterface",
"of",
"the",
"class",
"or",
"interface",
"represented",
"by",
"the",
"second",
"Class",
"parameter",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java#L174-L177
|
147,829
|
ykrasik/jaci
|
jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java
|
ReflectionUtils.assertReturnValue
|
public static void assertReturnValue(ReflectionMethod method, Class<?> expectedReturnType) {
final Class<?> returnType = method.getReturnType();
if (returnType != expectedReturnType) {
final String message = "Class='"+method.getDeclaringClass()+"', method='"+method.getName()+"': Must return a value of type '"+expectedReturnType+"'!";
throw new IllegalArgumentException(message);
}
}
|
java
|
public static void assertReturnValue(ReflectionMethod method, Class<?> expectedReturnType) {
final Class<?> returnType = method.getReturnType();
if (returnType != expectedReturnType) {
final String message = "Class='"+method.getDeclaringClass()+"', method='"+method.getName()+"': Must return a value of type '"+expectedReturnType+"'!";
throw new IllegalArgumentException(message);
}
}
|
[
"public",
"static",
"void",
"assertReturnValue",
"(",
"ReflectionMethod",
"method",
",",
"Class",
"<",
"?",
">",
"expectedReturnType",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"returnType",
"=",
"method",
".",
"getReturnType",
"(",
")",
";",
"if",
"(",
"returnType",
"!=",
"expectedReturnType",
")",
"{",
"final",
"String",
"message",
"=",
"\"Class='\"",
"+",
"method",
".",
"getDeclaringClass",
"(",
")",
"+",
"\"', method='\"",
"+",
"method",
".",
"getName",
"(",
")",
"+",
"\"': Must return a value of type '\"",
"+",
"expectedReturnType",
"+",
"\"'!\"",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
";",
"}",
"}"
] |
Assert that the given method returns the expected return type.
@param method Method to assert.
@param expectedReturnType Expected return type of the method.
@throws IllegalArgumentException If the method's return type doesn't match the expected type.
|
[
"Assert",
"that",
"the",
"given",
"method",
"returns",
"the",
"expected",
"return",
"type",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java#L207-L213
|
147,830
|
ykrasik/jaci
|
jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java
|
ReflectionUtils.assertNoParameters
|
public static void assertNoParameters(ReflectionMethod method) {
final List<ReflectionParameter> parameters = method.getParameters();
if (!parameters.isEmpty()) {
final String message = "Class='"+method.getDeclaringClass()+"', method='"+method.getName()+"': Must take no parameters!";
throw new IllegalArgumentException(message);
}
}
|
java
|
public static void assertNoParameters(ReflectionMethod method) {
final List<ReflectionParameter> parameters = method.getParameters();
if (!parameters.isEmpty()) {
final String message = "Class='"+method.getDeclaringClass()+"', method='"+method.getName()+"': Must take no parameters!";
throw new IllegalArgumentException(message);
}
}
|
[
"public",
"static",
"void",
"assertNoParameters",
"(",
"ReflectionMethod",
"method",
")",
"{",
"final",
"List",
"<",
"ReflectionParameter",
">",
"parameters",
"=",
"method",
".",
"getParameters",
"(",
")",
";",
"if",
"(",
"!",
"parameters",
".",
"isEmpty",
"(",
")",
")",
"{",
"final",
"String",
"message",
"=",
"\"Class='\"",
"+",
"method",
".",
"getDeclaringClass",
"(",
")",
"+",
"\"', method='\"",
"+",
"method",
".",
"getName",
"(",
")",
"+",
"\"': Must take no parameters!\"",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
";",
"}",
"}"
] |
Assert that the given method takes no parameters.
@param method Method to assert.
@throws IllegalArgumentException If the method takes any parameters.
|
[
"Assert",
"that",
"the",
"given",
"method",
"takes",
"no",
"parameters",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-reflection-api/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionUtils.java#L221-L227
|
147,831
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/loaders/context/CTXMLContextLoader.java
|
CTXMLContextLoader.findRoot
|
private INode findRoot() {
for (INode node : nodes.values()) {
if (!node.hasParent() && !BASE_NODE.equals(node.getNodeData().getName())) {
return node;
}
}
return null;
}
|
java
|
private INode findRoot() {
for (INode node : nodes.values()) {
if (!node.hasParent() && !BASE_NODE.equals(node.getNodeData().getName())) {
return node;
}
}
return null;
}
|
[
"private",
"INode",
"findRoot",
"(",
")",
"{",
"for",
"(",
"INode",
"node",
":",
"nodes",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"!",
"node",
".",
"hasParent",
"(",
")",
"&&",
"!",
"BASE_NODE",
".",
"equals",
"(",
"node",
".",
"getNodeData",
"(",
")",
".",
"getName",
"(",
")",
")",
")",
"{",
"return",
"node",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
org.xml.sax.helpers.DefaultHandler methods re-implementation end
|
[
"org",
".",
"xml",
".",
"sax",
".",
"helpers",
".",
"DefaultHandler",
"methods",
"re",
"-",
"implementation",
"end"
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/loaders/context/CTXMLContextLoader.java#L225-L232
|
147,832
|
gilberto-torrezan/gwt-views
|
src/main/java/com/github/gilbertotorrezan/gwtviews/client/NavigationManager.java
|
NavigationManager.setInjectorInstance
|
public static <T> void setInjectorInstance(Class<T> injectorClass, T injectorInstance) {
if (injectorInstance == null){
injectorsMap.remove(injectorClass);
}
injectorsMap.put(injectorClass, injectorInstance);
}
|
java
|
public static <T> void setInjectorInstance(Class<T> injectorClass, T injectorInstance) {
if (injectorInstance == null){
injectorsMap.remove(injectorClass);
}
injectorsMap.put(injectorClass, injectorInstance);
}
|
[
"public",
"static",
"<",
"T",
">",
"void",
"setInjectorInstance",
"(",
"Class",
"<",
"T",
">",
"injectorClass",
",",
"T",
"injectorInstance",
")",
"{",
"if",
"(",
"injectorInstance",
"==",
"null",
")",
"{",
"injectorsMap",
".",
"remove",
"(",
"injectorClass",
")",
";",
"}",
"injectorsMap",
".",
"put",
"(",
"injectorClass",
",",
"injectorInstance",
")",
";",
"}"
] |
Sets the injector instance to be used internally by the framework to inject views. If an injector instance is not declared here,
a new instance is created every time a view is invoked.
@param injectorClass The class literal of the injector.
@param injectorInstance The injector instance to be used.
@see View#injector()
@since v.1.3.1
|
[
"Sets",
"the",
"injector",
"instance",
"to",
"be",
"used",
"internally",
"by",
"the",
"framework",
"to",
"inject",
"views",
".",
"If",
"an",
"injector",
"instance",
"is",
"not",
"declared",
"here",
"a",
"new",
"instance",
"is",
"created",
"every",
"time",
"a",
"view",
"is",
"invoked",
"."
] |
c6511435d14b5aa93a722b0e861230d0ae2159e5
|
https://github.com/gilberto-torrezan/gwt-views/blob/c6511435d14b5aa93a722b0e861230d0ae2159e5/src/main/java/com/github/gilbertotorrezan/gwtviews/client/NavigationManager.java#L94-L99
|
147,833
|
gilberto-torrezan/gwt-views
|
src/main/java/com/github/gilbertotorrezan/gwtviews/client/NavigationManager.java
|
NavigationManager.getInjectorInstance
|
@SuppressWarnings("unchecked")
public static <T> T getInjectorInstance(Class<T> injectorClass) {
return (T) injectorsMap.get(injectorClass);
}
|
java
|
@SuppressWarnings("unchecked")
public static <T> T getInjectorInstance(Class<T> injectorClass) {
return (T) injectorsMap.get(injectorClass);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"getInjectorInstance",
"(",
"Class",
"<",
"T",
">",
"injectorClass",
")",
"{",
"return",
"(",
"T",
")",
"injectorsMap",
".",
"get",
"(",
"injectorClass",
")",
";",
"}"
] |
Gets the current injector instance associated to the injector class literal. This method is called internally by the framework
to determine which injector instance should be used when injecting views.
@param injectorClass The class literal of the injector.
@return The injector instance previously set on {@link #setInjectorInstance(Class, Object)}
@since v.1.3.1
|
[
"Gets",
"the",
"current",
"injector",
"instance",
"associated",
"to",
"the",
"injector",
"class",
"literal",
".",
"This",
"method",
"is",
"called",
"internally",
"by",
"the",
"framework",
"to",
"determine",
"which",
"injector",
"instance",
"should",
"be",
"used",
"when",
"injecting",
"views",
"."
] |
c6511435d14b5aa93a722b0e861230d0ae2159e5
|
https://github.com/gilberto-torrezan/gwt-views/blob/c6511435d14b5aa93a722b0e861230d0ae2159e5/src/main/java/com/github/gilbertotorrezan/gwtviews/client/NavigationManager.java#L110-L113
|
147,834
|
colin-lee/mybatis-spring-support
|
src/main/java/com/github/mybatis/spring/LazyConnection.java
|
LazyConnection.getTargetConnection
|
private Connection getTargetConnection(Method operation) throws SQLException {
if (this.target == null) {
boolean readOnly = MasterSlaveInterceptor.isReadOnly();
// No target Connection held -> fetch one.
if (log.isDebugEnabled()) {
log.debug("Connecting to database for operation '" + operation.getName() + "'");
}
// Fetch physical Connection from DataSource.
DruidDataSource ds = router.determineTargetDataSource(readOnly);
TraceContext.get().setServerName(router.getConfigName()).setUrl(extractHost(ds.getUrl()));
this.target = (this.username != null) ? ds.getConnection(this.username, this.password) : ds.getConnection();
// If we still lack default connection properties, check them now.
//checkDefaultConnectionProperties(this.target);
// Apply kept transaction settings, if any.
if (this.readOnly) {
this.target.setReadOnly(true);
}
if (this.transactionIsolation != null) {
this.target.setTransactionIsolation(this.transactionIsolation);
}
if (this.autoCommit != null && this.autoCommit != this.target.getAutoCommit()) {
this.target.setAutoCommit(this.autoCommit);
}
} else {
// Target Connection already held -> return it.
if (log.isDebugEnabled()) {
log.debug("Using existing database connection for operation '" + operation.getName() + "'");
}
}
return this.target;
}
|
java
|
private Connection getTargetConnection(Method operation) throws SQLException {
if (this.target == null) {
boolean readOnly = MasterSlaveInterceptor.isReadOnly();
// No target Connection held -> fetch one.
if (log.isDebugEnabled()) {
log.debug("Connecting to database for operation '" + operation.getName() + "'");
}
// Fetch physical Connection from DataSource.
DruidDataSource ds = router.determineTargetDataSource(readOnly);
TraceContext.get().setServerName(router.getConfigName()).setUrl(extractHost(ds.getUrl()));
this.target = (this.username != null) ? ds.getConnection(this.username, this.password) : ds.getConnection();
// If we still lack default connection properties, check them now.
//checkDefaultConnectionProperties(this.target);
// Apply kept transaction settings, if any.
if (this.readOnly) {
this.target.setReadOnly(true);
}
if (this.transactionIsolation != null) {
this.target.setTransactionIsolation(this.transactionIsolation);
}
if (this.autoCommit != null && this.autoCommit != this.target.getAutoCommit()) {
this.target.setAutoCommit(this.autoCommit);
}
} else {
// Target Connection already held -> return it.
if (log.isDebugEnabled()) {
log.debug("Using existing database connection for operation '" + operation.getName() + "'");
}
}
return this.target;
}
|
[
"private",
"Connection",
"getTargetConnection",
"(",
"Method",
"operation",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"this",
".",
"target",
"==",
"null",
")",
"{",
"boolean",
"readOnly",
"=",
"MasterSlaveInterceptor",
".",
"isReadOnly",
"(",
")",
";",
"// No target Connection held -> fetch one.",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Connecting to database for operation '\"",
"+",
"operation",
".",
"getName",
"(",
")",
"+",
"\"'\"",
")",
";",
"}",
"// Fetch physical Connection from DataSource.",
"DruidDataSource",
"ds",
"=",
"router",
".",
"determineTargetDataSource",
"(",
"readOnly",
")",
";",
"TraceContext",
".",
"get",
"(",
")",
".",
"setServerName",
"(",
"router",
".",
"getConfigName",
"(",
")",
")",
".",
"setUrl",
"(",
"extractHost",
"(",
"ds",
".",
"getUrl",
"(",
")",
")",
")",
";",
"this",
".",
"target",
"=",
"(",
"this",
".",
"username",
"!=",
"null",
")",
"?",
"ds",
".",
"getConnection",
"(",
"this",
".",
"username",
",",
"this",
".",
"password",
")",
":",
"ds",
".",
"getConnection",
"(",
")",
";",
"// If we still lack default connection properties, check them now.",
"//checkDefaultConnectionProperties(this.target);",
"// Apply kept transaction settings, if any.",
"if",
"(",
"this",
".",
"readOnly",
")",
"{",
"this",
".",
"target",
".",
"setReadOnly",
"(",
"true",
")",
";",
"}",
"if",
"(",
"this",
".",
"transactionIsolation",
"!=",
"null",
")",
"{",
"this",
".",
"target",
".",
"setTransactionIsolation",
"(",
"this",
".",
"transactionIsolation",
")",
";",
"}",
"if",
"(",
"this",
".",
"autoCommit",
"!=",
"null",
"&&",
"this",
".",
"autoCommit",
"!=",
"this",
".",
"target",
".",
"getAutoCommit",
"(",
")",
")",
"{",
"this",
".",
"target",
".",
"setAutoCommit",
"(",
"this",
".",
"autoCommit",
")",
";",
"}",
"}",
"else",
"{",
"// Target Connection already held -> return it.",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Using existing database connection for operation '\"",
"+",
"operation",
".",
"getName",
"(",
")",
"+",
"\"'\"",
")",
";",
"}",
"}",
"return",
"this",
".",
"target",
";",
"}"
] |
Return the target Connection, fetching it and initializing it if necessary.
|
[
"Return",
"the",
"target",
"Connection",
"fetching",
"it",
"and",
"initializing",
"it",
"if",
"necessary",
"."
] |
de412e98d00e9a012c0619778fa1a61832863b82
|
https://github.com/colin-lee/mybatis-spring-support/blob/de412e98d00e9a012c0619778fa1a61832863b82/src/main/java/com/github/mybatis/spring/LazyConnection.java#L132-L166
|
147,835
|
yfpeng/pengyifan-bioc
|
src/main/java/com/pengyifan/bioc/util/BioCValidate2.java
|
BioCValidate2.check
|
public static void check(BioCDocument document) {
String text = BioCUtils.getText(document);
// check annotation offset and text
checkAnnotations(document.getAnnotations(), text, 0, BioCLog.log(document));
// check relation
for (BioCRelation relation : document.getRelations()) {
for (BioCNode node : relation.getNodes()) {
checkArgument(document.getAnnotation(node.getRefid()).isPresent(),
"Cannot find node %s in relation %s\n" +
"Location: %s", node, relation, BioCLog.log(document));
}
}
// check passage
for (BioCPassage passage : document.getPassages()) {
text = BioCUtils.getText(passage);
// check annotation offset and text
checkAnnotations(passage.getAnnotations(), text, passage.getOffset(),
BioCLog.log(document, passage));
// check relation
for (BioCRelation relation : passage.getRelations()) {
for (BioCNode node : relation.getNodes()) {
checkArgument(passage.getAnnotation(node.getRefid()).isPresent(),
"Cannot find node %s in relation %s\n" +
"Location: %s", node, relation, BioCLog.log(document, passage));
}
}
// check sentence
for (BioCSentence sentence : passage.getSentences()) {
// check annotation offset and text
checkAnnotations(sentence.getAnnotations(), sentence.getText().get(),
sentence.getOffset(), BioCUtils.getXPathString(document, passage, sentence));
// check relation
for (BioCRelation relation : sentence.getRelations()) {
for (BioCNode node : relation.getNodes()) {
checkArgument(sentence.getAnnotation(node.getRefid()).isPresent(),
"Cannot find node %s in relation %s\n" +
" Location: %s", node, relation,
BioCUtils.getXPathString(document, passage, sentence));
}
}
}
}
}
|
java
|
public static void check(BioCDocument document) {
String text = BioCUtils.getText(document);
// check annotation offset and text
checkAnnotations(document.getAnnotations(), text, 0, BioCLog.log(document));
// check relation
for (BioCRelation relation : document.getRelations()) {
for (BioCNode node : relation.getNodes()) {
checkArgument(document.getAnnotation(node.getRefid()).isPresent(),
"Cannot find node %s in relation %s\n" +
"Location: %s", node, relation, BioCLog.log(document));
}
}
// check passage
for (BioCPassage passage : document.getPassages()) {
text = BioCUtils.getText(passage);
// check annotation offset and text
checkAnnotations(passage.getAnnotations(), text, passage.getOffset(),
BioCLog.log(document, passage));
// check relation
for (BioCRelation relation : passage.getRelations()) {
for (BioCNode node : relation.getNodes()) {
checkArgument(passage.getAnnotation(node.getRefid()).isPresent(),
"Cannot find node %s in relation %s\n" +
"Location: %s", node, relation, BioCLog.log(document, passage));
}
}
// check sentence
for (BioCSentence sentence : passage.getSentences()) {
// check annotation offset and text
checkAnnotations(sentence.getAnnotations(), sentence.getText().get(),
sentence.getOffset(), BioCUtils.getXPathString(document, passage, sentence));
// check relation
for (BioCRelation relation : sentence.getRelations()) {
for (BioCNode node : relation.getNodes()) {
checkArgument(sentence.getAnnotation(node.getRefid()).isPresent(),
"Cannot find node %s in relation %s\n" +
" Location: %s", node, relation,
BioCUtils.getXPathString(document, passage, sentence));
}
}
}
}
}
|
[
"public",
"static",
"void",
"check",
"(",
"BioCDocument",
"document",
")",
"{",
"String",
"text",
"=",
"BioCUtils",
".",
"getText",
"(",
"document",
")",
";",
"// check annotation offset and text",
"checkAnnotations",
"(",
"document",
".",
"getAnnotations",
"(",
")",
",",
"text",
",",
"0",
",",
"BioCLog",
".",
"log",
"(",
"document",
")",
")",
";",
"// check relation",
"for",
"(",
"BioCRelation",
"relation",
":",
"document",
".",
"getRelations",
"(",
")",
")",
"{",
"for",
"(",
"BioCNode",
"node",
":",
"relation",
".",
"getNodes",
"(",
")",
")",
"{",
"checkArgument",
"(",
"document",
".",
"getAnnotation",
"(",
"node",
".",
"getRefid",
"(",
")",
")",
".",
"isPresent",
"(",
")",
",",
"\"Cannot find node %s in relation %s\\n\"",
"+",
"\"Location: %s\"",
",",
"node",
",",
"relation",
",",
"BioCLog",
".",
"log",
"(",
"document",
")",
")",
";",
"}",
"}",
"// check passage",
"for",
"(",
"BioCPassage",
"passage",
":",
"document",
".",
"getPassages",
"(",
")",
")",
"{",
"text",
"=",
"BioCUtils",
".",
"getText",
"(",
"passage",
")",
";",
"// check annotation offset and text",
"checkAnnotations",
"(",
"passage",
".",
"getAnnotations",
"(",
")",
",",
"text",
",",
"passage",
".",
"getOffset",
"(",
")",
",",
"BioCLog",
".",
"log",
"(",
"document",
",",
"passage",
")",
")",
";",
"// check relation",
"for",
"(",
"BioCRelation",
"relation",
":",
"passage",
".",
"getRelations",
"(",
")",
")",
"{",
"for",
"(",
"BioCNode",
"node",
":",
"relation",
".",
"getNodes",
"(",
")",
")",
"{",
"checkArgument",
"(",
"passage",
".",
"getAnnotation",
"(",
"node",
".",
"getRefid",
"(",
")",
")",
".",
"isPresent",
"(",
")",
",",
"\"Cannot find node %s in relation %s\\n\"",
"+",
"\"Location: %s\"",
",",
"node",
",",
"relation",
",",
"BioCLog",
".",
"log",
"(",
"document",
",",
"passage",
")",
")",
";",
"}",
"}",
"// check sentence",
"for",
"(",
"BioCSentence",
"sentence",
":",
"passage",
".",
"getSentences",
"(",
")",
")",
"{",
"// check annotation offset and text",
"checkAnnotations",
"(",
"sentence",
".",
"getAnnotations",
"(",
")",
",",
"sentence",
".",
"getText",
"(",
")",
".",
"get",
"(",
")",
",",
"sentence",
".",
"getOffset",
"(",
")",
",",
"BioCUtils",
".",
"getXPathString",
"(",
"document",
",",
"passage",
",",
"sentence",
")",
")",
";",
"// check relation",
"for",
"(",
"BioCRelation",
"relation",
":",
"sentence",
".",
"getRelations",
"(",
")",
")",
"{",
"for",
"(",
"BioCNode",
"node",
":",
"relation",
".",
"getNodes",
"(",
")",
")",
"{",
"checkArgument",
"(",
"sentence",
".",
"getAnnotation",
"(",
"node",
".",
"getRefid",
"(",
")",
")",
".",
"isPresent",
"(",
")",
",",
"\"Cannot find node %s in relation %s\\n\"",
"+",
"\" Location: %s\"",
",",
"node",
",",
"relation",
",",
"BioCUtils",
".",
"getXPathString",
"(",
"document",
",",
"passage",
",",
"sentence",
")",
")",
";",
"}",
"}",
"}",
"}",
"}"
] |
Checks annotations and ie.
@param document input document
|
[
"Checks",
"annotations",
"and",
"ie",
"."
] |
e09cce1969aa598ff89e7957237375715d7a1a3a
|
https://github.com/yfpeng/pengyifan-bioc/blob/e09cce1969aa598ff89e7957237375715d7a1a3a/src/main/java/com/pengyifan/bioc/util/BioCValidate2.java#L38-L82
|
147,836
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/filters/RedundantMappingFilter.java
|
RedundantMappingFilter.isRedundant
|
private boolean isRedundant(IContextMapping<INode> mapping, IMappingElement<INode> e) {
switch (e.getRelation()) {
case IMappingElement.LESS_GENERAL: {
if (verifyCondition1(mapping, e)) {
return true;
}
break;
}
case IMappingElement.MORE_GENERAL: {
if (verifyCondition2(mapping, e)) {
return true;
}
break;
}
case IMappingElement.DISJOINT: {
if (verifyCondition3(mapping, e)) {
return true;
}
break;
}
case IMappingElement.EQUIVALENCE: {
if (verifyCondition4(mapping, e)) {
return true;
}
break;
}
default: {
return false;
}
}// end switch
return false;
}
|
java
|
private boolean isRedundant(IContextMapping<INode> mapping, IMappingElement<INode> e) {
switch (e.getRelation()) {
case IMappingElement.LESS_GENERAL: {
if (verifyCondition1(mapping, e)) {
return true;
}
break;
}
case IMappingElement.MORE_GENERAL: {
if (verifyCondition2(mapping, e)) {
return true;
}
break;
}
case IMappingElement.DISJOINT: {
if (verifyCondition3(mapping, e)) {
return true;
}
break;
}
case IMappingElement.EQUIVALENCE: {
if (verifyCondition4(mapping, e)) {
return true;
}
break;
}
default: {
return false;
}
}// end switch
return false;
}
|
[
"private",
"boolean",
"isRedundant",
"(",
"IContextMapping",
"<",
"INode",
">",
"mapping",
",",
"IMappingElement",
"<",
"INode",
">",
"e",
")",
"{",
"switch",
"(",
"e",
".",
"getRelation",
"(",
")",
")",
"{",
"case",
"IMappingElement",
".",
"LESS_GENERAL",
":",
"{",
"if",
"(",
"verifyCondition1",
"(",
"mapping",
",",
"e",
")",
")",
"{",
"return",
"true",
";",
"}",
"break",
";",
"}",
"case",
"IMappingElement",
".",
"MORE_GENERAL",
":",
"{",
"if",
"(",
"verifyCondition2",
"(",
"mapping",
",",
"e",
")",
")",
"{",
"return",
"true",
";",
"}",
"break",
";",
"}",
"case",
"IMappingElement",
".",
"DISJOINT",
":",
"{",
"if",
"(",
"verifyCondition3",
"(",
"mapping",
",",
"e",
")",
")",
"{",
"return",
"true",
";",
"}",
"break",
";",
"}",
"case",
"IMappingElement",
".",
"EQUIVALENCE",
":",
"{",
"if",
"(",
"verifyCondition4",
"(",
"mapping",
",",
"e",
")",
")",
"{",
"return",
"true",
";",
"}",
"break",
";",
"}",
"default",
":",
"{",
"return",
"false",
";",
"}",
"}",
"// end switch\r",
"return",
"false",
";",
"}"
] |
Checks the relation between source and target is redundant or not for minimal mapping.
@param mapping a mapping
@param e a mapping element
@return true for redundant relation
|
[
"Checks",
"the",
"relation",
"between",
"source",
"and",
"target",
"is",
"redundant",
"or",
"not",
"for",
"minimal",
"mapping",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/filters/RedundantMappingFilter.java#L65-L98
|
147,837
|
gilberto-torrezan/gwt-views
|
src/main/java/com/github/gilbertotorrezan/gwtviews/client/URLToken.java
|
URLToken.setToken
|
public void setToken(String completeToken) {
clearParameters();
id = "";
if (completeToken != null) {
StringBuilder builder = new StringBuilder();
char[] chs = completeToken.toCharArray();
String currentKey = null;
TokenParseState state = TokenParseState.PARSING_ID;
for (char ch : chs) {
switch (state) {
case PARSING_ID:
if (ch == '&') {
state = TokenParseState.PARSING_KEY;
id = builder.toString();
builder.delete(0, builder.length());
} else {
builder.append(ch);
}
break;
case PARSING_KEY:
if (ch == '=') {
state = TokenParseState.PARSING_VALUE;
currentKey = builder.toString();
if (!currentKey.isEmpty()) {
parameters.put(currentKey, "");
builder.delete(0, builder.length());
}
} else if (ch == '&') {
currentKey = builder.toString();
if (!currentKey.isEmpty()) {
parameters.put(currentKey, "");
builder.delete(0, builder.length());
}
} else {
builder.append(ch);
}
break;
case PARSING_VALUE:
if (ch == '\'') {
state = TokenParseState.PARSING_COMPLEX_VALUE;
} else if (ch == '&') {
state = TokenParseState.PARSING_KEY;
parameters.put(currentKey, builder.toString());
builder.delete(0, builder.length());
} else {
builder.append(ch);
}
break;
case PARSING_COMPLEX_VALUE:
if (ch == '\'') {
state = TokenParseState.PARSED_COMPLEX_VALUE;
parameters.put(currentKey, builder.toString());
builder.delete(0, builder.length());
} else {
builder.append(ch);
}
break;
case PARSED_COMPLEX_VALUE:
if (ch == '&') {
state = TokenParseState.PARSING_KEY;
}
break;
}
}
switch (state) {
case PARSING_ID:
id = builder.toString();
break;
case PARSING_KEY:
currentKey = builder.toString();
if (!currentKey.isEmpty()) {
parameters.put(currentKey, "");
}
break;
case PARSING_COMPLEX_VALUE:
case PARSING_VALUE:
String value = builder.toString();
if (!value.isEmpty() && currentKey != null) {
parameters.put(currentKey, value);
}
break;
default:
break;
}
}
}
|
java
|
public void setToken(String completeToken) {
clearParameters();
id = "";
if (completeToken != null) {
StringBuilder builder = new StringBuilder();
char[] chs = completeToken.toCharArray();
String currentKey = null;
TokenParseState state = TokenParseState.PARSING_ID;
for (char ch : chs) {
switch (state) {
case PARSING_ID:
if (ch == '&') {
state = TokenParseState.PARSING_KEY;
id = builder.toString();
builder.delete(0, builder.length());
} else {
builder.append(ch);
}
break;
case PARSING_KEY:
if (ch == '=') {
state = TokenParseState.PARSING_VALUE;
currentKey = builder.toString();
if (!currentKey.isEmpty()) {
parameters.put(currentKey, "");
builder.delete(0, builder.length());
}
} else if (ch == '&') {
currentKey = builder.toString();
if (!currentKey.isEmpty()) {
parameters.put(currentKey, "");
builder.delete(0, builder.length());
}
} else {
builder.append(ch);
}
break;
case PARSING_VALUE:
if (ch == '\'') {
state = TokenParseState.PARSING_COMPLEX_VALUE;
} else if (ch == '&') {
state = TokenParseState.PARSING_KEY;
parameters.put(currentKey, builder.toString());
builder.delete(0, builder.length());
} else {
builder.append(ch);
}
break;
case PARSING_COMPLEX_VALUE:
if (ch == '\'') {
state = TokenParseState.PARSED_COMPLEX_VALUE;
parameters.put(currentKey, builder.toString());
builder.delete(0, builder.length());
} else {
builder.append(ch);
}
break;
case PARSED_COMPLEX_VALUE:
if (ch == '&') {
state = TokenParseState.PARSING_KEY;
}
break;
}
}
switch (state) {
case PARSING_ID:
id = builder.toString();
break;
case PARSING_KEY:
currentKey = builder.toString();
if (!currentKey.isEmpty()) {
parameters.put(currentKey, "");
}
break;
case PARSING_COMPLEX_VALUE:
case PARSING_VALUE:
String value = builder.toString();
if (!value.isEmpty() && currentKey != null) {
parameters.put(currentKey, value);
}
break;
default:
break;
}
}
}
|
[
"public",
"void",
"setToken",
"(",
"String",
"completeToken",
")",
"{",
"clearParameters",
"(",
")",
";",
"id",
"=",
"\"\"",
";",
"if",
"(",
"completeToken",
"!=",
"null",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"char",
"[",
"]",
"chs",
"=",
"completeToken",
".",
"toCharArray",
"(",
")",
";",
"String",
"currentKey",
"=",
"null",
";",
"TokenParseState",
"state",
"=",
"TokenParseState",
".",
"PARSING_ID",
";",
"for",
"(",
"char",
"ch",
":",
"chs",
")",
"{",
"switch",
"(",
"state",
")",
"{",
"case",
"PARSING_ID",
":",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"{",
"state",
"=",
"TokenParseState",
".",
"PARSING_KEY",
";",
"id",
"=",
"builder",
".",
"toString",
"(",
")",
";",
"builder",
".",
"delete",
"(",
"0",
",",
"builder",
".",
"length",
"(",
")",
")",
";",
"}",
"else",
"{",
"builder",
".",
"append",
"(",
"ch",
")",
";",
"}",
"break",
";",
"case",
"PARSING_KEY",
":",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"{",
"state",
"=",
"TokenParseState",
".",
"PARSING_VALUE",
";",
"currentKey",
"=",
"builder",
".",
"toString",
"(",
")",
";",
"if",
"(",
"!",
"currentKey",
".",
"isEmpty",
"(",
")",
")",
"{",
"parameters",
".",
"put",
"(",
"currentKey",
",",
"\"\"",
")",
";",
"builder",
".",
"delete",
"(",
"0",
",",
"builder",
".",
"length",
"(",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"{",
"currentKey",
"=",
"builder",
".",
"toString",
"(",
")",
";",
"if",
"(",
"!",
"currentKey",
".",
"isEmpty",
"(",
")",
")",
"{",
"parameters",
".",
"put",
"(",
"currentKey",
",",
"\"\"",
")",
";",
"builder",
".",
"delete",
"(",
"0",
",",
"builder",
".",
"length",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"builder",
".",
"append",
"(",
"ch",
")",
";",
"}",
"break",
";",
"case",
"PARSING_VALUE",
":",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"{",
"state",
"=",
"TokenParseState",
".",
"PARSING_COMPLEX_VALUE",
";",
"}",
"else",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"{",
"state",
"=",
"TokenParseState",
".",
"PARSING_KEY",
";",
"parameters",
".",
"put",
"(",
"currentKey",
",",
"builder",
".",
"toString",
"(",
")",
")",
";",
"builder",
".",
"delete",
"(",
"0",
",",
"builder",
".",
"length",
"(",
")",
")",
";",
"}",
"else",
"{",
"builder",
".",
"append",
"(",
"ch",
")",
";",
"}",
"break",
";",
"case",
"PARSING_COMPLEX_VALUE",
":",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"{",
"state",
"=",
"TokenParseState",
".",
"PARSED_COMPLEX_VALUE",
";",
"parameters",
".",
"put",
"(",
"currentKey",
",",
"builder",
".",
"toString",
"(",
")",
")",
";",
"builder",
".",
"delete",
"(",
"0",
",",
"builder",
".",
"length",
"(",
")",
")",
";",
"}",
"else",
"{",
"builder",
".",
"append",
"(",
"ch",
")",
";",
"}",
"break",
";",
"case",
"PARSED_COMPLEX_VALUE",
":",
"if",
"(",
"ch",
"==",
"'",
"'",
")",
"{",
"state",
"=",
"TokenParseState",
".",
"PARSING_KEY",
";",
"}",
"break",
";",
"}",
"}",
"switch",
"(",
"state",
")",
"{",
"case",
"PARSING_ID",
":",
"id",
"=",
"builder",
".",
"toString",
"(",
")",
";",
"break",
";",
"case",
"PARSING_KEY",
":",
"currentKey",
"=",
"builder",
".",
"toString",
"(",
")",
";",
"if",
"(",
"!",
"currentKey",
".",
"isEmpty",
"(",
")",
")",
"{",
"parameters",
".",
"put",
"(",
"currentKey",
",",
"\"\"",
")",
";",
"}",
"break",
";",
"case",
"PARSING_COMPLEX_VALUE",
":",
"case",
"PARSING_VALUE",
":",
"String",
"value",
"=",
"builder",
".",
"toString",
"(",
")",
";",
"if",
"(",
"!",
"value",
".",
"isEmpty",
"(",
")",
"&&",
"currentKey",
"!=",
"null",
")",
"{",
"parameters",
".",
"put",
"(",
"currentKey",
",",
"value",
")",
";",
"}",
"break",
";",
"default",
":",
"break",
";",
"}",
"}",
"}"
] |
Sets the current token, causing it to parse the parameters and the tokenId.
@param completeToken The History token to be parsed, in the form of: <pre>{@code tokenId¶m1=value1¶m2¶m3='complex&value' }</pre>
|
[
"Sets",
"the",
"current",
"token",
"causing",
"it",
"to",
"parse",
"the",
"parameters",
"and",
"the",
"tokenId",
"."
] |
c6511435d14b5aa93a722b0e861230d0ae2159e5
|
https://github.com/gilberto-torrezan/gwt-views/blob/c6511435d14b5aa93a722b0e861230d0ae2159e5/src/main/java/com/github/gilbertotorrezan/gwtviews/client/URLToken.java#L90-L178
|
147,838
|
craterdog/java-smart-objects
|
src/main/java/craterdog/smart/SmartObject.java
|
SmartObject.copy
|
@Override
public <T extends Composite<S>> T copy() {
try {
String fullJSON = fullMapper.writeValueAsString(this);
@SuppressWarnings("unchecked")
T copy = (T) fullMapper.readValue(fullJSON, getClass());
return copy;
} catch (IOException e) {
throw new RuntimeException("The attempted copy of an object failed.", e);
}
}
|
java
|
@Override
public <T extends Composite<S>> T copy() {
try {
String fullJSON = fullMapper.writeValueAsString(this);
@SuppressWarnings("unchecked")
T copy = (T) fullMapper.readValue(fullJSON, getClass());
return copy;
} catch (IOException e) {
throw new RuntimeException("The attempted copy of an object failed.", e);
}
}
|
[
"@",
"Override",
"public",
"<",
"T",
"extends",
"Composite",
"<",
"S",
">",
">",
"T",
"copy",
"(",
")",
"{",
"try",
"{",
"String",
"fullJSON",
"=",
"fullMapper",
".",
"writeValueAsString",
"(",
"this",
")",
";",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"T",
"copy",
"=",
"(",
"T",
")",
"fullMapper",
".",
"readValue",
"(",
"fullJSON",
",",
"getClass",
"(",
")",
")",
";",
"return",
"copy",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"The attempted copy of an object failed.\"",
",",
"e",
")",
";",
"}",
"}"
] |
This method should work for all objects. However, it is very inefficient and should only be
used sparingly and for unit testing.
@param <T> The concrete type of the smart object.
@return An exact copy of the smart object.
|
[
"This",
"method",
"should",
"work",
"for",
"all",
"objects",
".",
"However",
"it",
"is",
"very",
"inefficient",
"and",
"should",
"only",
"be",
"used",
"sparingly",
"and",
"for",
"unit",
"testing",
"."
] |
6d11e2f345e4d2836e3aca3990c8ed2db330d856
|
https://github.com/craterdog/java-smart-objects/blob/6d11e2f345e4d2836e3aca3990c8ed2db330d856/src/main/java/craterdog/smart/SmartObject.java#L133-L143
|
147,839
|
craterdog/java-smart-objects
|
src/main/java/craterdog/smart/SmartObject.java
|
SmartObject.addSerializableClass
|
protected void addSerializableClass(Class<?> serializable, Class<?> mixin) {
safeMapper.addMixIn(serializable, mixin);
fullMapper.addMixIn(serializable, mixin);
}
|
java
|
protected void addSerializableClass(Class<?> serializable, Class<?> mixin) {
safeMapper.addMixIn(serializable, mixin);
fullMapper.addMixIn(serializable, mixin);
}
|
[
"protected",
"void",
"addSerializableClass",
"(",
"Class",
"<",
"?",
">",
"serializable",
",",
"Class",
"<",
"?",
">",
"mixin",
")",
"{",
"safeMapper",
".",
"addMixIn",
"(",
"serializable",
",",
"mixin",
")",
";",
"fullMapper",
".",
"addMixIn",
"(",
"serializable",
",",
"mixin",
")",
";",
"}"
] |
This protected method allows a subclass to add to the mappers a class type that can be
serialized using mixin class.
@param serializable The type of class that can be serialized using its toString() method.
@param mixin The type of class that can be used to serialized the serializable class.
|
[
"This",
"protected",
"method",
"allows",
"a",
"subclass",
"to",
"add",
"to",
"the",
"mappers",
"a",
"class",
"type",
"that",
"can",
"be",
"serialized",
"using",
"mixin",
"class",
"."
] |
6d11e2f345e4d2836e3aca3990c8ed2db330d856
|
https://github.com/craterdog/java-smart-objects/blob/6d11e2f345e4d2836e3aca3990c8ed2db330d856/src/main/java/craterdog/smart/SmartObject.java#L265-L268
|
147,840
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/preprocessors/DefaultContextPreprocessor.java
|
DefaultContextPreprocessor.buildCLabs
|
private IContext buildCLabs(IContext context) throws ContextPreprocessorException {
int counter = 0;
int total = context.getRoot().getDescendantCount() + 1;
int reportInt = (total / 20) + 1;//i.e. report every 5%
for (Iterator<INode> i = context.getNodes(); i.hasNext(); ) {
processNode(i.next());
counter++;
if ((SMatchConstants.LARGE_TREE < total) && (0 == (counter % reportInt)) && log.isEnabledFor(Level.INFO)) {
log.info(100 * counter / total + "%");
}
}
return context;
}
|
java
|
private IContext buildCLabs(IContext context) throws ContextPreprocessorException {
int counter = 0;
int total = context.getRoot().getDescendantCount() + 1;
int reportInt = (total / 20) + 1;//i.e. report every 5%
for (Iterator<INode> i = context.getNodes(); i.hasNext(); ) {
processNode(i.next());
counter++;
if ((SMatchConstants.LARGE_TREE < total) && (0 == (counter % reportInt)) && log.isEnabledFor(Level.INFO)) {
log.info(100 * counter / total + "%");
}
}
return context;
}
|
[
"private",
"IContext",
"buildCLabs",
"(",
"IContext",
"context",
")",
"throws",
"ContextPreprocessorException",
"{",
"int",
"counter",
"=",
"0",
";",
"int",
"total",
"=",
"context",
".",
"getRoot",
"(",
")",
".",
"getDescendantCount",
"(",
")",
"+",
"1",
";",
"int",
"reportInt",
"=",
"(",
"total",
"/",
"20",
")",
"+",
"1",
";",
"//i.e. report every 5%\r",
"for",
"(",
"Iterator",
"<",
"INode",
">",
"i",
"=",
"context",
".",
"getNodes",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"processNode",
"(",
"i",
".",
"next",
"(",
")",
")",
";",
"counter",
"++",
";",
"if",
"(",
"(",
"SMatchConstants",
".",
"LARGE_TREE",
"<",
"total",
")",
"&&",
"(",
"0",
"==",
"(",
"counter",
"%",
"reportInt",
")",
")",
"&&",
"log",
".",
"isEnabledFor",
"(",
"Level",
".",
"INFO",
")",
")",
"{",
"log",
".",
"info",
"(",
"100",
"*",
"counter",
"/",
"total",
"+",
"\"%\"",
")",
";",
"}",
"}",
"return",
"context",
";",
"}"
] |
Constructs cLabs for all nodes of the context.
@param context context of node which cLab to be build
@return context with cLabs
@throws ContextPreprocessorException ContextPreprocessorException
|
[
"Constructs",
"cLabs",
"for",
"all",
"nodes",
"of",
"the",
"context",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/preprocessors/DefaultContextPreprocessor.java#L166-L181
|
147,841
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/preprocessors/DefaultContextPreprocessor.java
|
DefaultContextPreprocessor.isTokenMeaningful
|
private boolean isTokenMeaningful(String token) {
token = token.trim();
return andWords.contains(token) || orWords.contains(token) || token.length() >= 3;
}
|
java
|
private boolean isTokenMeaningful(String token) {
token = token.trim();
return andWords.contains(token) || orWords.contains(token) || token.length() >= 3;
}
|
[
"private",
"boolean",
"isTokenMeaningful",
"(",
"String",
"token",
")",
"{",
"token",
"=",
"token",
".",
"trim",
"(",
")",
";",
"return",
"andWords",
".",
"contains",
"(",
"token",
")",
"||",
"orWords",
".",
"contains",
"(",
"token",
")",
"||",
"token",
".",
"length",
"(",
")",
">=",
"3",
";",
"}"
] |
Checks the token is meaningful or not.
@param token the token
@return true if the token is meaningful
|
[
"Checks",
"the",
"token",
"is",
"meaningful",
"or",
"not",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/preprocessors/DefaultContextPreprocessor.java#L338-L341
|
147,842
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/preprocessors/DefaultContextPreprocessor.java
|
DefaultContextPreprocessor.complexWordsRecognition
|
private List<String> complexWordsRecognition(String token) throws ContextPreprocessorException {
List<String> result = new ArrayList<String>();
try {
List<ISense> senses = new ArrayList<ISense>();
int i = 0;
String start = null;
String end = null;
String toCheck = null;
boolean flag = false;
boolean multiword = false;
while ((i < token.length() - 1) && (0 == senses.size())) {
i++;
start = token.substring(0, i);
end = token.substring(i, token.length());
toCheck = start + ' ' + end;
senses = linguisticOracle.getSenses(toCheck);
if (0 == senses.size()) {
toCheck = start + '-' + end;
senses = linguisticOracle.getSenses(toCheck);
}
if (0 < senses.size()) {
multiword = true;
break;
} else {
if ((start.length() > 3) && (end.length() > 3)) {
senses = linguisticOracle.getSenses(start);
if (0 < senses.size()) {
senses = linguisticOracle.getSenses(end);
if (0 < senses.size()) {
flag = true;
break;
}
}
}
}
}
if (multiword) {
result.add(toCheck);
return result;
}
if (flag) {
result.add(start);
result.add(end);
return result;
}
return result;
} catch (LinguisticOracleException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new ContextPreprocessorException(errMessage, e);
}
}
|
java
|
private List<String> complexWordsRecognition(String token) throws ContextPreprocessorException {
List<String> result = new ArrayList<String>();
try {
List<ISense> senses = new ArrayList<ISense>();
int i = 0;
String start = null;
String end = null;
String toCheck = null;
boolean flag = false;
boolean multiword = false;
while ((i < token.length() - 1) && (0 == senses.size())) {
i++;
start = token.substring(0, i);
end = token.substring(i, token.length());
toCheck = start + ' ' + end;
senses = linguisticOracle.getSenses(toCheck);
if (0 == senses.size()) {
toCheck = start + '-' + end;
senses = linguisticOracle.getSenses(toCheck);
}
if (0 < senses.size()) {
multiword = true;
break;
} else {
if ((start.length() > 3) && (end.length() > 3)) {
senses = linguisticOracle.getSenses(start);
if (0 < senses.size()) {
senses = linguisticOracle.getSenses(end);
if (0 < senses.size()) {
flag = true;
break;
}
}
}
}
}
if (multiword) {
result.add(toCheck);
return result;
}
if (flag) {
result.add(start);
result.add(end);
return result;
}
return result;
} catch (LinguisticOracleException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new ContextPreprocessorException(errMessage, e);
}
}
|
[
"private",
"List",
"<",
"String",
">",
"complexWordsRecognition",
"(",
"String",
"token",
")",
"throws",
"ContextPreprocessorException",
"{",
"List",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"try",
"{",
"List",
"<",
"ISense",
">",
"senses",
"=",
"new",
"ArrayList",
"<",
"ISense",
">",
"(",
")",
";",
"int",
"i",
"=",
"0",
";",
"String",
"start",
"=",
"null",
";",
"String",
"end",
"=",
"null",
";",
"String",
"toCheck",
"=",
"null",
";",
"boolean",
"flag",
"=",
"false",
";",
"boolean",
"multiword",
"=",
"false",
";",
"while",
"(",
"(",
"i",
"<",
"token",
".",
"length",
"(",
")",
"-",
"1",
")",
"&&",
"(",
"0",
"==",
"senses",
".",
"size",
"(",
")",
")",
")",
"{",
"i",
"++",
";",
"start",
"=",
"token",
".",
"substring",
"(",
"0",
",",
"i",
")",
";",
"end",
"=",
"token",
".",
"substring",
"(",
"i",
",",
"token",
".",
"length",
"(",
")",
")",
";",
"toCheck",
"=",
"start",
"+",
"'",
"'",
"+",
"end",
";",
"senses",
"=",
"linguisticOracle",
".",
"getSenses",
"(",
"toCheck",
")",
";",
"if",
"(",
"0",
"==",
"senses",
".",
"size",
"(",
")",
")",
"{",
"toCheck",
"=",
"start",
"+",
"'",
"'",
"+",
"end",
";",
"senses",
"=",
"linguisticOracle",
".",
"getSenses",
"(",
"toCheck",
")",
";",
"}",
"if",
"(",
"0",
"<",
"senses",
".",
"size",
"(",
")",
")",
"{",
"multiword",
"=",
"true",
";",
"break",
";",
"}",
"else",
"{",
"if",
"(",
"(",
"start",
".",
"length",
"(",
")",
">",
"3",
")",
"&&",
"(",
"end",
".",
"length",
"(",
")",
">",
"3",
")",
")",
"{",
"senses",
"=",
"linguisticOracle",
".",
"getSenses",
"(",
"start",
")",
";",
"if",
"(",
"0",
"<",
"senses",
".",
"size",
"(",
")",
")",
"{",
"senses",
"=",
"linguisticOracle",
".",
"getSenses",
"(",
"end",
")",
";",
"if",
"(",
"0",
"<",
"senses",
".",
"size",
"(",
")",
")",
"{",
"flag",
"=",
"true",
";",
"break",
";",
"}",
"}",
"}",
"}",
"}",
"if",
"(",
"multiword",
")",
"{",
"result",
".",
"add",
"(",
"toCheck",
")",
";",
"return",
"result",
";",
"}",
"if",
"(",
"flag",
")",
"{",
"result",
".",
"add",
"(",
"start",
")",
";",
"result",
".",
"add",
"(",
"end",
")",
";",
"return",
"result",
";",
"}",
"return",
"result",
";",
"}",
"catch",
"(",
"LinguisticOracleException",
"e",
")",
"{",
"final",
"String",
"errMessage",
"=",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\": \"",
"+",
"e",
".",
"getMessage",
"(",
")",
";",
"log",
".",
"error",
"(",
"errMessage",
",",
"e",
")",
";",
"throw",
"new",
"ContextPreprocessorException",
"(",
"errMessage",
",",
"e",
")",
";",
"}",
"}"
] |
Finds out if the input token is a complex word or not using WordNet. Tries to insert spaces and dash
between all characters and searches for the result to be in WordNet.
@param token token
@return a list which contains parts of the complex word
@throws ContextPreprocessorException ContextPreprocessorException
|
[
"Finds",
"out",
"if",
"the",
"input",
"token",
"is",
"a",
"complex",
"word",
"or",
"not",
"using",
"WordNet",
".",
"Tries",
"to",
"insert",
"spaces",
"and",
"dash",
"between",
"all",
"characters",
"and",
"searches",
"for",
"the",
"result",
"to",
"be",
"in",
"WordNet",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/preprocessors/DefaultContextPreprocessor.java#L351-L403
|
147,843
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/preprocessors/DefaultContextPreprocessor.java
|
DefaultContextPreprocessor.replacePunctuation
|
private static String replacePunctuation(String lemma) {
lemma = lemma.replace(",", " , ");
lemma = lemma.replace('.', ' ');
// lemma = lemma.replace('-', ' ');
lemma = lemma.replace('\'', ' ');
lemma = lemma.replace('(', ' ');
lemma = lemma.replace(')', ' ');
lemma = lemma.replace(':', ' ');
lemma = lemma.replace(";", " ; ");
return lemma;
}
|
java
|
private static String replacePunctuation(String lemma) {
lemma = lemma.replace(",", " , ");
lemma = lemma.replace('.', ' ');
// lemma = lemma.replace('-', ' ');
lemma = lemma.replace('\'', ' ');
lemma = lemma.replace('(', ' ');
lemma = lemma.replace(')', ' ');
lemma = lemma.replace(':', ' ');
lemma = lemma.replace(";", " ; ");
return lemma;
}
|
[
"private",
"static",
"String",
"replacePunctuation",
"(",
"String",
"lemma",
")",
"{",
"lemma",
"=",
"lemma",
".",
"replace",
"(",
"\",\"",
",",
"\" , \"",
")",
";",
"lemma",
"=",
"lemma",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"// lemma = lemma.replace('-', ' ');\r",
"lemma",
"=",
"lemma",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"lemma",
"=",
"lemma",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"lemma",
"=",
"lemma",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"lemma",
"=",
"lemma",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"lemma",
"=",
"lemma",
".",
"replace",
"(",
"\";\"",
",",
"\" ; \"",
")",
";",
"return",
"lemma",
";",
"}"
] |
Replaces punctuation by spaces.
@param lemma input string
@return string with spaces in place of punctuation
|
[
"Replaces",
"punctuation",
"by",
"spaces",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/preprocessors/DefaultContextPreprocessor.java#L554-L564
|
147,844
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/preprocessors/DefaultContextPreprocessor.java
|
DefaultContextPreprocessor.isNumber
|
private boolean isNumber(String in1) {
//noinspection LoopStatementThatDoesntLoop
for (StringTokenizer stringTokenizer = new StringTokenizer(in1, numberCharacters); stringTokenizer.hasMoreTokens(); ) {
return false;
}
return true;
}
|
java
|
private boolean isNumber(String in1) {
//noinspection LoopStatementThatDoesntLoop
for (StringTokenizer stringTokenizer = new StringTokenizer(in1, numberCharacters); stringTokenizer.hasMoreTokens(); ) {
return false;
}
return true;
}
|
[
"private",
"boolean",
"isNumber",
"(",
"String",
"in1",
")",
"{",
"//noinspection LoopStatementThatDoesntLoop\r",
"for",
"(",
"StringTokenizer",
"stringTokenizer",
"=",
"new",
"StringTokenizer",
"(",
"in1",
",",
"numberCharacters",
")",
";",
"stringTokenizer",
".",
"hasMoreTokens",
"(",
")",
";",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Checks whether input string contains a number or not.
@param in1 input string
@return false if it contains a number
|
[
"Checks",
"whether",
"input",
"string",
"contains",
"a",
"number",
"or",
"not",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/preprocessors/DefaultContextPreprocessor.java#L736-L742
|
147,845
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/preprocessors/DefaultContextPreprocessor.java
|
DefaultContextPreprocessor.extendedIndexOf
|
private int extendedIndexOf(List<String> vec, String str, int init_pos) throws ContextPreprocessorException {
try {
// for all words in the input list starting from init_pos
for (int i = init_pos; i < vec.size(); i++) {
String vel = vec.get(i);
// try syntactic
if (vel.equals(str)) {
return i;
} else if (vel.indexOf(str) == 0) {
// and semantic comparison
if (linguisticOracle.isEqual(vel, str)) {
vec.add(i, str);
vec.remove(i + 1);
return i;
}
}
}
return -1;
} catch (LinguisticOracleException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new ContextPreprocessorException(errMessage, e);
}
}
|
java
|
private int extendedIndexOf(List<String> vec, String str, int init_pos) throws ContextPreprocessorException {
try {
// for all words in the input list starting from init_pos
for (int i = init_pos; i < vec.size(); i++) {
String vel = vec.get(i);
// try syntactic
if (vel.equals(str)) {
return i;
} else if (vel.indexOf(str) == 0) {
// and semantic comparison
if (linguisticOracle.isEqual(vel, str)) {
vec.add(i, str);
vec.remove(i + 1);
return i;
}
}
}
return -1;
} catch (LinguisticOracleException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new ContextPreprocessorException(errMessage, e);
}
}
|
[
"private",
"int",
"extendedIndexOf",
"(",
"List",
"<",
"String",
">",
"vec",
",",
"String",
"str",
",",
"int",
"init_pos",
")",
"throws",
"ContextPreprocessorException",
"{",
"try",
"{",
"// for all words in the input list starting from init_pos\r",
"for",
"(",
"int",
"i",
"=",
"init_pos",
";",
"i",
"<",
"vec",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"String",
"vel",
"=",
"vec",
".",
"get",
"(",
"i",
")",
";",
"// try syntactic\r",
"if",
"(",
"vel",
".",
"equals",
"(",
"str",
")",
")",
"{",
"return",
"i",
";",
"}",
"else",
"if",
"(",
"vel",
".",
"indexOf",
"(",
"str",
")",
"==",
"0",
")",
"{",
"// and semantic comparison\r",
"if",
"(",
"linguisticOracle",
".",
"isEqual",
"(",
"vel",
",",
"str",
")",
")",
"{",
"vec",
".",
"add",
"(",
"i",
",",
"str",
")",
";",
"vec",
".",
"remove",
"(",
"i",
"+",
"1",
")",
";",
"return",
"i",
";",
"}",
"}",
"}",
"return",
"-",
"1",
";",
"}",
"catch",
"(",
"LinguisticOracleException",
"e",
")",
"{",
"final",
"String",
"errMessage",
"=",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\": \"",
"+",
"e",
".",
"getMessage",
"(",
")",
";",
"log",
".",
"error",
"(",
"errMessage",
",",
"e",
")",
";",
"throw",
"new",
"ContextPreprocessorException",
"(",
"errMessage",
",",
"e",
")",
";",
"}",
"}"
] |
An extension of the list indexOf method which uses approximate comparison of the words as
elements of the List.
@param vec list of strings
@param str string to search
@param init_pos start position
@return position
@throws ContextPreprocessorException ContextPreprocessorException
|
[
"An",
"extension",
"of",
"the",
"list",
"indexOf",
"method",
"which",
"uses",
"approximate",
"comparison",
"of",
"the",
"words",
"as",
"elements",
"of",
"the",
"List",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/preprocessors/DefaultContextPreprocessor.java#L754-L777
|
147,846
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/TextFormat.java
|
TextFormat.shortDebugString
|
public static String shortDebugString(final MessageOrBuilder message) {
try {
final StringBuilder sb = new StringBuilder();
SINGLE_LINE_PRINTER.print(message, new TextGenerator(sb));
// Single line mode currently might have an extra space at the end.
return sb.toString().trim();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
|
java
|
public static String shortDebugString(final MessageOrBuilder message) {
try {
final StringBuilder sb = new StringBuilder();
SINGLE_LINE_PRINTER.print(message, new TextGenerator(sb));
// Single line mode currently might have an extra space at the end.
return sb.toString().trim();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
|
[
"public",
"static",
"String",
"shortDebugString",
"(",
"final",
"MessageOrBuilder",
"message",
")",
"{",
"try",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"SINGLE_LINE_PRINTER",
".",
"print",
"(",
"message",
",",
"new",
"TextGenerator",
"(",
"sb",
")",
")",
";",
"// Single line mode currently might have an extra space at the end.",
"return",
"sb",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"}"
] |
Generates a human readable form of this message, useful for debugging and
other purposes, with no newline characters.
|
[
"Generates",
"a",
"human",
"readable",
"form",
"of",
"this",
"message",
"useful",
"for",
"debugging",
"and",
"other",
"purposes",
"with",
"no",
"newline",
"characters",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/TextFormat.java#L85-L94
|
147,847
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/TextFormat.java
|
TextFormat.shortDebugString
|
public static String shortDebugString(final UnknownFieldSet fields) {
try {
final StringBuilder sb = new StringBuilder();
SINGLE_LINE_PRINTER.printUnknownFields(fields, new TextGenerator(sb));
// Single line mode currently might have an extra space at the end.
return sb.toString().trim();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
|
java
|
public static String shortDebugString(final UnknownFieldSet fields) {
try {
final StringBuilder sb = new StringBuilder();
SINGLE_LINE_PRINTER.printUnknownFields(fields, new TextGenerator(sb));
// Single line mode currently might have an extra space at the end.
return sb.toString().trim();
} catch (IOException e) {
throw new IllegalStateException(e);
}
}
|
[
"public",
"static",
"String",
"shortDebugString",
"(",
"final",
"UnknownFieldSet",
"fields",
")",
"{",
"try",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"SINGLE_LINE_PRINTER",
".",
"printUnknownFields",
"(",
"fields",
",",
"new",
"TextGenerator",
"(",
"sb",
")",
")",
";",
"// Single line mode currently might have an extra space at the end.",
"return",
"sb",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"}"
] |
Generates a human readable form of the unknown fields, useful for debugging
and other purposes, with no newline characters.
|
[
"Generates",
"a",
"human",
"readable",
"form",
"of",
"the",
"unknown",
"fields",
"useful",
"for",
"debugging",
"and",
"other",
"purposes",
"with",
"no",
"newline",
"characters",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/TextFormat.java#L100-L109
|
147,848
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/TextFormat.java
|
TextFormat.printUnknownFieldValue
|
public static void printUnknownFieldValue(final int tag,
final Object value,
final Appendable output)
throws IOException {
printUnknownFieldValue(tag, value, new TextGenerator(output));
}
|
java
|
public static void printUnknownFieldValue(final int tag,
final Object value,
final Appendable output)
throws IOException {
printUnknownFieldValue(tag, value, new TextGenerator(output));
}
|
[
"public",
"static",
"void",
"printUnknownFieldValue",
"(",
"final",
"int",
"tag",
",",
"final",
"Object",
"value",
",",
"final",
"Appendable",
"output",
")",
"throws",
"IOException",
"{",
"printUnknownFieldValue",
"(",
"tag",
",",
"value",
",",
"new",
"TextGenerator",
"(",
"output",
")",
")",
";",
"}"
] |
Outputs a textual representation of the value of an unknown field.
@param tag the field's tag number
@param value the value of the field
@param output the output to which to append the formatted value
@throws ClassCastException if the value is not appropriate for the
given field descriptor
@throws IOException if there is an exception writing to the output
|
[
"Outputs",
"a",
"textual",
"representation",
"of",
"the",
"value",
"of",
"an",
"unknown",
"field",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/TextFormat.java#L212-L217
|
147,849
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/TextFormat.java
|
TextFormat.unsignedToString
|
private static String unsignedToString(final long value) {
if (value >= 0) {
return Long.toString(value);
} else {
// Pull off the most-significant bit so that BigInteger doesn't think
// the number is negative, then set it again using setBit().
return BigInteger.valueOf(value & 0x7FFFFFFFFFFFFFFFL)
.setBit(63).toString();
}
}
|
java
|
private static String unsignedToString(final long value) {
if (value >= 0) {
return Long.toString(value);
} else {
// Pull off the most-significant bit so that BigInteger doesn't think
// the number is negative, then set it again using setBit().
return BigInteger.valueOf(value & 0x7FFFFFFFFFFFFFFFL)
.setBit(63).toString();
}
}
|
[
"private",
"static",
"String",
"unsignedToString",
"(",
"final",
"long",
"value",
")",
"{",
"if",
"(",
"value",
">=",
"0",
")",
"{",
"return",
"Long",
".",
"toString",
"(",
"value",
")",
";",
"}",
"else",
"{",
"// Pull off the most-significant bit so that BigInteger doesn't think",
"// the number is negative, then set it again using setBit().",
"return",
"BigInteger",
".",
"valueOf",
"(",
"value",
"&",
"0x7FFFFFFFFFFFFFFF",
"L",
")",
".",
"setBit",
"(",
"63",
")",
".",
"toString",
"(",
")",
";",
"}",
"}"
] |
Convert an unsigned 64-bit integer to a string.
|
[
"Convert",
"an",
"unsigned",
"64",
"-",
"bit",
"integer",
"to",
"a",
"string",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/TextFormat.java#L467-L476
|
147,850
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/swing/StatusBar.java
|
StatusBar.addZone
|
public void addZone(String id, Component zone, String constraints) {
// is there already a zone with this id?
Component previousZone = getZone(id);
if (previousZone != null) {
remove(previousZone);
idToZones.remove(id);
}
if (zone instanceof JComponent) {
JComponent jc = (JComponent) zone;
if (jc.getBorder() == null || jc.getBorder() instanceof UIResource) {
if (jc instanceof JLabel) {
jc.setBorder(
new CompoundBorder(zoneBorder, new EmptyBorder(0, 2, 0, 2)));
((JLabel) jc).setText(" ");
} else {
jc.setBorder(zoneBorder);
}
}
}
add(zone, constraints);
idToZones.put(id, zone);
}
|
java
|
public void addZone(String id, Component zone, String constraints) {
// is there already a zone with this id?
Component previousZone = getZone(id);
if (previousZone != null) {
remove(previousZone);
idToZones.remove(id);
}
if (zone instanceof JComponent) {
JComponent jc = (JComponent) zone;
if (jc.getBorder() == null || jc.getBorder() instanceof UIResource) {
if (jc instanceof JLabel) {
jc.setBorder(
new CompoundBorder(zoneBorder, new EmptyBorder(0, 2, 0, 2)));
((JLabel) jc).setText(" ");
} else {
jc.setBorder(zoneBorder);
}
}
}
add(zone, constraints);
idToZones.put(id, zone);
}
|
[
"public",
"void",
"addZone",
"(",
"String",
"id",
",",
"Component",
"zone",
",",
"String",
"constraints",
")",
"{",
"// is there already a zone with this id?",
"Component",
"previousZone",
"=",
"getZone",
"(",
"id",
")",
";",
"if",
"(",
"previousZone",
"!=",
"null",
")",
"{",
"remove",
"(",
"previousZone",
")",
";",
"idToZones",
".",
"remove",
"(",
"id",
")",
";",
"}",
"if",
"(",
"zone",
"instanceof",
"JComponent",
")",
"{",
"JComponent",
"jc",
"=",
"(",
"JComponent",
")",
"zone",
";",
"if",
"(",
"jc",
".",
"getBorder",
"(",
")",
"==",
"null",
"||",
"jc",
".",
"getBorder",
"(",
")",
"instanceof",
"UIResource",
")",
"{",
"if",
"(",
"jc",
"instanceof",
"JLabel",
")",
"{",
"jc",
".",
"setBorder",
"(",
"new",
"CompoundBorder",
"(",
"zoneBorder",
",",
"new",
"EmptyBorder",
"(",
"0",
",",
"2",
",",
"0",
",",
"2",
")",
")",
")",
";",
"(",
"(",
"JLabel",
")",
"jc",
")",
".",
"setText",
"(",
"\" \"",
")",
";",
"}",
"else",
"{",
"jc",
".",
"setBorder",
"(",
"zoneBorder",
")",
";",
"}",
"}",
"}",
"add",
"(",
"zone",
",",
"constraints",
")",
";",
"idToZones",
".",
"put",
"(",
"id",
",",
"zone",
")",
";",
"}"
] |
Adds a new zone in the StatusBar.
@param id
@param zone
@param constraints one of the constraint support by the
{@link com.l2fprod.common.swing.PercentLayout}
|
[
"Adds",
"a",
"new",
"zone",
"in",
"the",
"StatusBar",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/StatusBar.java#L67-L90
|
147,851
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/loaders/context/StringFunctionLoader.java
|
StringFunctionLoader.loadContext
|
public IContext loadContext(String function) throws ContextLoaderException {
IContext result = new Context();
parse(function, result, null);
createIds(result);
log.info("Parsed nodes: " + nodesParsed);
return result;
}
|
java
|
public IContext loadContext(String function) throws ContextLoaderException {
IContext result = new Context();
parse(function, result, null);
createIds(result);
log.info("Parsed nodes: " + nodesParsed);
return result;
}
|
[
"public",
"IContext",
"loadContext",
"(",
"String",
"function",
")",
"throws",
"ContextLoaderException",
"{",
"IContext",
"result",
"=",
"new",
"Context",
"(",
")",
";",
"parse",
"(",
"function",
",",
"result",
",",
"null",
")",
";",
"createIds",
"(",
"result",
")",
";",
"log",
".",
"info",
"(",
"\"Parsed nodes: \"",
"+",
"nodesParsed",
")",
";",
"return",
"result",
";",
"}"
] |
Converts the string with a function into a tree.
@param function a single line with the string in the format: fn(arg,arg,..), where arg can be fn(arg,..)
@return tree representation of the function
|
[
"Converts",
"the",
"string",
"with",
"a",
"function",
"into",
"a",
"tree",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/loaders/context/StringFunctionLoader.java#L36-L42
|
147,852
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/loaders/context/StringFunctionLoader.java
|
StringFunctionLoader.parse
|
static void parse(String inString, IContext context, INode parent) {
List<String> tokens = getCommaTokens(inString);
for (String token : tokens) {
int isFunction = token.indexOf(OPEN_PARENTHESIS);
if (isFunction >= 0) {
String funcName = token.substring(0, isFunction);
INode newParent = addChild(parent, context, funcName);
String arguments = token.substring(isFunction + 1, token.length() - 1);
parse(arguments, context, newParent);
} else {
addChild(parent, context, token);
}
}
}
|
java
|
static void parse(String inString, IContext context, INode parent) {
List<String> tokens = getCommaTokens(inString);
for (String token : tokens) {
int isFunction = token.indexOf(OPEN_PARENTHESIS);
if (isFunction >= 0) {
String funcName = token.substring(0, isFunction);
INode newParent = addChild(parent, context, funcName);
String arguments = token.substring(isFunction + 1, token.length() - 1);
parse(arguments, context, newParent);
} else {
addChild(parent, context, token);
}
}
}
|
[
"static",
"void",
"parse",
"(",
"String",
"inString",
",",
"IContext",
"context",
",",
"INode",
"parent",
")",
"{",
"List",
"<",
"String",
">",
"tokens",
"=",
"getCommaTokens",
"(",
"inString",
")",
";",
"for",
"(",
"String",
"token",
":",
"tokens",
")",
"{",
"int",
"isFunction",
"=",
"token",
".",
"indexOf",
"(",
"OPEN_PARENTHESIS",
")",
";",
"if",
"(",
"isFunction",
">=",
"0",
")",
"{",
"String",
"funcName",
"=",
"token",
".",
"substring",
"(",
"0",
",",
"isFunction",
")",
";",
"INode",
"newParent",
"=",
"addChild",
"(",
"parent",
",",
"context",
",",
"funcName",
")",
";",
"String",
"arguments",
"=",
"token",
".",
"substring",
"(",
"isFunction",
"+",
"1",
",",
"token",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"parse",
"(",
"arguments",
",",
"context",
",",
"newParent",
")",
";",
"}",
"else",
"{",
"addChild",
"(",
"parent",
",",
"context",
",",
"token",
")",
";",
"}",
"}",
"}"
] |
Parses the string to get the children of the given node.
@param inString string to be parsed
@param context a tree being created
@param parent the parent node of the parsed tokens
|
[
"Parses",
"the",
"string",
"to",
"get",
"the",
"children",
"of",
"the",
"given",
"node",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/loaders/context/StringFunctionLoader.java#L59-L72
|
147,853
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/loaders/context/StringFunctionLoader.java
|
StringFunctionLoader.getCommaTokens
|
static List<String> getCommaTokens(String inString) {
String input = inString.trim();
List<String> tokens = new ArrayList<String>();
String token;
while (0 < input.length()) {
if (COMMA == input.charAt(0)) {
input = input.substring(1);
}
token = getNextCommaToken(input);
input = input.substring(token.length());
tokens.add(token.trim());
}
return tokens;
}
|
java
|
static List<String> getCommaTokens(String inString) {
String input = inString.trim();
List<String> tokens = new ArrayList<String>();
String token;
while (0 < input.length()) {
if (COMMA == input.charAt(0)) {
input = input.substring(1);
}
token = getNextCommaToken(input);
input = input.substring(token.length());
tokens.add(token.trim());
}
return tokens;
}
|
[
"static",
"List",
"<",
"String",
">",
"getCommaTokens",
"(",
"String",
"inString",
")",
"{",
"String",
"input",
"=",
"inString",
".",
"trim",
"(",
")",
";",
"List",
"<",
"String",
">",
"tokens",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"String",
"token",
";",
"while",
"(",
"0",
"<",
"input",
".",
"length",
"(",
")",
")",
"{",
"if",
"(",
"COMMA",
"==",
"input",
".",
"charAt",
"(",
"0",
")",
")",
"{",
"input",
"=",
"input",
".",
"substring",
"(",
"1",
")",
";",
"}",
"token",
"=",
"getNextCommaToken",
"(",
"input",
")",
";",
"input",
"=",
"input",
".",
"substring",
"(",
"token",
".",
"length",
"(",
")",
")",
";",
"tokens",
".",
"add",
"(",
"token",
".",
"trim",
"(",
")",
")",
";",
"}",
"return",
"tokens",
";",
"}"
] |
Tokenizes the string into siblings.
@param inString string to be parsed, in the form arg,arg,.. where arg can be fn(arg,arg,..)
@return vector of siblings
|
[
"Tokenizes",
"the",
"string",
"into",
"siblings",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/loaders/context/StringFunctionLoader.java#L100-L116
|
147,854
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/loaders/context/StringFunctionLoader.java
|
StringFunctionLoader.getNextCommaToken
|
static String getNextCommaToken(String inString) {
String token = "";
//number of open parenthesis
int parenthesis = 0;
for (int i = 0; i < inString.length(); i++) {
if (OPEN_PARENTHESIS == inString.charAt(i)) {
parenthesis++;
token += inString.charAt(i);
} else if (CLOSE_PARENTHESIS == inString.charAt(i)) {
parenthesis--;
token += inString.charAt(i);
} else if (COMMA == inString.charAt(i)) {
//if there is no open parenthesis finish
if (parenthesis == 0) {
break;
} else {
token += inString.charAt(i);
}
} else {
token += inString.charAt(i);
}
}
return token;
}
|
java
|
static String getNextCommaToken(String inString) {
String token = "";
//number of open parenthesis
int parenthesis = 0;
for (int i = 0; i < inString.length(); i++) {
if (OPEN_PARENTHESIS == inString.charAt(i)) {
parenthesis++;
token += inString.charAt(i);
} else if (CLOSE_PARENTHESIS == inString.charAt(i)) {
parenthesis--;
token += inString.charAt(i);
} else if (COMMA == inString.charAt(i)) {
//if there is no open parenthesis finish
if (parenthesis == 0) {
break;
} else {
token += inString.charAt(i);
}
} else {
token += inString.charAt(i);
}
}
return token;
}
|
[
"static",
"String",
"getNextCommaToken",
"(",
"String",
"inString",
")",
"{",
"String",
"token",
"=",
"\"\"",
";",
"//number of open parenthesis\r",
"int",
"parenthesis",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"inString",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"OPEN_PARENTHESIS",
"==",
"inString",
".",
"charAt",
"(",
"i",
")",
")",
"{",
"parenthesis",
"++",
";",
"token",
"+=",
"inString",
".",
"charAt",
"(",
"i",
")",
";",
"}",
"else",
"if",
"(",
"CLOSE_PARENTHESIS",
"==",
"inString",
".",
"charAt",
"(",
"i",
")",
")",
"{",
"parenthesis",
"--",
";",
"token",
"+=",
"inString",
".",
"charAt",
"(",
"i",
")",
";",
"}",
"else",
"if",
"(",
"COMMA",
"==",
"inString",
".",
"charAt",
"(",
"i",
")",
")",
"{",
"//if there is no open parenthesis finish\r",
"if",
"(",
"parenthesis",
"==",
"0",
")",
"{",
"break",
";",
"}",
"else",
"{",
"token",
"+=",
"inString",
".",
"charAt",
"(",
"i",
")",
";",
"}",
"}",
"else",
"{",
"token",
"+=",
"inString",
".",
"charAt",
"(",
"i",
")",
";",
"}",
"}",
"return",
"token",
";",
"}"
] |
Computes the first argument from a list of arguments
@param inString arg,arg,... arg can also be fn(arg,..)
@return the first argument of the given string
|
[
"Computes",
"the",
"first",
"argument",
"from",
"a",
"list",
"of",
"arguments"
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/loaders/context/StringFunctionLoader.java#L124-L154
|
147,855
|
innoq/LiQID
|
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapNode.java
|
LdapNode.get
|
@Override
public String get(String key) {
if("dn".equals(key)) {
return this.dn;
} else if (key != null
&& attributes != null
&& getKeys().contains(key)
&& attributes.get(key) != null) {
return attributes.get(key).toString().replace(key + ":", "").trim();
}
return null;
}
|
java
|
@Override
public String get(String key) {
if("dn".equals(key)) {
return this.dn;
} else if (key != null
&& attributes != null
&& getKeys().contains(key)
&& attributes.get(key) != null) {
return attributes.get(key).toString().replace(key + ":", "").trim();
}
return null;
}
|
[
"@",
"Override",
"public",
"String",
"get",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"\"dn\"",
".",
"equals",
"(",
"key",
")",
")",
"{",
"return",
"this",
".",
"dn",
";",
"}",
"else",
"if",
"(",
"key",
"!=",
"null",
"&&",
"attributes",
"!=",
"null",
"&&",
"getKeys",
"(",
")",
".",
"contains",
"(",
"key",
")",
"&&",
"attributes",
".",
"get",
"(",
"key",
")",
"!=",
"null",
")",
"{",
"return",
"attributes",
".",
"get",
"(",
"key",
")",
".",
"toString",
"(",
")",
".",
"replace",
"(",
"key",
"+",
"\":\"",
",",
"\"\"",
")",
".",
"trim",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns an entry for a given key.
@param key the key for the entry.
@return the value of the entry, null if the entry does not exists.
|
[
"Returns",
"an",
"entry",
"for",
"a",
"given",
"key",
"."
] |
ae3de2c1fd78c40219780d510eba57c931901279
|
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapNode.java#L51-L62
|
147,856
|
innoq/LiQID
|
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapNode.java
|
LdapNode.set
|
@Override
public void set(String key, String value) {
if("dn".equals(key)) {
this.dn = value;
} else if (value != null
&& !value.isEmpty()
&& key != null
&& !key.isEmpty()) {
addAttribute(new BasicAttribute(key, value, true));
}
}
|
java
|
@Override
public void set(String key, String value) {
if("dn".equals(key)) {
this.dn = value;
} else if (value != null
&& !value.isEmpty()
&& key != null
&& !key.isEmpty()) {
addAttribute(new BasicAttribute(key, value, true));
}
}
|
[
"@",
"Override",
"public",
"void",
"set",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"\"dn\"",
".",
"equals",
"(",
"key",
")",
")",
"{",
"this",
".",
"dn",
"=",
"value",
";",
"}",
"else",
"if",
"(",
"value",
"!=",
"null",
"&&",
"!",
"value",
".",
"isEmpty",
"(",
")",
"&&",
"key",
"!=",
"null",
"&&",
"!",
"key",
".",
"isEmpty",
"(",
")",
")",
"{",
"addAttribute",
"(",
"new",
"BasicAttribute",
"(",
"key",
",",
"value",
",",
"true",
")",
")",
";",
"}",
"}"
] |
Sets the value of an entry.
@param key the key of that entry.
@param value the new value for that entry.
|
[
"Sets",
"the",
"value",
"of",
"an",
"entry",
"."
] |
ae3de2c1fd78c40219780d510eba57c931901279
|
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapNode.java#L81-L91
|
147,857
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/OnShutdown.java
|
OnShutdown.deleteAtExit
|
public synchronized void deleteAtExit(FileNode node) {
if (delete == null) {
// already exiting
tryDelete(node);
} else {
delete.add(node);
}
}
|
java
|
public synchronized void deleteAtExit(FileNode node) {
if (delete == null) {
// already exiting
tryDelete(node);
} else {
delete.add(node);
}
}
|
[
"public",
"synchronized",
"void",
"deleteAtExit",
"(",
"FileNode",
"node",
")",
"{",
"if",
"(",
"delete",
"==",
"null",
")",
"{",
"// already exiting",
"tryDelete",
"(",
"node",
")",
";",
"}",
"else",
"{",
"delete",
".",
"add",
"(",
"node",
")",
";",
"}",
"}"
] |
Use this instead of File.deleteAtExist because it can delete none-empty directories
@param node file or directory
|
[
"Use",
"this",
"instead",
"of",
"File",
".",
"deleteAtExist",
"because",
"it",
"can",
"delete",
"none",
"-",
"empty",
"directories"
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/OnShutdown.java#L108-L115
|
147,858
|
ykrasik/jaci
|
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/assist/AutoComplete.java
|
AutoComplete.union
|
public AutoComplete union(AutoComplete other) {
if (possibilities.isEmpty()) {
return other;
}
if (other.possibilities.isEmpty()) {
return this;
}
// TODO: Make sure this can't happen.
if (!this.prefix.equals(other.prefix)) {
throw new IllegalArgumentException("Trying to perform union on different prefixes: prefix1='"+this.prefix+"', prefix2='"+other.prefix+'\'');
}
final Trie<CliValueType> unifiedPossibilities = this.possibilities.union(other.possibilities);
return new AutoComplete(prefix, unifiedPossibilities);
}
|
java
|
public AutoComplete union(AutoComplete other) {
if (possibilities.isEmpty()) {
return other;
}
if (other.possibilities.isEmpty()) {
return this;
}
// TODO: Make sure this can't happen.
if (!this.prefix.equals(other.prefix)) {
throw new IllegalArgumentException("Trying to perform union on different prefixes: prefix1='"+this.prefix+"', prefix2='"+other.prefix+'\'');
}
final Trie<CliValueType> unifiedPossibilities = this.possibilities.union(other.possibilities);
return new AutoComplete(prefix, unifiedPossibilities);
}
|
[
"public",
"AutoComplete",
"union",
"(",
"AutoComplete",
"other",
")",
"{",
"if",
"(",
"possibilities",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"other",
";",
"}",
"if",
"(",
"other",
".",
"possibilities",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"// TODO: Make sure this can't happen.",
"if",
"(",
"!",
"this",
".",
"prefix",
".",
"equals",
"(",
"other",
".",
"prefix",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Trying to perform union on different prefixes: prefix1='\"",
"+",
"this",
".",
"prefix",
"+",
"\"', prefix2='\"",
"+",
"other",
".",
"prefix",
"+",
"'",
"'",
")",
";",
"}",
"final",
"Trie",
"<",
"CliValueType",
">",
"unifiedPossibilities",
"=",
"this",
".",
"possibilities",
".",
"union",
"(",
"other",
".",
"possibilities",
")",
";",
"return",
"new",
"AutoComplete",
"(",
"prefix",
",",
"unifiedPossibilities",
")",
";",
"}"
] |
Create a new auto-complete by merging this auto-complete with the given auto-complete.
The resulting auto-complete will contain possibilities from both this and the given auto-complete.
@param other Auto-complete to merge with.
@return A merged auto-complete containing possibilities from both this and the given auto-complete.
|
[
"Create",
"a",
"new",
"auto",
"-",
"complete",
"by",
"merging",
"this",
"auto",
"-",
"complete",
"with",
"the",
"given",
"auto",
"-",
"complete",
".",
"The",
"resulting",
"auto",
"-",
"complete",
"will",
"contain",
"possibilities",
"from",
"both",
"this",
"and",
"the",
"given",
"auto",
"-",
"complete",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/assist/AutoComplete.java#L115-L130
|
147,859
|
ykrasik/jaci
|
jaci-utils/src/main/java/com/github/ykrasik/jaci/util/trie/TrieBuilder.java
|
TrieBuilder.add
|
public TrieBuilder<T> add(String word, T value) {
assertNotEmptyWord(word);
// Save the word-value pair in the map. The actual construction will be done later.
if (map.containsKey(word)) {
throw new IllegalArgumentException("Trie already contains a value for '"+word+"': " + map.get(word));
}
map.put(word, value);
return this;
}
|
java
|
public TrieBuilder<T> add(String word, T value) {
assertNotEmptyWord(word);
// Save the word-value pair in the map. The actual construction will be done later.
if (map.containsKey(word)) {
throw new IllegalArgumentException("Trie already contains a value for '"+word+"': " + map.get(word));
}
map.put(word, value);
return this;
}
|
[
"public",
"TrieBuilder",
"<",
"T",
">",
"add",
"(",
"String",
"word",
",",
"T",
"value",
")",
"{",
"assertNotEmptyWord",
"(",
"word",
")",
";",
"// Save the word-value pair in the map. The actual construction will be done later.",
"if",
"(",
"map",
".",
"containsKey",
"(",
"word",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Trie already contains a value for '\"",
"+",
"word",
"+",
"\"': \"",
"+",
"map",
".",
"get",
"(",
"word",
")",
")",
";",
"}",
"map",
".",
"put",
"(",
"word",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] |
Add a word-value mapping to the Trie. Expects there not to be a previous mapping for the word.
@param word The word for the word-value mapping.
@param value The value for the word-value mapping.
@return {@code this}, for chaining.
@throws IllegalStateException If this Trie already contained a mapping for the given word.
|
[
"Add",
"a",
"word",
"-",
"value",
"mapping",
"to",
"the",
"Trie",
".",
"Expects",
"there",
"not",
"to",
"be",
"a",
"previous",
"mapping",
"for",
"the",
"word",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-utils/src/main/java/com/github/ykrasik/jaci/util/trie/TrieBuilder.java#L41-L50
|
147,860
|
ykrasik/jaci
|
jaci-utils/src/main/java/com/github/ykrasik/jaci/util/trie/TrieBuilder.java
|
TrieBuilder.addAll
|
public TrieBuilder<T> addAll(Map<String, T> map) {
for (Entry<String, T> entry : map.entrySet()) {
add(entry.getKey(), entry.getValue());
}
return this;
}
|
java
|
public TrieBuilder<T> addAll(Map<String, T> map) {
for (Entry<String, T> entry : map.entrySet()) {
add(entry.getKey(), entry.getValue());
}
return this;
}
|
[
"public",
"TrieBuilder",
"<",
"T",
">",
"addAll",
"(",
"Map",
"<",
"String",
",",
"T",
">",
"map",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"T",
">",
"entry",
":",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
"add",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Add all word-value pairs from the given map to the Trie.
Expects there not to be any previous mappings for any of the words.
@param map Map to add word-value pairs from.
@return {@code this}, for chaining.
@throws IllegalStateException If this Trie already contained a mapping for any of the map's words (keys).
|
[
"Add",
"all",
"word",
"-",
"value",
"pairs",
"from",
"the",
"given",
"map",
"to",
"the",
"Trie",
".",
"Expects",
"there",
"not",
"to",
"be",
"any",
"previous",
"mappings",
"for",
"any",
"of",
"the",
"words",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-utils/src/main/java/com/github/ykrasik/jaci/util/trie/TrieBuilder.java#L60-L65
|
147,861
|
ykrasik/jaci
|
jaci-utils/src/main/java/com/github/ykrasik/jaci/util/trie/TrieBuilder.java
|
TrieBuilder.set
|
public TrieBuilder<T> set(String word, T value) {
assertNotEmptyWord(word);
// Save the word-value pair in the map. The actual construction will be done later.
map.put(word, value);
return this;
}
|
java
|
public TrieBuilder<T> set(String word, T value) {
assertNotEmptyWord(word);
// Save the word-value pair in the map. The actual construction will be done later.
map.put(word, value);
return this;
}
|
[
"public",
"TrieBuilder",
"<",
"T",
">",
"set",
"(",
"String",
"word",
",",
"T",
"value",
")",
"{",
"assertNotEmptyWord",
"(",
"word",
")",
";",
"// Save the word-value pair in the map. The actual construction will be done later.",
"map",
".",
"put",
"(",
"word",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] |
Set a word-value mapping on the Trie. If a previous mapping exists, it will be overwritten.
Otherwise, will create a new word-value mapping.
@param word The word for the word-value mapping.
@param value The value for the word-value mapping.
@return {@code this}, for chaining.
|
[
"Set",
"a",
"word",
"-",
"value",
"mapping",
"on",
"the",
"Trie",
".",
"If",
"a",
"previous",
"mapping",
"exists",
"it",
"will",
"be",
"overwritten",
".",
"Otherwise",
"will",
"create",
"a",
"new",
"word",
"-",
"value",
"mapping",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-utils/src/main/java/com/github/ykrasik/jaci/util/trie/TrieBuilder.java#L75-L81
|
147,862
|
ykrasik/jaci
|
jaci-utils/src/main/java/com/github/ykrasik/jaci/util/trie/TrieBuilder.java
|
TrieBuilder.setAll
|
public TrieBuilder<T> setAll(Map<String, T> map) {
for (Entry<String, T> entry : map.entrySet()) {
set(entry.getKey(), entry.getValue());
}
return this;
}
|
java
|
public TrieBuilder<T> setAll(Map<String, T> map) {
for (Entry<String, T> entry : map.entrySet()) {
set(entry.getKey(), entry.getValue());
}
return this;
}
|
[
"public",
"TrieBuilder",
"<",
"T",
">",
"setAll",
"(",
"Map",
"<",
"String",
",",
"T",
">",
"map",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"T",
">",
"entry",
":",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
"set",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Set all word-value pairs in the given map to the Trie.
If any previous mapping exists, it will be overwritten.
@param map Map to set word-value pairs from.
@return {@code this}, for chaining.
|
[
"Set",
"all",
"word",
"-",
"value",
"pairs",
"in",
"the",
"given",
"map",
"to",
"the",
"Trie",
".",
"If",
"any",
"previous",
"mapping",
"exists",
"it",
"will",
"be",
"overwritten",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-utils/src/main/java/com/github/ykrasik/jaci/util/trie/TrieBuilder.java#L90-L95
|
147,863
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/propertysheet/PropertySheetPanel.java
|
PropertySheetPanel.setTable
|
public final void setTable(PropertySheetTable table) {
if (table == null) {
throw new IllegalArgumentException("table must not be null");
}
// remove the property change listener from any previous model
if (model != null) {
model.removePropertyChangeListener(this);
}
// get the model from the table
model = (PropertySheetTableModel) table.getModel();
model.addPropertyChangeListener(this);
// remove the listener from the old table
if (this.table != null) {
this.table.getSelectionModel().removeListSelectionListener(
selectionListener);
}
// prepare the new table
table.getSelectionModel().addListSelectionListener(selectionListener);
tableScroll.getViewport().setView(table);
// use the new table as our table
this.table = table;
}
|
java
|
public final void setTable(PropertySheetTable table) {
if (table == null) {
throw new IllegalArgumentException("table must not be null");
}
// remove the property change listener from any previous model
if (model != null) {
model.removePropertyChangeListener(this);
}
// get the model from the table
model = (PropertySheetTableModel) table.getModel();
model.addPropertyChangeListener(this);
// remove the listener from the old table
if (this.table != null) {
this.table.getSelectionModel().removeListSelectionListener(
selectionListener);
}
// prepare the new table
table.getSelectionModel().addListSelectionListener(selectionListener);
tableScroll.getViewport().setView(table);
// use the new table as our table
this.table = table;
}
|
[
"public",
"final",
"void",
"setTable",
"(",
"PropertySheetTable",
"table",
")",
"{",
"if",
"(",
"table",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"table must not be null\"",
")",
";",
"}",
"// remove the property change listener from any previous model",
"if",
"(",
"model",
"!=",
"null",
")",
"{",
"model",
".",
"removePropertyChangeListener",
"(",
"this",
")",
";",
"}",
"// get the model from the table",
"model",
"=",
"(",
"PropertySheetTableModel",
")",
"table",
".",
"getModel",
"(",
")",
";",
"model",
".",
"addPropertyChangeListener",
"(",
"this",
")",
";",
"// remove the listener from the old table",
"if",
"(",
"this",
".",
"table",
"!=",
"null",
")",
"{",
"this",
".",
"table",
".",
"getSelectionModel",
"(",
")",
".",
"removeListSelectionListener",
"(",
"selectionListener",
")",
";",
"}",
"// prepare the new table",
"table",
".",
"getSelectionModel",
"(",
")",
".",
"addListSelectionListener",
"(",
"selectionListener",
")",
";",
"tableScroll",
".",
"getViewport",
"(",
")",
".",
"setView",
"(",
"table",
")",
";",
"// use the new table as our table",
"this",
".",
"table",
"=",
"table",
";",
"}"
] |
Sets the table used by this panel.
Note: listeners previously added with
{@link PropertySheetPanel#addPropertySheetChangeListener(PropertyChangeListener)}
must be re-added after this call if the table model is not the same as
the previous table.
@param table
|
[
"Sets",
"the",
"table",
"used",
"by",
"this",
"panel",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetPanel.java#L95-L121
|
147,864
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/propertysheet/PropertySheetPanel.java
|
PropertySheetPanel.setDescriptionVisible
|
public void setDescriptionVisible(boolean visible) {
if (visible) {
add("Center", split);
split.setTopComponent(tableScroll);
split.setBottomComponent(descriptionScrollPane);
// restore the divider location
split.setDividerLocation(split.getHeight() - lastDescriptionHeight);
} else {
// save the size of the description pane to restore it later
lastDescriptionHeight = split.getHeight() - split.getDividerLocation();
remove(split);
add("Center", tableScroll);
}
descriptionButton.setSelected(visible);
PropertySheetPanel.this.revalidate();
}
|
java
|
public void setDescriptionVisible(boolean visible) {
if (visible) {
add("Center", split);
split.setTopComponent(tableScroll);
split.setBottomComponent(descriptionScrollPane);
// restore the divider location
split.setDividerLocation(split.getHeight() - lastDescriptionHeight);
} else {
// save the size of the description pane to restore it later
lastDescriptionHeight = split.getHeight() - split.getDividerLocation();
remove(split);
add("Center", tableScroll);
}
descriptionButton.setSelected(visible);
PropertySheetPanel.this.revalidate();
}
|
[
"public",
"void",
"setDescriptionVisible",
"(",
"boolean",
"visible",
")",
"{",
"if",
"(",
"visible",
")",
"{",
"add",
"(",
"\"Center\"",
",",
"split",
")",
";",
"split",
".",
"setTopComponent",
"(",
"tableScroll",
")",
";",
"split",
".",
"setBottomComponent",
"(",
"descriptionScrollPane",
")",
";",
"// restore the divider location",
"split",
".",
"setDividerLocation",
"(",
"split",
".",
"getHeight",
"(",
")",
"-",
"lastDescriptionHeight",
")",
";",
"}",
"else",
"{",
"// save the size of the description pane to restore it later",
"lastDescriptionHeight",
"=",
"split",
".",
"getHeight",
"(",
")",
"-",
"split",
".",
"getDividerLocation",
"(",
")",
";",
"remove",
"(",
"split",
")",
";",
"add",
"(",
"\"Center\"",
",",
"tableScroll",
")",
";",
"}",
"descriptionButton",
".",
"setSelected",
"(",
"visible",
")",
";",
"PropertySheetPanel",
".",
"this",
".",
"revalidate",
"(",
")",
";",
"}"
] |
Toggles the visibility of the description panel.
@param visible
|
[
"Toggles",
"the",
"visibility",
"of",
"the",
"description",
"panel",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetPanel.java#L145-L160
|
147,865
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/propertysheet/PropertySheetPanel.java
|
PropertySheetPanel.readFromObject
|
public void readFromObject(Object data) {
// cancel pending edits
getTable().cancelEditing();
Property[] properties = model.getProperties();
for (int i = 0, c = properties.length; i < c; i++) {
properties[i].readFromObject(data);
}
repaint();
}
|
java
|
public void readFromObject(Object data) {
// cancel pending edits
getTable().cancelEditing();
Property[] properties = model.getProperties();
for (int i = 0, c = properties.length; i < c; i++) {
properties[i].readFromObject(data);
}
repaint();
}
|
[
"public",
"void",
"readFromObject",
"(",
"Object",
"data",
")",
"{",
"// cancel pending edits",
"getTable",
"(",
")",
".",
"cancelEditing",
"(",
")",
";",
"Property",
"[",
"]",
"properties",
"=",
"model",
".",
"getProperties",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"c",
"=",
"properties",
".",
"length",
";",
"i",
"<",
"c",
";",
"i",
"++",
")",
"{",
"properties",
"[",
"i",
"]",
".",
"readFromObject",
"(",
"data",
")",
";",
"}",
"repaint",
"(",
")",
";",
"}"
] |
Initializes the PropertySheet from the given object. If any, it cancels
pending edit before proceeding with properties.
@param data
|
[
"Initializes",
"the",
"PropertySheet",
"from",
"the",
"given",
"object",
".",
"If",
"any",
"it",
"cancels",
"pending",
"edit",
"before",
"proceeding",
"with",
"properties",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetPanel.java#L249-L258
|
147,866
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/propertysheet/PropertySheetPanel.java
|
PropertySheetPanel.writeToObject
|
public void writeToObject(Object data) {
// ensure pending edits are committed
getTable().commitEditing();
Property[] properties = getProperties();
for (int i = 0, c = properties.length; i < c; i++) {
properties[i].writeToObject(data);
}
}
|
java
|
public void writeToObject(Object data) {
// ensure pending edits are committed
getTable().commitEditing();
Property[] properties = getProperties();
for (int i = 0, c = properties.length; i < c; i++) {
properties[i].writeToObject(data);
}
}
|
[
"public",
"void",
"writeToObject",
"(",
"Object",
"data",
")",
"{",
"// ensure pending edits are committed",
"getTable",
"(",
")",
".",
"commitEditing",
"(",
")",
";",
"Property",
"[",
"]",
"properties",
"=",
"getProperties",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"c",
"=",
"properties",
".",
"length",
";",
"i",
"<",
"c",
";",
"i",
"++",
")",
"{",
"properties",
"[",
"i",
"]",
".",
"writeToObject",
"(",
"data",
")",
";",
"}",
"}"
] |
Writes the PropertySheet to the given object. If any, it commits pending
edit before proceeding with properties.
@param data
|
[
"Writes",
"the",
"PropertySheet",
"to",
"the",
"given",
"object",
".",
"If",
"any",
"it",
"commits",
"pending",
"edit",
"before",
"proceeding",
"with",
"properties",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetPanel.java#L266-L274
|
147,867
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/propertysheet/PropertySheetPanel.java
|
PropertySheetPanel.setSorting
|
public void setSorting(boolean value) {
model.setSortingCategories(value);
model.setSortingProperties(value);
sortButton.setSelected(value);
}
|
java
|
public void setSorting(boolean value) {
model.setSortingCategories(value);
model.setSortingProperties(value);
sortButton.setSelected(value);
}
|
[
"public",
"void",
"setSorting",
"(",
"boolean",
"value",
")",
"{",
"model",
".",
"setSortingCategories",
"(",
"value",
")",
";",
"model",
".",
"setSortingProperties",
"(",
"value",
")",
";",
"sortButton",
".",
"setSelected",
"(",
"value",
")",
";",
"}"
] |
Sets sorting properties and categories enabled or disabled.
@param value true to enable sorting
|
[
"Sets",
"sorting",
"properties",
"and",
"categories",
"enabled",
"or",
"disabled",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetPanel.java#L358-L362
|
147,868
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/CodedOutputStream.java
|
CodedOutputStream.writeMessage
|
public void writeMessage(final int fieldNumber, final MessageLite value)
throws IOException {
writeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED);
writeMessageNoTag(value);
}
|
java
|
public void writeMessage(final int fieldNumber, final MessageLite value)
throws IOException {
writeTag(fieldNumber, WireFormat.WIRETYPE_LENGTH_DELIMITED);
writeMessageNoTag(value);
}
|
[
"public",
"void",
"writeMessage",
"(",
"final",
"int",
"fieldNumber",
",",
"final",
"MessageLite",
"value",
")",
"throws",
"IOException",
"{",
"writeTag",
"(",
"fieldNumber",
",",
"WireFormat",
".",
"WIRETYPE_LENGTH_DELIMITED",
")",
";",
"writeMessageNoTag",
"(",
"value",
")",
";",
"}"
] |
Write an embedded message field, including tag, to the stream.
|
[
"Write",
"an",
"embedded",
"message",
"field",
"including",
"tag",
"to",
"the",
"stream",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedOutputStream.java#L219-L223
|
147,869
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/CodedOutputStream.java
|
CodedOutputStream.writeEnum
|
public void writeEnum(final int fieldNumber, final int value)
throws IOException {
writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT);
writeEnumNoTag(value);
}
|
java
|
public void writeEnum(final int fieldNumber, final int value)
throws IOException {
writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT);
writeEnumNoTag(value);
}
|
[
"public",
"void",
"writeEnum",
"(",
"final",
"int",
"fieldNumber",
",",
"final",
"int",
"value",
")",
"throws",
"IOException",
"{",
"writeTag",
"(",
"fieldNumber",
",",
"WireFormat",
".",
"WIRETYPE_VARINT",
")",
";",
"writeEnumNoTag",
"(",
"value",
")",
";",
"}"
] |
Write an enum field, including tag, to the stream. Caller is responsible
for converting the enum value to its numeric value.
|
[
"Write",
"an",
"enum",
"field",
"including",
"tag",
"to",
"the",
"stream",
".",
"Caller",
"is",
"responsible",
"for",
"converting",
"the",
"enum",
"value",
"to",
"its",
"numeric",
"value",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedOutputStream.java#L243-L247
|
147,870
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/CodedOutputStream.java
|
CodedOutputStream.writeMessageSetExtension
|
public void writeMessageSetExtension(final int fieldNumber,
final MessageLite value)
throws IOException {
writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_START_GROUP);
writeUInt32(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber);
writeMessage(WireFormat.MESSAGE_SET_MESSAGE, value);
writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_END_GROUP);
}
|
java
|
public void writeMessageSetExtension(final int fieldNumber,
final MessageLite value)
throws IOException {
writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_START_GROUP);
writeUInt32(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber);
writeMessage(WireFormat.MESSAGE_SET_MESSAGE, value);
writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_END_GROUP);
}
|
[
"public",
"void",
"writeMessageSetExtension",
"(",
"final",
"int",
"fieldNumber",
",",
"final",
"MessageLite",
"value",
")",
"throws",
"IOException",
"{",
"writeTag",
"(",
"WireFormat",
".",
"MESSAGE_SET_ITEM",
",",
"WireFormat",
".",
"WIRETYPE_START_GROUP",
")",
";",
"writeUInt32",
"(",
"WireFormat",
".",
"MESSAGE_SET_TYPE_ID",
",",
"fieldNumber",
")",
";",
"writeMessage",
"(",
"WireFormat",
".",
"MESSAGE_SET_MESSAGE",
",",
"value",
")",
";",
"writeTag",
"(",
"WireFormat",
".",
"MESSAGE_SET_ITEM",
",",
"WireFormat",
".",
"WIRETYPE_END_GROUP",
")",
";",
"}"
] |
Write a MessageSet extension field to the stream. For historical reasons,
the wire format differs from normal fields.
|
[
"Write",
"a",
"MessageSet",
"extension",
"field",
"to",
"the",
"stream",
".",
"For",
"historical",
"reasons",
"the",
"wire",
"format",
"differs",
"from",
"normal",
"fields",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedOutputStream.java#L281-L288
|
147,871
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/CodedOutputStream.java
|
CodedOutputStream.writeRawMessageSetExtension
|
public void writeRawMessageSetExtension(final int fieldNumber,
final ByteString value)
throws IOException {
writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_START_GROUP);
writeUInt32(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber);
writeBytes(WireFormat.MESSAGE_SET_MESSAGE, value);
writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_END_GROUP);
}
|
java
|
public void writeRawMessageSetExtension(final int fieldNumber,
final ByteString value)
throws IOException {
writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_START_GROUP);
writeUInt32(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber);
writeBytes(WireFormat.MESSAGE_SET_MESSAGE, value);
writeTag(WireFormat.MESSAGE_SET_ITEM, WireFormat.WIRETYPE_END_GROUP);
}
|
[
"public",
"void",
"writeRawMessageSetExtension",
"(",
"final",
"int",
"fieldNumber",
",",
"final",
"ByteString",
"value",
")",
"throws",
"IOException",
"{",
"writeTag",
"(",
"WireFormat",
".",
"MESSAGE_SET_ITEM",
",",
"WireFormat",
".",
"WIRETYPE_START_GROUP",
")",
";",
"writeUInt32",
"(",
"WireFormat",
".",
"MESSAGE_SET_TYPE_ID",
",",
"fieldNumber",
")",
";",
"writeBytes",
"(",
"WireFormat",
".",
"MESSAGE_SET_MESSAGE",
",",
"value",
")",
";",
"writeTag",
"(",
"WireFormat",
".",
"MESSAGE_SET_ITEM",
",",
"WireFormat",
".",
"WIRETYPE_END_GROUP",
")",
";",
"}"
] |
Write an unparsed MessageSet extension field to the stream. For
historical reasons, the wire format differs from normal fields.
|
[
"Write",
"an",
"unparsed",
"MessageSet",
"extension",
"field",
"to",
"the",
"stream",
".",
"For",
"historical",
"reasons",
"the",
"wire",
"format",
"differs",
"from",
"normal",
"fields",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedOutputStream.java#L294-L301
|
147,872
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/CodedOutputStream.java
|
CodedOutputStream.computeMessageSetExtensionSize
|
public static int computeMessageSetExtensionSize(
final int fieldNumber, final MessageLite value) {
return computeTagSize(WireFormat.MESSAGE_SET_ITEM) * 2 +
computeUInt32Size(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber) +
computeMessageSize(WireFormat.MESSAGE_SET_MESSAGE, value);
}
|
java
|
public static int computeMessageSetExtensionSize(
final int fieldNumber, final MessageLite value) {
return computeTagSize(WireFormat.MESSAGE_SET_ITEM) * 2 +
computeUInt32Size(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber) +
computeMessageSize(WireFormat.MESSAGE_SET_MESSAGE, value);
}
|
[
"public",
"static",
"int",
"computeMessageSetExtensionSize",
"(",
"final",
"int",
"fieldNumber",
",",
"final",
"MessageLite",
"value",
")",
"{",
"return",
"computeTagSize",
"(",
"WireFormat",
".",
"MESSAGE_SET_ITEM",
")",
"*",
"2",
"+",
"computeUInt32Size",
"(",
"WireFormat",
".",
"MESSAGE_SET_TYPE_ID",
",",
"fieldNumber",
")",
"+",
"computeMessageSize",
"(",
"WireFormat",
".",
"MESSAGE_SET_MESSAGE",
",",
"value",
")",
";",
"}"
] |
Compute the number of bytes that would be needed to encode a
MessageSet extension to the stream. For historical reasons,
the wire format differs from normal fields.
|
[
"Compute",
"the",
"number",
"of",
"bytes",
"that",
"would",
"be",
"needed",
"to",
"encode",
"a",
"MessageSet",
"extension",
"to",
"the",
"stream",
".",
"For",
"historical",
"reasons",
"the",
"wire",
"format",
"differs",
"from",
"normal",
"fields",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedOutputStream.java#L607-L612
|
147,873
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/CodedOutputStream.java
|
CodedOutputStream.computeRawMessageSetExtensionSize
|
public static int computeRawMessageSetExtensionSize(
final int fieldNumber, final ByteString value) {
return computeTagSize(WireFormat.MESSAGE_SET_ITEM) * 2 +
computeUInt32Size(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber) +
computeBytesSize(WireFormat.MESSAGE_SET_MESSAGE, value);
}
|
java
|
public static int computeRawMessageSetExtensionSize(
final int fieldNumber, final ByteString value) {
return computeTagSize(WireFormat.MESSAGE_SET_ITEM) * 2 +
computeUInt32Size(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber) +
computeBytesSize(WireFormat.MESSAGE_SET_MESSAGE, value);
}
|
[
"public",
"static",
"int",
"computeRawMessageSetExtensionSize",
"(",
"final",
"int",
"fieldNumber",
",",
"final",
"ByteString",
"value",
")",
"{",
"return",
"computeTagSize",
"(",
"WireFormat",
".",
"MESSAGE_SET_ITEM",
")",
"*",
"2",
"+",
"computeUInt32Size",
"(",
"WireFormat",
".",
"MESSAGE_SET_TYPE_ID",
",",
"fieldNumber",
")",
"+",
"computeBytesSize",
"(",
"WireFormat",
".",
"MESSAGE_SET_MESSAGE",
",",
"value",
")",
";",
"}"
] |
Compute the number of bytes that would be needed to encode an
unparsed MessageSet extension field to the stream. For
historical reasons, the wire format differs from normal fields.
|
[
"Compute",
"the",
"number",
"of",
"bytes",
"that",
"would",
"be",
"needed",
"to",
"encode",
"an",
"unparsed",
"MessageSet",
"extension",
"field",
"to",
"the",
"stream",
".",
"For",
"historical",
"reasons",
"the",
"wire",
"format",
"differs",
"from",
"normal",
"fields",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedOutputStream.java#L619-L624
|
147,874
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/CodedOutputStream.java
|
CodedOutputStream.computeLazyFieldMessageSetExtensionSize
|
public static int computeLazyFieldMessageSetExtensionSize(
final int fieldNumber, final LazyField value) {
return computeTagSize(WireFormat.MESSAGE_SET_ITEM) * 2 +
computeUInt32Size(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber) +
computeLazyFieldSize(WireFormat.MESSAGE_SET_MESSAGE, value);
}
|
java
|
public static int computeLazyFieldMessageSetExtensionSize(
final int fieldNumber, final LazyField value) {
return computeTagSize(WireFormat.MESSAGE_SET_ITEM) * 2 +
computeUInt32Size(WireFormat.MESSAGE_SET_TYPE_ID, fieldNumber) +
computeLazyFieldSize(WireFormat.MESSAGE_SET_MESSAGE, value);
}
|
[
"public",
"static",
"int",
"computeLazyFieldMessageSetExtensionSize",
"(",
"final",
"int",
"fieldNumber",
",",
"final",
"LazyField",
"value",
")",
"{",
"return",
"computeTagSize",
"(",
"WireFormat",
".",
"MESSAGE_SET_ITEM",
")",
"*",
"2",
"+",
"computeUInt32Size",
"(",
"WireFormat",
".",
"MESSAGE_SET_TYPE_ID",
",",
"fieldNumber",
")",
"+",
"computeLazyFieldSize",
"(",
"WireFormat",
".",
"MESSAGE_SET_MESSAGE",
",",
"value",
")",
";",
"}"
] |
Compute the number of bytes that would be needed to encode an
lazily parsed MessageSet extension field to the stream. For
historical reasons, the wire format differs from normal fields.
|
[
"Compute",
"the",
"number",
"of",
"bytes",
"that",
"would",
"be",
"needed",
"to",
"encode",
"an",
"lazily",
"parsed",
"MessageSet",
"extension",
"field",
"to",
"the",
"stream",
".",
"For",
"historical",
"reasons",
"the",
"wire",
"format",
"differs",
"from",
"normal",
"fields",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedOutputStream.java#L631-L636
|
147,875
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/CodedOutputStream.java
|
CodedOutputStream.refreshBuffer
|
private void refreshBuffer() throws IOException {
if (output == null) {
// We're writing to a single buffer.
throw new OutOfSpaceException();
}
// Since we have an output stream, this is our buffer
// and buffer offset == 0
output.write(buffer, 0, position);
position = 0;
}
|
java
|
private void refreshBuffer() throws IOException {
if (output == null) {
// We're writing to a single buffer.
throw new OutOfSpaceException();
}
// Since we have an output stream, this is our buffer
// and buffer offset == 0
output.write(buffer, 0, position);
position = 0;
}
|
[
"private",
"void",
"refreshBuffer",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"// We're writing to a single buffer.",
"throw",
"new",
"OutOfSpaceException",
"(",
")",
";",
"}",
"// Since we have an output stream, this is our buffer",
"// and buffer offset == 0",
"output",
".",
"write",
"(",
"buffer",
",",
"0",
",",
"position",
")",
";",
"position",
"=",
"0",
";",
"}"
] |
Internal helper that writes the current buffer to the output. The
buffer position is reset to its initial value when this returns.
|
[
"Internal",
"helper",
"that",
"writes",
"the",
"current",
"buffer",
"to",
"the",
"output",
".",
"The",
"buffer",
"position",
"is",
"reset",
"to",
"its",
"initial",
"value",
"when",
"this",
"returns",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedOutputStream.java#L825-L835
|
147,876
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/CodedOutputStream.java
|
CodedOutputStream.writeRawBytes
|
public void writeRawBytes(final byte[] value, int offset, int length)
throws IOException {
if (limit - position >= length) {
// We have room in the current buffer.
System.arraycopy(value, offset, buffer, position, length);
position += length;
} else {
// Write extends past current buffer. Fill the rest of this buffer and
// flush.
final int bytesWritten = limit - position;
System.arraycopy(value, offset, buffer, position, bytesWritten);
offset += bytesWritten;
length -= bytesWritten;
position = limit;
refreshBuffer();
// Now deal with the rest.
// Since we have an output stream, this is our buffer
// and buffer offset == 0
if (length <= limit) {
// Fits in new buffer.
System.arraycopy(value, offset, buffer, 0, length);
position = length;
} else {
// Write is very big. Let's do it all at once.
output.write(value, offset, length);
}
}
}
|
java
|
public void writeRawBytes(final byte[] value, int offset, int length)
throws IOException {
if (limit - position >= length) {
// We have room in the current buffer.
System.arraycopy(value, offset, buffer, position, length);
position += length;
} else {
// Write extends past current buffer. Fill the rest of this buffer and
// flush.
final int bytesWritten = limit - position;
System.arraycopy(value, offset, buffer, position, bytesWritten);
offset += bytesWritten;
length -= bytesWritten;
position = limit;
refreshBuffer();
// Now deal with the rest.
// Since we have an output stream, this is our buffer
// and buffer offset == 0
if (length <= limit) {
// Fits in new buffer.
System.arraycopy(value, offset, buffer, 0, length);
position = length;
} else {
// Write is very big. Let's do it all at once.
output.write(value, offset, length);
}
}
}
|
[
"public",
"void",
"writeRawBytes",
"(",
"final",
"byte",
"[",
"]",
"value",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"if",
"(",
"limit",
"-",
"position",
">=",
"length",
")",
"{",
"// We have room in the current buffer.",
"System",
".",
"arraycopy",
"(",
"value",
",",
"offset",
",",
"buffer",
",",
"position",
",",
"length",
")",
";",
"position",
"+=",
"length",
";",
"}",
"else",
"{",
"// Write extends past current buffer. Fill the rest of this buffer and",
"// flush.",
"final",
"int",
"bytesWritten",
"=",
"limit",
"-",
"position",
";",
"System",
".",
"arraycopy",
"(",
"value",
",",
"offset",
",",
"buffer",
",",
"position",
",",
"bytesWritten",
")",
";",
"offset",
"+=",
"bytesWritten",
";",
"length",
"-=",
"bytesWritten",
";",
"position",
"=",
"limit",
";",
"refreshBuffer",
"(",
")",
";",
"// Now deal with the rest.",
"// Since we have an output stream, this is our buffer",
"// and buffer offset == 0",
"if",
"(",
"length",
"<=",
"limit",
")",
"{",
"// Fits in new buffer.",
"System",
".",
"arraycopy",
"(",
"value",
",",
"offset",
",",
"buffer",
",",
"0",
",",
"length",
")",
";",
"position",
"=",
"length",
";",
"}",
"else",
"{",
"// Write is very big. Let's do it all at once.",
"output",
".",
"write",
"(",
"value",
",",
"offset",
",",
"length",
")",
";",
"}",
"}",
"}"
] |
Write part of an array of bytes.
|
[
"Write",
"part",
"of",
"an",
"array",
"of",
"bytes",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedOutputStream.java#L914-L942
|
147,877
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/CodedOutputStream.java
|
CodedOutputStream.writeRawBytes
|
public void writeRawBytes(final ByteString value, int offset, int length)
throws IOException {
if (limit - position >= length) {
// We have room in the current buffer.
value.copyTo(buffer, offset, position, length);
position += length;
} else {
// Write extends past current buffer. Fill the rest of this buffer and
// flush.
final int bytesWritten = limit - position;
value.copyTo(buffer, offset, position, bytesWritten);
offset += bytesWritten;
length -= bytesWritten;
position = limit;
refreshBuffer();
// Now deal with the rest.
// Since we have an output stream, this is our buffer
// and buffer offset == 0
if (length <= limit) {
// Fits in new buffer.
value.copyTo(buffer, offset, 0, length);
position = length;
} else {
// Write is very big, but we can't do it all at once without allocating
// an a copy of the byte array since ByteString does not give us access
// to the underlying bytes. Use the InputStream interface on the
// ByteString and our buffer to copy between the two.
InputStream inputStreamFrom = value.newInput();
if (offset != inputStreamFrom.skip(offset)) {
throw new IllegalStateException("Skip failed? Should never happen.");
}
// Use the buffer as the temporary buffer to avoid allocating memory.
while (length > 0) {
int bytesToRead = Math.min(length, limit);
int bytesRead = inputStreamFrom.read(buffer, 0, bytesToRead);
if (bytesRead != bytesToRead) {
throw new IllegalStateException("Read failed? Should never happen");
}
output.write(buffer, 0, bytesRead);
length -= bytesRead;
}
}
}
}
|
java
|
public void writeRawBytes(final ByteString value, int offset, int length)
throws IOException {
if (limit - position >= length) {
// We have room in the current buffer.
value.copyTo(buffer, offset, position, length);
position += length;
} else {
// Write extends past current buffer. Fill the rest of this buffer and
// flush.
final int bytesWritten = limit - position;
value.copyTo(buffer, offset, position, bytesWritten);
offset += bytesWritten;
length -= bytesWritten;
position = limit;
refreshBuffer();
// Now deal with the rest.
// Since we have an output stream, this is our buffer
// and buffer offset == 0
if (length <= limit) {
// Fits in new buffer.
value.copyTo(buffer, offset, 0, length);
position = length;
} else {
// Write is very big, but we can't do it all at once without allocating
// an a copy of the byte array since ByteString does not give us access
// to the underlying bytes. Use the InputStream interface on the
// ByteString and our buffer to copy between the two.
InputStream inputStreamFrom = value.newInput();
if (offset != inputStreamFrom.skip(offset)) {
throw new IllegalStateException("Skip failed? Should never happen.");
}
// Use the buffer as the temporary buffer to avoid allocating memory.
while (length > 0) {
int bytesToRead = Math.min(length, limit);
int bytesRead = inputStreamFrom.read(buffer, 0, bytesToRead);
if (bytesRead != bytesToRead) {
throw new IllegalStateException("Read failed? Should never happen");
}
output.write(buffer, 0, bytesRead);
length -= bytesRead;
}
}
}
}
|
[
"public",
"void",
"writeRawBytes",
"(",
"final",
"ByteString",
"value",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"if",
"(",
"limit",
"-",
"position",
">=",
"length",
")",
"{",
"// We have room in the current buffer.",
"value",
".",
"copyTo",
"(",
"buffer",
",",
"offset",
",",
"position",
",",
"length",
")",
";",
"position",
"+=",
"length",
";",
"}",
"else",
"{",
"// Write extends past current buffer. Fill the rest of this buffer and",
"// flush.",
"final",
"int",
"bytesWritten",
"=",
"limit",
"-",
"position",
";",
"value",
".",
"copyTo",
"(",
"buffer",
",",
"offset",
",",
"position",
",",
"bytesWritten",
")",
";",
"offset",
"+=",
"bytesWritten",
";",
"length",
"-=",
"bytesWritten",
";",
"position",
"=",
"limit",
";",
"refreshBuffer",
"(",
")",
";",
"// Now deal with the rest.",
"// Since we have an output stream, this is our buffer",
"// and buffer offset == 0",
"if",
"(",
"length",
"<=",
"limit",
")",
"{",
"// Fits in new buffer.",
"value",
".",
"copyTo",
"(",
"buffer",
",",
"offset",
",",
"0",
",",
"length",
")",
";",
"position",
"=",
"length",
";",
"}",
"else",
"{",
"// Write is very big, but we can't do it all at once without allocating",
"// an a copy of the byte array since ByteString does not give us access",
"// to the underlying bytes. Use the InputStream interface on the",
"// ByteString and our buffer to copy between the two.",
"InputStream",
"inputStreamFrom",
"=",
"value",
".",
"newInput",
"(",
")",
";",
"if",
"(",
"offset",
"!=",
"inputStreamFrom",
".",
"skip",
"(",
"offset",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Skip failed? Should never happen.\"",
")",
";",
"}",
"// Use the buffer as the temporary buffer to avoid allocating memory.",
"while",
"(",
"length",
">",
"0",
")",
"{",
"int",
"bytesToRead",
"=",
"Math",
".",
"min",
"(",
"length",
",",
"limit",
")",
";",
"int",
"bytesRead",
"=",
"inputStreamFrom",
".",
"read",
"(",
"buffer",
",",
"0",
",",
"bytesToRead",
")",
";",
"if",
"(",
"bytesRead",
"!=",
"bytesToRead",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Read failed? Should never happen\"",
")",
";",
"}",
"output",
".",
"write",
"(",
"buffer",
",",
"0",
",",
"bytesRead",
")",
";",
"length",
"-=",
"bytesRead",
";",
"}",
"}",
"}",
"}"
] |
Write part of a byte string.
|
[
"Write",
"part",
"of",
"a",
"byte",
"string",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedOutputStream.java#L945-L989
|
147,878
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/CodedOutputStream.java
|
CodedOutputStream.writeRawLittleEndian32
|
public void writeRawLittleEndian32(final int value) throws IOException {
writeRawByte((value ) & 0xFF);
writeRawByte((value >> 8) & 0xFF);
writeRawByte((value >> 16) & 0xFF);
writeRawByte((value >> 24) & 0xFF);
}
|
java
|
public void writeRawLittleEndian32(final int value) throws IOException {
writeRawByte((value ) & 0xFF);
writeRawByte((value >> 8) & 0xFF);
writeRawByte((value >> 16) & 0xFF);
writeRawByte((value >> 24) & 0xFF);
}
|
[
"public",
"void",
"writeRawLittleEndian32",
"(",
"final",
"int",
"value",
")",
"throws",
"IOException",
"{",
"writeRawByte",
"(",
"(",
"value",
")",
"&",
"0xFF",
")",
";",
"writeRawByte",
"(",
"(",
"value",
">>",
"8",
")",
"&",
"0xFF",
")",
";",
"writeRawByte",
"(",
"(",
"value",
">>",
"16",
")",
"&",
"0xFF",
")",
";",
"writeRawByte",
"(",
"(",
"value",
">>",
"24",
")",
"&",
"0xFF",
")",
";",
"}"
] |
Write a little-endian 32-bit integer.
|
[
"Write",
"a",
"little",
"-",
"endian",
"32",
"-",
"bit",
"integer",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedOutputStream.java#L1059-L1064
|
147,879
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/CodedOutputStream.java
|
CodedOutputStream.writeRawLittleEndian64
|
public void writeRawLittleEndian64(final long value) throws IOException {
writeRawByte((int)(value ) & 0xFF);
writeRawByte((int)(value >> 8) & 0xFF);
writeRawByte((int)(value >> 16) & 0xFF);
writeRawByte((int)(value >> 24) & 0xFF);
writeRawByte((int)(value >> 32) & 0xFF);
writeRawByte((int)(value >> 40) & 0xFF);
writeRawByte((int)(value >> 48) & 0xFF);
writeRawByte((int)(value >> 56) & 0xFF);
}
|
java
|
public void writeRawLittleEndian64(final long value) throws IOException {
writeRawByte((int)(value ) & 0xFF);
writeRawByte((int)(value >> 8) & 0xFF);
writeRawByte((int)(value >> 16) & 0xFF);
writeRawByte((int)(value >> 24) & 0xFF);
writeRawByte((int)(value >> 32) & 0xFF);
writeRawByte((int)(value >> 40) & 0xFF);
writeRawByte((int)(value >> 48) & 0xFF);
writeRawByte((int)(value >> 56) & 0xFF);
}
|
[
"public",
"void",
"writeRawLittleEndian64",
"(",
"final",
"long",
"value",
")",
"throws",
"IOException",
"{",
"writeRawByte",
"(",
"(",
"int",
")",
"(",
"value",
")",
"&",
"0xFF",
")",
";",
"writeRawByte",
"(",
"(",
"int",
")",
"(",
"value",
">>",
"8",
")",
"&",
"0xFF",
")",
";",
"writeRawByte",
"(",
"(",
"int",
")",
"(",
"value",
">>",
"16",
")",
"&",
"0xFF",
")",
";",
"writeRawByte",
"(",
"(",
"int",
")",
"(",
"value",
">>",
"24",
")",
"&",
"0xFF",
")",
";",
"writeRawByte",
"(",
"(",
"int",
")",
"(",
"value",
">>",
"32",
")",
"&",
"0xFF",
")",
";",
"writeRawByte",
"(",
"(",
"int",
")",
"(",
"value",
">>",
"40",
")",
"&",
"0xFF",
")",
";",
"writeRawByte",
"(",
"(",
"int",
")",
"(",
"value",
">>",
"48",
")",
"&",
"0xFF",
")",
";",
"writeRawByte",
"(",
"(",
"int",
")",
"(",
"value",
">>",
"56",
")",
"&",
"0xFF",
")",
";",
"}"
] |
Write a little-endian 64-bit integer.
|
[
"Write",
"a",
"little",
"-",
"endian",
"64",
"-",
"bit",
"integer",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/CodedOutputStream.java#L1069-L1078
|
147,880
|
kmi/iserve
|
iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/util/MatchResultPredicates.java
|
MatchResultPredicates.greaterThan
|
public static <T extends MatchResult, S extends MatchType> Predicate<T> greaterThan(S matchType) {
return new GreaterThanPredicate<T, S>(matchType);
}
|
java
|
public static <T extends MatchResult, S extends MatchType> Predicate<T> greaterThan(S matchType) {
return new GreaterThanPredicate<T, S>(matchType);
}
|
[
"public",
"static",
"<",
"T",
"extends",
"MatchResult",
",",
"S",
"extends",
"MatchType",
">",
"Predicate",
"<",
"T",
">",
"greaterThan",
"(",
"S",
"matchType",
")",
"{",
"return",
"new",
"GreaterThanPredicate",
"<",
"T",
",",
"S",
">",
"(",
"matchType",
")",
";",
"}"
] |
Generates a Predicate that only accepts the Match Results that have a Match Type greater than matchType
@param matchType the matchType that defines the boundary
@param <T> a subclass of MatchResult
@param <S> a subclass of MatchType
@return the Predicate
|
[
"Generates",
"a",
"Predicate",
"that",
"only",
"accepts",
"the",
"Match",
"Results",
"that",
"have",
"a",
"Match",
"Type",
"greater",
"than",
"matchType"
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/util/MatchResultPredicates.java#L45-L47
|
147,881
|
kmi/iserve
|
iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/util/MatchResultPredicates.java
|
MatchResultPredicates.lowerThan
|
public static <T extends MatchResult, S extends MatchType> Predicate<T> lowerThan(S matchType) {
return new LowerThanPredicate<T, S>(matchType);
}
|
java
|
public static <T extends MatchResult, S extends MatchType> Predicate<T> lowerThan(S matchType) {
return new LowerThanPredicate<T, S>(matchType);
}
|
[
"public",
"static",
"<",
"T",
"extends",
"MatchResult",
",",
"S",
"extends",
"MatchType",
">",
"Predicate",
"<",
"T",
">",
"lowerThan",
"(",
"S",
"matchType",
")",
"{",
"return",
"new",
"LowerThanPredicate",
"<",
"T",
",",
"S",
">",
"(",
"matchType",
")",
";",
"}"
] |
Generates a Predicate that only accepts the Match Results that have a Match Type lower than matchType
@param matchType the matchType that defines the boundary
@param <T> a subclass of MatchResult
@param <S> a subclass of MatchType
@return the Predicate
|
[
"Generates",
"a",
"Predicate",
"that",
"only",
"accepts",
"the",
"Match",
"Results",
"that",
"have",
"a",
"Match",
"Type",
"lower",
"than",
"matchType"
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/util/MatchResultPredicates.java#L57-L59
|
147,882
|
kmi/iserve
|
iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/util/MatchResultPredicates.java
|
MatchResultPredicates.equalTo
|
public static <T extends MatchResult, S extends MatchType> Predicate<T> equalTo(S matchType) {
return new EqualToPredicate<T, S>(matchType);
}
|
java
|
public static <T extends MatchResult, S extends MatchType> Predicate<T> equalTo(S matchType) {
return new EqualToPredicate<T, S>(matchType);
}
|
[
"public",
"static",
"<",
"T",
"extends",
"MatchResult",
",",
"S",
"extends",
"MatchType",
">",
"Predicate",
"<",
"T",
">",
"equalTo",
"(",
"S",
"matchType",
")",
"{",
"return",
"new",
"EqualToPredicate",
"<",
"T",
",",
"S",
">",
"(",
"matchType",
")",
";",
"}"
] |
Generates a Predicate that only accepts the Match Results that have a Match Type equal to matchType
@param matchType the matchType
@param <T> a subclass of MatchResult
@param <S> a subclass of MatchType
@return the Predicate
|
[
"Generates",
"a",
"Predicate",
"that",
"only",
"accepts",
"the",
"Match",
"Results",
"that",
"have",
"a",
"Match",
"Type",
"equal",
"to",
"matchType"
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/util/MatchResultPredicates.java#L69-L71
|
147,883
|
kmi/iserve
|
iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/util/MatchResultPredicates.java
|
MatchResultPredicates.greaterOrEqualTo
|
public static <T extends MatchResult, S extends MatchType> Predicate<T> greaterOrEqualTo(S matchType) {
return Predicates.or(greaterThan(matchType), equalTo(matchType));
}
|
java
|
public static <T extends MatchResult, S extends MatchType> Predicate<T> greaterOrEqualTo(S matchType) {
return Predicates.or(greaterThan(matchType), equalTo(matchType));
}
|
[
"public",
"static",
"<",
"T",
"extends",
"MatchResult",
",",
"S",
"extends",
"MatchType",
">",
"Predicate",
"<",
"T",
">",
"greaterOrEqualTo",
"(",
"S",
"matchType",
")",
"{",
"return",
"Predicates",
".",
"or",
"(",
"greaterThan",
"(",
"matchType",
")",
",",
"equalTo",
"(",
"matchType",
")",
")",
";",
"}"
] |
Generates a Predicate that only accepts the Match Results that have a Match Type greater or equal to matchType
@param matchType the matchType that defines the boundary
@param <T> a subclass of MatchResult
@param <S> a subclass of MatchType
@return the Predicate
|
[
"Generates",
"a",
"Predicate",
"that",
"only",
"accepts",
"the",
"Match",
"Results",
"that",
"have",
"a",
"Match",
"Type",
"greater",
"or",
"equal",
"to",
"matchType"
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/util/MatchResultPredicates.java#L81-L83
|
147,884
|
kmi/iserve
|
iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/util/MatchResultPredicates.java
|
MatchResultPredicates.lowerOrEqualTo
|
public static <T extends MatchResult, S extends MatchType> Predicate<T> lowerOrEqualTo(S matchType) {
return Predicates.or(lowerThan(matchType), equalTo(matchType));
}
|
java
|
public static <T extends MatchResult, S extends MatchType> Predicate<T> lowerOrEqualTo(S matchType) {
return Predicates.or(lowerThan(matchType), equalTo(matchType));
}
|
[
"public",
"static",
"<",
"T",
"extends",
"MatchResult",
",",
"S",
"extends",
"MatchType",
">",
"Predicate",
"<",
"T",
">",
"lowerOrEqualTo",
"(",
"S",
"matchType",
")",
"{",
"return",
"Predicates",
".",
"or",
"(",
"lowerThan",
"(",
"matchType",
")",
",",
"equalTo",
"(",
"matchType",
")",
")",
";",
"}"
] |
Generates a Predicate that only accepts the Match Results that have a Match Type lower or equal to matchType
@param matchType the matchType that defines the boundary
@param <T> a subclass of MatchResult
@param <S> a subclass of MatchType
@return the Predicate
|
[
"Generates",
"a",
"Predicate",
"that",
"only",
"accepts",
"the",
"Match",
"Results",
"that",
"have",
"a",
"Match",
"Type",
"lower",
"or",
"equal",
"to",
"matchType"
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/util/MatchResultPredicates.java#L93-L95
|
147,885
|
wkgcass/Style
|
src/main/java/net/cassite/style/LoopInfo.java
|
LoopInfo.setValues
|
public LoopInfo<R> setValues(int currentIndex, int effectiveIndex, R lastRes) {
this.currentIndex = currentIndex;
this.effectiveIndex = effectiveIndex;
this.lastRes = lastRes;
return this;
}
|
java
|
public LoopInfo<R> setValues(int currentIndex, int effectiveIndex, R lastRes) {
this.currentIndex = currentIndex;
this.effectiveIndex = effectiveIndex;
this.lastRes = lastRes;
return this;
}
|
[
"public",
"LoopInfo",
"<",
"R",
">",
"setValues",
"(",
"int",
"currentIndex",
",",
"int",
"effectiveIndex",
",",
"R",
"lastRes",
")",
"{",
"this",
".",
"currentIndex",
"=",
"currentIndex",
";",
"this",
".",
"effectiveIndex",
"=",
"effectiveIndex",
";",
"this",
".",
"lastRes",
"=",
"lastRes",
";",
"return",
"this",
";",
"}"
] |
set all fields of the loop info
@param currentIndex current index
@param effectiveIndex the times 'last loop value' has been modified
@param lastRes last loop result
@return <code>this</code>
|
[
"set",
"all",
"fields",
"of",
"the",
"loop",
"info"
] |
db3ea64337251f46f734279480e365293bececbd
|
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/LoopInfo.java#L32-L37
|
147,886
|
awltech/org.parallelj
|
parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/reflect/callback/FieldIterable.java
|
FieldIterable.getIterable
|
public java.lang.Iterable<?> getIterable(KProcess process) {
// try new one
java.lang.Iterable<?> iterable = null;
try {
iterable = (java.lang.Iterable<?>) this.field.get(process
.getContext());
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return iterable;
}
|
java
|
public java.lang.Iterable<?> getIterable(KProcess process) {
// try new one
java.lang.Iterable<?> iterable = null;
try {
iterable = (java.lang.Iterable<?>) this.field.get(process
.getContext());
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return iterable;
}
|
[
"public",
"java",
".",
"lang",
".",
"Iterable",
"<",
"?",
">",
"getIterable",
"(",
"KProcess",
"process",
")",
"{",
"// try new one",
"java",
".",
"lang",
".",
"Iterable",
"<",
"?",
">",
"iterable",
"=",
"null",
";",
"try",
"{",
"iterable",
"=",
"(",
"java",
".",
"lang",
".",
"Iterable",
"<",
"?",
">",
")",
"this",
".",
"field",
".",
"get",
"(",
"process",
".",
"getContext",
"(",
")",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"// TODO Auto-generated catch block",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"// TODO Auto-generated catch block",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"return",
"iterable",
";",
"}"
] |
This will return Iterable to Calling method as parameter.
@param process
@return
|
[
"This",
"will",
"return",
"Iterable",
"to",
"Calling",
"method",
"as",
"parameter",
"."
] |
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
|
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/reflect/callback/FieldIterable.java#L79-L94
|
147,887
|
droidpl/android-json-viewer
|
android-json-viewer/src/main/java/com/github/droidpl/android/jsonviewer/RVJsonAdapter.java
|
RVJsonAdapter.getItemKey
|
@Nullable
private String getItemKey(int position) {
if (mMap != null) {
return new ArrayList<>(mMap.entrySet()).get(position).getKey();
} else if (mJsonArray != null) {
return String.valueOf(position);
}
return null;
}
|
java
|
@Nullable
private String getItemKey(int position) {
if (mMap != null) {
return new ArrayList<>(mMap.entrySet()).get(position).getKey();
} else if (mJsonArray != null) {
return String.valueOf(position);
}
return null;
}
|
[
"@",
"Nullable",
"private",
"String",
"getItemKey",
"(",
"int",
"position",
")",
"{",
"if",
"(",
"mMap",
"!=",
"null",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
"mMap",
".",
"entrySet",
"(",
")",
")",
".",
"get",
"(",
"position",
")",
".",
"getKey",
"(",
")",
";",
"}",
"else",
"if",
"(",
"mJsonArray",
"!=",
"null",
")",
"{",
"return",
"String",
".",
"valueOf",
"(",
"position",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Provides the item key name. Number for array, property for object.
@param position The position.
@return The key as string or null.
|
[
"Provides",
"the",
"item",
"key",
"name",
".",
"Number",
"for",
"array",
"property",
"for",
"object",
"."
] |
7345a7a0e6636399015a03fad8243a47f5fcdd8f
|
https://github.com/droidpl/android-json-viewer/blob/7345a7a0e6636399015a03fad8243a47f5fcdd8f/android-json-viewer/src/main/java/com/github/droidpl/android/jsonviewer/RVJsonAdapter.java#L156-L164
|
147,888
|
droidpl/android-json-viewer
|
android-json-viewer/src/main/java/com/github/droidpl/android/jsonviewer/RVJsonAdapter.java
|
RVJsonAdapter.getItem
|
@Nullable
private Object getItem(int position) {
if (mMap != null) {
return new ArrayList<>(mMap.entrySet()).get(position).getValue();
} else if (mJsonArray != null) {
return mJsonArray.opt(position);
}
return null;
}
|
java
|
@Nullable
private Object getItem(int position) {
if (mMap != null) {
return new ArrayList<>(mMap.entrySet()).get(position).getValue();
} else if (mJsonArray != null) {
return mJsonArray.opt(position);
}
return null;
}
|
[
"@",
"Nullable",
"private",
"Object",
"getItem",
"(",
"int",
"position",
")",
"{",
"if",
"(",
"mMap",
"!=",
"null",
")",
"{",
"return",
"new",
"ArrayList",
"<>",
"(",
"mMap",
".",
"entrySet",
"(",
")",
")",
".",
"get",
"(",
"position",
")",
".",
"getValue",
"(",
")",
";",
"}",
"else",
"if",
"(",
"mJsonArray",
"!=",
"null",
")",
"{",
"return",
"mJsonArray",
".",
"opt",
"(",
"position",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Provides the item in a given position.
@param position The position.
@return The item in this position or null if no item.
|
[
"Provides",
"the",
"item",
"in",
"a",
"given",
"position",
"."
] |
7345a7a0e6636399015a03fad8243a47f5fcdd8f
|
https://github.com/droidpl/android-json-viewer/blob/7345a7a0e6636399015a03fad8243a47f5fcdd8f/android-json-viewer/src/main/java/com/github/droidpl/android/jsonviewer/RVJsonAdapter.java#L172-L180
|
147,889
|
eurekaclinical/aiw-i2b2-etl
|
src/main/java/edu/emory/cci/aiw/i2b2etl/dest/metadata/conceptid/PropDefConceptId.java
|
PropDefConceptId.getInstance
|
public static ConceptId getInstance(String propId, String propertyName, Metadata metadata) {
return getInstance(propId, propertyName, null, metadata);
}
|
java
|
public static ConceptId getInstance(String propId, String propertyName, Metadata metadata) {
return getInstance(propId, propertyName, null, metadata);
}
|
[
"public",
"static",
"ConceptId",
"getInstance",
"(",
"String",
"propId",
",",
"String",
"propertyName",
",",
"Metadata",
"metadata",
")",
"{",
"return",
"getInstance",
"(",
"propId",
",",
"propertyName",
",",
"null",
",",
"metadata",
")",
";",
"}"
] |
Returns a concept propId with the given proposition propId and property name.
@param propId a proposition propId {@link String}. Cannot be
<code>null</code>.
@param propertyName a property name {@link String}.
@return a {@link PropDefConceptId}.
|
[
"Returns",
"a",
"concept",
"propId",
"with",
"the",
"given",
"proposition",
"propId",
"and",
"property",
"name",
"."
] |
3eed6bda7755919cb9466d2930723a0f4748341a
|
https://github.com/eurekaclinical/aiw-i2b2-etl/blob/3eed6bda7755919cb9466d2930723a0f4748341a/src/main/java/edu/emory/cci/aiw/i2b2etl/dest/metadata/conceptid/PropDefConceptId.java#L53-L55
|
147,890
|
eurekaclinical/aiw-i2b2-etl
|
src/main/java/edu/emory/cci/aiw/i2b2etl/dest/metadata/conceptid/PropDefConceptId.java
|
PropDefConceptId.getInstance
|
public static PropDefConceptId getInstance(String propId,
String propertyName, Value value, Metadata metadata) {
List<Object> key = new ArrayList<>(4);
key.add(propId);
key.add(propertyName);
key.add(value);
key.add(Boolean.TRUE); //distinguishes these from properties represented as a modifier.
PropDefConceptId conceptId = (PropDefConceptId) metadata.getFromConceptIdCache(key);
if (conceptId == null) {
conceptId = new PropDefConceptId(propId, propertyName, value, metadata);
metadata.putInConceptIdCache(key, conceptId);
}
return conceptId;
}
|
java
|
public static PropDefConceptId getInstance(String propId,
String propertyName, Value value, Metadata metadata) {
List<Object> key = new ArrayList<>(4);
key.add(propId);
key.add(propertyName);
key.add(value);
key.add(Boolean.TRUE); //distinguishes these from properties represented as a modifier.
PropDefConceptId conceptId = (PropDefConceptId) metadata.getFromConceptIdCache(key);
if (conceptId == null) {
conceptId = new PropDefConceptId(propId, propertyName, value, metadata);
metadata.putInConceptIdCache(key, conceptId);
}
return conceptId;
}
|
[
"public",
"static",
"PropDefConceptId",
"getInstance",
"(",
"String",
"propId",
",",
"String",
"propertyName",
",",
"Value",
"value",
",",
"Metadata",
"metadata",
")",
"{",
"List",
"<",
"Object",
">",
"key",
"=",
"new",
"ArrayList",
"<>",
"(",
"4",
")",
";",
"key",
".",
"add",
"(",
"propId",
")",
";",
"key",
".",
"add",
"(",
"propertyName",
")",
";",
"key",
".",
"add",
"(",
"value",
")",
";",
"key",
".",
"add",
"(",
"Boolean",
".",
"TRUE",
")",
";",
"//distinguishes these from properties represented as a modifier.",
"PropDefConceptId",
"conceptId",
"=",
"(",
"PropDefConceptId",
")",
"metadata",
".",
"getFromConceptIdCache",
"(",
"key",
")",
";",
"if",
"(",
"conceptId",
"==",
"null",
")",
"{",
"conceptId",
"=",
"new",
"PropDefConceptId",
"(",
"propId",
",",
"propertyName",
",",
"value",
",",
"metadata",
")",
";",
"metadata",
".",
"putInConceptIdCache",
"(",
"key",
",",
"conceptId",
")",
";",
"}",
"return",
"conceptId",
";",
"}"
] |
Returns a concept propId with the given proposition propId, property name and
value.
@param propId a proposition propId {@link String}. Cannot be
<code>null</code>.
@param propertyName a property name {@link String}.
@param value a {@link Value}.
@return a {@link PropDefConceptId}.
|
[
"Returns",
"a",
"concept",
"propId",
"with",
"the",
"given",
"proposition",
"propId",
"property",
"name",
"and",
"value",
"."
] |
3eed6bda7755919cb9466d2930723a0f4748341a
|
https://github.com/eurekaclinical/aiw-i2b2-etl/blob/3eed6bda7755919cb9466d2930723a0f4748341a/src/main/java/edu/emory/cci/aiw/i2b2etl/dest/metadata/conceptid/PropDefConceptId.java#L67-L80
|
147,891
|
wkgcass/Style
|
src/main/java/net/cassite/style/reflect/Reflect.java
|
Reflect.cls
|
public static <T> ClassSup<T> cls(Class<T> cls) {
return mapper.get(cls.getName(), () -> new ClassSup<>(cls));
}
|
java
|
public static <T> ClassSup<T> cls(Class<T> cls) {
return mapper.get(cls.getName(), () -> new ClassSup<>(cls));
}
|
[
"public",
"static",
"<",
"T",
">",
"ClassSup",
"<",
"T",
">",
"cls",
"(",
"Class",
"<",
"T",
">",
"cls",
")",
"{",
"return",
"mapper",
".",
"get",
"(",
"cls",
".",
"getName",
"(",
")",
",",
"(",
")",
"->",
"new",
"ClassSup",
"<>",
"(",
"cls",
")",
")",
";",
"}"
] |
create a class supporter with given class
@param cls the class object to be supported
@return Class supporter
@see ClassSup
|
[
"create",
"a",
"class",
"supporter",
"with",
"given",
"class"
] |
db3ea64337251f46f734279480e365293bececbd
|
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/reflect/Reflect.java#L37-L39
|
147,892
|
wkgcass/Style
|
src/main/java/net/cassite/style/reflect/Reflect.java
|
Reflect.cls
|
@SuppressWarnings("unchecked")
public static <T> ClassSup<T> cls(T obj) {
return mapper.get(obj.getClass().getName(), () -> (ClassSup<T>) cls(obj.getClass()));
}
|
java
|
@SuppressWarnings("unchecked")
public static <T> ClassSup<T> cls(T obj) {
return mapper.get(obj.getClass().getName(), () -> (ClassSup<T>) cls(obj.getClass()));
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"ClassSup",
"<",
"T",
">",
"cls",
"(",
"T",
"obj",
")",
"{",
"return",
"mapper",
".",
"get",
"(",
"obj",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
",",
"(",
")",
"->",
"(",
"ClassSup",
"<",
"T",
">",
")",
"cls",
"(",
"obj",
".",
"getClass",
"(",
")",
")",
")",
";",
"}"
] |
create a class supporter with given object
@param obj instance of the class to be supported
@return Class supporter
@see ClassSup
|
[
"create",
"a",
"class",
"supporter",
"with",
"given",
"object"
] |
db3ea64337251f46f734279480e365293bececbd
|
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/reflect/Reflect.java#L64-L67
|
147,893
|
wkgcass/Style
|
src/main/java/net/cassite/style/reflect/Reflect.java
|
Reflect.proxy
|
@SuppressWarnings("unchecked")
public static <T> T proxy(InvocationHandler handler, T toProxy) {
return (T) Proxy.newProxyInstance(toProxy.getClass().getClassLoader(), toProxy.getClass().getInterfaces(), handler);
}
|
java
|
@SuppressWarnings("unchecked")
public static <T> T proxy(InvocationHandler handler, T toProxy) {
return (T) Proxy.newProxyInstance(toProxy.getClass().getClassLoader(), toProxy.getClass().getInterfaces(), handler);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"proxy",
"(",
"InvocationHandler",
"handler",
",",
"T",
"toProxy",
")",
"{",
"return",
"(",
"T",
")",
"Proxy",
".",
"newProxyInstance",
"(",
"toProxy",
".",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
",",
"toProxy",
".",
"getClass",
"(",
")",
".",
"getInterfaces",
"(",
")",
",",
"handler",
")",
";",
"}"
] |
generate proxy object with given InvocationHandler and the object to
do proxy
@param handler InvocationHandler instance
@param toProxy the object to do proxy
@return proxy object generated with Proxy.newProxyInstance(...)
@see InvocationHandler
@see Proxy#newProxyInstance(ClassLoader, Class[], InvocationHandler)
|
[
"generate",
"proxy",
"object",
"with",
"given",
"InvocationHandler",
"and",
"the",
"object",
"to",
"do",
"proxy"
] |
db3ea64337251f46f734279480e365293bececbd
|
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/reflect/Reflect.java#L79-L82
|
147,894
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/filter/Glob.java
|
Glob.translate
|
private static boolean translate(String glob, StringBuilder result) {
int i;
int max;
char c;
int j;
String stuff;
int escaped;
escaped = 0;
max = glob.length();
for (i = 0; i < max;) {
c = glob.charAt(i++);
if (c == '*') {
result.append(".*");
} else if (c == '?') {
result.append('.');
} else if (c == '[') {
j = i;
if (j < max && glob.charAt(j) == '!') {
j++;
}
if (j < max && glob.charAt(j) == ']') {
j++;
}
while (j < max && glob.charAt(j) != ']') {
j++;
}
if (j >= max) {
result.append("\\[");
} else {
stuff = glob.substring(i, j);
stuff = Strings.replace(stuff, "\\", "\\\\");
i = j+1;
if (stuff.charAt(0) == '!') {
stuff = '^' + stuff.substring(1);
} else if (stuff.charAt(0) == '^') {
stuff = '\\' + stuff;
}
result.append('[');
result.append(stuff);
result.append(']');
}
} else {
escaped++;
result.append(escape(c));
}
}
result.append('$');
return escaped == max;
}
|
java
|
private static boolean translate(String glob, StringBuilder result) {
int i;
int max;
char c;
int j;
String stuff;
int escaped;
escaped = 0;
max = glob.length();
for (i = 0; i < max;) {
c = glob.charAt(i++);
if (c == '*') {
result.append(".*");
} else if (c == '?') {
result.append('.');
} else if (c == '[') {
j = i;
if (j < max && glob.charAt(j) == '!') {
j++;
}
if (j < max && glob.charAt(j) == ']') {
j++;
}
while (j < max && glob.charAt(j) != ']') {
j++;
}
if (j >= max) {
result.append("\\[");
} else {
stuff = glob.substring(i, j);
stuff = Strings.replace(stuff, "\\", "\\\\");
i = j+1;
if (stuff.charAt(0) == '!') {
stuff = '^' + stuff.substring(1);
} else if (stuff.charAt(0) == '^') {
stuff = '\\' + stuff;
}
result.append('[');
result.append(stuff);
result.append(']');
}
} else {
escaped++;
result.append(escape(c));
}
}
result.append('$');
return escaped == max;
}
|
[
"private",
"static",
"boolean",
"translate",
"(",
"String",
"glob",
",",
"StringBuilder",
"result",
")",
"{",
"int",
"i",
";",
"int",
"max",
";",
"char",
"c",
";",
"int",
"j",
";",
"String",
"stuff",
";",
"int",
"escaped",
";",
"escaped",
"=",
"0",
";",
"max",
"=",
"glob",
".",
"length",
"(",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
")",
"{",
"c",
"=",
"glob",
".",
"charAt",
"(",
"i",
"++",
")",
";",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"result",
".",
"append",
"(",
"\".*\"",
")",
";",
"}",
"else",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"result",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"j",
"=",
"i",
";",
"if",
"(",
"j",
"<",
"max",
"&&",
"glob",
".",
"charAt",
"(",
"j",
")",
"==",
"'",
"'",
")",
"{",
"j",
"++",
";",
"}",
"if",
"(",
"j",
"<",
"max",
"&&",
"glob",
".",
"charAt",
"(",
"j",
")",
"==",
"'",
"'",
")",
"{",
"j",
"++",
";",
"}",
"while",
"(",
"j",
"<",
"max",
"&&",
"glob",
".",
"charAt",
"(",
"j",
")",
"!=",
"'",
"'",
")",
"{",
"j",
"++",
";",
"}",
"if",
"(",
"j",
">=",
"max",
")",
"{",
"result",
".",
"append",
"(",
"\"\\\\[\"",
")",
";",
"}",
"else",
"{",
"stuff",
"=",
"glob",
".",
"substring",
"(",
"i",
",",
"j",
")",
";",
"stuff",
"=",
"Strings",
".",
"replace",
"(",
"stuff",
",",
"\"\\\\\"",
",",
"\"\\\\\\\\\"",
")",
";",
"i",
"=",
"j",
"+",
"1",
";",
"if",
"(",
"stuff",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"{",
"stuff",
"=",
"'",
"'",
"+",
"stuff",
".",
"substring",
"(",
"1",
")",
";",
"}",
"else",
"if",
"(",
"stuff",
".",
"charAt",
"(",
"0",
")",
"==",
"'",
"'",
")",
"{",
"stuff",
"=",
"'",
"'",
"+",
"stuff",
";",
"}",
"result",
".",
"append",
"(",
"'",
"'",
")",
";",
"result",
".",
"append",
"(",
"stuff",
")",
";",
"result",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"}",
"else",
"{",
"escaped",
"++",
";",
"result",
".",
"append",
"(",
"escape",
"(",
"c",
")",
")",
";",
"}",
"}",
"result",
".",
"append",
"(",
"'",
"'",
")",
";",
"return",
"escaped",
"==",
"max",
";",
"}"
] |
Translate a glob PATTERN to a regular expression.
|
[
"Translate",
"a",
"glob",
"PATTERN",
"to",
"a",
"regular",
"expression",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/filter/Glob.java#L78-L127
|
147,895
|
pvanassen/ns-api
|
src/main/java/nl/pvanassen/ns/HttpConnection.java
|
HttpConnection.getContent
|
InputStream getContent(String url) throws IOException, NsApiException {
Request request = new Request.Builder().url(url).get().build();
try {
Response response = client.newCall(request).execute();
if (response.body() == null) {
log.error("Error while calling the webservice, entity is null");
throw new NsApiException("Error while calling the webservice, entity is null");
}
return response.body().byteStream();
}
catch (RuntimeException e) {
log.error("Error while calling the webservice, entity is null");
throw new NsApiException("Error while calling the webservice, entity is null", e);
}
}
|
java
|
InputStream getContent(String url) throws IOException, NsApiException {
Request request = new Request.Builder().url(url).get().build();
try {
Response response = client.newCall(request).execute();
if (response.body() == null) {
log.error("Error while calling the webservice, entity is null");
throw new NsApiException("Error while calling the webservice, entity is null");
}
return response.body().byteStream();
}
catch (RuntimeException e) {
log.error("Error while calling the webservice, entity is null");
throw new NsApiException("Error while calling the webservice, entity is null", e);
}
}
|
[
"InputStream",
"getContent",
"(",
"String",
"url",
")",
"throws",
"IOException",
",",
"NsApiException",
"{",
"Request",
"request",
"=",
"new",
"Request",
".",
"Builder",
"(",
")",
".",
"url",
"(",
"url",
")",
".",
"get",
"(",
")",
".",
"build",
"(",
")",
";",
"try",
"{",
"Response",
"response",
"=",
"client",
".",
"newCall",
"(",
"request",
")",
".",
"execute",
"(",
")",
";",
"if",
"(",
"response",
".",
"body",
"(",
")",
"==",
"null",
")",
"{",
"log",
".",
"error",
"(",
"\"Error while calling the webservice, entity is null\"",
")",
";",
"throw",
"new",
"NsApiException",
"(",
"\"Error while calling the webservice, entity is null\"",
")",
";",
"}",
"return",
"response",
".",
"body",
"(",
")",
".",
"byteStream",
"(",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Error while calling the webservice, entity is null\"",
")",
";",
"throw",
"new",
"NsApiException",
"(",
"\"Error while calling the webservice, entity is null\"",
",",
"e",
")",
";",
"}",
"}"
] |
Handling the webservice call
@param url URL to call
@return Input stream as a result, or an exception
@throws IOException In case of an IO error
@throws NsApiException In case of any other error
|
[
"Handling",
"the",
"webservice",
"call"
] |
e90e01028a0eb24006e4fddd4c85e7a25c4fe0ae
|
https://github.com/pvanassen/ns-api/blob/e90e01028a0eb24006e4fddd4c85e7a25c4fe0ae/src/main/java/nl/pvanassen/ns/HttpConnection.java#L49-L63
|
147,896
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/ExtensionRegistryLite.java
|
ExtensionRegistryLite.add
|
public final void add(
final GeneratedMessageLite.GeneratedExtension<?, ?> extension) {
extensionsByNumber.put(
new ObjectIntPair(extension.getContainingTypeDefaultInstance(),
extension.getNumber()),
extension);
}
|
java
|
public final void add(
final GeneratedMessageLite.GeneratedExtension<?, ?> extension) {
extensionsByNumber.put(
new ObjectIntPair(extension.getContainingTypeDefaultInstance(),
extension.getNumber()),
extension);
}
|
[
"public",
"final",
"void",
"add",
"(",
"final",
"GeneratedMessageLite",
".",
"GeneratedExtension",
"<",
"?",
",",
"?",
">",
"extension",
")",
"{",
"extensionsByNumber",
".",
"put",
"(",
"new",
"ObjectIntPair",
"(",
"extension",
".",
"getContainingTypeDefaultInstance",
"(",
")",
",",
"extension",
".",
"getNumber",
"(",
")",
")",
",",
"extension",
")",
";",
"}"
] |
Add an extension from a lite generated file to the registry.
|
[
"Add",
"an",
"extension",
"from",
"a",
"lite",
"generated",
"file",
"to",
"the",
"registry",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/ExtensionRegistryLite.java#L123-L129
|
147,897
|
awltech/org.parallelj
|
parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/KAttribute.java
|
KAttribute.value
|
public String value(Object context) {
return this.property != null ? this.property.get(context) : null;
}
|
java
|
public String value(Object context) {
return this.property != null ? this.property.get(context) : null;
}
|
[
"public",
"String",
"value",
"(",
"Object",
"context",
")",
"{",
"return",
"this",
".",
"property",
"!=",
"null",
"?",
"this",
".",
"property",
".",
"get",
"(",
"context",
")",
":",
"null",
";",
"}"
] |
Return the value of the attribute
@param context
the context
@return the value of the attribute. Might be <code>null</code>.
|
[
"Return",
"the",
"value",
"of",
"the",
"attribute"
] |
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
|
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/kernel/KAttribute.java#L74-L76
|
147,898
|
pulse00/Composer-Java-Bindings
|
java-api/src/main/java/com/dubture/getcomposer/core/entities/AbstractJsonObject.java
|
AbstractJsonObject.set
|
@SuppressWarnings("unchecked")
protected void set(String property, Object value, boolean notify) {
// remove listener on the current value if there is one yet
uninstallListener(property);
JsonEntity entity = null;
// install listener to be aware of changes
if (value instanceof JsonValue) {
entity = getEntity((JsonValue) value);
} else if (value instanceof JsonEntity) {
entity = (JsonEntity) value;
}
if (entity != null && !listeners.containsKey(property)) {
installListener(property, entity);
}
V oldValue = properties.get(property);
properties.put(property, (V) value);
appendSortOrder(property);
if (notify) {
firePropertyChange(property, oldValue, (V) value);
}
}
|
java
|
@SuppressWarnings("unchecked")
protected void set(String property, Object value, boolean notify) {
// remove listener on the current value if there is one yet
uninstallListener(property);
JsonEntity entity = null;
// install listener to be aware of changes
if (value instanceof JsonValue) {
entity = getEntity((JsonValue) value);
} else if (value instanceof JsonEntity) {
entity = (JsonEntity) value;
}
if (entity != null && !listeners.containsKey(property)) {
installListener(property, entity);
}
V oldValue = properties.get(property);
properties.put(property, (V) value);
appendSortOrder(property);
if (notify) {
firePropertyChange(property, oldValue, (V) value);
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"void",
"set",
"(",
"String",
"property",
",",
"Object",
"value",
",",
"boolean",
"notify",
")",
"{",
"// remove listener on the current value if there is one yet",
"uninstallListener",
"(",
"property",
")",
";",
"JsonEntity",
"entity",
"=",
"null",
";",
"// install listener to be aware of changes",
"if",
"(",
"value",
"instanceof",
"JsonValue",
")",
"{",
"entity",
"=",
"getEntity",
"(",
"(",
"JsonValue",
")",
"value",
")",
";",
"}",
"else",
"if",
"(",
"value",
"instanceof",
"JsonEntity",
")",
"{",
"entity",
"=",
"(",
"JsonEntity",
")",
"value",
";",
"}",
"if",
"(",
"entity",
"!=",
"null",
"&&",
"!",
"listeners",
".",
"containsKey",
"(",
"property",
")",
")",
"{",
"installListener",
"(",
"property",
",",
"entity",
")",
";",
"}",
"V",
"oldValue",
"=",
"properties",
".",
"get",
"(",
"property",
")",
";",
"properties",
".",
"put",
"(",
"property",
",",
"(",
"V",
")",
"value",
")",
";",
"appendSortOrder",
"(",
"property",
")",
";",
"if",
"(",
"notify",
")",
"{",
"firePropertyChange",
"(",
"property",
",",
"oldValue",
",",
"(",
"V",
")",
"value",
")",
";",
"}",
"}"
] |
Sets a new value for the given property.
@param property
the property
@param value
the new value
@param notify
whether listeners should be notified about the change
|
[
"Sets",
"a",
"new",
"value",
"for",
"the",
"given",
"property",
"."
] |
0aa572567db37d047a41a57c32ede7c7fd5d4938
|
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/entities/AbstractJsonObject.java#L228-L253
|
147,899
|
pulse00/Composer-Java-Bindings
|
java-api/src/main/java/com/dubture/getcomposer/core/entities/AbstractJsonObject.java
|
AbstractJsonObject.remove
|
public void remove(String property) {
uninstallListener(property);
Object oldValue = get(property);
properties.remove(property);
firePropertyChange(property, oldValue, null);
}
|
java
|
public void remove(String property) {
uninstallListener(property);
Object oldValue = get(property);
properties.remove(property);
firePropertyChange(property, oldValue, null);
}
|
[
"public",
"void",
"remove",
"(",
"String",
"property",
")",
"{",
"uninstallListener",
"(",
"property",
")",
";",
"Object",
"oldValue",
"=",
"get",
"(",
"property",
")",
";",
"properties",
".",
"remove",
"(",
"property",
")",
";",
"firePropertyChange",
"(",
"property",
",",
"oldValue",
",",
"null",
")",
";",
"}"
] |
Removes the given property.
@param property
the property
|
[
"Removes",
"the",
"given",
"property",
"."
] |
0aa572567db37d047a41a57c32ede7c7fd5d4938
|
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/entities/AbstractJsonObject.java#L262-L267
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.