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,600
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java
|
PropertySheetTable.getCellRenderer
|
private TableCellRenderer getCellRenderer(Class<?> type) {
// try to create one from the factory
TableCellRenderer renderer = getRendererFactory().createTableCellRenderer(type);
// if that fails, recursively try again with the superclass
if (renderer == null && type != null) {
renderer = getCellRenderer(type.getSuperclass());
}
// if that fails, just use the default Object renderer
if (renderer == null) {
renderer = super.getDefaultRenderer(Object.class);
}
return renderer;
}
|
java
|
private TableCellRenderer getCellRenderer(Class<?> type) {
// try to create one from the factory
TableCellRenderer renderer = getRendererFactory().createTableCellRenderer(type);
// if that fails, recursively try again with the superclass
if (renderer == null && type != null) {
renderer = getCellRenderer(type.getSuperclass());
}
// if that fails, just use the default Object renderer
if (renderer == null) {
renderer = super.getDefaultRenderer(Object.class);
}
return renderer;
}
|
[
"private",
"TableCellRenderer",
"getCellRenderer",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"// try to create one from the factory\r",
"TableCellRenderer",
"renderer",
"=",
"getRendererFactory",
"(",
")",
".",
"createTableCellRenderer",
"(",
"type",
")",
";",
"// if that fails, recursively try again with the superclass\r",
"if",
"(",
"renderer",
"==",
"null",
"&&",
"type",
"!=",
"null",
")",
"{",
"renderer",
"=",
"getCellRenderer",
"(",
"type",
".",
"getSuperclass",
"(",
")",
")",
";",
"}",
"// if that fails, just use the default Object renderer\r",
"if",
"(",
"renderer",
"==",
"null",
")",
"{",
"renderer",
"=",
"super",
".",
"getDefaultRenderer",
"(",
"Object",
".",
"class",
")",
";",
"}",
"return",
"renderer",
";",
"}"
] |
Helper method to lookup a cell renderer based on type.
@param type the type for which a renderer should be found
@return a renderer for the given object type
|
[
"Helper",
"method",
"to",
"lookup",
"a",
"cell",
"renderer",
"based",
"on",
"type",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java#L395-L410
|
147,601
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java
|
PropertySheetTable.setModel
|
@Override
public void setModel(TableModel newModel) {
if (!(newModel instanceof PropertySheetTableModel)) {
throw new IllegalArgumentException("dataModel must be of type "
+ PropertySheetTableModel.class.getName());
}
if (cancelEditing == null) {
cancelEditing = new CancelEditing();
}
TableModel oldModel = getModel();
if (oldModel != null) {
oldModel.removeTableModelListener(cancelEditing);
}
super.setModel(newModel);
newModel.addTableModelListener(cancelEditing);
// ensure the "value" column can not be resized
getColumnModel().getColumn(1).setResizable(false);
}
|
java
|
@Override
public void setModel(TableModel newModel) {
if (!(newModel instanceof PropertySheetTableModel)) {
throw new IllegalArgumentException("dataModel must be of type "
+ PropertySheetTableModel.class.getName());
}
if (cancelEditing == null) {
cancelEditing = new CancelEditing();
}
TableModel oldModel = getModel();
if (oldModel != null) {
oldModel.removeTableModelListener(cancelEditing);
}
super.setModel(newModel);
newModel.addTableModelListener(cancelEditing);
// ensure the "value" column can not be resized
getColumnModel().getColumn(1).setResizable(false);
}
|
[
"@",
"Override",
"public",
"void",
"setModel",
"(",
"TableModel",
"newModel",
")",
"{",
"if",
"(",
"!",
"(",
"newModel",
"instanceof",
"PropertySheetTableModel",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"dataModel must be of type \"",
"+",
"PropertySheetTableModel",
".",
"class",
".",
"getName",
"(",
")",
")",
";",
"}",
"if",
"(",
"cancelEditing",
"==",
"null",
")",
"{",
"cancelEditing",
"=",
"new",
"CancelEditing",
"(",
")",
";",
"}",
"TableModel",
"oldModel",
"=",
"getModel",
"(",
")",
";",
"if",
"(",
"oldModel",
"!=",
"null",
")",
"{",
"oldModel",
".",
"removeTableModelListener",
"(",
"cancelEditing",
")",
";",
"}",
"super",
".",
"setModel",
"(",
"newModel",
")",
";",
"newModel",
".",
"addTableModelListener",
"(",
"cancelEditing",
")",
";",
"// ensure the \"value\" column can not be resized\r",
"getColumnModel",
"(",
")",
".",
"getColumn",
"(",
"1",
")",
".",
"setResizable",
"(",
"false",
")",
";",
"}"
] |
Overriden to register a listener on the model. This listener ensures
editing is canceled when editing row is being changed.
@param newModel
@see javax.swing.JTable#setModel(javax.swing.table.TableModel)
@throws IllegalArgumentException if dataModel is not a
{@link PropertySheetTableModel}
|
[
"Overriden",
"to",
"register",
"a",
"listener",
"on",
"the",
"model",
".",
"This",
"listener",
"ensures",
"editing",
"is",
"canceled",
"when",
"editing",
"row",
"is",
"being",
"changed",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java#L449-L469
|
147,602
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java
|
PropertySheetTable.getIndent
|
static int getIndent(PropertySheetTable table, Item item) {
int indent;
if (item.isProperty()) {
// it is a property, it has no parent or a category, and no child
if ((item.getParent() == null || !item.getParent().isProperty())
&& !item.hasToggle()) {
indent = table.getWantsExtraIndent() ? HOTSPOT_SIZE : 0;
} else {
// it is a property with children
if (item.hasToggle()) {
indent = item.getDepth() * HOTSPOT_SIZE;
} else {
indent = (item.getDepth() + 1) * HOTSPOT_SIZE;
}
}
if (table.getSheetModel().getMode() == PropertySheet.VIEW_AS_CATEGORIES
&& table.getWantsExtraIndent()) {
indent += HOTSPOT_SIZE;
}
} else {
// category has no indent
indent = 0;
}
return indent;
}
|
java
|
static int getIndent(PropertySheetTable table, Item item) {
int indent;
if (item.isProperty()) {
// it is a property, it has no parent or a category, and no child
if ((item.getParent() == null || !item.getParent().isProperty())
&& !item.hasToggle()) {
indent = table.getWantsExtraIndent() ? HOTSPOT_SIZE : 0;
} else {
// it is a property with children
if (item.hasToggle()) {
indent = item.getDepth() * HOTSPOT_SIZE;
} else {
indent = (item.getDepth() + 1) * HOTSPOT_SIZE;
}
}
if (table.getSheetModel().getMode() == PropertySheet.VIEW_AS_CATEGORIES
&& table.getWantsExtraIndent()) {
indent += HOTSPOT_SIZE;
}
} else {
// category has no indent
indent = 0;
}
return indent;
}
|
[
"static",
"int",
"getIndent",
"(",
"PropertySheetTable",
"table",
",",
"Item",
"item",
")",
"{",
"int",
"indent",
";",
"if",
"(",
"item",
".",
"isProperty",
"(",
")",
")",
"{",
"// it is a property, it has no parent or a category, and no child\r",
"if",
"(",
"(",
"item",
".",
"getParent",
"(",
")",
"==",
"null",
"||",
"!",
"item",
".",
"getParent",
"(",
")",
".",
"isProperty",
"(",
")",
")",
"&&",
"!",
"item",
".",
"hasToggle",
"(",
")",
")",
"{",
"indent",
"=",
"table",
".",
"getWantsExtraIndent",
"(",
")",
"?",
"HOTSPOT_SIZE",
":",
"0",
";",
"}",
"else",
"{",
"// it is a property with children\r",
"if",
"(",
"item",
".",
"hasToggle",
"(",
")",
")",
"{",
"indent",
"=",
"item",
".",
"getDepth",
"(",
")",
"*",
"HOTSPOT_SIZE",
";",
"}",
"else",
"{",
"indent",
"=",
"(",
"item",
".",
"getDepth",
"(",
")",
"+",
"1",
")",
"*",
"HOTSPOT_SIZE",
";",
"}",
"}",
"if",
"(",
"table",
".",
"getSheetModel",
"(",
")",
".",
"getMode",
"(",
")",
"==",
"PropertySheet",
".",
"VIEW_AS_CATEGORIES",
"&&",
"table",
".",
"getWantsExtraIndent",
"(",
")",
")",
"{",
"indent",
"+=",
"HOTSPOT_SIZE",
";",
"}",
"}",
"else",
"{",
"// category has no indent\r",
"indent",
"=",
"0",
";",
"}",
"return",
"indent",
";",
"}"
] |
Calculates the required left indent for a given item, given its type and
its hierarchy level.
|
[
"Calculates",
"the",
"required",
"left",
"indent",
"for",
"a",
"given",
"item",
"given",
"its",
"type",
"and",
"its",
"hierarchy",
"level",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java#L632-L659
|
147,603
|
awltech/org.parallelj
|
parallelj-ssh-parent/parallelj-ssh-publickey-common/src/main/java/org/parallelj/ssh/publickey/ParalleljSshPublicKey.java
|
ParalleljSshPublicKey.process
|
@Override
public void process(SshServer sshd) throws ExtensionException {
// load the URLKeyPairProvider implementation
ParallelJURLKeyPairProvider urlKeyPairProvider = null;
ServiceLoader<ParallelJURLKeyPairProvider> loader = CacheableServiceLoader.INSTANCE.load(ParallelJURLKeyPairProvider.class, ParallelJURLKeyPairProvider.class.getClassLoader());
if (loader==null || loader.iterator()==null || !loader.iterator().hasNext()) {
loader = CacheableServiceLoader.INSTANCE.load(ParallelJURLKeyPairProvider.class, Thread.currentThread().getContextClassLoader());
}
for (ParallelJURLKeyPairProvider currentURLKeyPairProvider : loader) {
urlKeyPairProvider = currentURLKeyPairProvider;
break;
}
urlKeyPairProvider.setPrivateServerKey(this.privateServerKey);
sshd.setKeyPairProvider(urlKeyPairProvider);
List<NamedFactory<UserAuth>> userAuthFactories = new ArrayList<NamedFactory<UserAuth>>();
userAuthFactories.add(new UserAuthPublicKey.Factory());
sshd.setUserAuthFactories(userAuthFactories);
sshd.setPublickeyAuthenticator(new URLPublicKeyAuthentificator(
this.authorizedServerKey));
}
|
java
|
@Override
public void process(SshServer sshd) throws ExtensionException {
// load the URLKeyPairProvider implementation
ParallelJURLKeyPairProvider urlKeyPairProvider = null;
ServiceLoader<ParallelJURLKeyPairProvider> loader = CacheableServiceLoader.INSTANCE.load(ParallelJURLKeyPairProvider.class, ParallelJURLKeyPairProvider.class.getClassLoader());
if (loader==null || loader.iterator()==null || !loader.iterator().hasNext()) {
loader = CacheableServiceLoader.INSTANCE.load(ParallelJURLKeyPairProvider.class, Thread.currentThread().getContextClassLoader());
}
for (ParallelJURLKeyPairProvider currentURLKeyPairProvider : loader) {
urlKeyPairProvider = currentURLKeyPairProvider;
break;
}
urlKeyPairProvider.setPrivateServerKey(this.privateServerKey);
sshd.setKeyPairProvider(urlKeyPairProvider);
List<NamedFactory<UserAuth>> userAuthFactories = new ArrayList<NamedFactory<UserAuth>>();
userAuthFactories.add(new UserAuthPublicKey.Factory());
sshd.setUserAuthFactories(userAuthFactories);
sshd.setPublickeyAuthenticator(new URLPublicKeyAuthentificator(
this.authorizedServerKey));
}
|
[
"@",
"Override",
"public",
"void",
"process",
"(",
"SshServer",
"sshd",
")",
"throws",
"ExtensionException",
"{",
"// load the URLKeyPairProvider implementation",
"ParallelJURLKeyPairProvider",
"urlKeyPairProvider",
"=",
"null",
";",
"ServiceLoader",
"<",
"ParallelJURLKeyPairProvider",
">",
"loader",
"=",
"CacheableServiceLoader",
".",
"INSTANCE",
".",
"load",
"(",
"ParallelJURLKeyPairProvider",
".",
"class",
",",
"ParallelJURLKeyPairProvider",
".",
"class",
".",
"getClassLoader",
"(",
")",
")",
";",
"if",
"(",
"loader",
"==",
"null",
"||",
"loader",
".",
"iterator",
"(",
")",
"==",
"null",
"||",
"!",
"loader",
".",
"iterator",
"(",
")",
".",
"hasNext",
"(",
")",
")",
"{",
"loader",
"=",
"CacheableServiceLoader",
".",
"INSTANCE",
".",
"load",
"(",
"ParallelJURLKeyPairProvider",
".",
"class",
",",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getContextClassLoader",
"(",
")",
")",
";",
"}",
"for",
"(",
"ParallelJURLKeyPairProvider",
"currentURLKeyPairProvider",
":",
"loader",
")",
"{",
"urlKeyPairProvider",
"=",
"currentURLKeyPairProvider",
";",
"break",
";",
"}",
"urlKeyPairProvider",
".",
"setPrivateServerKey",
"(",
"this",
".",
"privateServerKey",
")",
";",
"sshd",
".",
"setKeyPairProvider",
"(",
"urlKeyPairProvider",
")",
";",
"List",
"<",
"NamedFactory",
"<",
"UserAuth",
">",
">",
"userAuthFactories",
"=",
"new",
"ArrayList",
"<",
"NamedFactory",
"<",
"UserAuth",
">",
">",
"(",
")",
";",
"userAuthFactories",
".",
"add",
"(",
"new",
"UserAuthPublicKey",
".",
"Factory",
"(",
")",
")",
";",
"sshd",
".",
"setUserAuthFactories",
"(",
"userAuthFactories",
")",
";",
"sshd",
".",
"setPublickeyAuthenticator",
"(",
"new",
"URLPublicKeyAuthentificator",
"(",
"this",
".",
"authorizedServerKey",
")",
")",
";",
"}"
] |
Any others configurations for the sshd server can be done directly with the SshServer object from Apache mina SSHD
Warnings:
- The shell factory mustn't be changed if you want to be able to launch your Programs remotly...!
- Changing the port of the Apache mina SSHD instance will not have any effect: sshd.setPort(port)
The port of the ssh server is read from the parallelj.xml file
|
[
"Any",
"others",
"configurations",
"for",
"the",
"sshd",
"server",
"can",
"be",
"done",
"directly",
"with",
"the",
"SshServer",
"object",
"from",
"Apache",
"mina",
"SSHD"
] |
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
|
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-ssh-parent/parallelj-ssh-publickey-common/src/main/java/org/parallelj/ssh/publickey/ParalleljSshPublicKey.java#L142-L164
|
147,604
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/Filesystem.java
|
Filesystem.after
|
public String after(String schemeSpecific, String separator) {
int idx;
idx = schemeSpecific.indexOf(separator);
if (idx == -1) {
return null;
}
return schemeSpecific.substring(idx + separator.length());
}
|
java
|
public String after(String schemeSpecific, String separator) {
int idx;
idx = schemeSpecific.indexOf(separator);
if (idx == -1) {
return null;
}
return schemeSpecific.substring(idx + separator.length());
}
|
[
"public",
"String",
"after",
"(",
"String",
"schemeSpecific",
",",
"String",
"separator",
")",
"{",
"int",
"idx",
";",
"idx",
"=",
"schemeSpecific",
".",
"indexOf",
"(",
"separator",
")",
";",
"if",
"(",
"idx",
"==",
"-",
"1",
")",
"{",
"return",
"null",
";",
"}",
"return",
"schemeSpecific",
".",
"substring",
"(",
"idx",
"+",
"separator",
".",
"length",
"(",
")",
")",
";",
"}"
] |
Helper Method for opaquePath implementations
|
[
"Helper",
"Method",
"for",
"opaquePath",
"implementations"
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Filesystem.java#L69-L77
|
147,605
|
kmi/iserve
|
iserve-elda/src/main/java/uk/ac/open/kmi/iserve/elda/EldaRouterRestlet.java
|
EldaRouterRestlet.getRouterFor
|
public static synchronized Router getRouterFor(ServletContext con) {
// log.info( "getting router for context path '" + givenContextPath + "'" );
String contextPath = EldaRouterRestletSupport.flatContextPath(con.getContextPath());
TimestampedRouter r = routers.get(contextPath);
long timeNow = System.currentTimeMillis();
//
if (r == null) {
log.info("creating router for '" + contextPath + "'");
long interval = getRefreshInterval(contextPath);
r = new TimestampedRouter(EldaRouterRestletSupport.createRouterFor(con), timeNow, interval);
routers.put(contextPath, r);
} else if (r.nextCheck < timeNow) {
long latestTime = EldaRouterRestletSupport.latestConfigTime(con, contextPath);
if (latestTime > r.timestamp) {
log.info("reloading router for '" + contextPath + "'");
long interval = getRefreshInterval(contextPath);
r = new TimestampedRouter(EldaRouterRestletSupport.createRouterFor(con), timeNow, interval);
DOMUtils.clearCache();
Cache.Registry.clearAll();
routers.put(contextPath, r);
} else {
// checked, but no change to reload
// log.info("don't need to reload router, will check again later." );
r.deferCheck();
}
} else {
// Don't need to check yet, still in waiting period
// log.info( "Using existing router, not time to check yet." );
}
//
return r.router;
}
|
java
|
public static synchronized Router getRouterFor(ServletContext con) {
// log.info( "getting router for context path '" + givenContextPath + "'" );
String contextPath = EldaRouterRestletSupport.flatContextPath(con.getContextPath());
TimestampedRouter r = routers.get(contextPath);
long timeNow = System.currentTimeMillis();
//
if (r == null) {
log.info("creating router for '" + contextPath + "'");
long interval = getRefreshInterval(contextPath);
r = new TimestampedRouter(EldaRouterRestletSupport.createRouterFor(con), timeNow, interval);
routers.put(contextPath, r);
} else if (r.nextCheck < timeNow) {
long latestTime = EldaRouterRestletSupport.latestConfigTime(con, contextPath);
if (latestTime > r.timestamp) {
log.info("reloading router for '" + contextPath + "'");
long interval = getRefreshInterval(contextPath);
r = new TimestampedRouter(EldaRouterRestletSupport.createRouterFor(con), timeNow, interval);
DOMUtils.clearCache();
Cache.Registry.clearAll();
routers.put(contextPath, r);
} else {
// checked, but no change to reload
// log.info("don't need to reload router, will check again later." );
r.deferCheck();
}
} else {
// Don't need to check yet, still in waiting period
// log.info( "Using existing router, not time to check yet." );
}
//
return r.router;
}
|
[
"public",
"static",
"synchronized",
"Router",
"getRouterFor",
"(",
"ServletContext",
"con",
")",
"{",
"// log.info( \"getting router for context path '\" + givenContextPath + \"'\" );",
"String",
"contextPath",
"=",
"EldaRouterRestletSupport",
".",
"flatContextPath",
"(",
"con",
".",
"getContextPath",
"(",
")",
")",
";",
"TimestampedRouter",
"r",
"=",
"routers",
".",
"get",
"(",
"contextPath",
")",
";",
"long",
"timeNow",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"//",
"if",
"(",
"r",
"==",
"null",
")",
"{",
"log",
".",
"info",
"(",
"\"creating router for '\"",
"+",
"contextPath",
"+",
"\"'\"",
")",
";",
"long",
"interval",
"=",
"getRefreshInterval",
"(",
"contextPath",
")",
";",
"r",
"=",
"new",
"TimestampedRouter",
"(",
"EldaRouterRestletSupport",
".",
"createRouterFor",
"(",
"con",
")",
",",
"timeNow",
",",
"interval",
")",
";",
"routers",
".",
"put",
"(",
"contextPath",
",",
"r",
")",
";",
"}",
"else",
"if",
"(",
"r",
".",
"nextCheck",
"<",
"timeNow",
")",
"{",
"long",
"latestTime",
"=",
"EldaRouterRestletSupport",
".",
"latestConfigTime",
"(",
"con",
",",
"contextPath",
")",
";",
"if",
"(",
"latestTime",
">",
"r",
".",
"timestamp",
")",
"{",
"log",
".",
"info",
"(",
"\"reloading router for '\"",
"+",
"contextPath",
"+",
"\"'\"",
")",
";",
"long",
"interval",
"=",
"getRefreshInterval",
"(",
"contextPath",
")",
";",
"r",
"=",
"new",
"TimestampedRouter",
"(",
"EldaRouterRestletSupport",
".",
"createRouterFor",
"(",
"con",
")",
",",
"timeNow",
",",
"interval",
")",
";",
"DOMUtils",
".",
"clearCache",
"(",
")",
";",
"Cache",
".",
"Registry",
".",
"clearAll",
"(",
")",
";",
"routers",
".",
"put",
"(",
"contextPath",
",",
"r",
")",
";",
"}",
"else",
"{",
"// checked, but no change to reload",
"// log.info(\"don't need to reload router, will check again later.\" );",
"r",
".",
"deferCheck",
"(",
")",
";",
"}",
"}",
"else",
"{",
"// Don't need to check yet, still in waiting period",
"// log.info( \"Using existing router, not time to check yet.\" );",
"}",
"//",
"return",
"r",
".",
"router",
";",
"}"
] |
Answer a router initialised with the URI templates appropriate to
this context path. Such a router may already be in the routers table,
in which case it is used, otherwise a new router is created, initialised,
put in the table, and returned.
|
[
"Answer",
"a",
"router",
"initialised",
"with",
"the",
"URI",
"templates",
"appropriate",
"to",
"this",
"context",
"path",
".",
"Such",
"a",
"router",
"may",
"already",
"be",
"in",
"the",
"routers",
"table",
"in",
"which",
"case",
"it",
"is",
"used",
"otherwise",
"a",
"new",
"router",
"is",
"created",
"initialised",
"put",
"in",
"the",
"table",
"and",
"returned",
"."
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-elda/src/main/java/uk/ac/open/kmi/iserve/elda/EldaRouterRestlet.java#L95-L126
|
147,606
|
kmi/iserve
|
iserve-elda/src/main/java/uk/ac/open/kmi/iserve/elda/EldaRouterRestlet.java
|
EldaRouterRestlet.notFormat
|
private boolean notFormat(Match m, String type) {
return m.getEndpoint().getRendererNamed(type) == null;
}
|
java
|
private boolean notFormat(Match m, String type) {
return m.getEndpoint().getRendererNamed(type) == null;
}
|
[
"private",
"boolean",
"notFormat",
"(",
"Match",
"m",
",",
"String",
"type",
")",
"{",
"return",
"m",
".",
"getEndpoint",
"(",
")",
".",
"getRendererNamed",
"(",
"type",
")",
"==",
"null",
";",
"}"
] |
Answer true of m's endpoint has no formatter called type.
|
[
"Answer",
"true",
"of",
"m",
"s",
"endpoint",
"has",
"no",
"formatter",
"called",
"type",
"."
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-elda/src/main/java/uk/ac/open/kmi/iserve/elda/EldaRouterRestlet.java#L369-L371
|
147,607
|
oaqa/cse-framework
|
src/main/java/edu/cmu/lti/oaqa/framework/eval/TraceConsumer.java
|
TraceConsumer.process
|
@Override
public void process(CAS aCAS) throws AnalysisEngineProcessException {
try {
JCas jcas = aCAS.getJCas();
ExperimentUUID experiment = ProcessingStepUtils.getCurrentExperiment(jcas);
AnnotationIndex<Annotation> steps = jcas.getAnnotationIndex(ProcessingStep.type);
String uuid = experiment.getUuid();
Trace trace = ProcessingStepUtils.getTrace(steps);
Key key = new Key(uuid, trace, experiment.getStageId());
experiments.add(new ExperimentKey(key.getExperiment(), key.getStage()));
for (TraceListener listener : listeners) {
listener.process(key, jcas);
}
} catch (Exception e) {
throw new AnalysisEngineProcessException(e);
}
}
|
java
|
@Override
public void process(CAS aCAS) throws AnalysisEngineProcessException {
try {
JCas jcas = aCAS.getJCas();
ExperimentUUID experiment = ProcessingStepUtils.getCurrentExperiment(jcas);
AnnotationIndex<Annotation> steps = jcas.getAnnotationIndex(ProcessingStep.type);
String uuid = experiment.getUuid();
Trace trace = ProcessingStepUtils.getTrace(steps);
Key key = new Key(uuid, trace, experiment.getStageId());
experiments.add(new ExperimentKey(key.getExperiment(), key.getStage()));
for (TraceListener listener : listeners) {
listener.process(key, jcas);
}
} catch (Exception e) {
throw new AnalysisEngineProcessException(e);
}
}
|
[
"@",
"Override",
"public",
"void",
"process",
"(",
"CAS",
"aCAS",
")",
"throws",
"AnalysisEngineProcessException",
"{",
"try",
"{",
"JCas",
"jcas",
"=",
"aCAS",
".",
"getJCas",
"(",
")",
";",
"ExperimentUUID",
"experiment",
"=",
"ProcessingStepUtils",
".",
"getCurrentExperiment",
"(",
"jcas",
")",
";",
"AnnotationIndex",
"<",
"Annotation",
">",
"steps",
"=",
"jcas",
".",
"getAnnotationIndex",
"(",
"ProcessingStep",
".",
"type",
")",
";",
"String",
"uuid",
"=",
"experiment",
".",
"getUuid",
"(",
")",
";",
"Trace",
"trace",
"=",
"ProcessingStepUtils",
".",
"getTrace",
"(",
"steps",
")",
";",
"Key",
"key",
"=",
"new",
"Key",
"(",
"uuid",
",",
"trace",
",",
"experiment",
".",
"getStageId",
"(",
")",
")",
";",
"experiments",
".",
"add",
"(",
"new",
"ExperimentKey",
"(",
"key",
".",
"getExperiment",
"(",
")",
",",
"key",
".",
"getStage",
"(",
")",
")",
")",
";",
"for",
"(",
"TraceListener",
"listener",
":",
"listeners",
")",
"{",
"listener",
".",
"process",
"(",
"key",
",",
"jcas",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"AnalysisEngineProcessException",
"(",
"e",
")",
";",
"}",
"}"
] |
Reads the results from the retrieval phase from the DOCUMENT and the DOCUEMNT_GS views of the
JCAs, and generates and evaluates them using the evaluate method from the FMeasureConsumer
class.
|
[
"Reads",
"the",
"results",
"from",
"the",
"retrieval",
"phase",
"from",
"the",
"DOCUMENT",
"and",
"the",
"DOCUEMNT_GS",
"views",
"of",
"the",
"JCAs",
"and",
"generates",
"and",
"evaluates",
"them",
"using",
"the",
"evaluate",
"method",
"from",
"the",
"FMeasureConsumer",
"class",
"."
] |
3a46b5828b3a33be4547345a0ac15e829c43c5ef
|
https://github.com/oaqa/cse-framework/blob/3a46b5828b3a33be4547345a0ac15e829c43c5ef/src/main/java/edu/cmu/lti/oaqa/framework/eval/TraceConsumer.java#L65-L81
|
147,608
|
colin-lee/mybatis-spring-support
|
src/main/java/com/github/mybatis/interceptor/PaginationAutoMapInterceptor.java
|
PaginationAutoMapInterceptor.resolveResultJavaType
|
private Class<?> resolveResultJavaType(Class<?> resultType, String property, Class<?> javaType) {
if (javaType == null && property != null) {
try {
MetaClass metaResultType = MetaClass.forClass(resultType, REFLECTOR_FACTORY);
javaType = metaResultType.getSetterType(property);
} catch (Exception ignored) {
// ignore, following null check statement will deal with the
// situation
}
}
if (javaType == null) {
javaType = Object.class;
}
return javaType;
}
|
java
|
private Class<?> resolveResultJavaType(Class<?> resultType, String property, Class<?> javaType) {
if (javaType == null && property != null) {
try {
MetaClass metaResultType = MetaClass.forClass(resultType, REFLECTOR_FACTORY);
javaType = metaResultType.getSetterType(property);
} catch (Exception ignored) {
// ignore, following null check statement will deal with the
// situation
}
}
if (javaType == null) {
javaType = Object.class;
}
return javaType;
}
|
[
"private",
"Class",
"<",
"?",
">",
"resolveResultJavaType",
"(",
"Class",
"<",
"?",
">",
"resultType",
",",
"String",
"property",
",",
"Class",
"<",
"?",
">",
"javaType",
")",
"{",
"if",
"(",
"javaType",
"==",
"null",
"&&",
"property",
"!=",
"null",
")",
"{",
"try",
"{",
"MetaClass",
"metaResultType",
"=",
"MetaClass",
".",
"forClass",
"(",
"resultType",
",",
"REFLECTOR_FACTORY",
")",
";",
"javaType",
"=",
"metaResultType",
".",
"getSetterType",
"(",
"property",
")",
";",
"}",
"catch",
"(",
"Exception",
"ignored",
")",
"{",
"// ignore, following null check statement will deal with the",
"// situation",
"}",
"}",
"if",
"(",
"javaType",
"==",
"null",
")",
"{",
"javaType",
"=",
"Object",
".",
"class",
";",
"}",
"return",
"javaType",
";",
"}"
] |
copy from mybatis sourceCode
@param resultType
@param property
@param javaType
@return
|
[
"copy",
"from",
"mybatis",
"sourceCode"
] |
de412e98d00e9a012c0619778fa1a61832863b82
|
https://github.com/colin-lee/mybatis-spring-support/blob/de412e98d00e9a012c0619778fa1a61832863b82/src/main/java/com/github/mybatis/interceptor/PaginationAutoMapInterceptor.java#L337-L351
|
147,609
|
awltech/org.parallelj
|
parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/reflect/callback/PipelineIterator.java
|
PipelineIterator.getNext
|
public Object getNext(KCall call) {
if (map.get(call.getProcedure().getId()) == null) {
Object context = call.getProcess().getContext();
// getting data by reflection
Method readMethod = null;
try {
readMethod = new PropertyDescriptor(pipelineDataName,
context.getClass()).getReadMethod();
} catch (IntrospectionException e) {
MessageKind.W0003.format(e);
}
Object invoke = null;
try {
invoke = readMethod.invoke(context);
} catch (IllegalArgumentException e) {
MessageKind.W0003.format(e);
} catch (IllegalAccessException e) {
MessageKind.W0003.format(e);
} catch (InvocationTargetException e) {
MessageKind.W0003.format(e);
}
// putting new Iterator into map
if (invoke instanceof Iterable<?>) {
Iterator newIterator = ((Iterable) invoke).iterator();
this.add(call.getProcedure().getId(), newIterator);
}
}
Iterator iterator = map.get(call.getProcedure().getId());
return iterator.next();
}
|
java
|
public Object getNext(KCall call) {
if (map.get(call.getProcedure().getId()) == null) {
Object context = call.getProcess().getContext();
// getting data by reflection
Method readMethod = null;
try {
readMethod = new PropertyDescriptor(pipelineDataName,
context.getClass()).getReadMethod();
} catch (IntrospectionException e) {
MessageKind.W0003.format(e);
}
Object invoke = null;
try {
invoke = readMethod.invoke(context);
} catch (IllegalArgumentException e) {
MessageKind.W0003.format(e);
} catch (IllegalAccessException e) {
MessageKind.W0003.format(e);
} catch (InvocationTargetException e) {
MessageKind.W0003.format(e);
}
// putting new Iterator into map
if (invoke instanceof Iterable<?>) {
Iterator newIterator = ((Iterable) invoke).iterator();
this.add(call.getProcedure().getId(), newIterator);
}
}
Iterator iterator = map.get(call.getProcedure().getId());
return iterator.next();
}
|
[
"public",
"Object",
"getNext",
"(",
"KCall",
"call",
")",
"{",
"if",
"(",
"map",
".",
"get",
"(",
"call",
".",
"getProcedure",
"(",
")",
".",
"getId",
"(",
")",
")",
"==",
"null",
")",
"{",
"Object",
"context",
"=",
"call",
".",
"getProcess",
"(",
")",
".",
"getContext",
"(",
")",
";",
"// getting data by reflection",
"Method",
"readMethod",
"=",
"null",
";",
"try",
"{",
"readMethod",
"=",
"new",
"PropertyDescriptor",
"(",
"pipelineDataName",
",",
"context",
".",
"getClass",
"(",
")",
")",
".",
"getReadMethod",
"(",
")",
";",
"}",
"catch",
"(",
"IntrospectionException",
"e",
")",
"{",
"MessageKind",
".",
"W0003",
".",
"format",
"(",
"e",
")",
";",
"}",
"Object",
"invoke",
"=",
"null",
";",
"try",
"{",
"invoke",
"=",
"readMethod",
".",
"invoke",
"(",
"context",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"MessageKind",
".",
"W0003",
".",
"format",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"MessageKind",
".",
"W0003",
".",
"format",
"(",
"e",
")",
";",
"}",
"catch",
"(",
"InvocationTargetException",
"e",
")",
"{",
"MessageKind",
".",
"W0003",
".",
"format",
"(",
"e",
")",
";",
"}",
"// putting new Iterator into map",
"if",
"(",
"invoke",
"instanceof",
"Iterable",
"<",
"?",
">",
")",
"{",
"Iterator",
"newIterator",
"=",
"(",
"(",
"Iterable",
")",
"invoke",
")",
".",
"iterator",
"(",
")",
";",
"this",
".",
"add",
"(",
"call",
".",
"getProcedure",
"(",
")",
".",
"getId",
"(",
")",
",",
"newIterator",
")",
";",
"}",
"}",
"Iterator",
"iterator",
"=",
"map",
".",
"get",
"(",
"call",
".",
"getProcedure",
"(",
")",
".",
"getId",
"(",
")",
")",
";",
"return",
"iterator",
".",
"next",
"(",
")",
";",
"}"
] |
Based on KProcedure index for data, it will return next value from list
@param call
@return
|
[
"Based",
"on",
"KProcedure",
"index",
"for",
"data",
"it",
"will",
"return",
"next",
"value",
"from",
"list"
] |
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
|
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-core-parent/parallelj-core-api/src/main/java/org/parallelj/internal/reflect/callback/PipelineIterator.java#L70-L103
|
147,610
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/swing/JCollapsiblePaneBeanInfo.java
|
JCollapsiblePaneBeanInfo.getAdditionalBeanInfo
|
@Override
public BeanInfo[] getAdditionalBeanInfo() {
ArrayList<BeanInfo> bi = new ArrayList<BeanInfo>();
BeanInfo[] biarr = null;
try {
for (Class<?> cl = com.l2fprod.common.swing.JCollapsiblePane.class
.getSuperclass(); !cl.equals(java.awt.Component.class.getSuperclass()); cl = cl
.getSuperclass()) {
bi.add(Introspector.getBeanInfo(cl));
}
biarr = bi.toArray(new BeanInfo[]{});
} catch (Exception e) {
// Ignore it
}
return biarr;
}
|
java
|
@Override
public BeanInfo[] getAdditionalBeanInfo() {
ArrayList<BeanInfo> bi = new ArrayList<BeanInfo>();
BeanInfo[] biarr = null;
try {
for (Class<?> cl = com.l2fprod.common.swing.JCollapsiblePane.class
.getSuperclass(); !cl.equals(java.awt.Component.class.getSuperclass()); cl = cl
.getSuperclass()) {
bi.add(Introspector.getBeanInfo(cl));
}
biarr = bi.toArray(new BeanInfo[]{});
} catch (Exception e) {
// Ignore it
}
return biarr;
}
|
[
"@",
"Override",
"public",
"BeanInfo",
"[",
"]",
"getAdditionalBeanInfo",
"(",
")",
"{",
"ArrayList",
"<",
"BeanInfo",
">",
"bi",
"=",
"new",
"ArrayList",
"<",
"BeanInfo",
">",
"(",
")",
";",
"BeanInfo",
"[",
"]",
"biarr",
"=",
"null",
";",
"try",
"{",
"for",
"(",
"Class",
"<",
"?",
">",
"cl",
"=",
"com",
".",
"l2fprod",
".",
"common",
".",
"swing",
".",
"JCollapsiblePane",
".",
"class",
".",
"getSuperclass",
"(",
")",
";",
"!",
"cl",
".",
"equals",
"(",
"java",
".",
"awt",
".",
"Component",
".",
"class",
".",
"getSuperclass",
"(",
")",
")",
";",
"cl",
"=",
"cl",
".",
"getSuperclass",
"(",
")",
")",
"{",
"bi",
".",
"add",
"(",
"Introspector",
".",
"getBeanInfo",
"(",
"cl",
")",
")",
";",
"}",
"biarr",
"=",
"bi",
".",
"toArray",
"(",
"new",
"BeanInfo",
"[",
"]",
"{",
"}",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// Ignore it",
"}",
"return",
"biarr",
";",
"}"
] |
Gets the additionalBeanInfo.
@return The additionalBeanInfo value
|
[
"Gets",
"the",
"additionalBeanInfo",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/JCollapsiblePaneBeanInfo.java#L90-L105
|
147,611
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/swing/JCollapsiblePaneBeanInfo.java
|
JCollapsiblePaneBeanInfo.getDefaultPropertyIndex
|
@Override
public int getDefaultPropertyIndex() {
String defName = "";
if ("".equals(defName)) {
return -1;
}
PropertyDescriptor[] pd = getPropertyDescriptors();
for (int i = 0; i < pd.length; i++) {
if (pd[i].getName().equals(defName)) {
return i;
}
}
return -1;
}
|
java
|
@Override
public int getDefaultPropertyIndex() {
String defName = "";
if ("".equals(defName)) {
return -1;
}
PropertyDescriptor[] pd = getPropertyDescriptors();
for (int i = 0; i < pd.length; i++) {
if (pd[i].getName().equals(defName)) {
return i;
}
}
return -1;
}
|
[
"@",
"Override",
"public",
"int",
"getDefaultPropertyIndex",
"(",
")",
"{",
"String",
"defName",
"=",
"\"\"",
";",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"defName",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"PropertyDescriptor",
"[",
"]",
"pd",
"=",
"getPropertyDescriptors",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pd",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"pd",
"[",
"i",
"]",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"defName",
")",
")",
"{",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
Gets the defaultPropertyIndex.
@return The defaultPropertyIndex value
|
[
"Gets",
"the",
"defaultPropertyIndex",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/JCollapsiblePaneBeanInfo.java#L122-L135
|
147,612
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/swing/JCollapsiblePaneBeanInfo.java
|
JCollapsiblePaneBeanInfo.getIcon
|
@Override
public Image getIcon(int type) {
if (type == BeanInfo.ICON_COLOR_16x16) {
return iconColor16;
}
if (type == BeanInfo.ICON_MONO_16x16) {
return iconMono16;
}
if (type == BeanInfo.ICON_COLOR_32x32) {
return iconColor32;
}
if (type == BeanInfo.ICON_MONO_32x32) {
return iconMono32;
}
return null;
}
|
java
|
@Override
public Image getIcon(int type) {
if (type == BeanInfo.ICON_COLOR_16x16) {
return iconColor16;
}
if (type == BeanInfo.ICON_MONO_16x16) {
return iconMono16;
}
if (type == BeanInfo.ICON_COLOR_32x32) {
return iconColor32;
}
if (type == BeanInfo.ICON_MONO_32x32) {
return iconMono32;
}
return null;
}
|
[
"@",
"Override",
"public",
"Image",
"getIcon",
"(",
"int",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"BeanInfo",
".",
"ICON_COLOR_16x16",
")",
"{",
"return",
"iconColor16",
";",
"}",
"if",
"(",
"type",
"==",
"BeanInfo",
".",
"ICON_MONO_16x16",
")",
"{",
"return",
"iconMono16",
";",
"}",
"if",
"(",
"type",
"==",
"BeanInfo",
".",
"ICON_COLOR_32x32",
")",
"{",
"return",
"iconColor32",
";",
"}",
"if",
"(",
"type",
"==",
"BeanInfo",
".",
"ICON_MONO_32x32",
")",
"{",
"return",
"iconMono32",
";",
"}",
"return",
"null",
";",
"}"
] |
Gets the icon.
@param type Description of the Parameter
@return The icon value
|
[
"Gets",
"the",
"icon",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/JCollapsiblePaneBeanInfo.java#L143-L158
|
147,613
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/swing/JCollapsiblePaneBeanInfo.java
|
JCollapsiblePaneBeanInfo.getPropertyDescriptors
|
@Override
public PropertyDescriptor[] getPropertyDescriptors() {
try {
ArrayList<PropertyDescriptor> descriptors = new ArrayList<PropertyDescriptor>();
PropertyDescriptor descriptor;
try {
descriptor = new PropertyDescriptor("animated",
com.l2fprod.common.swing.JCollapsiblePane.class);
} catch (IntrospectionException e) {
descriptor = new PropertyDescriptor("animated",
com.l2fprod.common.swing.JCollapsiblePane.class, "getAnimated", null);
}
descriptor.setPreferred(true);
descriptor.setBound(true);
descriptors.add(descriptor);
try {
descriptor = new PropertyDescriptor("collapsed",
com.l2fprod.common.swing.JCollapsiblePane.class);
} catch (IntrospectionException e) {
descriptor = new PropertyDescriptor("collapsed",
com.l2fprod.common.swing.JCollapsiblePane.class, "getCollapsed", null);
}
descriptor.setPreferred(true);
descriptor.setBound(true);
descriptors.add(descriptor);
return (PropertyDescriptor[]) descriptors
.toArray(new PropertyDescriptor[descriptors.size()]);
} catch (Exception e) {
// do not ignore, bomb politely so use has chance to discover what went
// wrong...
// I know that this is suboptimal solution, but swallowing silently is
// even worse... Propose better solution!
Logger.getLogger(JCollapsiblePane.class.getName()).log(Level.SEVERE, null, e);
}
return null;
}
|
java
|
@Override
public PropertyDescriptor[] getPropertyDescriptors() {
try {
ArrayList<PropertyDescriptor> descriptors = new ArrayList<PropertyDescriptor>();
PropertyDescriptor descriptor;
try {
descriptor = new PropertyDescriptor("animated",
com.l2fprod.common.swing.JCollapsiblePane.class);
} catch (IntrospectionException e) {
descriptor = new PropertyDescriptor("animated",
com.l2fprod.common.swing.JCollapsiblePane.class, "getAnimated", null);
}
descriptor.setPreferred(true);
descriptor.setBound(true);
descriptors.add(descriptor);
try {
descriptor = new PropertyDescriptor("collapsed",
com.l2fprod.common.swing.JCollapsiblePane.class);
} catch (IntrospectionException e) {
descriptor = new PropertyDescriptor("collapsed",
com.l2fprod.common.swing.JCollapsiblePane.class, "getCollapsed", null);
}
descriptor.setPreferred(true);
descriptor.setBound(true);
descriptors.add(descriptor);
return (PropertyDescriptor[]) descriptors
.toArray(new PropertyDescriptor[descriptors.size()]);
} catch (Exception e) {
// do not ignore, bomb politely so use has chance to discover what went
// wrong...
// I know that this is suboptimal solution, but swallowing silently is
// even worse... Propose better solution!
Logger.getLogger(JCollapsiblePane.class.getName()).log(Level.SEVERE, null, e);
}
return null;
}
|
[
"@",
"Override",
"public",
"PropertyDescriptor",
"[",
"]",
"getPropertyDescriptors",
"(",
")",
"{",
"try",
"{",
"ArrayList",
"<",
"PropertyDescriptor",
">",
"descriptors",
"=",
"new",
"ArrayList",
"<",
"PropertyDescriptor",
">",
"(",
")",
";",
"PropertyDescriptor",
"descriptor",
";",
"try",
"{",
"descriptor",
"=",
"new",
"PropertyDescriptor",
"(",
"\"animated\"",
",",
"com",
".",
"l2fprod",
".",
"common",
".",
"swing",
".",
"JCollapsiblePane",
".",
"class",
")",
";",
"}",
"catch",
"(",
"IntrospectionException",
"e",
")",
"{",
"descriptor",
"=",
"new",
"PropertyDescriptor",
"(",
"\"animated\"",
",",
"com",
".",
"l2fprod",
".",
"common",
".",
"swing",
".",
"JCollapsiblePane",
".",
"class",
",",
"\"getAnimated\"",
",",
"null",
")",
";",
"}",
"descriptor",
".",
"setPreferred",
"(",
"true",
")",
";",
"descriptor",
".",
"setBound",
"(",
"true",
")",
";",
"descriptors",
".",
"add",
"(",
"descriptor",
")",
";",
"try",
"{",
"descriptor",
"=",
"new",
"PropertyDescriptor",
"(",
"\"collapsed\"",
",",
"com",
".",
"l2fprod",
".",
"common",
".",
"swing",
".",
"JCollapsiblePane",
".",
"class",
")",
";",
"}",
"catch",
"(",
"IntrospectionException",
"e",
")",
"{",
"descriptor",
"=",
"new",
"PropertyDescriptor",
"(",
"\"collapsed\"",
",",
"com",
".",
"l2fprod",
".",
"common",
".",
"swing",
".",
"JCollapsiblePane",
".",
"class",
",",
"\"getCollapsed\"",
",",
"null",
")",
";",
"}",
"descriptor",
".",
"setPreferred",
"(",
"true",
")",
";",
"descriptor",
".",
"setBound",
"(",
"true",
")",
";",
"descriptors",
".",
"add",
"(",
"descriptor",
")",
";",
"return",
"(",
"PropertyDescriptor",
"[",
"]",
")",
"descriptors",
".",
"toArray",
"(",
"new",
"PropertyDescriptor",
"[",
"descriptors",
".",
"size",
"(",
")",
"]",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// do not ignore, bomb politely so use has chance to discover what went",
"// wrong...",
"// I know that this is suboptimal solution, but swallowing silently is",
"// even worse... Propose better solution!",
"Logger",
".",
"getLogger",
"(",
"JCollapsiblePane",
".",
"class",
".",
"getName",
"(",
")",
")",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"null",
",",
"e",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Gets the Property Descriptors.
@return The propertyDescriptors value
|
[
"Gets",
"the",
"Property",
"Descriptors",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/JCollapsiblePaneBeanInfo.java#L165-L208
|
147,614
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNExtendedSemanticGlossComparison.java
|
WNExtendedSemanticGlossComparison.match
|
public char match(ISense source, ISense target) throws MatcherLibraryException {
char result = IMappingElement.IDK;
try {
String sSynset = source.getGloss();
// get gloss of Immediate ancestor of target node
String tLGExtendedGloss = getExtendedGloss(target, 1, IMappingElement.LESS_GENERAL);
// get relation frequently occur between gloss of source and extended gloss of target
char LGRel = getDominantRelation(sSynset, tLGExtendedGloss);
// get final relation
char LGFinal = getRelationFromRels(IMappingElement.LESS_GENERAL, LGRel);
// get gloss of Immediate descendant of target node
String tMGExtendedGloss = getExtendedGloss(target, 1, IMappingElement.MORE_GENERAL);
char MGRel = getDominantRelation(sSynset, tMGExtendedGloss);
char MGFinal = getRelationFromRels(IMappingElement.MORE_GENERAL, MGRel);
// Compute final relation
if (MGFinal == LGFinal) {
result = MGFinal;
}
if (MGFinal == IMappingElement.IDK) {
result = LGFinal;
}
if (LGFinal == IMappingElement.IDK) {
result = MGFinal;
}
} catch (LinguisticOracleException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new MatcherLibraryException(errMessage, e);
}
return result;
}
|
java
|
public char match(ISense source, ISense target) throws MatcherLibraryException {
char result = IMappingElement.IDK;
try {
String sSynset = source.getGloss();
// get gloss of Immediate ancestor of target node
String tLGExtendedGloss = getExtendedGloss(target, 1, IMappingElement.LESS_GENERAL);
// get relation frequently occur between gloss of source and extended gloss of target
char LGRel = getDominantRelation(sSynset, tLGExtendedGloss);
// get final relation
char LGFinal = getRelationFromRels(IMappingElement.LESS_GENERAL, LGRel);
// get gloss of Immediate descendant of target node
String tMGExtendedGloss = getExtendedGloss(target, 1, IMappingElement.MORE_GENERAL);
char MGRel = getDominantRelation(sSynset, tMGExtendedGloss);
char MGFinal = getRelationFromRels(IMappingElement.MORE_GENERAL, MGRel);
// Compute final relation
if (MGFinal == LGFinal) {
result = MGFinal;
}
if (MGFinal == IMappingElement.IDK) {
result = LGFinal;
}
if (LGFinal == IMappingElement.IDK) {
result = MGFinal;
}
} catch (LinguisticOracleException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new MatcherLibraryException(errMessage, e);
}
return result;
}
|
[
"public",
"char",
"match",
"(",
"ISense",
"source",
",",
"ISense",
"target",
")",
"throws",
"MatcherLibraryException",
"{",
"char",
"result",
"=",
"IMappingElement",
".",
"IDK",
";",
"try",
"{",
"String",
"sSynset",
"=",
"source",
".",
"getGloss",
"(",
")",
";",
"// get gloss of Immediate ancestor of target node\r",
"String",
"tLGExtendedGloss",
"=",
"getExtendedGloss",
"(",
"target",
",",
"1",
",",
"IMappingElement",
".",
"LESS_GENERAL",
")",
";",
"// get relation frequently occur between gloss of source and extended gloss of target\r",
"char",
"LGRel",
"=",
"getDominantRelation",
"(",
"sSynset",
",",
"tLGExtendedGloss",
")",
";",
"// get final relation\r",
"char",
"LGFinal",
"=",
"getRelationFromRels",
"(",
"IMappingElement",
".",
"LESS_GENERAL",
",",
"LGRel",
")",
";",
"// get gloss of Immediate descendant of target node\r",
"String",
"tMGExtendedGloss",
"=",
"getExtendedGloss",
"(",
"target",
",",
"1",
",",
"IMappingElement",
".",
"MORE_GENERAL",
")",
";",
"char",
"MGRel",
"=",
"getDominantRelation",
"(",
"sSynset",
",",
"tMGExtendedGloss",
")",
";",
"char",
"MGFinal",
"=",
"getRelationFromRels",
"(",
"IMappingElement",
".",
"MORE_GENERAL",
",",
"MGRel",
")",
";",
"// Compute final relation\r",
"if",
"(",
"MGFinal",
"==",
"LGFinal",
")",
"{",
"result",
"=",
"MGFinal",
";",
"}",
"if",
"(",
"MGFinal",
"==",
"IMappingElement",
".",
"IDK",
")",
"{",
"result",
"=",
"LGFinal",
";",
"}",
"if",
"(",
"LGFinal",
"==",
"IMappingElement",
".",
"IDK",
")",
"{",
"result",
"=",
"MGFinal",
";",
"}",
"}",
"catch",
"(",
"LinguisticOracleException",
"e",
")",
"{",
"final",
"String",
"errMessage",
"=",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\": \"",
"+",
"e",
".",
"getMessage",
"(",
")",
";",
"log",
".",
"error",
"(",
"errMessage",
",",
"e",
")",
";",
"throw",
"new",
"MatcherLibraryException",
"(",
"errMessage",
",",
"e",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Computes the relation for extended semantic gloss matcher.
@param source the gloss of source
@param target the gloss of target
@return more general, less general or IDK relation
|
[
"Computes",
"the",
"relation",
"for",
"extended",
"semantic",
"gloss",
"matcher",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNExtendedSemanticGlossComparison.java#L50-L81
|
147,615
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNExtendedSemanticGlossComparison.java
|
WNExtendedSemanticGlossComparison.getDominantRelation
|
private char getDominantRelation(String sExtendedGloss, String tExtendedGloss) throws MatcherLibraryException {
int Equals = 0;
int moreGeneral = 0;
int lessGeneral = 0;
int Opposite = 0;
StringTokenizer stSource = new StringTokenizer(sExtendedGloss, " ,.\"'()");
String lemmaS, lemmaT;
while (stSource.hasMoreTokens()) {
StringTokenizer stTarget = new StringTokenizer(tExtendedGloss, " ,.\"'()");
lemmaS = stSource.nextToken();
if (!meaninglessWords.contains(lemmaS)) {
while (stTarget.hasMoreTokens()) {
lemmaT = stTarget.nextToken();
if (!meaninglessWords.contains(lemmaT)) {
if (isWordLessGeneral(lemmaS, lemmaT)) {
lessGeneral++;
} else if (isWordMoreGeneral(lemmaS, lemmaT)) {
moreGeneral++;
} else if (isWordSynonym(lemmaS, lemmaT)) {
Equals++;
} else if (isWordOpposite(lemmaS, lemmaT)) {
Opposite++;
}
}
}
}
}
return getRelationFromInts(lessGeneral, moreGeneral, Equals, Opposite);
}
|
java
|
private char getDominantRelation(String sExtendedGloss, String tExtendedGloss) throws MatcherLibraryException {
int Equals = 0;
int moreGeneral = 0;
int lessGeneral = 0;
int Opposite = 0;
StringTokenizer stSource = new StringTokenizer(sExtendedGloss, " ,.\"'()");
String lemmaS, lemmaT;
while (stSource.hasMoreTokens()) {
StringTokenizer stTarget = new StringTokenizer(tExtendedGloss, " ,.\"'()");
lemmaS = stSource.nextToken();
if (!meaninglessWords.contains(lemmaS)) {
while (stTarget.hasMoreTokens()) {
lemmaT = stTarget.nextToken();
if (!meaninglessWords.contains(lemmaT)) {
if (isWordLessGeneral(lemmaS, lemmaT)) {
lessGeneral++;
} else if (isWordMoreGeneral(lemmaS, lemmaT)) {
moreGeneral++;
} else if (isWordSynonym(lemmaS, lemmaT)) {
Equals++;
} else if (isWordOpposite(lemmaS, lemmaT)) {
Opposite++;
}
}
}
}
}
return getRelationFromInts(lessGeneral, moreGeneral, Equals, Opposite);
}
|
[
"private",
"char",
"getDominantRelation",
"(",
"String",
"sExtendedGloss",
",",
"String",
"tExtendedGloss",
")",
"throws",
"MatcherLibraryException",
"{",
"int",
"Equals",
"=",
"0",
";",
"int",
"moreGeneral",
"=",
"0",
";",
"int",
"lessGeneral",
"=",
"0",
";",
"int",
"Opposite",
"=",
"0",
";",
"StringTokenizer",
"stSource",
"=",
"new",
"StringTokenizer",
"(",
"sExtendedGloss",
",",
"\" ,.\\\"'()\"",
")",
";",
"String",
"lemmaS",
",",
"lemmaT",
";",
"while",
"(",
"stSource",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"StringTokenizer",
"stTarget",
"=",
"new",
"StringTokenizer",
"(",
"tExtendedGloss",
",",
"\" ,.\\\"'()\"",
")",
";",
"lemmaS",
"=",
"stSource",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"!",
"meaninglessWords",
".",
"contains",
"(",
"lemmaS",
")",
")",
"{",
"while",
"(",
"stTarget",
".",
"hasMoreTokens",
"(",
")",
")",
"{",
"lemmaT",
"=",
"stTarget",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"!",
"meaninglessWords",
".",
"contains",
"(",
"lemmaT",
")",
")",
"{",
"if",
"(",
"isWordLessGeneral",
"(",
"lemmaS",
",",
"lemmaT",
")",
")",
"{",
"lessGeneral",
"++",
";",
"}",
"else",
"if",
"(",
"isWordMoreGeneral",
"(",
"lemmaS",
",",
"lemmaT",
")",
")",
"{",
"moreGeneral",
"++",
";",
"}",
"else",
"if",
"(",
"isWordSynonym",
"(",
"lemmaS",
",",
"lemmaT",
")",
")",
"{",
"Equals",
"++",
";",
"}",
"else",
"if",
"(",
"isWordOpposite",
"(",
"lemmaS",
",",
"lemmaT",
")",
")",
"{",
"Opposite",
"++",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"getRelationFromInts",
"(",
"lessGeneral",
",",
"moreGeneral",
",",
"Equals",
",",
"Opposite",
")",
";",
"}"
] |
Gets Semantic relation occurring more frequently between words in two extended glosses.
@param sExtendedGloss extended gloss of source
@param tExtendedGloss extended gloss of target
@return more general, less general or IDK relation
@throws MatcherLibraryException MatcherLibraryException
|
[
"Gets",
"Semantic",
"relation",
"occurring",
"more",
"frequently",
"between",
"words",
"in",
"two",
"extended",
"glosses",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNExtendedSemanticGlossComparison.java#L91-L119
|
147,616
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNExtendedSemanticGlossComparison.java
|
WNExtendedSemanticGlossComparison.getRelationFromInts
|
private char getRelationFromInts(int lg, int mg, int syn, int opp) {
if ((lg >= mg) && (lg >= syn) && (lg >= opp) && (lg > 0)) {
return IMappingElement.LESS_GENERAL;
}
if ((mg >= lg) && (mg >= syn) && (mg >= opp) && (mg > 0)) {
return IMappingElement.MORE_GENERAL;
}
if ((syn >= mg) && (syn >= lg) && (syn >= opp) && (syn > 0)) {
return IMappingElement.LESS_GENERAL;
}
if ((opp >= mg) && (opp >= syn) && (opp >= lg) && (opp > 0)) {
return IMappingElement.LESS_GENERAL;
}
return IMappingElement.IDK;
}
|
java
|
private char getRelationFromInts(int lg, int mg, int syn, int opp) {
if ((lg >= mg) && (lg >= syn) && (lg >= opp) && (lg > 0)) {
return IMappingElement.LESS_GENERAL;
}
if ((mg >= lg) && (mg >= syn) && (mg >= opp) && (mg > 0)) {
return IMappingElement.MORE_GENERAL;
}
if ((syn >= mg) && (syn >= lg) && (syn >= opp) && (syn > 0)) {
return IMappingElement.LESS_GENERAL;
}
if ((opp >= mg) && (opp >= syn) && (opp >= lg) && (opp > 0)) {
return IMappingElement.LESS_GENERAL;
}
return IMappingElement.IDK;
}
|
[
"private",
"char",
"getRelationFromInts",
"(",
"int",
"lg",
",",
"int",
"mg",
",",
"int",
"syn",
",",
"int",
"opp",
")",
"{",
"if",
"(",
"(",
"lg",
">=",
"mg",
")",
"&&",
"(",
"lg",
">=",
"syn",
")",
"&&",
"(",
"lg",
">=",
"opp",
")",
"&&",
"(",
"lg",
">",
"0",
")",
")",
"{",
"return",
"IMappingElement",
".",
"LESS_GENERAL",
";",
"}",
"if",
"(",
"(",
"mg",
">=",
"lg",
")",
"&&",
"(",
"mg",
">=",
"syn",
")",
"&&",
"(",
"mg",
">=",
"opp",
")",
"&&",
"(",
"mg",
">",
"0",
")",
")",
"{",
"return",
"IMappingElement",
".",
"MORE_GENERAL",
";",
"}",
"if",
"(",
"(",
"syn",
">=",
"mg",
")",
"&&",
"(",
"syn",
">=",
"lg",
")",
"&&",
"(",
"syn",
">=",
"opp",
")",
"&&",
"(",
"syn",
">",
"0",
")",
")",
"{",
"return",
"IMappingElement",
".",
"LESS_GENERAL",
";",
"}",
"if",
"(",
"(",
"opp",
">=",
"mg",
")",
"&&",
"(",
"opp",
">=",
"syn",
")",
"&&",
"(",
"opp",
">=",
"lg",
")",
"&&",
"(",
"opp",
">",
"0",
")",
")",
"{",
"return",
"IMappingElement",
".",
"LESS_GENERAL",
";",
"}",
"return",
"IMappingElement",
".",
"IDK",
";",
"}"
] |
Decides which relation to return.
@param lg number of less general words between two extended gloss
@param mg number of more general words between two extended gloss
@param syn number of synonym words between two extended gloss
@param opp number of opposite words between two extended gloss
@return the more frequent relation between two extended glosses.
|
[
"Decides",
"which",
"relation",
"to",
"return",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNExtendedSemanticGlossComparison.java#L130-L144
|
147,617
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNExtendedSemanticGlossComparison.java
|
WNExtendedSemanticGlossComparison.getRelationFromRels
|
private char getRelationFromRels(char builtForRel, char glossRel) {
if (builtForRel == IMappingElement.EQUIVALENCE) {
return glossRel;
}
if (builtForRel == IMappingElement.LESS_GENERAL) {
if ((glossRel == IMappingElement.LESS_GENERAL) || (glossRel == IMappingElement.EQUIVALENCE)) {
return IMappingElement.LESS_GENERAL;
}
}
if (builtForRel == IMappingElement.MORE_GENERAL) {
if ((glossRel == IMappingElement.MORE_GENERAL) || (glossRel == IMappingElement.EQUIVALENCE)) {
return IMappingElement.MORE_GENERAL;
}
}
return IMappingElement.IDK;
}
|
java
|
private char getRelationFromRels(char builtForRel, char glossRel) {
if (builtForRel == IMappingElement.EQUIVALENCE) {
return glossRel;
}
if (builtForRel == IMappingElement.LESS_GENERAL) {
if ((glossRel == IMappingElement.LESS_GENERAL) || (glossRel == IMappingElement.EQUIVALENCE)) {
return IMappingElement.LESS_GENERAL;
}
}
if (builtForRel == IMappingElement.MORE_GENERAL) {
if ((glossRel == IMappingElement.MORE_GENERAL) || (glossRel == IMappingElement.EQUIVALENCE)) {
return IMappingElement.MORE_GENERAL;
}
}
return IMappingElement.IDK;
}
|
[
"private",
"char",
"getRelationFromRels",
"(",
"char",
"builtForRel",
",",
"char",
"glossRel",
")",
"{",
"if",
"(",
"builtForRel",
"==",
"IMappingElement",
".",
"EQUIVALENCE",
")",
"{",
"return",
"glossRel",
";",
"}",
"if",
"(",
"builtForRel",
"==",
"IMappingElement",
".",
"LESS_GENERAL",
")",
"{",
"if",
"(",
"(",
"glossRel",
"==",
"IMappingElement",
".",
"LESS_GENERAL",
")",
"||",
"(",
"glossRel",
"==",
"IMappingElement",
".",
"EQUIVALENCE",
")",
")",
"{",
"return",
"IMappingElement",
".",
"LESS_GENERAL",
";",
"}",
"}",
"if",
"(",
"builtForRel",
"==",
"IMappingElement",
".",
"MORE_GENERAL",
")",
"{",
"if",
"(",
"(",
"glossRel",
"==",
"IMappingElement",
".",
"MORE_GENERAL",
")",
"||",
"(",
"glossRel",
"==",
"IMappingElement",
".",
"EQUIVALENCE",
")",
")",
"{",
"return",
"IMappingElement",
".",
"MORE_GENERAL",
";",
"}",
"}",
"return",
"IMappingElement",
".",
"IDK",
";",
"}"
] |
Decides which relation to return as a function of relation for which extended gloss was built.
@param builtForRel relation for which the gloss was built
@param glossRel relation
@return less general, more general or IDK relation
|
[
"Decides",
"which",
"relation",
"to",
"return",
"as",
"a",
"function",
"of",
"relation",
"for",
"which",
"extended",
"gloss",
"was",
"built",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/gloss/WNExtendedSemanticGlossComparison.java#L153-L168
|
147,618
|
ykrasik/jaci
|
jaci-core/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionClassProcessor.java
|
ReflectionClassProcessor.processObject
|
public Map<ParsedPath, List<CommandDef>> processObject(Object instance) {
final ClassContext context = new ClassContext();
doProcess(instance, context);
return context.commandPaths;
}
|
java
|
public Map<ParsedPath, List<CommandDef>> processObject(Object instance) {
final ClassContext context = new ClassContext();
doProcess(instance, context);
return context.commandPaths;
}
|
[
"public",
"Map",
"<",
"ParsedPath",
",",
"List",
"<",
"CommandDef",
">",
">",
"processObject",
"(",
"Object",
"instance",
")",
"{",
"final",
"ClassContext",
"context",
"=",
"new",
"ClassContext",
"(",
")",
";",
"doProcess",
"(",
"instance",
",",
"context",
")",
";",
"return",
"context",
".",
"commandPaths",
";",
"}"
] |
Process the object's class and all declared inner classes
and return all parsed commands with their paths.
@param instance Object to process.
@return The {@link CommandDef}s that were extracted out of the object.
@throws RuntimeException If any error occurs.
|
[
"Process",
"the",
"object",
"s",
"class",
"and",
"all",
"declared",
"inner",
"classes",
"and",
"return",
"all",
"parsed",
"commands",
"with",
"their",
"paths",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-core/src/main/java/com/github/ykrasik/jaci/reflection/ReflectionClassProcessor.java#L68-L72
|
147,619
|
netceteragroup/trema-core
|
src/main/java/com/netcetera/trema/core/importing/AbstractFile.java
|
AbstractFile.add
|
protected void add(String key, Status status, String masterValue, String value) {
textNodeMap.put(key, new TextNode(key, status, masterValue, value));
}
|
java
|
protected void add(String key, Status status, String masterValue, String value) {
textNodeMap.put(key, new TextNode(key, status, masterValue, value));
}
|
[
"protected",
"void",
"add",
"(",
"String",
"key",
",",
"Status",
"status",
",",
"String",
"masterValue",
",",
"String",
"value",
")",
"{",
"textNodeMap",
".",
"put",
"(",
"key",
",",
"new",
"TextNode",
"(",
"key",
",",
"status",
",",
"masterValue",
",",
"value",
")",
")",
";",
"}"
] |
Adds a record to this CSV file.
@param key the key
@param status the status
@param masterValue the master value, may be <code>null</code>
@param value the value
|
[
"Adds",
"a",
"record",
"to",
"this",
"CSV",
"file",
"."
] |
e5367f4b80b38038d462627aa146a62bc34fc489
|
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/importing/AbstractFile.java#L67-L69
|
147,620
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/matchers/structure/tree/spsm/ted/TreeEditDistance.java
|
TreeEditDistance.preorder
|
private static List<INode> preorder(INode root) {
ArrayList<INode> result = new ArrayList<INode>();
Deque<INode> stack = new ArrayDeque<INode>();
stack.push(root);
while (!stack.isEmpty()) {
INode c = stack.pop();
result.add(c);
for (int i = c.getChildCount() - 1; i >= 0; i--) {
stack.push(c.getChildAt(i));
}
}
return result;
}
|
java
|
private static List<INode> preorder(INode root) {
ArrayList<INode> result = new ArrayList<INode>();
Deque<INode> stack = new ArrayDeque<INode>();
stack.push(root);
while (!stack.isEmpty()) {
INode c = stack.pop();
result.add(c);
for (int i = c.getChildCount() - 1; i >= 0; i--) {
stack.push(c.getChildAt(i));
}
}
return result;
}
|
[
"private",
"static",
"List",
"<",
"INode",
">",
"preorder",
"(",
"INode",
"root",
")",
"{",
"ArrayList",
"<",
"INode",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"INode",
">",
"(",
")",
";",
"Deque",
"<",
"INode",
">",
"stack",
"=",
"new",
"ArrayDeque",
"<",
"INode",
">",
"(",
")",
";",
"stack",
".",
"push",
"(",
"root",
")",
";",
"while",
"(",
"!",
"stack",
".",
"isEmpty",
"(",
")",
")",
"{",
"INode",
"c",
"=",
"stack",
".",
"pop",
"(",
")",
";",
"result",
".",
"add",
"(",
"c",
")",
";",
"for",
"(",
"int",
"i",
"=",
"c",
".",
"getChildCount",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"stack",
".",
"push",
"(",
"c",
".",
"getChildAt",
"(",
"i",
")",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Preorders the subtree rooted at the given node.
@param root root node
@return the converted list, empty if no elements in input
|
[
"Preorders",
"the",
"subtree",
"rooted",
"at",
"the",
"given",
"node",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/structure/tree/spsm/ted/TreeEditDistance.java#L662-L677
|
147,621
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/swing/JCollapsiblePane.java
|
JCollapsiblePane.setContentPane
|
public void setContentPane(Container contentPanel) {
if (contentPanel == null) {
throw new IllegalArgumentException("Content pane can't be null");
}
if (wrapper != null) {
super.remove(wrapper);
}
wrapper = new WrapperContainer(contentPanel);
super.addImpl(wrapper, BorderLayout.CENTER, -1);
}
|
java
|
public void setContentPane(Container contentPanel) {
if (contentPanel == null) {
throw new IllegalArgumentException("Content pane can't be null");
}
if (wrapper != null) {
super.remove(wrapper);
}
wrapper = new WrapperContainer(contentPanel);
super.addImpl(wrapper, BorderLayout.CENTER, -1);
}
|
[
"public",
"void",
"setContentPane",
"(",
"Container",
"contentPanel",
")",
"{",
"if",
"(",
"contentPanel",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Content pane can't be null\"",
")",
";",
"}",
"if",
"(",
"wrapper",
"!=",
"null",
")",
"{",
"super",
".",
"remove",
"(",
"wrapper",
")",
";",
"}",
"wrapper",
"=",
"new",
"WrapperContainer",
"(",
"contentPanel",
")",
";",
"super",
".",
"addImpl",
"(",
"wrapper",
",",
"BorderLayout",
".",
"CENTER",
",",
"-",
"1",
")",
";",
"}"
] |
Sets the content pane of this JCollapsiblePane. Components must be added
to this content pane, not to the JCollapsiblePane.
@param contentPanel
@throws IllegalArgumentException if contentPanel is null
|
[
"Sets",
"the",
"content",
"pane",
"of",
"this",
"JCollapsiblePane",
".",
"Components",
"must",
"be",
"added",
"to",
"this",
"content",
"pane",
"not",
"to",
"the",
"JCollapsiblePane",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/JCollapsiblePane.java#L212-L222
|
147,622
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/swing/JCollapsiblePane.java
|
JCollapsiblePane.setAnimationParams
|
private void setAnimationParams(AnimationParams params) {
if (params == null) {
throw new IllegalArgumentException(
"params can't be null");
}
if (animateTimer != null) {
animateTimer.stop();
}
animationParams = params;
animateTimer = new Timer(animationParams.waitTime, animator);
animateTimer.setInitialDelay(0);
}
|
java
|
private void setAnimationParams(AnimationParams params) {
if (params == null) {
throw new IllegalArgumentException(
"params can't be null");
}
if (animateTimer != null) {
animateTimer.stop();
}
animationParams = params;
animateTimer = new Timer(animationParams.waitTime, animator);
animateTimer.setInitialDelay(0);
}
|
[
"private",
"void",
"setAnimationParams",
"(",
"AnimationParams",
"params",
")",
"{",
"if",
"(",
"params",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"params can't be null\"",
")",
";",
"}",
"if",
"(",
"animateTimer",
"!=",
"null",
")",
"{",
"animateTimer",
".",
"stop",
"(",
")",
";",
"}",
"animationParams",
"=",
"params",
";",
"animateTimer",
"=",
"new",
"Timer",
"(",
"animationParams",
".",
"waitTime",
",",
"animator",
")",
";",
"animateTimer",
".",
"setInitialDelay",
"(",
"0",
")",
";",
"}"
] |
Sets the parameters controlling the animation.
@param params
@throws IllegalArgumentException if params is null
|
[
"Sets",
"the",
"parameters",
"controlling",
"the",
"animation",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/swing/JCollapsiblePane.java#L417-L428
|
147,623
|
wkgcass/Style
|
src/main/java/net/cassite/style/util/DateFuncSup.java
|
DateFuncSup.subtract
|
public DateFuncSup subtract(DateSeperator d) {
date.setTime(date.getTime() - d.parse());
return this;
}
|
java
|
public DateFuncSup subtract(DateSeperator d) {
date.setTime(date.getTime() - d.parse());
return this;
}
|
[
"public",
"DateFuncSup",
"subtract",
"(",
"DateSeperator",
"d",
")",
"{",
"date",
".",
"setTime",
"(",
"date",
".",
"getTime",
"(",
")",
"-",
"d",
".",
"parse",
"(",
")",
")",
";",
"return",
"this",
";",
"}"
] |
subtract date on supported date
@param d date to subtract
@return <code>this</code>
|
[
"subtract",
"date",
"on",
"supported",
"date"
] |
db3ea64337251f46f734279480e365293bececbd
|
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/util/DateFuncSup.java#L112-L115
|
147,624
|
wkgcass/Style
|
src/main/java/net/cassite/style/util/DateFuncSup.java
|
DateFuncSup.nextMonth
|
public DateFuncSup nextMonth(int next) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MONTH, next);
date.setTime(cal.getTimeInMillis());
return this;
}
|
java
|
public DateFuncSup nextMonth(int next) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.MONTH, next);
date.setTime(cal.getTimeInMillis());
return this;
}
|
[
"public",
"DateFuncSup",
"nextMonth",
"(",
"int",
"next",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"date",
")",
";",
"cal",
".",
"add",
"(",
"Calendar",
".",
"MONTH",
",",
"next",
")",
";",
"date",
".",
"setTime",
"(",
"cal",
".",
"getTimeInMillis",
"(",
")",
")",
";",
"return",
"this",
";",
"}"
] |
set date to next months
@param next count of next months to set to
@return <code>this</code>
|
[
"set",
"date",
"to",
"next",
"months"
] |
db3ea64337251f46f734279480e365293bececbd
|
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/util/DateFuncSup.java#L180-L186
|
147,625
|
wkgcass/Style
|
src/main/java/net/cassite/style/util/DateFuncSup.java
|
DateFuncSup.nextYear
|
public DateFuncSup nextYear(int next) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.YEAR, next);
date.setTime(cal.getTimeInMillis());
return this;
}
|
java
|
public DateFuncSup nextYear(int next) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.YEAR, next);
date.setTime(cal.getTimeInMillis());
return this;
}
|
[
"public",
"DateFuncSup",
"nextYear",
"(",
"int",
"next",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"date",
")",
";",
"cal",
".",
"add",
"(",
"Calendar",
".",
"YEAR",
",",
"next",
")",
";",
"date",
".",
"setTime",
"(",
"cal",
".",
"getTimeInMillis",
"(",
")",
")",
";",
"return",
"this",
";",
"}"
] |
set date to next years
@param next count of next years to set to
@return <code>this</code>
|
[
"set",
"date",
"to",
"next",
"years"
] |
db3ea64337251f46f734279480e365293bececbd
|
https://github.com/wkgcass/Style/blob/db3ea64337251f46f734279480e365293bececbd/src/main/java/net/cassite/style/util/DateFuncSup.java#L194-L200
|
147,626
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/classifiers/CNFContextClassifier.java
|
CNFContextClassifier.toCNF
|
public static String toCNF(INode in, String formula) throws ContextClassifierException {
PEParser parser = new PEParser();
CNFTransformer transformer = new CNFTransformer();
String result = formula;
if ((formula.contains("&") && formula.contains("|")) || formula.contains("~")) {
String tmpFormula = formula;
tmpFormula = tmpFormula.trim();
tmpFormula = tmpFormula.replace("&", "AND");
tmpFormula = tmpFormula.replace("|", "OR");
tmpFormula = tmpFormula.replace("~", "NOT");
tmpFormula = "(" + tmpFormula + ")";
if (!tmpFormula.isEmpty()) {
tmpFormula = tmpFormula.replace('.', 'P');
Sentence f = (Sentence) parser.parse(tmpFormula);
Sentence cnf = transformer.transform(f);
tmpFormula = cnf.toString();
tmpFormula = tmpFormula.replace("AND", "&");
tmpFormula = tmpFormula.replace("OR", "|");
tmpFormula = tmpFormula.replace("NOT", "~");
result = tmpFormula.replace('P', '.');
} else {
result = tmpFormula;
}
}
return result;
}
|
java
|
public static String toCNF(INode in, String formula) throws ContextClassifierException {
PEParser parser = new PEParser();
CNFTransformer transformer = new CNFTransformer();
String result = formula;
if ((formula.contains("&") && formula.contains("|")) || formula.contains("~")) {
String tmpFormula = formula;
tmpFormula = tmpFormula.trim();
tmpFormula = tmpFormula.replace("&", "AND");
tmpFormula = tmpFormula.replace("|", "OR");
tmpFormula = tmpFormula.replace("~", "NOT");
tmpFormula = "(" + tmpFormula + ")";
if (!tmpFormula.isEmpty()) {
tmpFormula = tmpFormula.replace('.', 'P');
Sentence f = (Sentence) parser.parse(tmpFormula);
Sentence cnf = transformer.transform(f);
tmpFormula = cnf.toString();
tmpFormula = tmpFormula.replace("AND", "&");
tmpFormula = tmpFormula.replace("OR", "|");
tmpFormula = tmpFormula.replace("NOT", "~");
result = tmpFormula.replace('P', '.');
} else {
result = tmpFormula;
}
}
return result;
}
|
[
"public",
"static",
"String",
"toCNF",
"(",
"INode",
"in",
",",
"String",
"formula",
")",
"throws",
"ContextClassifierException",
"{",
"PEParser",
"parser",
"=",
"new",
"PEParser",
"(",
")",
";",
"CNFTransformer",
"transformer",
"=",
"new",
"CNFTransformer",
"(",
")",
";",
"String",
"result",
"=",
"formula",
";",
"if",
"(",
"(",
"formula",
".",
"contains",
"(",
"\"&\"",
")",
"&&",
"formula",
".",
"contains",
"(",
"\"|\"",
")",
")",
"||",
"formula",
".",
"contains",
"(",
"\"~\"",
")",
")",
"{",
"String",
"tmpFormula",
"=",
"formula",
";",
"tmpFormula",
"=",
"tmpFormula",
".",
"trim",
"(",
")",
";",
"tmpFormula",
"=",
"tmpFormula",
".",
"replace",
"(",
"\"&\"",
",",
"\"AND\"",
")",
";",
"tmpFormula",
"=",
"tmpFormula",
".",
"replace",
"(",
"\"|\"",
",",
"\"OR\"",
")",
";",
"tmpFormula",
"=",
"tmpFormula",
".",
"replace",
"(",
"\"~\"",
",",
"\"NOT\"",
")",
";",
"tmpFormula",
"=",
"\"(\"",
"+",
"tmpFormula",
"+",
"\")\"",
";",
"if",
"(",
"!",
"tmpFormula",
".",
"isEmpty",
"(",
")",
")",
"{",
"tmpFormula",
"=",
"tmpFormula",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"Sentence",
"f",
"=",
"(",
"Sentence",
")",
"parser",
".",
"parse",
"(",
"tmpFormula",
")",
";",
"Sentence",
"cnf",
"=",
"transformer",
".",
"transform",
"(",
"f",
")",
";",
"tmpFormula",
"=",
"cnf",
".",
"toString",
"(",
")",
";",
"tmpFormula",
"=",
"tmpFormula",
".",
"replace",
"(",
"\"AND\"",
",",
"\"&\"",
")",
";",
"tmpFormula",
"=",
"tmpFormula",
".",
"replace",
"(",
"\"OR\"",
",",
"\"|\"",
")",
";",
"tmpFormula",
"=",
"tmpFormula",
".",
"replace",
"(",
"\"NOT\"",
",",
"\"~\"",
")",
";",
"result",
"=",
"tmpFormula",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
";",
"}",
"else",
"{",
"result",
"=",
"tmpFormula",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Converts the formula into CNF.
@param in the owner of the formula
@param formula the formula to convert
@return formula in CNF form
@throws ContextClassifierException ContextClassifierException
|
[
"Converts",
"the",
"formula",
"into",
"CNF",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/classifiers/CNFContextClassifier.java#L66-L97
|
147,627
|
netceteragroup/trema-core
|
src/main/java/com/netcetera/trema/core/importing/CSVFile.java
|
CSVFile.extractLanguage
|
private String extractLanguage(String columnHeading) throws ParseException {
int start = columnHeading.indexOf('(');
int end = columnHeading.indexOf(')');
if (start == -1 || end == -1 || start >= end) {
throwWrongHeaderException();
}
return columnHeading.substring(start + 1, end);
}
|
java
|
private String extractLanguage(String columnHeading) throws ParseException {
int start = columnHeading.indexOf('(');
int end = columnHeading.indexOf(')');
if (start == -1 || end == -1 || start >= end) {
throwWrongHeaderException();
}
return columnHeading.substring(start + 1, end);
}
|
[
"private",
"String",
"extractLanguage",
"(",
"String",
"columnHeading",
")",
"throws",
"ParseException",
"{",
"int",
"start",
"=",
"columnHeading",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"int",
"end",
"=",
"columnHeading",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"start",
"==",
"-",
"1",
"||",
"end",
"==",
"-",
"1",
"||",
"start",
">=",
"end",
")",
"{",
"throwWrongHeaderException",
"(",
")",
";",
"}",
"return",
"columnHeading",
".",
"substring",
"(",
"start",
"+",
"1",
",",
"end",
")",
";",
"}"
] |
Extracts the language of the "master language value" and "value"
column heading in the first line of the trema CSV file.
@param columnHeading the column heading. The expected format is:
<code>master (<lang>)</code> or <code>value (<lang>)</code>.
@return the extracted language
@throws ParseException if any parse errors occur
|
[
"Extracts",
"the",
"language",
"of",
"the",
"master",
"language",
"value",
"and",
"value",
"column",
"heading",
"in",
"the",
"first",
"line",
"of",
"the",
"trema",
"CSV",
"file",
"."
] |
e5367f4b80b38038d462627aa146a62bc34fc489
|
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/importing/CSVFile.java#L182-L190
|
147,628
|
awltech/org.parallelj
|
parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/servers/jmx/MinimalJmxServer.java
|
MinimalJmxServer.registerMBean
|
public final boolean registerMBean(final Class<?> clazz) {
if (this.mbs != null && clazz != null) {
try {
final String fqnName = clazz.getCanonicalName();
final String domain = fqnName.substring(0, fqnName.lastIndexOf('.'));
final String type = fqnName.substring(fqnName.lastIndexOf('.') + 1);
final ObjectName objectName = new ObjectName(String.format(
beanNameFormat, domain, type));
if (!mbs.isRegistered(objectName)) {
LaunchingMessageKind.IJMX0004.format(objectName);
mbs.registerMBean(clazz.newInstance(), objectName);
LaunchingMessageKind.IJMX0005.format(objectName);
}
this.beanNames.add(objectName);
} catch (Exception e) {
LaunchingMessageKind.EJMX0004.format(clazz.getCanonicalName(), e);
return false;
}
} else {
LaunchingMessageKind.EJMX0002.format();
return false;
}
return true;
}
|
java
|
public final boolean registerMBean(final Class<?> clazz) {
if (this.mbs != null && clazz != null) {
try {
final String fqnName = clazz.getCanonicalName();
final String domain = fqnName.substring(0, fqnName.lastIndexOf('.'));
final String type = fqnName.substring(fqnName.lastIndexOf('.') + 1);
final ObjectName objectName = new ObjectName(String.format(
beanNameFormat, domain, type));
if (!mbs.isRegistered(objectName)) {
LaunchingMessageKind.IJMX0004.format(objectName);
mbs.registerMBean(clazz.newInstance(), objectName);
LaunchingMessageKind.IJMX0005.format(objectName);
}
this.beanNames.add(objectName);
} catch (Exception e) {
LaunchingMessageKind.EJMX0004.format(clazz.getCanonicalName(), e);
return false;
}
} else {
LaunchingMessageKind.EJMX0002.format();
return false;
}
return true;
}
|
[
"public",
"final",
"boolean",
"registerMBean",
"(",
"final",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"if",
"(",
"this",
".",
"mbs",
"!=",
"null",
"&&",
"clazz",
"!=",
"null",
")",
"{",
"try",
"{",
"final",
"String",
"fqnName",
"=",
"clazz",
".",
"getCanonicalName",
"(",
")",
";",
"final",
"String",
"domain",
"=",
"fqnName",
".",
"substring",
"(",
"0",
",",
"fqnName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
")",
";",
"final",
"String",
"type",
"=",
"fqnName",
".",
"substring",
"(",
"fqnName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"final",
"ObjectName",
"objectName",
"=",
"new",
"ObjectName",
"(",
"String",
".",
"format",
"(",
"beanNameFormat",
",",
"domain",
",",
"type",
")",
")",
";",
"if",
"(",
"!",
"mbs",
".",
"isRegistered",
"(",
"objectName",
")",
")",
"{",
"LaunchingMessageKind",
".",
"IJMX0004",
".",
"format",
"(",
"objectName",
")",
";",
"mbs",
".",
"registerMBean",
"(",
"clazz",
".",
"newInstance",
"(",
")",
",",
"objectName",
")",
";",
"LaunchingMessageKind",
".",
"IJMX0005",
".",
"format",
"(",
"objectName",
")",
";",
"}",
"this",
".",
"beanNames",
".",
"add",
"(",
"objectName",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LaunchingMessageKind",
".",
"EJMX0004",
".",
"format",
"(",
"clazz",
".",
"getCanonicalName",
"(",
")",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"}",
"else",
"{",
"LaunchingMessageKind",
".",
"EJMX0002",
".",
"format",
"(",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Try to register standard MBean type in the JMX server
@param beanClass the class name of the MBean
|
[
"Try",
"to",
"register",
"standard",
"MBean",
"type",
"in",
"the",
"JMX",
"server"
] |
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
|
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/servers/jmx/MinimalJmxServer.java#L123-L147
|
147,629
|
awltech/org.parallelj
|
parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/servers/jmx/MinimalJmxServer.java
|
MinimalJmxServer.unRegisterMBeans
|
private void unRegisterMBeans() {
if (beanNames != null) {
for (ObjectName objectName : beanNames) {
// unRegister the bean in the JMX server...
try {
mbs.unregisterMBean(objectName);
LaunchingMessageKind.IJMX0006.format(objectName);
} catch (MBeanRegistrationException e) {
// Do nothing
} catch (InstanceNotFoundException e) {
// Do nothing
}
}
beanNames.clear();
}
}
|
java
|
private void unRegisterMBeans() {
if (beanNames != null) {
for (ObjectName objectName : beanNames) {
// unRegister the bean in the JMX server...
try {
mbs.unregisterMBean(objectName);
LaunchingMessageKind.IJMX0006.format(objectName);
} catch (MBeanRegistrationException e) {
// Do nothing
} catch (InstanceNotFoundException e) {
// Do nothing
}
}
beanNames.clear();
}
}
|
[
"private",
"void",
"unRegisterMBeans",
"(",
")",
"{",
"if",
"(",
"beanNames",
"!=",
"null",
")",
"{",
"for",
"(",
"ObjectName",
"objectName",
":",
"beanNames",
")",
"{",
"// unRegister the bean in the JMX server...",
"try",
"{",
"mbs",
".",
"unregisterMBean",
"(",
"objectName",
")",
";",
"LaunchingMessageKind",
".",
"IJMX0006",
".",
"format",
"(",
"objectName",
")",
";",
"}",
"catch",
"(",
"MBeanRegistrationException",
"e",
")",
"{",
"// Do nothing",
"}",
"catch",
"(",
"InstanceNotFoundException",
"e",
")",
"{",
"// Do nothing",
"}",
"}",
"beanNames",
".",
"clear",
"(",
")",
";",
"}",
"}"
] |
Unregister all registered MBeans in the JMX server.
|
[
"Unregister",
"all",
"registered",
"MBeans",
"in",
"the",
"JMX",
"server",
"."
] |
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
|
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/servers/jmx/MinimalJmxServer.java#L202-L217
|
147,630
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/loaders/context/TabContextLoader.java
|
TabContextLoader.numOfTabs
|
private int numOfTabs(String line) {
int i = 0;
while (i < line.length() && '\t' == line.charAt(i)) {
i++;
}
return i;
}
|
java
|
private int numOfTabs(String line) {
int i = 0;
while (i < line.length() && '\t' == line.charAt(i)) {
i++;
}
return i;
}
|
[
"private",
"int",
"numOfTabs",
"(",
"String",
"line",
")",
"{",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"line",
".",
"length",
"(",
")",
"&&",
"'",
"'",
"==",
"line",
".",
"charAt",
"(",
"i",
")",
")",
"{",
"i",
"++",
";",
"}",
"return",
"i",
";",
"}"
] |
Counts the number of tabs in the line.
@param line the string of the each line of file
@return the number of tabs at the beginning of the line
|
[
"Counts",
"the",
"number",
"of",
"tabs",
"in",
"the",
"line",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/loaders/context/TabContextLoader.java#L92-L98
|
147,631
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/smatch/loaders/context/TabContextLoader.java
|
TabContextLoader.setArrayNodeID
|
private void setArrayNodeID(int index, ArrayList<INode> array, INode node) {
if (index < array.size()) {
array.set(index, node);
} else {
array.add(index, node);
}
}
|
java
|
private void setArrayNodeID(int index, ArrayList<INode> array, INode node) {
if (index < array.size()) {
array.set(index, node);
} else {
array.add(index, node);
}
}
|
[
"private",
"void",
"setArrayNodeID",
"(",
"int",
"index",
",",
"ArrayList",
"<",
"INode",
">",
"array",
",",
"INode",
"node",
")",
"{",
"if",
"(",
"index",
"<",
"array",
".",
"size",
"(",
")",
")",
"{",
"array",
".",
"set",
"(",
"index",
",",
"node",
")",
";",
"}",
"else",
"{",
"array",
".",
"add",
"(",
"index",
",",
"node",
")",
";",
"}",
"}"
] |
Sets the node at a given position of the array.
Changes the current value if there is one, if there is no value, adds a new one.
@param index position to be filled
@param array array to be modified
@param node value to be set
|
[
"Sets",
"the",
"node",
"at",
"a",
"given",
"position",
"of",
"the",
"array",
".",
"Changes",
"the",
"current",
"value",
"if",
"there",
"is",
"one",
"if",
"there",
"is",
"no",
"value",
"adds",
"a",
"new",
"one",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/loaders/context/TabContextLoader.java#L108-L114
|
147,632
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/SmallSortedMap.java
|
SmallSortedMap.makeImmutable
|
public void makeImmutable() {
if (!isImmutable) {
// Note: There's no need to wrap the entryList in an unmodifiableList
// because none of the list's accessors are exposed. The iterator() of
// overflowEntries, on the other hand, is exposed so it must be made
// unmodifiable.
overflowEntries = overflowEntries.isEmpty() ?
Collections.<K, V>emptyMap() :
Collections.unmodifiableMap(overflowEntries);
isImmutable = true;
}
}
|
java
|
public void makeImmutable() {
if (!isImmutable) {
// Note: There's no need to wrap the entryList in an unmodifiableList
// because none of the list's accessors are exposed. The iterator() of
// overflowEntries, on the other hand, is exposed so it must be made
// unmodifiable.
overflowEntries = overflowEntries.isEmpty() ?
Collections.<K, V>emptyMap() :
Collections.unmodifiableMap(overflowEntries);
isImmutable = true;
}
}
|
[
"public",
"void",
"makeImmutable",
"(",
")",
"{",
"if",
"(",
"!",
"isImmutable",
")",
"{",
"// Note: There's no need to wrap the entryList in an unmodifiableList",
"// because none of the list's accessors are exposed. The iterator() of",
"// overflowEntries, on the other hand, is exposed so it must be made",
"// unmodifiable.",
"overflowEntries",
"=",
"overflowEntries",
".",
"isEmpty",
"(",
")",
"?",
"Collections",
".",
"<",
"K",
",",
"V",
">",
"emptyMap",
"(",
")",
":",
"Collections",
".",
"unmodifiableMap",
"(",
"overflowEntries",
")",
";",
"isImmutable",
"=",
"true",
";",
"}",
"}"
] |
Make this map immutable from this point forward.
|
[
"Make",
"this",
"map",
"immutable",
"from",
"this",
"point",
"forward",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/SmallSortedMap.java#L160-L171
|
147,633
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/SmallSortedMap.java
|
SmallSortedMap.ensureEntryArrayMutable
|
private void ensureEntryArrayMutable() {
checkMutable();
if (entryList.isEmpty() && !(entryList instanceof ArrayList)) {
entryList = new ArrayList<Entry>(maxArraySize);
}
}
|
java
|
private void ensureEntryArrayMutable() {
checkMutable();
if (entryList.isEmpty() && !(entryList instanceof ArrayList)) {
entryList = new ArrayList<Entry>(maxArraySize);
}
}
|
[
"private",
"void",
"ensureEntryArrayMutable",
"(",
")",
"{",
"checkMutable",
"(",
")",
";",
"if",
"(",
"entryList",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"(",
"entryList",
"instanceof",
"ArrayList",
")",
")",
"{",
"entryList",
"=",
"new",
"ArrayList",
"<",
"Entry",
">",
"(",
"maxArraySize",
")",
";",
"}",
"}"
] |
Lazily creates the entry list. Any code that adds to the list must first
call this method.
|
[
"Lazily",
"creates",
"the",
"entry",
"list",
".",
"Any",
"code",
"that",
"adds",
"to",
"the",
"list",
"must",
"first",
"call",
"this",
"method",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/SmallSortedMap.java#L388-L393
|
147,634
|
awltech/org.parallelj
|
parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/launching/mbeans/ConfigurationHandlerRemote.java
|
ConfigurationHandlerRemote.displayConfiguration
|
public String displayConfiguration() {
StringBuffer result = new StringBuffer();
for (ConfigurationManager confManager : ConfigurationService
.getConfigurationService().getConfigurationManager().values()) {
Object configuration = confManager.getConfiguration();
StringWriter writer = new StringWriter();
JAXB.marshal(configuration, writer);
result.append(writer.getBuffer());
result.append("\n");
}
;
return result.toString();
}
|
java
|
public String displayConfiguration() {
StringBuffer result = new StringBuffer();
for (ConfigurationManager confManager : ConfigurationService
.getConfigurationService().getConfigurationManager().values()) {
Object configuration = confManager.getConfiguration();
StringWriter writer = new StringWriter();
JAXB.marshal(configuration, writer);
result.append(writer.getBuffer());
result.append("\n");
}
;
return result.toString();
}
|
[
"public",
"String",
"displayConfiguration",
"(",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"for",
"(",
"ConfigurationManager",
"confManager",
":",
"ConfigurationService",
".",
"getConfigurationService",
"(",
")",
".",
"getConfigurationManager",
"(",
")",
".",
"values",
"(",
")",
")",
"{",
"Object",
"configuration",
"=",
"confManager",
".",
"getConfiguration",
"(",
")",
";",
"StringWriter",
"writer",
"=",
"new",
"StringWriter",
"(",
")",
";",
"JAXB",
".",
"marshal",
"(",
"configuration",
",",
"writer",
")",
";",
"result",
".",
"append",
"(",
"writer",
".",
"getBuffer",
"(",
")",
")",
";",
"result",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"}",
";",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] |
This method is used to display the configurations data loaded from all
configuration files.
@return String
|
[
"This",
"method",
"is",
"used",
"to",
"display",
"the",
"configurations",
"data",
"loaded",
"from",
"all",
"configuration",
"files",
"."
] |
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
|
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/launching/mbeans/ConfigurationHandlerRemote.java#L63-L77
|
147,635
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/Node.java
|
Node.readBytes
|
public byte[] readBytes() throws IOException {
Buffer buffer;
try (InputStream src = newInputStream()) {
buffer = getWorld().getBuffer();
synchronized (buffer) {
return buffer.readBytes(src);
}
}
}
|
java
|
public byte[] readBytes() throws IOException {
Buffer buffer;
try (InputStream src = newInputStream()) {
buffer = getWorld().getBuffer();
synchronized (buffer) {
return buffer.readBytes(src);
}
}
}
|
[
"public",
"byte",
"[",
"]",
"readBytes",
"(",
")",
"throws",
"IOException",
"{",
"Buffer",
"buffer",
";",
"try",
"(",
"InputStream",
"src",
"=",
"newInputStream",
"(",
")",
")",
"{",
"buffer",
"=",
"getWorld",
"(",
")",
".",
"getBuffer",
"(",
")",
";",
"synchronized",
"(",
"buffer",
")",
"{",
"return",
"buffer",
".",
"readBytes",
"(",
"src",
")",
";",
"}",
"}",
"}"
] |
Reads all bytes of the node.
Default implementation that works for all nodes: reads the file in chunks and builds the result in memory.
Derived classes should override it if they can provide a more efficient implementation, e.g. by determining
the length first if getting the length is cheap.
|
[
"Reads",
"all",
"bytes",
"of",
"the",
"node",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Node.java#L487-L496
|
147,636
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/Node.java
|
Node.readProperties
|
public Properties readProperties() throws IOException {
Properties p;
try (Reader src = newReader()) {
p = new Properties();
p.load(src);
}
return p;
}
|
java
|
public Properties readProperties() throws IOException {
Properties p;
try (Reader src = newReader()) {
p = new Properties();
p.load(src);
}
return p;
}
|
[
"public",
"Properties",
"readProperties",
"(",
")",
"throws",
"IOException",
"{",
"Properties",
"p",
";",
"try",
"(",
"Reader",
"src",
"=",
"newReader",
"(",
")",
")",
"{",
"p",
"=",
"new",
"Properties",
"(",
")",
";",
"p",
".",
"load",
"(",
"src",
")",
";",
"}",
"return",
"p",
";",
"}"
] |
Reads properties with the encoding for this node
|
[
"Reads",
"properties",
"with",
"the",
"encoding",
"for",
"this",
"node"
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Node.java#L517-L525
|
147,637
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/Node.java
|
Node.mkfile
|
public T mkfile() throws MkfileException {
try {
if (exists()) {
throw new MkfileException(this);
}
return writeBytes();
} catch (IOException e) {
throw new MkfileException(this, e);
}
}
|
java
|
public T mkfile() throws MkfileException {
try {
if (exists()) {
throw new MkfileException(this);
}
return writeBytes();
} catch (IOException e) {
throw new MkfileException(this, e);
}
}
|
[
"public",
"T",
"mkfile",
"(",
")",
"throws",
"MkfileException",
"{",
"try",
"{",
"if",
"(",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"MkfileException",
"(",
"this",
")",
";",
"}",
"return",
"writeBytes",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"MkfileException",
"(",
"this",
",",
"e",
")",
";",
"}",
"}"
] |
Fails if the file already exists. Features define whether this operation is atomic.
This default implementation is not atomic.
@return this
|
[
"Fails",
"if",
"the",
"file",
"already",
"exists",
".",
"Features",
"define",
"whether",
"this",
"operation",
"is",
"atomic",
".",
"This",
"default",
"implementation",
"is",
"not",
"atomic",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Node.java#L563-L572
|
147,638
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/Node.java
|
Node.copy
|
public void copy(Node dest) throws NodeNotFoundException, CopyException {
try {
if (isDirectory()) {
dest.mkdirOpt();
copyDirectory(dest);
} else {
copyFile(dest);
}
} catch (FileNotFoundException | CopyException e) {
throw e;
} catch (IOException e) {
throw new CopyException(this, dest, e);
}
}
|
java
|
public void copy(Node dest) throws NodeNotFoundException, CopyException {
try {
if (isDirectory()) {
dest.mkdirOpt();
copyDirectory(dest);
} else {
copyFile(dest);
}
} catch (FileNotFoundException | CopyException e) {
throw e;
} catch (IOException e) {
throw new CopyException(this, dest, e);
}
}
|
[
"public",
"void",
"copy",
"(",
"Node",
"dest",
")",
"throws",
"NodeNotFoundException",
",",
"CopyException",
"{",
"try",
"{",
"if",
"(",
"isDirectory",
"(",
")",
")",
"{",
"dest",
".",
"mkdirOpt",
"(",
")",
";",
"copyDirectory",
"(",
"dest",
")",
";",
"}",
"else",
"{",
"copyFile",
"(",
"dest",
")",
";",
"}",
"}",
"catch",
"(",
"FileNotFoundException",
"|",
"CopyException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"CopyException",
"(",
"this",
",",
"dest",
",",
"e",
")",
";",
"}",
"}"
] |
Copies this to dest. Overwrites existing file and adds to existing directories.
@throws NodeNotFoundException if this does not exist
|
[
"Copies",
"this",
"to",
"dest",
".",
"Overwrites",
"existing",
"file",
"and",
"adds",
"to",
"existing",
"directories",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Node.java#L729-L742
|
147,639
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/Node.java
|
Node.copyFile
|
public Node copyFile(Node dest) throws FileNotFoundException, CopyException {
try (OutputStream out = dest.newOutputStream()) {
copyFileTo(out);
} catch (FileNotFoundException e) {
throw e;
} catch (IOException e) {
throw new CopyException(this, dest, e);
}
return this;
}
|
java
|
public Node copyFile(Node dest) throws FileNotFoundException, CopyException {
try (OutputStream out = dest.newOutputStream()) {
copyFileTo(out);
} catch (FileNotFoundException e) {
throw e;
} catch (IOException e) {
throw new CopyException(this, dest, e);
}
return this;
}
|
[
"public",
"Node",
"copyFile",
"(",
"Node",
"dest",
")",
"throws",
"FileNotFoundException",
",",
"CopyException",
"{",
"try",
"(",
"OutputStream",
"out",
"=",
"dest",
".",
"newOutputStream",
"(",
")",
")",
"{",
"copyFileTo",
"(",
"out",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"CopyException",
"(",
"this",
",",
"dest",
",",
"e",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Overwrites dest if it already exists.
@return dest
|
[
"Overwrites",
"dest",
"if",
"it",
"already",
"exists",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Node.java#L753-L762
|
147,640
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/Node.java
|
Node.copyDirectory
|
public List<Node> copyDirectory(Node dest) throws DirectoryNotFoundException, CopyException {
return copyDirectory(dest, new Filter().includeAll());
}
|
java
|
public List<Node> copyDirectory(Node dest) throws DirectoryNotFoundException, CopyException {
return copyDirectory(dest, new Filter().includeAll());
}
|
[
"public",
"List",
"<",
"Node",
">",
"copyDirectory",
"(",
"Node",
"dest",
")",
"throws",
"DirectoryNotFoundException",
",",
"CopyException",
"{",
"return",
"copyDirectory",
"(",
"dest",
",",
"new",
"Filter",
"(",
")",
".",
"includeAll",
"(",
")",
")",
";",
"}"
] |
Convenience method for copy all files. Does not use default-excludes
@return list of files and directories created
|
[
"Convenience",
"method",
"for",
"copy",
"all",
"files",
".",
"Does",
"not",
"use",
"default",
"-",
"excludes"
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Node.java#L768-L770
|
147,641
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/Node.java
|
Node.copyDirectory
|
public List<Node> copyDirectory(Node destdir, Filter filter) throws DirectoryNotFoundException, CopyException {
return new Copy(this, filter).directory(destdir);
}
|
java
|
public List<Node> copyDirectory(Node destdir, Filter filter) throws DirectoryNotFoundException, CopyException {
return new Copy(this, filter).directory(destdir);
}
|
[
"public",
"List",
"<",
"Node",
">",
"copyDirectory",
"(",
"Node",
"destdir",
",",
"Filter",
"filter",
")",
"throws",
"DirectoryNotFoundException",
",",
"CopyException",
"{",
"return",
"new",
"Copy",
"(",
"this",
",",
"filter",
")",
".",
"directory",
"(",
"destdir",
")",
";",
"}"
] |
Throws an exception is this or dest is not a directory. Overwrites existing files in dest.
@return list of files and directories created
|
[
"Throws",
"an",
"exception",
"is",
"this",
"or",
"dest",
"is",
"not",
"a",
"directory",
".",
"Overwrites",
"existing",
"files",
"in",
"dest",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Node.java#L776-L778
|
147,642
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/Node.java
|
Node.move
|
public Node move(Node dest, boolean overwrite) throws NodeNotFoundException, MoveException {
try {
if (!overwrite) {
dest.checkNotExists();
}
copy(dest);
deleteTree();
} catch (FileNotFoundException e) {
throw e;
} catch (IOException e) {
throw new MoveException(this, dest, "move failed", e);
}
return dest;
}
|
java
|
public Node move(Node dest, boolean overwrite) throws NodeNotFoundException, MoveException {
try {
if (!overwrite) {
dest.checkNotExists();
}
copy(dest);
deleteTree();
} catch (FileNotFoundException e) {
throw e;
} catch (IOException e) {
throw new MoveException(this, dest, "move failed", e);
}
return dest;
}
|
[
"public",
"Node",
"move",
"(",
"Node",
"dest",
",",
"boolean",
"overwrite",
")",
"throws",
"NodeNotFoundException",
",",
"MoveException",
"{",
"try",
"{",
"if",
"(",
"!",
"overwrite",
")",
"{",
"dest",
".",
"checkNotExists",
"(",
")",
";",
"}",
"copy",
"(",
"dest",
")",
";",
"deleteTree",
"(",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"MoveException",
"(",
"this",
",",
"dest",
",",
"\"move failed\"",
",",
"e",
")",
";",
"}",
"return",
"dest",
";",
"}"
] |
Moves this file or directory to dest. Throws an exception if this does not exist or if dest already exists.
This method is a default implementation with copy and delete, derived classes should override it with a native
implementation when available.
@param overwrite false reports an error if the target already exists. true can be usued to implement atomic updates.
@return dest
@throws FileNotFoundException if this does not exist
|
[
"Moves",
"this",
"file",
"or",
"directory",
"to",
"dest",
".",
"Throws",
"an",
"exception",
"if",
"this",
"does",
"not",
"exist",
"or",
"if",
"dest",
"already",
"exists",
".",
"This",
"method",
"is",
"a",
"default",
"implementation",
"with",
"copy",
"and",
"delete",
"derived",
"classes",
"should",
"override",
"it",
"with",
"a",
"native",
"implementation",
"when",
"available",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Node.java#L874-L887
|
147,643
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/Node.java
|
Node.link
|
public T link(T dest) throws LinkException {
if (!getClass().equals(dest.getClass())) {
throw new IllegalArgumentException(this.getClass() + " vs " + dest.getClass());
}
try {
checkExists();
} catch (IOException e) {
throw new LinkException(this, e);
}
// TODO: getRoot() for ssh root ...
dest.mklink(Filesystem.SEPARATOR_STRING + this.getPath());
return dest;
}
|
java
|
public T link(T dest) throws LinkException {
if (!getClass().equals(dest.getClass())) {
throw new IllegalArgumentException(this.getClass() + " vs " + dest.getClass());
}
try {
checkExists();
} catch (IOException e) {
throw new LinkException(this, e);
}
// TODO: getRoot() for ssh root ...
dest.mklink(Filesystem.SEPARATOR_STRING + this.getPath());
return dest;
}
|
[
"public",
"T",
"link",
"(",
"T",
"dest",
")",
"throws",
"LinkException",
"{",
"if",
"(",
"!",
"getClass",
"(",
")",
".",
"equals",
"(",
"dest",
".",
"getClass",
"(",
")",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"this",
".",
"getClass",
"(",
")",
"+",
"\" vs \"",
"+",
"dest",
".",
"getClass",
"(",
")",
")",
";",
"}",
"try",
"{",
"checkExists",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"throw",
"new",
"LinkException",
"(",
"this",
",",
"e",
")",
";",
"}",
"// TODO: getRoot() for ssh root ...",
"dest",
".",
"mklink",
"(",
"Filesystem",
".",
"SEPARATOR_STRING",
"+",
"this",
".",
"getPath",
"(",
")",
")",
";",
"return",
"dest",
";",
"}"
] |
Creates an absolute link dest pointing to this. The signature of this method resembles the copy method.
@param dest link to be created
@return dest;
|
[
"Creates",
"an",
"absolute",
"link",
"dest",
"pointing",
"to",
"this",
".",
"The",
"signature",
"of",
"this",
"method",
"resembles",
"the",
"copy",
"method",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Node.java#L902-L914
|
147,644
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/Node.java
|
Node.resolveLink
|
public T resolveLink() throws ReadLinkException {
String path;
path = readLink();
if (path.startsWith(Filesystem.SEPARATOR_STRING)) {
return getRoot().node(path.substring(1), null);
} else {
return (T) getParent().join(path);
}
}
|
java
|
public T resolveLink() throws ReadLinkException {
String path;
path = readLink();
if (path.startsWith(Filesystem.SEPARATOR_STRING)) {
return getRoot().node(path.substring(1), null);
} else {
return (T) getParent().join(path);
}
}
|
[
"public",
"T",
"resolveLink",
"(",
")",
"throws",
"ReadLinkException",
"{",
"String",
"path",
";",
"path",
"=",
"readLink",
"(",
")",
";",
"if",
"(",
"path",
".",
"startsWith",
"(",
"Filesystem",
".",
"SEPARATOR_STRING",
")",
")",
"{",
"return",
"getRoot",
"(",
")",
".",
"node",
"(",
"path",
".",
"substring",
"(",
"1",
")",
",",
"null",
")",
";",
"}",
"else",
"{",
"return",
"(",
"T",
")",
"getParent",
"(",
")",
".",
"join",
"(",
"path",
")",
";",
"}",
"}"
] |
Throws an exception if this is not a link.
|
[
"Throws",
"an",
"exception",
"if",
"this",
"is",
"not",
"a",
"link",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Node.java#L930-L939
|
147,645
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/Node.java
|
Node.find
|
public List<T> find(String... includes) throws IOException {
return find(getWorld().filter().include(includes));
}
|
java
|
public List<T> find(String... includes) throws IOException {
return find(getWorld().filter().include(includes));
}
|
[
"public",
"List",
"<",
"T",
">",
"find",
"(",
"String",
"...",
"includes",
")",
"throws",
"IOException",
"{",
"return",
"find",
"(",
"getWorld",
"(",
")",
".",
"filter",
"(",
")",
".",
"include",
"(",
"includes",
")",
")",
";",
"}"
] |
uses default excludes
|
[
"uses",
"default",
"excludes"
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/Node.java#L982-L984
|
147,646
|
eurekaclinical/aiw-i2b2-etl
|
src/main/java/edu/emory/cci/aiw/i2b2etl/dest/I2b2QueryResultsHandler.java
|
I2b2QueryResultsHandler.truncateTempTables
|
private void truncateTempTables() throws SQLException {
Logger logger = I2b2ETLUtil.logger();
logger.log(Level.INFO, "Truncating temp data tables for query {0}", this.query.getName());
try (final Connection conn = openDataDatabaseConnection()) {
conn.setAutoCommit(true);
String[] dataschemaTables = {tempPatientTableName(), tempPatientMappingTableName(), tempVisitTableName(), tempEncounterMappingTableName(), tempProviderTableName(), tempConceptTableName(), tempModifierTableName(), tempObservationFactTableName(), tempObservationFactCompleteTableName()};
for (String tableName : dataschemaTables) {
truncateTable(conn, tableName);
}
logger.log(Level.INFO, "Done truncating temp data tables for query {0}", this.query.getName());
}
}
|
java
|
private void truncateTempTables() throws SQLException {
Logger logger = I2b2ETLUtil.logger();
logger.log(Level.INFO, "Truncating temp data tables for query {0}", this.query.getName());
try (final Connection conn = openDataDatabaseConnection()) {
conn.setAutoCommit(true);
String[] dataschemaTables = {tempPatientTableName(), tempPatientMappingTableName(), tempVisitTableName(), tempEncounterMappingTableName(), tempProviderTableName(), tempConceptTableName(), tempModifierTableName(), tempObservationFactTableName(), tempObservationFactCompleteTableName()};
for (String tableName : dataschemaTables) {
truncateTable(conn, tableName);
}
logger.log(Level.INFO, "Done truncating temp data tables for query {0}", this.query.getName());
}
}
|
[
"private",
"void",
"truncateTempTables",
"(",
")",
"throws",
"SQLException",
"{",
"Logger",
"logger",
"=",
"I2b2ETLUtil",
".",
"logger",
"(",
")",
";",
"logger",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Truncating temp data tables for query {0}\"",
",",
"this",
".",
"query",
".",
"getName",
"(",
")",
")",
";",
"try",
"(",
"final",
"Connection",
"conn",
"=",
"openDataDatabaseConnection",
"(",
")",
")",
"{",
"conn",
".",
"setAutoCommit",
"(",
"true",
")",
";",
"String",
"[",
"]",
"dataschemaTables",
"=",
"{",
"tempPatientTableName",
"(",
")",
",",
"tempPatientMappingTableName",
"(",
")",
",",
"tempVisitTableName",
"(",
")",
",",
"tempEncounterMappingTableName",
"(",
")",
",",
"tempProviderTableName",
"(",
")",
",",
"tempConceptTableName",
"(",
")",
",",
"tempModifierTableName",
"(",
")",
",",
"tempObservationFactTableName",
"(",
")",
",",
"tempObservationFactCompleteTableName",
"(",
")",
"}",
";",
"for",
"(",
"String",
"tableName",
":",
"dataschemaTables",
")",
"{",
"truncateTable",
"(",
"conn",
",",
"tableName",
")",
";",
"}",
"logger",
".",
"log",
"(",
"Level",
".",
"INFO",
",",
"\"Done truncating temp data tables for query {0}\"",
",",
"this",
".",
"query",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] |
Calls stored procedures to drop all of the temp tables created.
@throws SQLException if an error occurs while interacting with the
database
|
[
"Calls",
"stored",
"procedures",
"to",
"drop",
"all",
"of",
"the",
"temp",
"tables",
"created",
"."
] |
3eed6bda7755919cb9466d2930723a0f4748341a
|
https://github.com/eurekaclinical/aiw-i2b2-etl/blob/3eed6bda7755919cb9466d2930723a0f4748341a/src/main/java/edu/emory/cci/aiw/i2b2etl/dest/I2b2QueryResultsHandler.java#L402-L413
|
147,647
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.first
|
public int first() {
int val;
int i;
for (i = 0; i < data.length; i++) {
if (data[i] != 0) {
val = data[i];
i <<= SHIFT;
while ((val & 1) == 0) {
val >>>= 1;
i++;
}
return i;
}
}
return -1;
}
|
java
|
public int first() {
int val;
int i;
for (i = 0; i < data.length; i++) {
if (data[i] != 0) {
val = data[i];
i <<= SHIFT;
while ((val & 1) == 0) {
val >>>= 1;
i++;
}
return i;
}
}
return -1;
}
|
[
"public",
"int",
"first",
"(",
")",
"{",
"int",
"val",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"data",
"[",
"i",
"]",
"!=",
"0",
")",
"{",
"val",
"=",
"data",
"[",
"i",
"]",
";",
"i",
"<<=",
"SHIFT",
";",
"while",
"(",
"(",
"val",
"&",
"1",
")",
"==",
"0",
")",
"{",
"val",
">>>=",
"1",
";",
"i",
"++",
";",
"}",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
Gets the first element of the set.
@return first element of the set, -1 if the set is empty
|
[
"Gets",
"the",
"first",
"element",
"of",
"the",
"set",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L95-L111
|
147,648
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.last
|
public int last() {
int val;
int i;
for (i = data.length - 1; i >= 0; i--) {
if (data[i] != 0) {
val = data[i] >>> 1;
i <<= SHIFT;
while (val != 0) {
val >>>= 1;
i++;
}
return i;
}
}
return -1;
}
|
java
|
public int last() {
int val;
int i;
for (i = data.length - 1; i >= 0; i--) {
if (data[i] != 0) {
val = data[i] >>> 1;
i <<= SHIFT;
while (val != 0) {
val >>>= 1;
i++;
}
return i;
}
}
return -1;
}
|
[
"public",
"int",
"last",
"(",
")",
"{",
"int",
"val",
";",
"int",
"i",
";",
"for",
"(",
"i",
"=",
"data",
".",
"length",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"if",
"(",
"data",
"[",
"i",
"]",
"!=",
"0",
")",
"{",
"val",
"=",
"data",
"[",
"i",
"]",
">>>",
"1",
";",
"i",
"<<=",
"SHIFT",
";",
"while",
"(",
"val",
"!=",
"0",
")",
"{",
"val",
">>>=",
"1",
";",
"i",
"++",
";",
"}",
"return",
"i",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
Gets the last element of the set.
@return last element of the set, -1 if the set is empty
|
[
"Gets",
"the",
"last",
"element",
"of",
"the",
"set",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L117-L133
|
147,649
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.next
|
public int next(int ele) {
int idx, bit, val;
idx = ele >> SHIFT;
bit = ele & MASK;
val = data[idx] >>> bit;
do {
val >>>= 1;
bit++;
if (val == 0) {
idx++;
if (idx == data.length) {
return -1;
}
val = data[idx];
bit = 0;
}
} while ((val & 1) == 0);
return (idx << SHIFT) + bit;
}
|
java
|
public int next(int ele) {
int idx, bit, val;
idx = ele >> SHIFT;
bit = ele & MASK;
val = data[idx] >>> bit;
do {
val >>>= 1;
bit++;
if (val == 0) {
idx++;
if (idx == data.length) {
return -1;
}
val = data[idx];
bit = 0;
}
} while ((val & 1) == 0);
return (idx << SHIFT) + bit;
}
|
[
"public",
"int",
"next",
"(",
"int",
"ele",
")",
"{",
"int",
"idx",
",",
"bit",
",",
"val",
";",
"idx",
"=",
"ele",
">>",
"SHIFT",
";",
"bit",
"=",
"ele",
"&",
"MASK",
";",
"val",
"=",
"data",
"[",
"idx",
"]",
">>>",
"bit",
";",
"do",
"{",
"val",
">>>=",
"1",
";",
"bit",
"++",
";",
"if",
"(",
"val",
"==",
"0",
")",
"{",
"idx",
"++",
";",
"if",
"(",
"idx",
"==",
"data",
".",
"length",
")",
"{",
"return",
"-",
"1",
";",
"}",
"val",
"=",
"data",
"[",
"idx",
"]",
";",
"bit",
"=",
"0",
";",
"}",
"}",
"while",
"(",
"(",
"val",
"&",
"1",
")",
"==",
"0",
")",
";",
"return",
"(",
"idx",
"<<",
"SHIFT",
")",
"+",
"bit",
";",
"}"
] |
Gets the element following ele.
@param ele the element to start with
@return the element following ele, -1 if nothing follows
|
[
"Gets",
"the",
"element",
"following",
"ele",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L140-L160
|
147,650
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.contains
|
public boolean contains(int ele) {
int idx;
idx = ele >> SHIFT;
if (idx >= data.length) {
return false;
}
return (data[idx] & (1 << ele)) != 0;
}
|
java
|
public boolean contains(int ele) {
int idx;
idx = ele >> SHIFT;
if (idx >= data.length) {
return false;
}
return (data[idx] & (1 << ele)) != 0;
}
|
[
"public",
"boolean",
"contains",
"(",
"int",
"ele",
")",
"{",
"int",
"idx",
";",
"idx",
"=",
"ele",
">>",
"SHIFT",
";",
"if",
"(",
"idx",
">=",
"data",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"data",
"[",
"idx",
"]",
"&",
"(",
"1",
"<<",
"ele",
")",
")",
"!=",
"0",
";",
"}"
] |
Lookup a specific element.
@param ele element to lookup
@return true, if ele is contained in the set
|
[
"Lookup",
"a",
"specific",
"element",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L181-L189
|
147,651
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.add
|
public void add(int ele) {
int idx;
idx = ele >> SHIFT;
if (idx >= data.length) {
resize(idx + 1 + GROW);
}
data[ele >> SHIFT] |= (1 << ele);
}
|
java
|
public void add(int ele) {
int idx;
idx = ele >> SHIFT;
if (idx >= data.length) {
resize(idx + 1 + GROW);
}
data[ele >> SHIFT] |= (1 << ele);
}
|
[
"public",
"void",
"add",
"(",
"int",
"ele",
")",
"{",
"int",
"idx",
";",
"idx",
"=",
"ele",
">>",
"SHIFT",
";",
"if",
"(",
"idx",
">=",
"data",
".",
"length",
")",
"{",
"resize",
"(",
"idx",
"+",
"1",
"+",
"GROW",
")",
";",
"}",
"data",
"[",
"ele",
">>",
"SHIFT",
"]",
"|=",
"(",
"1",
"<<",
"ele",
")",
";",
"}"
] |
Add an element.
@param ele the element to add
|
[
"Add",
"an",
"element",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L206-L214
|
147,652
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.addRange
|
public void addRange(int first, int last) {
int ele;
for (ele = first; ele <= last; ele++) {
add(ele);
}
}
|
java
|
public void addRange(int first, int last) {
int ele;
for (ele = first; ele <= last; ele++) {
add(ele);
}
}
|
[
"public",
"void",
"addRange",
"(",
"int",
"first",
",",
"int",
"last",
")",
"{",
"int",
"ele",
";",
"for",
"(",
"ele",
"=",
"first",
";",
"ele",
"<=",
"last",
";",
"ele",
"++",
")",
"{",
"add",
"(",
"ele",
")",
";",
"}",
"}"
] |
Add all elements in the indicated range. Nothing is set for first > last.
@param first first element to add
@param last last element to add
|
[
"Add",
"all",
"elements",
"in",
"the",
"indicated",
"range",
".",
"Nothing",
"is",
"set",
"for",
"first",
">",
";",
"last",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L221-L227
|
147,653
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.remove
|
public void remove(int ele) {
int idx;
idx = ele >> SHIFT;
if (idx < data.length) {
data[idx] &= ~(1 << ele);
}
}
|
java
|
public void remove(int ele) {
int idx;
idx = ele >> SHIFT;
if (idx < data.length) {
data[idx] &= ~(1 << ele);
}
}
|
[
"public",
"void",
"remove",
"(",
"int",
"ele",
")",
"{",
"int",
"idx",
";",
"idx",
"=",
"ele",
">>",
"SHIFT",
";",
"if",
"(",
"idx",
"<",
"data",
".",
"length",
")",
"{",
"data",
"[",
"idx",
"]",
"&=",
"~",
"(",
"1",
"<<",
"ele",
")",
";",
"}",
"}"
] |
Remove an element from the set.
@param ele element to remove
|
[
"Remove",
"an",
"element",
"from",
"the",
"set",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L233-L240
|
147,654
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.removeRange
|
public void removeRange(int first, int last) {
int ele;
for (ele = first; ele <= last; ele++) {
remove(ele);
}
}
|
java
|
public void removeRange(int first, int last) {
int ele;
for (ele = first; ele <= last; ele++) {
remove(ele);
}
}
|
[
"public",
"void",
"removeRange",
"(",
"int",
"first",
",",
"int",
"last",
")",
"{",
"int",
"ele",
";",
"for",
"(",
"ele",
"=",
"first",
";",
"ele",
"<=",
"last",
";",
"ele",
"++",
")",
"{",
"remove",
"(",
"ele",
")",
";",
"}",
"}"
] |
Remove all elements in the indicated range.
@param first first element to remove
@param last last element to remove
|
[
"Remove",
"all",
"elements",
"in",
"the",
"indicated",
"range",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L247-L253
|
147,655
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.containsAll
|
public boolean containsAll(IntBitSet set) {
int i, end;
if (data.length < set.data.length) {
end = data.length;
for (i = end; i < set.data.length; i++) {
if (set.data[i] != 0) {
return false;
}
}
} else {
end = set.data.length;
}
for (i = 0; i < end; i++) {
// any bits in set where this has none? -> false
if ((set.data[i] & ~data[i])!= 0) {
return false;
}
}
return true;
}
|
java
|
public boolean containsAll(IntBitSet set) {
int i, end;
if (data.length < set.data.length) {
end = data.length;
for (i = end; i < set.data.length; i++) {
if (set.data[i] != 0) {
return false;
}
}
} else {
end = set.data.length;
}
for (i = 0; i < end; i++) {
// any bits in set where this has none? -> false
if ((set.data[i] & ~data[i])!= 0) {
return false;
}
}
return true;
}
|
[
"public",
"boolean",
"containsAll",
"(",
"IntBitSet",
"set",
")",
"{",
"int",
"i",
",",
"end",
";",
"if",
"(",
"data",
".",
"length",
"<",
"set",
".",
"data",
".",
"length",
")",
"{",
"end",
"=",
"data",
".",
"length",
";",
"for",
"(",
"i",
"=",
"end",
";",
"i",
"<",
"set",
".",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"set",
".",
"data",
"[",
"i",
"]",
"!=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"}",
"}",
"else",
"{",
"end",
"=",
"set",
".",
"data",
".",
"length",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"end",
";",
"i",
"++",
")",
"{",
"// any bits in set where this has none? -> false",
"if",
"(",
"(",
"set",
".",
"data",
"[",
"i",
"]",
"&",
"~",
"data",
"[",
"i",
"]",
")",
"!=",
"0",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
] |
The subset test.
@param set the set to be compared with
@return true, if the argument is contained
|
[
"The",
"subset",
"test",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L319-L340
|
147,656
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.retainAll
|
public void retainAll(IntBitSet set) {
int i;
if (set.data.length > data.length) {
resize(set.data.length);
}
for (i = 0; i < set.data.length; i++) {
data[i] &= set.data[i];
}
for ( ; i < data.length; i++) {
data[i] = 0;
}
}
|
java
|
public void retainAll(IntBitSet set) {
int i;
if (set.data.length > data.length) {
resize(set.data.length);
}
for (i = 0; i < set.data.length; i++) {
data[i] &= set.data[i];
}
for ( ; i < data.length; i++) {
data[i] = 0;
}
}
|
[
"public",
"void",
"retainAll",
"(",
"IntBitSet",
"set",
")",
"{",
"int",
"i",
";",
"if",
"(",
"set",
".",
"data",
".",
"length",
">",
"data",
".",
"length",
")",
"{",
"resize",
"(",
"set",
".",
"data",
".",
"length",
")",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"set",
".",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"data",
"[",
"i",
"]",
"&=",
"set",
".",
"data",
"[",
"i",
"]",
";",
"}",
"for",
"(",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"data",
"[",
"i",
"]",
"=",
"0",
";",
"}",
"}"
] |
Computes the intersection. The result is stored in this set.
@param set the set to be combined with
|
[
"Computes",
"the",
"intersection",
".",
"The",
"result",
"is",
"stored",
"in",
"this",
"set",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L348-L360
|
147,657
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.removeAll
|
public void removeAll(IntBitSet set) {
int i, end;
end = (set.data.length < data.length)? set.data.length : data.length;
for (i = 0; i < end; i++) {
data[i] &= ~set.data[i];
}
}
|
java
|
public void removeAll(IntBitSet set) {
int i, end;
end = (set.data.length < data.length)? set.data.length : data.length;
for (i = 0; i < end; i++) {
data[i] &= ~set.data[i];
}
}
|
[
"public",
"void",
"removeAll",
"(",
"IntBitSet",
"set",
")",
"{",
"int",
"i",
",",
"end",
";",
"end",
"=",
"(",
"set",
".",
"data",
".",
"length",
"<",
"data",
".",
"length",
")",
"?",
"set",
".",
"data",
".",
"length",
":",
"data",
".",
"length",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"end",
";",
"i",
"++",
")",
"{",
"data",
"[",
"i",
"]",
"&=",
"~",
"set",
".",
"data",
"[",
"i",
"]",
";",
"}",
"}"
] |
Computes the set difference. The result is stored in this set.
@param set the set to be combined with
|
[
"Computes",
"the",
"set",
"difference",
".",
"The",
"result",
"is",
"stored",
"in",
"this",
"set",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L366-L373
|
147,658
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.addAll
|
public void addAll(IntBitSet set) {
int i;
if (set.data.length > data.length) {
resize(set.data.length);
}
for (i = 0; i < set.data.length; i++) {
data[i] |= set.data[i];
}
}
|
java
|
public void addAll(IntBitSet set) {
int i;
if (set.data.length > data.length) {
resize(set.data.length);
}
for (i = 0; i < set.data.length; i++) {
data[i] |= set.data[i];
}
}
|
[
"public",
"void",
"addAll",
"(",
"IntBitSet",
"set",
")",
"{",
"int",
"i",
";",
"if",
"(",
"set",
".",
"data",
".",
"length",
">",
"data",
".",
"length",
")",
"{",
"resize",
"(",
"set",
".",
"data",
".",
"length",
")",
";",
"}",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"set",
".",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"data",
"[",
"i",
"]",
"|=",
"set",
".",
"data",
"[",
"i",
"]",
";",
"}",
"}"
] |
Computes the union. The result is stored in this set.
@param set the set to be combined with
|
[
"Computes",
"the",
"union",
".",
"The",
"result",
"is",
"stored",
"in",
"this",
"set",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L379-L389
|
147,659
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.size
|
public int size() {
int ele, count;
count = 0;
for (ele = first(); ele != -1; ele = next(ele)) {
count++;
}
return count;
}
|
java
|
public int size() {
int ele, count;
count = 0;
for (ele = first(); ele != -1; ele = next(ele)) {
count++;
}
return count;
}
|
[
"public",
"int",
"size",
"(",
")",
"{",
"int",
"ele",
",",
"count",
";",
"count",
"=",
"0",
";",
"for",
"(",
"ele",
"=",
"first",
"(",
")",
";",
"ele",
"!=",
"-",
"1",
";",
"ele",
"=",
"next",
"(",
"ele",
")",
")",
"{",
"count",
"++",
";",
"}",
"return",
"count",
";",
"}"
] |
Counts the elements.
@return number of elements in this set
|
[
"Counts",
"the",
"elements",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L407-L415
|
147,660
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.toArray
|
public int[] toArray() {
int i, ele;
int[] result;
result = new int[size()];
for (ele = first(), i = 0; ele != -1; ele = next(ele), i++) {
result[i] = ele;
}
return result;
}
|
java
|
public int[] toArray() {
int i, ele;
int[] result;
result = new int[size()];
for (ele = first(), i = 0; ele != -1; ele = next(ele), i++) {
result[i] = ele;
}
return result;
}
|
[
"public",
"int",
"[",
"]",
"toArray",
"(",
")",
"{",
"int",
"i",
",",
"ele",
";",
"int",
"[",
"]",
"result",
";",
"result",
"=",
"new",
"int",
"[",
"size",
"(",
")",
"]",
";",
"for",
"(",
"ele",
"=",
"first",
"(",
")",
",",
"i",
"=",
"0",
";",
"ele",
"!=",
"-",
"1",
";",
"ele",
"=",
"next",
"(",
"ele",
")",
",",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"ele",
";",
"}",
"return",
"result",
";",
"}"
] |
Creates an array with all elements of the set.
@return array with all elements of the set
|
[
"Creates",
"an",
"array",
"with",
"all",
"elements",
"of",
"the",
"set",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L429-L438
|
147,661
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/IntBitSet.java
|
IntBitSet.resize
|
private void resize(int s) {
int[] n;
int count;
n = new int[s];
count = (s < data.length)? s : data.length;
System.arraycopy(data, 0, n, 0, count);
data = n;
}
|
java
|
private void resize(int s) {
int[] n;
int count;
n = new int[s];
count = (s < data.length)? s : data.length;
System.arraycopy(data, 0, n, 0, count);
data = n;
}
|
[
"private",
"void",
"resize",
"(",
"int",
"s",
")",
"{",
"int",
"[",
"]",
"n",
";",
"int",
"count",
";",
"n",
"=",
"new",
"int",
"[",
"s",
"]",
";",
"count",
"=",
"(",
"s",
"<",
"data",
".",
"length",
")",
"?",
"s",
":",
"data",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"data",
",",
"0",
",",
"n",
",",
"0",
",",
"count",
")",
";",
"data",
"=",
"n",
";",
"}"
] |
Changes data to have data.length >= s components. All data
components that fit into the new size are preserved.
@param s new data size wanted
|
[
"Changes",
"data",
"to",
"have",
"data",
".",
"length",
">",
"=",
"s",
"components",
".",
"All",
"data",
"components",
"that",
"fit",
"into",
"the",
"new",
"size",
"are",
"preserved",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/IntBitSet.java#L445-L453
|
147,662
|
awltech/org.parallelj
|
parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/launching/transport/jmx/JmxServer.java
|
JmxServer.start
|
public final synchronized void start() throws IOException {
LaunchingMessageKind.IJMX0001.format(this.host, this.port);
this.mbs = ManagementFactory.getPlatformMBeanServer();
final String oldRmiServerName = System
.getProperty("java.rmi.server.hostname");
System.setProperty("java.rmi.server.hostname", this.host);
register = LocateRegistry.createRegistry(this.port);
if (oldRmiServerName == null) {
final Properties props = System.getProperties();
for (Object key : props.keySet()) {
if (key.equals("java.rmi.server.hostname")) {
props.remove(key);
break;
}
}
} else {
System.setProperty("java.rmi.server.hostname", oldRmiServerName);
}
final String serviceURL = String.format(serverUrlFormat, this.host,
this.host, this.port);
LaunchingMessageKind.IJMX0002.format(serviceURL);
final JMXServiceURL url = new JMXServiceURL(serviceURL);
this.jmxConnectorServer = JMXConnectorServerFactory
.newJMXConnectorServer(url, null, mbs);
this.jmxConnectorServer.start();
registerMBeans();
}
|
java
|
public final synchronized void start() throws IOException {
LaunchingMessageKind.IJMX0001.format(this.host, this.port);
this.mbs = ManagementFactory.getPlatformMBeanServer();
final String oldRmiServerName = System
.getProperty("java.rmi.server.hostname");
System.setProperty("java.rmi.server.hostname", this.host);
register = LocateRegistry.createRegistry(this.port);
if (oldRmiServerName == null) {
final Properties props = System.getProperties();
for (Object key : props.keySet()) {
if (key.equals("java.rmi.server.hostname")) {
props.remove(key);
break;
}
}
} else {
System.setProperty("java.rmi.server.hostname", oldRmiServerName);
}
final String serviceURL = String.format(serverUrlFormat, this.host,
this.host, this.port);
LaunchingMessageKind.IJMX0002.format(serviceURL);
final JMXServiceURL url = new JMXServiceURL(serviceURL);
this.jmxConnectorServer = JMXConnectorServerFactory
.newJMXConnectorServer(url, null, mbs);
this.jmxConnectorServer.start();
registerMBeans();
}
|
[
"public",
"final",
"synchronized",
"void",
"start",
"(",
")",
"throws",
"IOException",
"{",
"LaunchingMessageKind",
".",
"IJMX0001",
".",
"format",
"(",
"this",
".",
"host",
",",
"this",
".",
"port",
")",
";",
"this",
".",
"mbs",
"=",
"ManagementFactory",
".",
"getPlatformMBeanServer",
"(",
")",
";",
"final",
"String",
"oldRmiServerName",
"=",
"System",
".",
"getProperty",
"(",
"\"java.rmi.server.hostname\"",
")",
";",
"System",
".",
"setProperty",
"(",
"\"java.rmi.server.hostname\"",
",",
"this",
".",
"host",
")",
";",
"register",
"=",
"LocateRegistry",
".",
"createRegistry",
"(",
"this",
".",
"port",
")",
";",
"if",
"(",
"oldRmiServerName",
"==",
"null",
")",
"{",
"final",
"Properties",
"props",
"=",
"System",
".",
"getProperties",
"(",
")",
";",
"for",
"(",
"Object",
"key",
":",
"props",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"key",
".",
"equals",
"(",
"\"java.rmi.server.hostname\"",
")",
")",
"{",
"props",
".",
"remove",
"(",
"key",
")",
";",
"break",
";",
"}",
"}",
"}",
"else",
"{",
"System",
".",
"setProperty",
"(",
"\"java.rmi.server.hostname\"",
",",
"oldRmiServerName",
")",
";",
"}",
"final",
"String",
"serviceURL",
"=",
"String",
".",
"format",
"(",
"serverUrlFormat",
",",
"this",
".",
"host",
",",
"this",
".",
"host",
",",
"this",
".",
"port",
")",
";",
"LaunchingMessageKind",
".",
"IJMX0002",
".",
"format",
"(",
"serviceURL",
")",
";",
"final",
"JMXServiceURL",
"url",
"=",
"new",
"JMXServiceURL",
"(",
"serviceURL",
")",
";",
"this",
".",
"jmxConnectorServer",
"=",
"JMXConnectorServerFactory",
".",
"newJMXConnectorServer",
"(",
"url",
",",
"null",
",",
"mbs",
")",
";",
"this",
".",
"jmxConnectorServer",
".",
"start",
"(",
")",
";",
"registerMBeans",
"(",
")",
";",
"}"
] |
Start the JMX Server
@throws IOException
|
[
"Start",
"the",
"JMX",
"Server"
] |
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
|
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/launching/transport/jmx/JmxServer.java#L96-L126
|
147,663
|
awltech/org.parallelj
|
parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/launching/transport/jmx/JmxServer.java
|
JmxServer.stop
|
public final synchronized void stop() {
LaunchingMessageKind.IJMX0003.format();
unRegisterMBeans();
try {
if (this.jmxConnectorServer != null) {
this.jmxConnectorServer.stop();
}
} catch (IOException e1) {
// Do nothing
}
try {
UnicastRemoteObject.unexportObject(register, true);
} catch (NoSuchObjectException e) {
// Do nothing
}
}
|
java
|
public final synchronized void stop() {
LaunchingMessageKind.IJMX0003.format();
unRegisterMBeans();
try {
if (this.jmxConnectorServer != null) {
this.jmxConnectorServer.stop();
}
} catch (IOException e1) {
// Do nothing
}
try {
UnicastRemoteObject.unexportObject(register, true);
} catch (NoSuchObjectException e) {
// Do nothing
}
}
|
[
"public",
"final",
"synchronized",
"void",
"stop",
"(",
")",
"{",
"LaunchingMessageKind",
".",
"IJMX0003",
".",
"format",
"(",
")",
";",
"unRegisterMBeans",
"(",
")",
";",
"try",
"{",
"if",
"(",
"this",
".",
"jmxConnectorServer",
"!=",
"null",
")",
"{",
"this",
".",
"jmxConnectorServer",
".",
"stop",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e1",
")",
"{",
"// Do nothing",
"}",
"try",
"{",
"UnicastRemoteObject",
".",
"unexportObject",
"(",
"register",
",",
"true",
")",
";",
"}",
"catch",
"(",
"NoSuchObjectException",
"e",
")",
"{",
"// Do nothing",
"}",
"}"
] |
Stop the JMX Server
|
[
"Stop",
"the",
"JMX",
"Server"
] |
2a2498cc4ac6227df6f45d295ec568cad3cffbc4
|
https://github.com/awltech/org.parallelj/blob/2a2498cc4ac6227df6f45d295ec568cad3cffbc4/parallelj-launching-parent/parallelj-launching-api/src/main/java/org/parallelj/launching/transport/jmx/JmxServer.java#L131-L147
|
147,664
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/common/utils/ClassFactory.java
|
ClassFactory.getClassForName
|
public static Object getClassForName(String className) {
Object object = null;
try {
Class classDefinition = Class.forName(className);
object = classDefinition.newInstance();
} catch (ClassNotFoundException e) {
if (log.isEnabledFor(Level.ERROR)) {
log.error("ClassNotFoundException", e);
}
} catch (InstantiationException e) {
if (log.isEnabledFor(Level.ERROR)) {
log.error("InstantiationException " + e.getMessage(), e);
}
} catch (IllegalAccessException e) {
if (log.isEnabledFor(Level.ERROR)) {
log.error("IllegalAccessException", e);
}
}
return object;
}
|
java
|
public static Object getClassForName(String className) {
Object object = null;
try {
Class classDefinition = Class.forName(className);
object = classDefinition.newInstance();
} catch (ClassNotFoundException e) {
if (log.isEnabledFor(Level.ERROR)) {
log.error("ClassNotFoundException", e);
}
} catch (InstantiationException e) {
if (log.isEnabledFor(Level.ERROR)) {
log.error("InstantiationException " + e.getMessage(), e);
}
} catch (IllegalAccessException e) {
if (log.isEnabledFor(Level.ERROR)) {
log.error("IllegalAccessException", e);
}
}
return object;
}
|
[
"public",
"static",
"Object",
"getClassForName",
"(",
"String",
"className",
")",
"{",
"Object",
"object",
"=",
"null",
";",
"try",
"{",
"Class",
"classDefinition",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
";",
"object",
"=",
"classDefinition",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"if",
"(",
"log",
".",
"isEnabledFor",
"(",
"Level",
".",
"ERROR",
")",
")",
"{",
"log",
".",
"error",
"(",
"\"ClassNotFoundException\"",
",",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"InstantiationException",
"e",
")",
"{",
"if",
"(",
"log",
".",
"isEnabledFor",
"(",
"Level",
".",
"ERROR",
")",
")",
"{",
"log",
".",
"error",
"(",
"\"InstantiationException \"",
"+",
"e",
".",
"getMessage",
"(",
")",
",",
"e",
")",
";",
"}",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"if",
"(",
"log",
".",
"isEnabledFor",
"(",
"Level",
".",
"ERROR",
")",
")",
"{",
"log",
".",
"error",
"(",
"\"IllegalAccessException\"",
",",
"e",
")",
";",
"}",
"}",
"return",
"object",
";",
"}"
] |
Returns object instance from the string representing its class name.
@param className className
@return Object instance
|
[
"Returns",
"object",
"instance",
"from",
"the",
"string",
"representing",
"its",
"class",
"name",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/utils/ClassFactory.java#L28-L47
|
147,665
|
opendatatrentino/s-match
|
src/main/java/it/unitn/disi/common/utils/ClassFactory.java
|
ClassFactory.getClassInstance
|
@SuppressWarnings("unchecked")
public static Object getClassInstance(String className,
Class[] attrTypes,
Object[] attrValues) throws DISIException {
Constructor constr;
try {
Class cl = Class.forName(className);
constr = cl.getConstructor(attrTypes);
} catch (ClassNotFoundException e) {
//yep, log and throw...
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
} catch (NoSuchMethodException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
}
Object classInst;
try {
classInst = constr.newInstance(attrValues);
} catch (InstantiationException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
} catch (IllegalAccessException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
} catch (InvocationTargetException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
}
return classInst;
}
|
java
|
@SuppressWarnings("unchecked")
public static Object getClassInstance(String className,
Class[] attrTypes,
Object[] attrValues) throws DISIException {
Constructor constr;
try {
Class cl = Class.forName(className);
constr = cl.getConstructor(attrTypes);
} catch (ClassNotFoundException e) {
//yep, log and throw...
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
} catch (NoSuchMethodException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
}
Object classInst;
try {
classInst = constr.newInstance(attrValues);
} catch (InstantiationException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
} catch (IllegalAccessException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
} catch (InvocationTargetException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new DISIException(errMessage, e);
}
return classInst;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Object",
"getClassInstance",
"(",
"String",
"className",
",",
"Class",
"[",
"]",
"attrTypes",
",",
"Object",
"[",
"]",
"attrValues",
")",
"throws",
"DISIException",
"{",
"Constructor",
"constr",
";",
"try",
"{",
"Class",
"cl",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
";",
"constr",
"=",
"cl",
".",
"getConstructor",
"(",
"attrTypes",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"//yep, log and throw...\r",
"final",
"String",
"errMessage",
"=",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\": \"",
"+",
"e",
".",
"getMessage",
"(",
")",
";",
"log",
".",
"error",
"(",
"errMessage",
",",
"e",
")",
";",
"throw",
"new",
"DISIException",
"(",
"errMessage",
",",
"e",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"final",
"String",
"errMessage",
"=",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\": \"",
"+",
"e",
".",
"getMessage",
"(",
")",
";",
"log",
".",
"error",
"(",
"errMessage",
",",
"e",
")",
";",
"throw",
"new",
"DISIException",
"(",
"errMessage",
",",
"e",
")",
";",
"}",
"Object",
"classInst",
";",
"try",
"{",
"classInst",
"=",
"constr",
".",
"newInstance",
"(",
"attrValues",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"e",
")",
"{",
"final",
"String",
"errMessage",
"=",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\": \"",
"+",
"e",
".",
"getMessage",
"(",
")",
";",
"log",
".",
"error",
"(",
"errMessage",
",",
"e",
")",
";",
"throw",
"new",
"DISIException",
"(",
"errMessage",
",",
"e",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"final",
"String",
"errMessage",
"=",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\": \"",
"+",
"e",
".",
"getMessage",
"(",
")",
";",
"log",
".",
"error",
"(",
"errMessage",
",",
"e",
")",
";",
"throw",
"new",
"DISIException",
"(",
"errMessage",
",",
"e",
")",
";",
"}",
"catch",
"(",
"InvocationTargetException",
"e",
")",
"{",
"final",
"String",
"errMessage",
"=",
"e",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\": \"",
"+",
"e",
".",
"getMessage",
"(",
")",
";",
"log",
".",
"error",
"(",
"errMessage",
",",
"e",
")",
";",
"throw",
"new",
"DISIException",
"(",
"errMessage",
",",
"e",
")",
";",
"}",
"return",
"classInst",
";",
"}"
] |
Creates an instance of the class whose name is passed as the parameter.
@param className name of the class those instance is to be created
@param attrTypes attrTypes
@param attrValues attrValues
@return instance of the class
@throws DISIException DISIException
|
[
"Creates",
"an",
"instance",
"of",
"the",
"class",
"whose",
"name",
"is",
"passed",
"as",
"the",
"parameter",
"."
] |
ba5982ef406b7010c2f92592e43887a485935aa1
|
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/utils/ClassFactory.java#L59-L97
|
147,666
|
kmi/iserve
|
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/RegistryManagerImpl.java
|
RegistryManagerImpl.getSupportedInputMediaTypes
|
@Override
public Set<String> getSupportedInputMediaTypes() {
ImmutableSet.Builder<String> result = ImmutableSet.builder();
result.addAll(MediaType.NATIVE_MEDIATYPE_SYNTAX_MAP.keySet());
result.addAll(this.serviceTransformationEngine.getSupportedMediaTypes());
return result.build();
}
|
java
|
@Override
public Set<String> getSupportedInputMediaTypes() {
ImmutableSet.Builder<String> result = ImmutableSet.builder();
result.addAll(MediaType.NATIVE_MEDIATYPE_SYNTAX_MAP.keySet());
result.addAll(this.serviceTransformationEngine.getSupportedMediaTypes());
return result.build();
}
|
[
"@",
"Override",
"public",
"Set",
"<",
"String",
">",
"getSupportedInputMediaTypes",
"(",
")",
"{",
"ImmutableSet",
".",
"Builder",
"<",
"String",
">",
"result",
"=",
"ImmutableSet",
".",
"builder",
"(",
")",
";",
"result",
".",
"addAll",
"(",
"MediaType",
".",
"NATIVE_MEDIATYPE_SYNTAX_MAP",
".",
"keySet",
"(",
")",
")",
";",
"result",
".",
"addAll",
"(",
"this",
".",
"serviceTransformationEngine",
".",
"getSupportedMediaTypes",
"(",
")",
")",
";",
"return",
"result",
".",
"build",
"(",
")",
";",
"}"
] |
Obtains the list of supported media types the engine can import
@return the Set of media types
|
[
"Obtains",
"the",
"list",
"of",
"supported",
"media",
"types",
"the",
"engine",
"can",
"import"
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/RegistryManagerImpl.java#L166-L172
|
147,667
|
kmi/iserve
|
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/RegistryManagerImpl.java
|
RegistryManagerImpl.canImport
|
@Override
public boolean canImport(String mediaType) {
return (MediaType.NATIVE_MEDIATYPE_SYNTAX_MAP.containsKey(mediaType) ||
this.serviceTransformationEngine.canTransform(mediaType));
}
|
java
|
@Override
public boolean canImport(String mediaType) {
return (MediaType.NATIVE_MEDIATYPE_SYNTAX_MAP.containsKey(mediaType) ||
this.serviceTransformationEngine.canTransform(mediaType));
}
|
[
"@",
"Override",
"public",
"boolean",
"canImport",
"(",
"String",
"mediaType",
")",
"{",
"return",
"(",
"MediaType",
".",
"NATIVE_MEDIATYPE_SYNTAX_MAP",
".",
"containsKey",
"(",
"mediaType",
")",
"||",
"this",
".",
"serviceTransformationEngine",
".",
"canTransform",
"(",
"mediaType",
")",
")",
";",
"}"
] |
Checks if the given media type can be imported
@param mediaType the media type we wish to check if it can be imported
@return true if it is supported or false otherwise.
|
[
"Checks",
"if",
"the",
"given",
"media",
"type",
"can",
"be",
"imported"
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/RegistryManagerImpl.java#L180-L184
|
147,668
|
kmi/iserve
|
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/RegistryManagerImpl.java
|
RegistryManagerImpl.getFilenameFilter
|
@Override
public FilenameFilter getFilenameFilter(String mediaType) {
if (mediaType == null) {
return null;
}
if (MediaType.NATIVE_MEDIATYPE_SYNTAX_MAP.containsKey(mediaType)) {
return new FilenameFilterBySyntax(MediaType.NATIVE_MEDIATYPE_SYNTAX_MAP.get(mediaType));
} else if (this.getServiceTransformationEngine().canTransform(mediaType)) {
return this.getServiceTransformationEngine().getFilenameFilter(mediaType);
}
return null;
}
|
java
|
@Override
public FilenameFilter getFilenameFilter(String mediaType) {
if (mediaType == null) {
return null;
}
if (MediaType.NATIVE_MEDIATYPE_SYNTAX_MAP.containsKey(mediaType)) {
return new FilenameFilterBySyntax(MediaType.NATIVE_MEDIATYPE_SYNTAX_MAP.get(mediaType));
} else if (this.getServiceTransformationEngine().canTransform(mediaType)) {
return this.getServiceTransformationEngine().getFilenameFilter(mediaType);
}
return null;
}
|
[
"@",
"Override",
"public",
"FilenameFilter",
"getFilenameFilter",
"(",
"String",
"mediaType",
")",
"{",
"if",
"(",
"mediaType",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"MediaType",
".",
"NATIVE_MEDIATYPE_SYNTAX_MAP",
".",
"containsKey",
"(",
"mediaType",
")",
")",
"{",
"return",
"new",
"FilenameFilterBySyntax",
"(",
"MediaType",
".",
"NATIVE_MEDIATYPE_SYNTAX_MAP",
".",
"get",
"(",
"mediaType",
")",
")",
";",
"}",
"else",
"if",
"(",
"this",
".",
"getServiceTransformationEngine",
"(",
")",
".",
"canTransform",
"(",
"mediaType",
")",
")",
"{",
"return",
"this",
".",
"getServiceTransformationEngine",
"(",
")",
".",
"getFilenameFilter",
"(",
"mediaType",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Gets the corresponding filename filter to a given media type by checking both native formats
and those supported through transformation
@param mediaType the media type for which to obtain the file extension
@return the filename filter or null if it is not supported. Callers are advised to check
first that the media type is supported @see canTransform .
|
[
"Gets",
"the",
"corresponding",
"filename",
"filter",
"to",
"a",
"given",
"media",
"type",
"by",
"checking",
"both",
"native",
"formats",
"and",
"those",
"supported",
"through",
"transformation"
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/RegistryManagerImpl.java#L194-L207
|
147,669
|
kmi/iserve
|
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/RegistryManagerImpl.java
|
RegistryManagerImpl.importServices
|
@Override
public List<URI> importServices(InputStream servicesContentStream,
String mediaType) throws SalException {
boolean isNativeFormat = MediaType.NATIVE_MEDIATYPE_SYNTAX_MAP.containsKey(mediaType);
// Throw error if Format Unsupported
if (!isNativeFormat && !this.serviceTransformationEngine.canTransform(mediaType)) {
log.error("The media type {} is not natively supported and has no suitable transformer.", mediaType);
throw new ServiceException("Unable to import service. Format unsupported.");
}
// Obtain the file extension to use
String fileExtension = findFileExtensionToUse(mediaType, isNativeFormat);
List<Service> services = null;
List<URI> importedServices = new ArrayList<URI>();
URI sourceDocUri = null;
InputStream localStream = null;
try {
// 1st Store the document
sourceDocUri = this.docManager.createDocument(servicesContentStream, fileExtension, mediaType);
if (sourceDocUri == null) {
throw new ServiceException("Unable to save service document. Operation aborted.");
}
// 2nd Parse and Transform the document
// The original stream may be a one-of stream so save it first and read locally
localStream = this.docManager.getDocument(sourceDocUri);
services = getServicesFromStream(mediaType, isNativeFormat, localStream);
// 3rd - Store the resulting MSM services. There may be more than one
URI serviceUri = null;
if (services != null && !services.isEmpty()) {
log.info("Importing {} services", services.size());
for (Service service : services) {
// The service is being imported -> update the source
service.setSource(sourceDocUri);
serviceUri = this.serviceManager.addService(service);
if (serviceUri != null) {
importedServices.add(serviceUri);
}
}
}
// 4th Log it was all done correctly
// TODO: log to the system and notify observers
log.info("Source document imported: {}", sourceDocUri.toASCIIString());
} finally {
// Rollback if something went wrong
if ((services == null || (services != null && services.size() != importedServices.size()))
&& sourceDocUri != null) {
this.docManager.deleteDocument(sourceDocUri);
for (URI svcUri : importedServices) {
this.serviceManager.deleteService(svcUri);
}
log.warn("There were problems importing the service. Changes undone.");
}
if (localStream != null)
try {
localStream.close();
} catch (IOException e) {
log.error("Error closing the service content stream", e);
}
}
return importedServices;
}
|
java
|
@Override
public List<URI> importServices(InputStream servicesContentStream,
String mediaType) throws SalException {
boolean isNativeFormat = MediaType.NATIVE_MEDIATYPE_SYNTAX_MAP.containsKey(mediaType);
// Throw error if Format Unsupported
if (!isNativeFormat && !this.serviceTransformationEngine.canTransform(mediaType)) {
log.error("The media type {} is not natively supported and has no suitable transformer.", mediaType);
throw new ServiceException("Unable to import service. Format unsupported.");
}
// Obtain the file extension to use
String fileExtension = findFileExtensionToUse(mediaType, isNativeFormat);
List<Service> services = null;
List<URI> importedServices = new ArrayList<URI>();
URI sourceDocUri = null;
InputStream localStream = null;
try {
// 1st Store the document
sourceDocUri = this.docManager.createDocument(servicesContentStream, fileExtension, mediaType);
if (sourceDocUri == null) {
throw new ServiceException("Unable to save service document. Operation aborted.");
}
// 2nd Parse and Transform the document
// The original stream may be a one-of stream so save it first and read locally
localStream = this.docManager.getDocument(sourceDocUri);
services = getServicesFromStream(mediaType, isNativeFormat, localStream);
// 3rd - Store the resulting MSM services. There may be more than one
URI serviceUri = null;
if (services != null && !services.isEmpty()) {
log.info("Importing {} services", services.size());
for (Service service : services) {
// The service is being imported -> update the source
service.setSource(sourceDocUri);
serviceUri = this.serviceManager.addService(service);
if (serviceUri != null) {
importedServices.add(serviceUri);
}
}
}
// 4th Log it was all done correctly
// TODO: log to the system and notify observers
log.info("Source document imported: {}", sourceDocUri.toASCIIString());
} finally {
// Rollback if something went wrong
if ((services == null || (services != null && services.size() != importedServices.size()))
&& sourceDocUri != null) {
this.docManager.deleteDocument(sourceDocUri);
for (URI svcUri : importedServices) {
this.serviceManager.deleteService(svcUri);
}
log.warn("There were problems importing the service. Changes undone.");
}
if (localStream != null)
try {
localStream.close();
} catch (IOException e) {
log.error("Error closing the service content stream", e);
}
}
return importedServices;
}
|
[
"@",
"Override",
"public",
"List",
"<",
"URI",
">",
"importServices",
"(",
"InputStream",
"servicesContentStream",
",",
"String",
"mediaType",
")",
"throws",
"SalException",
"{",
"boolean",
"isNativeFormat",
"=",
"MediaType",
".",
"NATIVE_MEDIATYPE_SYNTAX_MAP",
".",
"containsKey",
"(",
"mediaType",
")",
";",
"// Throw error if Format Unsupported",
"if",
"(",
"!",
"isNativeFormat",
"&&",
"!",
"this",
".",
"serviceTransformationEngine",
".",
"canTransform",
"(",
"mediaType",
")",
")",
"{",
"log",
".",
"error",
"(",
"\"The media type {} is not natively supported and has no suitable transformer.\"",
",",
"mediaType",
")",
";",
"throw",
"new",
"ServiceException",
"(",
"\"Unable to import service. Format unsupported.\"",
")",
";",
"}",
"// Obtain the file extension to use",
"String",
"fileExtension",
"=",
"findFileExtensionToUse",
"(",
"mediaType",
",",
"isNativeFormat",
")",
";",
"List",
"<",
"Service",
">",
"services",
"=",
"null",
";",
"List",
"<",
"URI",
">",
"importedServices",
"=",
"new",
"ArrayList",
"<",
"URI",
">",
"(",
")",
";",
"URI",
"sourceDocUri",
"=",
"null",
";",
"InputStream",
"localStream",
"=",
"null",
";",
"try",
"{",
"// 1st Store the document",
"sourceDocUri",
"=",
"this",
".",
"docManager",
".",
"createDocument",
"(",
"servicesContentStream",
",",
"fileExtension",
",",
"mediaType",
")",
";",
"if",
"(",
"sourceDocUri",
"==",
"null",
")",
"{",
"throw",
"new",
"ServiceException",
"(",
"\"Unable to save service document. Operation aborted.\"",
")",
";",
"}",
"// 2nd Parse and Transform the document",
"// The original stream may be a one-of stream so save it first and read locally",
"localStream",
"=",
"this",
".",
"docManager",
".",
"getDocument",
"(",
"sourceDocUri",
")",
";",
"services",
"=",
"getServicesFromStream",
"(",
"mediaType",
",",
"isNativeFormat",
",",
"localStream",
")",
";",
"// 3rd - Store the resulting MSM services. There may be more than one",
"URI",
"serviceUri",
"=",
"null",
";",
"if",
"(",
"services",
"!=",
"null",
"&&",
"!",
"services",
".",
"isEmpty",
"(",
")",
")",
"{",
"log",
".",
"info",
"(",
"\"Importing {} services\"",
",",
"services",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Service",
"service",
":",
"services",
")",
"{",
"// The service is being imported -> update the source",
"service",
".",
"setSource",
"(",
"sourceDocUri",
")",
";",
"serviceUri",
"=",
"this",
".",
"serviceManager",
".",
"addService",
"(",
"service",
")",
";",
"if",
"(",
"serviceUri",
"!=",
"null",
")",
"{",
"importedServices",
".",
"add",
"(",
"serviceUri",
")",
";",
"}",
"}",
"}",
"// 4th Log it was all done correctly",
"// TODO: log to the system and notify observers",
"log",
".",
"info",
"(",
"\"Source document imported: {}\"",
",",
"sourceDocUri",
".",
"toASCIIString",
"(",
")",
")",
";",
"}",
"finally",
"{",
"// Rollback if something went wrong",
"if",
"(",
"(",
"services",
"==",
"null",
"||",
"(",
"services",
"!=",
"null",
"&&",
"services",
".",
"size",
"(",
")",
"!=",
"importedServices",
".",
"size",
"(",
")",
")",
")",
"&&",
"sourceDocUri",
"!=",
"null",
")",
"{",
"this",
".",
"docManager",
".",
"deleteDocument",
"(",
"sourceDocUri",
")",
";",
"for",
"(",
"URI",
"svcUri",
":",
"importedServices",
")",
"{",
"this",
".",
"serviceManager",
".",
"deleteService",
"(",
"svcUri",
")",
";",
"}",
"log",
".",
"warn",
"(",
"\"There were problems importing the service. Changes undone.\"",
")",
";",
"}",
"if",
"(",
"localStream",
"!=",
"null",
")",
"try",
"{",
"localStream",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"Error closing the service content stream\"",
",",
"e",
")",
";",
"}",
"}",
"return",
"importedServices",
";",
"}"
] |
Imports a new service within iServe. The original document is stored
in the server and the transformed version registered within iServe.
@param servicesContentStream
@param mediaType
@return the List of URIs of the services imported
@throws SalException
|
[
"Imports",
"a",
"new",
"service",
"within",
"iServe",
".",
"The",
"original",
"document",
"is",
"stored",
"in",
"the",
"server",
"and",
"the",
"transformed",
"version",
"registered",
"within",
"iServe",
"."
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/RegistryManagerImpl.java#L218-L286
|
147,670
|
kmi/iserve
|
iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/RegistryManagerImpl.java
|
RegistryManagerImpl.unregisterService
|
@Override
public boolean unregisterService(URI serviceUri) throws SalException {
// Check the URI is correct and belongs to the server
if (serviceUri == null ||
!UriUtil.isResourceLocalToServer(serviceUri, this.getIserveUri())) {
return false;
}
if (this.serviceManager.deleteService(serviceUri)) {
// delete documents
Set<URI> docs = this.serviceManager.listDocumentsForService(serviceUri);
for (URI doc : docs) {
this.docManager.deleteDocument(doc);
}
// Some documents may not have been deleted properly. TODO: handle properly this case
return true;
}
return false;
}
|
java
|
@Override
public boolean unregisterService(URI serviceUri) throws SalException {
// Check the URI is correct and belongs to the server
if (serviceUri == null ||
!UriUtil.isResourceLocalToServer(serviceUri, this.getIserveUri())) {
return false;
}
if (this.serviceManager.deleteService(serviceUri)) {
// delete documents
Set<URI> docs = this.serviceManager.listDocumentsForService(serviceUri);
for (URI doc : docs) {
this.docManager.deleteDocument(doc);
}
// Some documents may not have been deleted properly. TODO: handle properly this case
return true;
}
return false;
}
|
[
"@",
"Override",
"public",
"boolean",
"unregisterService",
"(",
"URI",
"serviceUri",
")",
"throws",
"SalException",
"{",
"// Check the URI is correct and belongs to the server",
"if",
"(",
"serviceUri",
"==",
"null",
"||",
"!",
"UriUtil",
".",
"isResourceLocalToServer",
"(",
"serviceUri",
",",
"this",
".",
"getIserveUri",
"(",
")",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"serviceManager",
".",
"deleteService",
"(",
"serviceUri",
")",
")",
"{",
"// delete documents",
"Set",
"<",
"URI",
">",
"docs",
"=",
"this",
".",
"serviceManager",
".",
"listDocumentsForService",
"(",
"serviceUri",
")",
";",
"for",
"(",
"URI",
"doc",
":",
"docs",
")",
"{",
"this",
".",
"docManager",
".",
"deleteDocument",
"(",
"doc",
")",
";",
"}",
"// Some documents may not have been deleted properly. TODO: handle properly this case",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Unregisters a service from the registry. Effectively this will delete the service description and remove any
related documents on the server.
@param serviceUri the URI of the service to unregister
@return true if it was properly unregistered, false otherwise.
@throws SalException
|
[
"Unregisters",
"a",
"service",
"from",
"the",
"registry",
".",
"Effectively",
"this",
"will",
"delete",
"the",
"service",
"description",
"and",
"remove",
"any",
"related",
"documents",
"on",
"the",
"server",
"."
] |
13e7016e64c1d5a539b838c6debf1a5cc4aefcb7
|
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-sal-core/src/main/java/uk/ac/open/kmi/iserve/sal/manager/impl/RegistryManagerImpl.java#L556-L576
|
147,671
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/ExtensionRegistry.java
|
ExtensionRegistry.add
|
public void add(final GeneratedMessage.GeneratedExtension<?, ?> extension) {
if (extension.getDescriptor().getJavaType() ==
FieldDescriptor.JavaType.MESSAGE) {
if (extension.getMessageDefaultInstance() == null) {
throw new IllegalStateException(
"Registered message-type extension had null default instance: " +
extension.getDescriptor().getFullName());
}
add(new ExtensionInfo(extension.getDescriptor(),
extension.getMessageDefaultInstance()));
} else {
add(new ExtensionInfo(extension.getDescriptor(), null));
}
}
|
java
|
public void add(final GeneratedMessage.GeneratedExtension<?, ?> extension) {
if (extension.getDescriptor().getJavaType() ==
FieldDescriptor.JavaType.MESSAGE) {
if (extension.getMessageDefaultInstance() == null) {
throw new IllegalStateException(
"Registered message-type extension had null default instance: " +
extension.getDescriptor().getFullName());
}
add(new ExtensionInfo(extension.getDescriptor(),
extension.getMessageDefaultInstance()));
} else {
add(new ExtensionInfo(extension.getDescriptor(), null));
}
}
|
[
"public",
"void",
"add",
"(",
"final",
"GeneratedMessage",
".",
"GeneratedExtension",
"<",
"?",
",",
"?",
">",
"extension",
")",
"{",
"if",
"(",
"extension",
".",
"getDescriptor",
"(",
")",
".",
"getJavaType",
"(",
")",
"==",
"FieldDescriptor",
".",
"JavaType",
".",
"MESSAGE",
")",
"{",
"if",
"(",
"extension",
".",
"getMessageDefaultInstance",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Registered message-type extension had null default instance: \"",
"+",
"extension",
".",
"getDescriptor",
"(",
")",
".",
"getFullName",
"(",
")",
")",
";",
"}",
"add",
"(",
"new",
"ExtensionInfo",
"(",
"extension",
".",
"getDescriptor",
"(",
")",
",",
"extension",
".",
"getMessageDefaultInstance",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"add",
"(",
"new",
"ExtensionInfo",
"(",
"extension",
".",
"getDescriptor",
"(",
")",
",",
"null",
")",
")",
";",
"}",
"}"
] |
Add an extension from a generated file to the registry.
|
[
"Add",
"an",
"extension",
"from",
"a",
"generated",
"file",
"to",
"the",
"registry",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/ExtensionRegistry.java#L157-L170
|
147,672
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/ExtensionRegistry.java
|
ExtensionRegistry.add
|
public void add(final FieldDescriptor type) {
if (type.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
throw new IllegalArgumentException(
"ExtensionRegistry.add() must be provided a default instance when " +
"adding an embedded message extension.");
}
add(new ExtensionInfo(type, null));
}
|
java
|
public void add(final FieldDescriptor type) {
if (type.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
throw new IllegalArgumentException(
"ExtensionRegistry.add() must be provided a default instance when " +
"adding an embedded message extension.");
}
add(new ExtensionInfo(type, null));
}
|
[
"public",
"void",
"add",
"(",
"final",
"FieldDescriptor",
"type",
")",
"{",
"if",
"(",
"type",
".",
"getJavaType",
"(",
")",
"==",
"FieldDescriptor",
".",
"JavaType",
".",
"MESSAGE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"ExtensionRegistry.add() must be provided a default instance when \"",
"+",
"\"adding an embedded message extension.\"",
")",
";",
"}",
"add",
"(",
"new",
"ExtensionInfo",
"(",
"type",
",",
"null",
")",
")",
";",
"}"
] |
Add a non-message-type extension to the registry by descriptor.
|
[
"Add",
"a",
"non",
"-",
"message",
"-",
"type",
"extension",
"to",
"the",
"registry",
"by",
"descriptor",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/ExtensionRegistry.java#L173-L180
|
147,673
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/ExtensionRegistry.java
|
ExtensionRegistry.add
|
public void add(final FieldDescriptor type, final Message defaultInstance) {
if (type.getJavaType() != FieldDescriptor.JavaType.MESSAGE) {
throw new IllegalArgumentException(
"ExtensionRegistry.add() provided a default instance for a " +
"non-message extension.");
}
add(new ExtensionInfo(type, defaultInstance));
}
|
java
|
public void add(final FieldDescriptor type, final Message defaultInstance) {
if (type.getJavaType() != FieldDescriptor.JavaType.MESSAGE) {
throw new IllegalArgumentException(
"ExtensionRegistry.add() provided a default instance for a " +
"non-message extension.");
}
add(new ExtensionInfo(type, defaultInstance));
}
|
[
"public",
"void",
"add",
"(",
"final",
"FieldDescriptor",
"type",
",",
"final",
"Message",
"defaultInstance",
")",
"{",
"if",
"(",
"type",
".",
"getJavaType",
"(",
")",
"!=",
"FieldDescriptor",
".",
"JavaType",
".",
"MESSAGE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"ExtensionRegistry.add() provided a default instance for a \"",
"+",
"\"non-message extension.\"",
")",
";",
"}",
"add",
"(",
"new",
"ExtensionInfo",
"(",
"type",
",",
"defaultInstance",
")",
")",
";",
"}"
] |
Add a message-type extension to the registry by descriptor.
|
[
"Add",
"a",
"message",
"-",
"type",
"extension",
"to",
"the",
"registry",
"by",
"descriptor",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/ExtensionRegistry.java#L183-L190
|
147,674
|
pulse00/Composer-Java-Bindings
|
java-api/src/main/java/com/dubture/getcomposer/core/collection/Versions.java
|
Versions.getMinors
|
public String[] getMinors(String major) {
prepareDetailedVersions();
if (majors.containsKey(major)) {
return majors.get(major).toArray(new String[]{});
}
return null;
}
|
java
|
public String[] getMinors(String major) {
prepareDetailedVersions();
if (majors.containsKey(major)) {
return majors.get(major).toArray(new String[]{});
}
return null;
}
|
[
"public",
"String",
"[",
"]",
"getMinors",
"(",
"String",
"major",
")",
"{",
"prepareDetailedVersions",
"(",
")",
";",
"if",
"(",
"majors",
".",
"containsKey",
"(",
"major",
")",
")",
"{",
"return",
"majors",
".",
"get",
"(",
"major",
")",
".",
"toArray",
"(",
"new",
"String",
"[",
"]",
"{",
"}",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns all minor versions for the given major version or null
if major version does not exist.
@param major
@return
|
[
"Returns",
"all",
"minor",
"versions",
"for",
"the",
"given",
"major",
"version",
"or",
"null",
"if",
"major",
"version",
"does",
"not",
"exist",
"."
] |
0aa572567db37d047a41a57c32ede7c7fd5d4938
|
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/collection/Versions.java#L136-L144
|
147,675
|
pulse00/Composer-Java-Bindings
|
java-api/src/main/java/com/dubture/getcomposer/core/collection/Versions.java
|
Versions.getRecentMinor
|
public String getRecentMinor(String major) {
if (major == null) {
return null;
}
prepareDetailedVersions();
if (majors.containsKey(major) && majors.get(major).size() > 0) {
return majors.get(major).get(0);
}
return null;
}
|
java
|
public String getRecentMinor(String major) {
if (major == null) {
return null;
}
prepareDetailedVersions();
if (majors.containsKey(major) && majors.get(major).size() > 0) {
return majors.get(major).get(0);
}
return null;
}
|
[
"public",
"String",
"getRecentMinor",
"(",
"String",
"major",
")",
"{",
"if",
"(",
"major",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"prepareDetailedVersions",
"(",
")",
";",
"if",
"(",
"majors",
".",
"containsKey",
"(",
"major",
")",
"&&",
"majors",
".",
"get",
"(",
"major",
")",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"return",
"majors",
".",
"get",
"(",
"major",
")",
".",
"get",
"(",
"0",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the recent minor version for the given major version or null
if neither major version or no minor version exists.
@param major
@return
|
[
"Returns",
"the",
"recent",
"minor",
"version",
"for",
"the",
"given",
"major",
"version",
"or",
"null",
"if",
"neither",
"major",
"version",
"or",
"no",
"minor",
"version",
"exists",
"."
] |
0aa572567db37d047a41a57c32ede7c7fd5d4938
|
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/collection/Versions.java#L153-L164
|
147,676
|
pulse00/Composer-Java-Bindings
|
java-api/src/main/java/com/dubture/getcomposer/core/collection/Versions.java
|
Versions.getDetailedVersion
|
public Version getDetailedVersion(String version) {
prepareDetailedVersions();
if (detailedVersions.containsKey(version)) {
return detailedVersions.get(version);
}
return null;
}
|
java
|
public Version getDetailedVersion(String version) {
prepareDetailedVersions();
if (detailedVersions.containsKey(version)) {
return detailedVersions.get(version);
}
return null;
}
|
[
"public",
"Version",
"getDetailedVersion",
"(",
"String",
"version",
")",
"{",
"prepareDetailedVersions",
"(",
")",
";",
"if",
"(",
"detailedVersions",
".",
"containsKey",
"(",
"version",
")",
")",
"{",
"return",
"detailedVersions",
".",
"get",
"(",
"version",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns the detailed version for a given string version or null
if the version doesn't exist in this version collection
@param version
@return
|
[
"Returns",
"the",
"detailed",
"version",
"for",
"a",
"given",
"string",
"version",
"or",
"null",
"if",
"the",
"version",
"doesn",
"t",
"exist",
"in",
"this",
"version",
"collection"
] |
0aa572567db37d047a41a57c32ede7c7fd5d4938
|
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/collection/Versions.java#L211-L219
|
147,677
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/RepeatedFieldBuilder.java
|
RepeatedFieldBuilder.getMessageOrBuilder
|
@SuppressWarnings("unchecked")
public IType getMessageOrBuilder(int index) {
if (this.builders == null) {
// We don't have any builders -- return the current Message.
// This is the case where no builder was created, so we MUST have a
// Message.
return (IType) messages.get(index);
}
SingleFieldBuilder<MType, BType, IType> builder = builders.get(index);
if (builder == null) {
// We don't have a builder -- return the current message.
// This is the case where no builder was created for the entry at index,
// so we MUST have a message.
return (IType) messages.get(index);
} else {
return builder.getMessageOrBuilder();
}
}
|
java
|
@SuppressWarnings("unchecked")
public IType getMessageOrBuilder(int index) {
if (this.builders == null) {
// We don't have any builders -- return the current Message.
// This is the case where no builder was created, so we MUST have a
// Message.
return (IType) messages.get(index);
}
SingleFieldBuilder<MType, BType, IType> builder = builders.get(index);
if (builder == null) {
// We don't have a builder -- return the current message.
// This is the case where no builder was created for the entry at index,
// so we MUST have a message.
return (IType) messages.get(index);
} else {
return builder.getMessageOrBuilder();
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"IType",
"getMessageOrBuilder",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"this",
".",
"builders",
"==",
"null",
")",
"{",
"// We don't have any builders -- return the current Message.",
"// This is the case where no builder was created, so we MUST have a",
"// Message.",
"return",
"(",
"IType",
")",
"messages",
".",
"get",
"(",
"index",
")",
";",
"}",
"SingleFieldBuilder",
"<",
"MType",
",",
"BType",
",",
"IType",
">",
"builder",
"=",
"builders",
".",
"get",
"(",
"index",
")",
";",
"if",
"(",
"builder",
"==",
"null",
")",
"{",
"// We don't have a builder -- return the current message.",
"// This is the case where no builder was created for the entry at index,",
"// so we MUST have a message.",
"return",
"(",
"IType",
")",
"messages",
".",
"get",
"(",
"index",
")",
";",
"}",
"else",
"{",
"return",
"builder",
".",
"getMessageOrBuilder",
"(",
")",
";",
"}",
"}"
] |
Gets the base class interface for the specified index. This may either be
a builder or a message. It will return whatever is more efficient.
@param index the index of the message to get
@return the message or builder for the index as the base class interface
|
[
"Gets",
"the",
"base",
"class",
"interface",
"for",
"the",
"specified",
"index",
".",
"This",
"may",
"either",
"be",
"a",
"builder",
"or",
"a",
"message",
".",
"It",
"will",
"return",
"whatever",
"is",
"more",
"efficient",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/RepeatedFieldBuilder.java#L262-L281
|
147,678
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/RepeatedFieldBuilder.java
|
RepeatedFieldBuilder.setMessage
|
public RepeatedFieldBuilder<MType, BType, IType> setMessage(
int index, MType message) {
if (message == null) {
throw new NullPointerException();
}
ensureMutableMessageList();
messages.set(index, message);
if (builders != null) {
SingleFieldBuilder<MType, BType, IType> entry =
builders.set(index, null);
if (entry != null) {
entry.dispose();
}
}
onChanged();
incrementModCounts();
return this;
}
|
java
|
public RepeatedFieldBuilder<MType, BType, IType> setMessage(
int index, MType message) {
if (message == null) {
throw new NullPointerException();
}
ensureMutableMessageList();
messages.set(index, message);
if (builders != null) {
SingleFieldBuilder<MType, BType, IType> entry =
builders.set(index, null);
if (entry != null) {
entry.dispose();
}
}
onChanged();
incrementModCounts();
return this;
}
|
[
"public",
"RepeatedFieldBuilder",
"<",
"MType",
",",
"BType",
",",
"IType",
">",
"setMessage",
"(",
"int",
"index",
",",
"MType",
"message",
")",
"{",
"if",
"(",
"message",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"ensureMutableMessageList",
"(",
")",
";",
"messages",
".",
"set",
"(",
"index",
",",
"message",
")",
";",
"if",
"(",
"builders",
"!=",
"null",
")",
"{",
"SingleFieldBuilder",
"<",
"MType",
",",
"BType",
",",
"IType",
">",
"entry",
"=",
"builders",
".",
"set",
"(",
"index",
",",
"null",
")",
";",
"if",
"(",
"entry",
"!=",
"null",
")",
"{",
"entry",
".",
"dispose",
"(",
")",
";",
"}",
"}",
"onChanged",
"(",
")",
";",
"incrementModCounts",
"(",
")",
";",
"return",
"this",
";",
"}"
] |
Sets a message at the specified index replacing the existing item at
that index.
@param index the index to set.
@param message the message to set
@return the builder
|
[
"Sets",
"a",
"message",
"at",
"the",
"specified",
"index",
"replacing",
"the",
"existing",
"item",
"at",
"that",
"index",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/RepeatedFieldBuilder.java#L291-L308
|
147,679
|
udoprog/ffwd-client-java
|
src/main/java/com/google/protobuf250/RepeatedFieldBuilder.java
|
RepeatedFieldBuilder.build
|
public List<MType> build() {
// Now that build has been called, we are required to dispatch
// invalidations.
isClean = true;
if (!isMessagesListMutable && builders == null) {
// We still have an immutable list and we never created a builder.
return messages;
}
boolean allMessagesInSync = true;
if (!isMessagesListMutable) {
// We still have an immutable list. Let's see if any of them are out
// of sync with their builders.
for (int i = 0; i < messages.size(); i++) {
Message message = messages.get(i);
SingleFieldBuilder<MType, BType, IType> builder = builders.get(i);
if (builder != null) {
if (builder.build() != message) {
allMessagesInSync = false;
break;
}
}
}
if (allMessagesInSync) {
// Immutable list is still in sync.
return messages;
}
}
// Need to make sure messages is up to date
ensureMutableMessageList();
for (int i = 0; i < messages.size(); i++) {
messages.set(i, getMessage(i, true));
}
// We're going to return our list as immutable so we mark that we can
// no longer update it.
messages = Collections.unmodifiableList(messages);
isMessagesListMutable = false;
return messages;
}
|
java
|
public List<MType> build() {
// Now that build has been called, we are required to dispatch
// invalidations.
isClean = true;
if (!isMessagesListMutable && builders == null) {
// We still have an immutable list and we never created a builder.
return messages;
}
boolean allMessagesInSync = true;
if (!isMessagesListMutable) {
// We still have an immutable list. Let's see if any of them are out
// of sync with their builders.
for (int i = 0; i < messages.size(); i++) {
Message message = messages.get(i);
SingleFieldBuilder<MType, BType, IType> builder = builders.get(i);
if (builder != null) {
if (builder.build() != message) {
allMessagesInSync = false;
break;
}
}
}
if (allMessagesInSync) {
// Immutable list is still in sync.
return messages;
}
}
// Need to make sure messages is up to date
ensureMutableMessageList();
for (int i = 0; i < messages.size(); i++) {
messages.set(i, getMessage(i, true));
}
// We're going to return our list as immutable so we mark that we can
// no longer update it.
messages = Collections.unmodifiableList(messages);
isMessagesListMutable = false;
return messages;
}
|
[
"public",
"List",
"<",
"MType",
">",
"build",
"(",
")",
"{",
"// Now that build has been called, we are required to dispatch",
"// invalidations.",
"isClean",
"=",
"true",
";",
"if",
"(",
"!",
"isMessagesListMutable",
"&&",
"builders",
"==",
"null",
")",
"{",
"// We still have an immutable list and we never created a builder.",
"return",
"messages",
";",
"}",
"boolean",
"allMessagesInSync",
"=",
"true",
";",
"if",
"(",
"!",
"isMessagesListMutable",
")",
"{",
"// We still have an immutable list. Let's see if any of them are out",
"// of sync with their builders.",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"messages",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"Message",
"message",
"=",
"messages",
".",
"get",
"(",
"i",
")",
";",
"SingleFieldBuilder",
"<",
"MType",
",",
"BType",
",",
"IType",
">",
"builder",
"=",
"builders",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"builder",
"!=",
"null",
")",
"{",
"if",
"(",
"builder",
".",
"build",
"(",
")",
"!=",
"message",
")",
"{",
"allMessagesInSync",
"=",
"false",
";",
"break",
";",
"}",
"}",
"}",
"if",
"(",
"allMessagesInSync",
")",
"{",
"// Immutable list is still in sync.",
"return",
"messages",
";",
"}",
"}",
"// Need to make sure messages is up to date",
"ensureMutableMessageList",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"messages",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"messages",
".",
"set",
"(",
"i",
",",
"getMessage",
"(",
"i",
",",
"true",
")",
")",
";",
"}",
"// We're going to return our list as immutable so we mark that we can",
"// no longer update it.",
"messages",
"=",
"Collections",
".",
"unmodifiableList",
"(",
"messages",
")",
";",
"isMessagesListMutable",
"=",
"false",
";",
"return",
"messages",
";",
"}"
] |
Builds the list of messages from the builder and returns them.
@return an immutable list of messages
|
[
"Builds",
"the",
"list",
"of",
"messages",
"from",
"the",
"builder",
"and",
"returns",
"them",
"."
] |
b4161d2b138e3edb8fa9420cc3cc653d5764cf5b
|
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/com/google/protobuf250/RepeatedFieldBuilder.java#L478-L519
|
147,680
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/util/Separator.java
|
Separator.trim
|
public Separator trim(LineFormat.Trim trim) {
return new Separator(separator, pattern, trim, skipEmpty, forNull, skipNull);
}
|
java
|
public Separator trim(LineFormat.Trim trim) {
return new Separator(separator, pattern, trim, skipEmpty, forNull, skipNull);
}
|
[
"public",
"Separator",
"trim",
"(",
"LineFormat",
".",
"Trim",
"trim",
")",
"{",
"return",
"new",
"Separator",
"(",
"separator",
",",
"pattern",
",",
"trim",
",",
"skipEmpty",
",",
"forNull",
",",
"skipNull",
")",
";",
"}"
] |
Trim elements before joining or after splitting
|
[
"Trim",
"elements",
"before",
"joining",
"or",
"after",
"splitting"
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/util/Separator.java#L104-L106
|
147,681
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/beans/editor/CalendarStringPropertyEditor.java
|
CalendarStringPropertyEditor.getValue
|
@Override
public Object getValue() {
Date d = Calendar.getInstance().getTime();
try {
d = DEFAULT_DATE_FORMAT.parse(((JTextField) editor).getText());
} catch (ParseException ex) {
Logger.getLogger(CalendarStringPropertyEditor.class.getName()).log(Level.SEVERE, null, ex);
}
Calendar c = Calendar.getInstance();
c.setTime(d);
return c;
}
|
java
|
@Override
public Object getValue() {
Date d = Calendar.getInstance().getTime();
try {
d = DEFAULT_DATE_FORMAT.parse(((JTextField) editor).getText());
} catch (ParseException ex) {
Logger.getLogger(CalendarStringPropertyEditor.class.getName()).log(Level.SEVERE, null, ex);
}
Calendar c = Calendar.getInstance();
c.setTime(d);
return c;
}
|
[
"@",
"Override",
"public",
"Object",
"getValue",
"(",
")",
"{",
"Date",
"d",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
".",
"getTime",
"(",
")",
";",
"try",
"{",
"d",
"=",
"DEFAULT_DATE_FORMAT",
".",
"parse",
"(",
"(",
"(",
"JTextField",
")",
"editor",
")",
".",
"getText",
"(",
")",
")",
";",
"}",
"catch",
"(",
"ParseException",
"ex",
")",
"{",
"Logger",
".",
"getLogger",
"(",
"CalendarStringPropertyEditor",
".",
"class",
".",
"getName",
"(",
")",
")",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"null",
",",
"ex",
")",
";",
"}",
"Calendar",
"c",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"c",
".",
"setTime",
"(",
"d",
")",
";",
"return",
"c",
";",
"}"
] |
Returns the Date of the Calendar.
@return the date choosed as a <b>java.util.Date </b>b> object or null is
the date is not set
|
[
"Returns",
"the",
"Date",
"of",
"the",
"Calendar",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/beans/editor/CalendarStringPropertyEditor.java#L64-L75
|
147,682
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/beans/editor/CalendarStringPropertyEditor.java
|
CalendarStringPropertyEditor.setValue
|
@Override
public void setValue(Object value) {
if (value != null) {
Calendar c = (Calendar) value;
((JTextField) editor).setText(DEFAULT_DATE_FORMAT.format(c.getTime()));
}
}
|
java
|
@Override
public void setValue(Object value) {
if (value != null) {
Calendar c = (Calendar) value;
((JTextField) editor).setText(DEFAULT_DATE_FORMAT.format(c.getTime()));
}
}
|
[
"@",
"Override",
"public",
"void",
"setValue",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"Calendar",
"c",
"=",
"(",
"Calendar",
")",
"value",
";",
"(",
"(",
"JTextField",
")",
"editor",
")",
".",
"setText",
"(",
"DEFAULT_DATE_FORMAT",
".",
"format",
"(",
"c",
".",
"getTime",
"(",
")",
")",
")",
";",
"}",
"}"
] |
Sets the Date of the Calendar.
@param value the Date object
|
[
"Sets",
"the",
"Date",
"of",
"the",
"Calendar",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/beans/editor/CalendarStringPropertyEditor.java#L82-L88
|
147,683
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/beans/editor/CalendarStringPropertyEditor.java
|
CalendarStringPropertyEditor.getAsText
|
@Override
public String getAsText() {
Calendar localDate = (Calendar) getValue();
String s = DEFAULT_DATE_FORMAT.format(localDate.getTime());
LOGGER.log(Level.WARNING, "getAsText(): {0}", s);
return s;
}
|
java
|
@Override
public String getAsText() {
Calendar localDate = (Calendar) getValue();
String s = DEFAULT_DATE_FORMAT.format(localDate.getTime());
LOGGER.log(Level.WARNING, "getAsText(): {0}", s);
return s;
}
|
[
"@",
"Override",
"public",
"String",
"getAsText",
"(",
")",
"{",
"Calendar",
"localDate",
"=",
"(",
"Calendar",
")",
"getValue",
"(",
")",
";",
"String",
"s",
"=",
"DEFAULT_DATE_FORMAT",
".",
"format",
"(",
"localDate",
".",
"getTime",
"(",
")",
")",
";",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"WARNING",
",",
"\"getAsText(): {0}\"",
",",
"s",
")",
";",
"return",
"s",
";",
"}"
] |
Returns the Date formated with the locale and formatString set.
@return the choosen Date as String
|
[
"Returns",
"the",
"Date",
"formated",
"with",
"the",
"locale",
"and",
"formatString",
"set",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/beans/editor/CalendarStringPropertyEditor.java#L95-L102
|
147,684
|
ykrasik/jaci
|
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/param/BooleanCliParam.java
|
BooleanCliParam.optional
|
public static BooleanCliParam optional(Identifier identifier, boolean defaultValue, boolean nullable) {
return new BooleanCliParam(identifier, Opt.of(MoreSuppliers.of(defaultValue)), nullable);
}
|
java
|
public static BooleanCliParam optional(Identifier identifier, boolean defaultValue, boolean nullable) {
return new BooleanCliParam(identifier, Opt.of(MoreSuppliers.of(defaultValue)), nullable);
}
|
[
"public",
"static",
"BooleanCliParam",
"optional",
"(",
"Identifier",
"identifier",
",",
"boolean",
"defaultValue",
",",
"boolean",
"nullable",
")",
"{",
"return",
"new",
"BooleanCliParam",
"(",
"identifier",
",",
"Opt",
".",
"of",
"(",
"MoreSuppliers",
".",
"of",
"(",
"defaultValue",
")",
")",
",",
"nullable",
")",
";",
"}"
] |
Construct an optional CLI boolean parameter with the given default value.
@param identifier Parameter identifier.
@param defaultValue Default value to be used by the parameter if it isn't explicitly bound.
@param nullable Whether the parameter is nullable.
@return A CLI boolean parameter constructed from the given parameters.
|
[
"Construct",
"an",
"optional",
"CLI",
"boolean",
"parameter",
"with",
"the",
"given",
"default",
"value",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/param/BooleanCliParam.java#L103-L105
|
147,685
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/World.java
|
World.locateClasspathEntry
|
public FileNode locateClasspathEntry(Class<?> c) {
return locateEntry(c, Reflect.resourceName(c), false);
}
|
java
|
public FileNode locateClasspathEntry(Class<?> c) {
return locateEntry(c, Reflect.resourceName(c), false);
}
|
[
"public",
"FileNode",
"locateClasspathEntry",
"(",
"Class",
"<",
"?",
">",
"c",
")",
"{",
"return",
"locateEntry",
"(",
"c",
",",
"Reflect",
".",
"resourceName",
"(",
"c",
")",
",",
"false",
")",
";",
"}"
] |
Returns the file or directory containing the specified class. Does not search modules
@param c the source class
@return the physical file defining the class
|
[
"Returns",
"the",
"file",
"or",
"directory",
"containing",
"the",
"specified",
"class",
".",
"Does",
"not",
"search",
"modules"
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/World.java#L539-L541
|
147,686
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/World.java
|
World.locatePathEntry
|
public FileNode locatePathEntry(Class<?> c) {
return locateEntry(c, Reflect.resourceName(c), true);
}
|
java
|
public FileNode locatePathEntry(Class<?> c) {
return locateEntry(c, Reflect.resourceName(c), true);
}
|
[
"public",
"FileNode",
"locatePathEntry",
"(",
"Class",
"<",
"?",
">",
"c",
")",
"{",
"return",
"locateEntry",
"(",
"c",
",",
"Reflect",
".",
"resourceName",
"(",
"c",
")",
",",
"true",
")",
";",
"}"
] |
Returns the file or directory or module containing the specified class.
@param c the source class
@return the physical file defining the class
|
[
"Returns",
"the",
"file",
"or",
"directory",
"or",
"module",
"containing",
"the",
"specified",
"class",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/World.java#L550-L552
|
147,687
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/ssh/SshNode.java
|
SshNode.copyFileTo
|
@Override
public long copyFileTo(OutputStream dest, long skip) throws FileNotFoundException, CopyFileToException {
ChannelSftp sftp;
Progress monitor;
try {
sftp = alloc();
monitor = new Progress();
try {
sftp.get(escape(slashPath), dest, monitor, ChannelSftp.RESUME, skip);
} finally {
free(sftp);
}
return Math.max(0, monitor.sum - skip);
} catch (SftpException e) {
if (e.id == 2 || e.id == 4) {
throw new FileNotFoundException(this);
}
throw new CopyFileToException(this, e);
} catch (JSchException e) {
throw new CopyFileToException(this, e);
}
}
|
java
|
@Override
public long copyFileTo(OutputStream dest, long skip) throws FileNotFoundException, CopyFileToException {
ChannelSftp sftp;
Progress monitor;
try {
sftp = alloc();
monitor = new Progress();
try {
sftp.get(escape(slashPath), dest, monitor, ChannelSftp.RESUME, skip);
} finally {
free(sftp);
}
return Math.max(0, monitor.sum - skip);
} catch (SftpException e) {
if (e.id == 2 || e.id == 4) {
throw new FileNotFoundException(this);
}
throw new CopyFileToException(this, e);
} catch (JSchException e) {
throw new CopyFileToException(this, e);
}
}
|
[
"@",
"Override",
"public",
"long",
"copyFileTo",
"(",
"OutputStream",
"dest",
",",
"long",
"skip",
")",
"throws",
"FileNotFoundException",
",",
"CopyFileToException",
"{",
"ChannelSftp",
"sftp",
";",
"Progress",
"monitor",
";",
"try",
"{",
"sftp",
"=",
"alloc",
"(",
")",
";",
"monitor",
"=",
"new",
"Progress",
"(",
")",
";",
"try",
"{",
"sftp",
".",
"get",
"(",
"escape",
"(",
"slashPath",
")",
",",
"dest",
",",
"monitor",
",",
"ChannelSftp",
".",
"RESUME",
",",
"skip",
")",
";",
"}",
"finally",
"{",
"free",
"(",
"sftp",
")",
";",
"}",
"return",
"Math",
".",
"max",
"(",
"0",
",",
"monitor",
".",
"sum",
"-",
"skip",
")",
";",
"}",
"catch",
"(",
"SftpException",
"e",
")",
"{",
"if",
"(",
"e",
".",
"id",
"==",
"2",
"||",
"e",
".",
"id",
"==",
"4",
")",
"{",
"throw",
"new",
"FileNotFoundException",
"(",
"this",
")",
";",
"}",
"throw",
"new",
"CopyFileToException",
"(",
"this",
",",
"e",
")",
";",
"}",
"catch",
"(",
"JSchException",
"e",
")",
"{",
"throw",
"new",
"CopyFileToException",
"(",
"this",
",",
"e",
")",
";",
"}",
"}"
] |
This is the core function to read an ssh node. Does not close dest.
@throws FileNotFoundException if this is not a file
|
[
"This",
"is",
"the",
"core",
"function",
"to",
"read",
"an",
"ssh",
"node",
".",
"Does",
"not",
"close",
"dest",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/ssh/SshNode.java#L706-L728
|
147,688
|
mlhartme/sushi
|
src/main/java/net/oneandone/sushi/fs/ssh/SshNode.java
|
SshNode.copyFileFrom
|
public void copyFileFrom(InputStream src, boolean append) throws CopyFileFromException {
ChannelSftp sftp;
try {
sftp = alloc();
try {
sftp.put(src, escape(slashPath), append ? ChannelSftp.APPEND : ChannelSftp.OVERWRITE);
} finally {
free(sftp);
}
} catch (SftpException | JSchException e) {
throw new CopyFileFromException(this, e);
}
}
|
java
|
public void copyFileFrom(InputStream src, boolean append) throws CopyFileFromException {
ChannelSftp sftp;
try {
sftp = alloc();
try {
sftp.put(src, escape(slashPath), append ? ChannelSftp.APPEND : ChannelSftp.OVERWRITE);
} finally {
free(sftp);
}
} catch (SftpException | JSchException e) {
throw new CopyFileFromException(this, e);
}
}
|
[
"public",
"void",
"copyFileFrom",
"(",
"InputStream",
"src",
",",
"boolean",
"append",
")",
"throws",
"CopyFileFromException",
"{",
"ChannelSftp",
"sftp",
";",
"try",
"{",
"sftp",
"=",
"alloc",
"(",
")",
";",
"try",
"{",
"sftp",
".",
"put",
"(",
"src",
",",
"escape",
"(",
"slashPath",
")",
",",
"append",
"?",
"ChannelSftp",
".",
"APPEND",
":",
"ChannelSftp",
".",
"OVERWRITE",
")",
";",
"}",
"finally",
"{",
"free",
"(",
"sftp",
")",
";",
"}",
"}",
"catch",
"(",
"SftpException",
"|",
"JSchException",
"e",
")",
"{",
"throw",
"new",
"CopyFileFromException",
"(",
"this",
",",
"e",
")",
";",
"}",
"}"
] |
This is the core function to write an ssh node. Does not close src.
|
[
"This",
"is",
"the",
"core",
"function",
"to",
"write",
"an",
"ssh",
"node",
".",
"Does",
"not",
"close",
"src",
"."
] |
4af33414b04bd58584d4febe5cc63ef6c7346a75
|
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/ssh/SshNode.java#L738-L751
|
147,689
|
ykrasik/jaci
|
jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/commandline/CommandLineHistory.java
|
CommandLineHistory.pushCommandLine
|
public void pushCommandLine(String commandLine) {
// Add new history entry to the end.
history.add(commandLine);
// Maintain max history size.
if (history.size() > maxHistory) {
history.remove(0);
}
// Reset the iteration index.
resetCurrentIndex();
}
|
java
|
public void pushCommandLine(String commandLine) {
// Add new history entry to the end.
history.add(commandLine);
// Maintain max history size.
if (history.size() > maxHistory) {
history.remove(0);
}
// Reset the iteration index.
resetCurrentIndex();
}
|
[
"public",
"void",
"pushCommandLine",
"(",
"String",
"commandLine",
")",
"{",
"// Add new history entry to the end.",
"history",
".",
"add",
"(",
"commandLine",
")",
";",
"// Maintain max history size.",
"if",
"(",
"history",
".",
"size",
"(",
")",
">",
"maxHistory",
")",
"{",
"history",
".",
"remove",
"(",
"0",
")",
";",
"}",
"// Reset the iteration index.",
"resetCurrentIndex",
"(",
")",
";",
"}"
] |
Adds a new command line to the history buffer. Resets the current history index.
@param commandLine Command line to add to history.
|
[
"Adds",
"a",
"new",
"command",
"line",
"to",
"the",
"history",
"buffer",
".",
"Resets",
"the",
"current",
"history",
"index",
"."
] |
4615edef7c76288ad5ea8d678132b161645ca1e3
|
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-cli-core/src/main/java/com/github/ykrasik/jaci/cli/commandline/CommandLineHistory.java#L94-L105
|
147,690
|
netceteragroup/trema-core
|
src/main/java/com/netcetera/trema/core/importing/Change.java
|
Change.getDescription
|
public static String getDescription(Change change) {
switch (change.getType()) {
case Change.TYPE_MASTER_VALUE_CHANGED:
return "The master value has changed";
case Change.TYPE_IMPORTED_STATUS_OLDER:
return "The imported status is older than the database status";
case Change.TYPE_IMPORTED_STATUS_NEWER:
return "The imported status is newer than the database status";
case Change.TYPE_LANGUAGE_ADDITION:
return "The language \"" + change.getLanguage() + "\" does not exist in the database";
case Change.TYPE_MASTER_LANGUAGE_ADDITION:
return "The master language \"" + change.getMasterLanguage() + "\" does not exist in the database";
case Change.TYPE_VALUE_CHANGED:
if (change.isConflicting()) {
return "The value and the status are conflicting";
}
return "The value has changed";
case Change.TYPE_VALUE_AND_STATUS_CHANGED:
if (change.isConflicting()) {
return "The value and the status are conflicting";
}
return "The value and the status have changed";
case Change.TYPE_KEY_ADDITION:
return "The key does not exist in the database";
default:
return "Unknown change";
}
}
|
java
|
public static String getDescription(Change change) {
switch (change.getType()) {
case Change.TYPE_MASTER_VALUE_CHANGED:
return "The master value has changed";
case Change.TYPE_IMPORTED_STATUS_OLDER:
return "The imported status is older than the database status";
case Change.TYPE_IMPORTED_STATUS_NEWER:
return "The imported status is newer than the database status";
case Change.TYPE_LANGUAGE_ADDITION:
return "The language \"" + change.getLanguage() + "\" does not exist in the database";
case Change.TYPE_MASTER_LANGUAGE_ADDITION:
return "The master language \"" + change.getMasterLanguage() + "\" does not exist in the database";
case Change.TYPE_VALUE_CHANGED:
if (change.isConflicting()) {
return "The value and the status are conflicting";
}
return "The value has changed";
case Change.TYPE_VALUE_AND_STATUS_CHANGED:
if (change.isConflicting()) {
return "The value and the status are conflicting";
}
return "The value and the status have changed";
case Change.TYPE_KEY_ADDITION:
return "The key does not exist in the database";
default:
return "Unknown change";
}
}
|
[
"public",
"static",
"String",
"getDescription",
"(",
"Change",
"change",
")",
"{",
"switch",
"(",
"change",
".",
"getType",
"(",
")",
")",
"{",
"case",
"Change",
".",
"TYPE_MASTER_VALUE_CHANGED",
":",
"return",
"\"The master value has changed\"",
";",
"case",
"Change",
".",
"TYPE_IMPORTED_STATUS_OLDER",
":",
"return",
"\"The imported status is older than the database status\"",
";",
"case",
"Change",
".",
"TYPE_IMPORTED_STATUS_NEWER",
":",
"return",
"\"The imported status is newer than the database status\"",
";",
"case",
"Change",
".",
"TYPE_LANGUAGE_ADDITION",
":",
"return",
"\"The language \\\"\"",
"+",
"change",
".",
"getLanguage",
"(",
")",
"+",
"\"\\\" does not exist in the database\"",
";",
"case",
"Change",
".",
"TYPE_MASTER_LANGUAGE_ADDITION",
":",
"return",
"\"The master language \\\"\"",
"+",
"change",
".",
"getMasterLanguage",
"(",
")",
"+",
"\"\\\" does not exist in the database\"",
";",
"case",
"Change",
".",
"TYPE_VALUE_CHANGED",
":",
"if",
"(",
"change",
".",
"isConflicting",
"(",
")",
")",
"{",
"return",
"\"The value and the status are conflicting\"",
";",
"}",
"return",
"\"The value has changed\"",
";",
"case",
"Change",
".",
"TYPE_VALUE_AND_STATUS_CHANGED",
":",
"if",
"(",
"change",
".",
"isConflicting",
"(",
")",
")",
"{",
"return",
"\"The value and the status are conflicting\"",
";",
"}",
"return",
"\"The value and the status have changed\"",
";",
"case",
"Change",
".",
"TYPE_KEY_ADDITION",
":",
"return",
"\"The key does not exist in the database\"",
";",
"default",
":",
"return",
"\"Unknown change\"",
";",
"}",
"}"
] |
Gets a human readable description for a given change.
@param change the change
@return a human readable description for the given change.
|
[
"Gets",
"a",
"human",
"readable",
"description",
"for",
"a",
"given",
"change",
"."
] |
e5367f4b80b38038d462627aa146a62bc34fc489
|
https://github.com/netceteragroup/trema-core/blob/e5367f4b80b38038d462627aa146a62bc34fc489/src/main/java/com/netcetera/trema/core/importing/Change.java#L392-L419
|
147,691
|
pulse00/Composer-Java-Bindings
|
java-api/src/main/java/com/dubture/getcomposer/core/objects/JsonObject.java
|
JsonObject.is
|
public boolean is(String property, Type type) {
if (super.has(property)) {
return get(property).is(type);
}
return false;
}
|
java
|
public boolean is(String property, Type type) {
if (super.has(property)) {
return get(property).is(type);
}
return false;
}
|
[
"public",
"boolean",
"is",
"(",
"String",
"property",
",",
"Type",
"type",
")",
"{",
"if",
"(",
"super",
".",
"has",
"(",
"property",
")",
")",
"{",
"return",
"get",
"(",
"property",
")",
".",
"is",
"(",
"type",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Returns whether the property is instance of the given type.
@param property
the property
@param type
the type
@return <ul>
<li><code>true</code> property is instance of type</li>
<li><code>false</code> property is not an instance of type or it doesn't exist.</li>
</ul>
|
[
"Returns",
"whether",
"the",
"property",
"is",
"instance",
"of",
"the",
"given",
"type",
"."
] |
0aa572567db37d047a41a57c32ede7c7fd5d4938
|
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/objects/JsonObject.java#L58-L63
|
147,692
|
pulse00/Composer-Java-Bindings
|
java-api/src/main/java/com/dubture/getcomposer/core/objects/JsonObject.java
|
JsonObject.getAsArray
|
public JsonArray getAsArray(String property) {
if (!super.has(property)) {
super.set(property, new JsonValue(new JsonArray()), false);
}
return get(property).getAsArray();
}
|
java
|
public JsonArray getAsArray(String property) {
if (!super.has(property)) {
super.set(property, new JsonValue(new JsonArray()), false);
}
return get(property).getAsArray();
}
|
[
"public",
"JsonArray",
"getAsArray",
"(",
"String",
"property",
")",
"{",
"if",
"(",
"!",
"super",
".",
"has",
"(",
"property",
")",
")",
"{",
"super",
".",
"set",
"(",
"property",
",",
"new",
"JsonValue",
"(",
"new",
"JsonArray",
"(",
")",
")",
",",
"false",
")",
";",
"}",
"return",
"get",
"(",
"property",
")",
".",
"getAsArray",
"(",
")",
";",
"}"
] |
Returns the property value as array.
@param property
the property
@return the value
|
[
"Returns",
"the",
"property",
"value",
"as",
"array",
"."
] |
0aa572567db37d047a41a57c32ede7c7fd5d4938
|
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/objects/JsonObject.java#L122-L127
|
147,693
|
pulse00/Composer-Java-Bindings
|
java-api/src/main/java/com/dubture/getcomposer/core/objects/JsonObject.java
|
JsonObject.getAsObject
|
public JsonObject getAsObject(String property) {
if (!super.has(property)) {
super.set(property, new JsonValue(new JsonObject()), false);
}
return get(property).getAsObject();
}
|
java
|
public JsonObject getAsObject(String property) {
if (!super.has(property)) {
super.set(property, new JsonValue(new JsonObject()), false);
}
return get(property).getAsObject();
}
|
[
"public",
"JsonObject",
"getAsObject",
"(",
"String",
"property",
")",
"{",
"if",
"(",
"!",
"super",
".",
"has",
"(",
"property",
")",
")",
"{",
"super",
".",
"set",
"(",
"property",
",",
"new",
"JsonValue",
"(",
"new",
"JsonObject",
"(",
")",
")",
",",
"false",
")",
";",
"}",
"return",
"get",
"(",
"property",
")",
".",
"getAsObject",
"(",
")",
";",
"}"
] |
Returns the property value as object.
@param property
the property
@return the value as entity
|
[
"Returns",
"the",
"property",
"value",
"as",
"object",
"."
] |
0aa572567db37d047a41a57c32ede7c7fd5d4938
|
https://github.com/pulse00/Composer-Java-Bindings/blob/0aa572567db37d047a41a57c32ede7c7fd5d4938/java-api/src/main/java/com/dubture/getcomposer/core/objects/JsonObject.java#L192-L197
|
147,694
|
synchronoss/cpo-api
|
cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java
|
CassandraCpoAdapter.newOrderBy
|
@Override
public CpoOrderBy newOrderBy(String attribute, boolean ascending) throws CpoException {
return new BindableCpoOrderBy(attribute, ascending);
}
|
java
|
@Override
public CpoOrderBy newOrderBy(String attribute, boolean ascending) throws CpoException {
return new BindableCpoOrderBy(attribute, ascending);
}
|
[
"@",
"Override",
"public",
"CpoOrderBy",
"newOrderBy",
"(",
"String",
"attribute",
",",
"boolean",
"ascending",
")",
"throws",
"CpoException",
"{",
"return",
"new",
"BindableCpoOrderBy",
"(",
"attribute",
",",
"ascending",
")",
";",
"}"
] |
newOrderBy allows you to dynamically change the order of the objects in the resulting collection. This allows you
to apply user input in determining the order of the collection
@param attribute The name of the attribute from the pojo that will be sorted.
@param ascending If true, sort ascending. If false sort descending.
@return A CpoOrderBy object to be passed into retrieveBeans.
@throws CpoException Thrown if there are errors accessing the datasource
|
[
"newOrderBy",
"allows",
"you",
"to",
"dynamically",
"change",
"the",
"order",
"of",
"the",
"objects",
"in",
"the",
"resulting",
"collection",
".",
"This",
"allows",
"you",
"to",
"apply",
"user",
"input",
"in",
"determining",
"the",
"order",
"of",
"the",
"collection"
] |
dc745aca3b3206abf80b85d9689b0132f5baa694
|
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L1045-L1048
|
147,695
|
synchronoss/cpo-api
|
cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java
|
CassandraCpoAdapter.getReadSession
|
protected Session getReadSession() throws CpoException {
Session session;
try {
if (!(invalidReadSession)) {
session = getReadDataSource().getSession();
} else {
session = getWriteDataSource().getSession();
}
} catch (Exception e) {
invalidReadSession = true;
String msg = "getReadConnection(): failed";
logger.error(msg, e);
session = getWriteSession();
}
return session;
}
|
java
|
protected Session getReadSession() throws CpoException {
Session session;
try {
if (!(invalidReadSession)) {
session = getReadDataSource().getSession();
} else {
session = getWriteDataSource().getSession();
}
} catch (Exception e) {
invalidReadSession = true;
String msg = "getReadConnection(): failed";
logger.error(msg, e);
session = getWriteSession();
}
return session;
}
|
[
"protected",
"Session",
"getReadSession",
"(",
")",
"throws",
"CpoException",
"{",
"Session",
"session",
";",
"try",
"{",
"if",
"(",
"!",
"(",
"invalidReadSession",
")",
")",
"{",
"session",
"=",
"getReadDataSource",
"(",
")",
".",
"getSession",
"(",
")",
";",
"}",
"else",
"{",
"session",
"=",
"getWriteDataSource",
"(",
")",
".",
"getSession",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"invalidReadSession",
"=",
"true",
";",
"String",
"msg",
"=",
"\"getReadConnection(): failed\"",
";",
"logger",
".",
"error",
"(",
"msg",
",",
"e",
")",
";",
"session",
"=",
"getWriteSession",
"(",
")",
";",
"}",
"return",
"session",
";",
"}"
] |
getReadSession returns the read session for Cassandra
@return A Session object for reading
@throws CpoException
|
[
"getReadSession",
"returns",
"the",
"read",
"session",
"for",
"Cassandra"
] |
dc745aca3b3206abf80b85d9689b0132f5baa694
|
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L1927-L1946
|
147,696
|
synchronoss/cpo-api
|
cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java
|
CassandraCpoAdapter.getWriteSession
|
protected Session getWriteSession() throws CpoException {
Session session;
try {
session = getWriteDataSource().getSession();
} catch (Throwable t) {
String msg = "getWriteConnection(): failed";
logger.error(msg, t);
throw new CpoException(msg, t);
}
return session;
}
|
java
|
protected Session getWriteSession() throws CpoException {
Session session;
try {
session = getWriteDataSource().getSession();
} catch (Throwable t) {
String msg = "getWriteConnection(): failed";
logger.error(msg, t);
throw new CpoException(msg, t);
}
return session;
}
|
[
"protected",
"Session",
"getWriteSession",
"(",
")",
"throws",
"CpoException",
"{",
"Session",
"session",
";",
"try",
"{",
"session",
"=",
"getWriteDataSource",
"(",
")",
".",
"getSession",
"(",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"String",
"msg",
"=",
"\"getWriteConnection(): failed\"",
";",
"logger",
".",
"error",
"(",
"msg",
",",
"t",
")",
";",
"throw",
"new",
"CpoException",
"(",
"msg",
",",
"t",
")",
";",
"}",
"return",
"session",
";",
"}"
] |
getWriteSession returns the write session for Cassandra
@return A Session object for writing
@throws CpoException
|
[
"getWriteSession",
"returns",
"the",
"write",
"session",
"for",
"Cassandra"
] |
dc745aca3b3206abf80b85d9689b0132f5baa694
|
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L1954-L1966
|
147,697
|
synchronoss/cpo-api
|
cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java
|
CassandraCpoAdapter.getCpoAttributes
|
@Override
public List<CpoAttribute> getCpoAttributes(String expression) throws CpoException {
List<CpoAttribute> attributes = new ArrayList<>();
if (expression != null && !expression.isEmpty()) {
Session session;
ResultSet rs;
try {
session = getWriteSession();
rs = session.execute(expression);
ColumnDefinitions columnDefs = rs.getColumnDefinitions();
for (int i = 0; i < columnDefs.size(); i++) {
CpoAttribute attribute = new CassandraCpoAttribute();
attribute.setDataName(columnDefs.getName(i));
DataTypeMapEntry<?> dataTypeMapEntry = metaDescriptor.getDataTypeMapEntry(columnDefs.getType(i).getName().ordinal());
attribute.setDataType(dataTypeMapEntry.getDataTypeName());
attribute.setDataTypeInt(dataTypeMapEntry.getDataTypeInt());
attribute.setJavaType(dataTypeMapEntry.getJavaClass().getName());
attribute.setJavaName(dataTypeMapEntry.makeJavaName(columnDefs.getName(i)));
attributes.add(attribute);
}
} catch (Throwable t) {
logger.error(ExceptionHelper.getLocalizedMessage(t), t);
throw new CpoException("Error Generating Attributes", t);
}
}
return attributes;
}
|
java
|
@Override
public List<CpoAttribute> getCpoAttributes(String expression) throws CpoException {
List<CpoAttribute> attributes = new ArrayList<>();
if (expression != null && !expression.isEmpty()) {
Session session;
ResultSet rs;
try {
session = getWriteSession();
rs = session.execute(expression);
ColumnDefinitions columnDefs = rs.getColumnDefinitions();
for (int i = 0; i < columnDefs.size(); i++) {
CpoAttribute attribute = new CassandraCpoAttribute();
attribute.setDataName(columnDefs.getName(i));
DataTypeMapEntry<?> dataTypeMapEntry = metaDescriptor.getDataTypeMapEntry(columnDefs.getType(i).getName().ordinal());
attribute.setDataType(dataTypeMapEntry.getDataTypeName());
attribute.setDataTypeInt(dataTypeMapEntry.getDataTypeInt());
attribute.setJavaType(dataTypeMapEntry.getJavaClass().getName());
attribute.setJavaName(dataTypeMapEntry.makeJavaName(columnDefs.getName(i)));
attributes.add(attribute);
}
} catch (Throwable t) {
logger.error(ExceptionHelper.getLocalizedMessage(t), t);
throw new CpoException("Error Generating Attributes", t);
}
}
return attributes;
}
|
[
"@",
"Override",
"public",
"List",
"<",
"CpoAttribute",
">",
"getCpoAttributes",
"(",
"String",
"expression",
")",
"throws",
"CpoException",
"{",
"List",
"<",
"CpoAttribute",
">",
"attributes",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"if",
"(",
"expression",
"!=",
"null",
"&&",
"!",
"expression",
".",
"isEmpty",
"(",
")",
")",
"{",
"Session",
"session",
";",
"ResultSet",
"rs",
";",
"try",
"{",
"session",
"=",
"getWriteSession",
"(",
")",
";",
"rs",
"=",
"session",
".",
"execute",
"(",
"expression",
")",
";",
"ColumnDefinitions",
"columnDefs",
"=",
"rs",
".",
"getColumnDefinitions",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"columnDefs",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"CpoAttribute",
"attribute",
"=",
"new",
"CassandraCpoAttribute",
"(",
")",
";",
"attribute",
".",
"setDataName",
"(",
"columnDefs",
".",
"getName",
"(",
"i",
")",
")",
";",
"DataTypeMapEntry",
"<",
"?",
">",
"dataTypeMapEntry",
"=",
"metaDescriptor",
".",
"getDataTypeMapEntry",
"(",
"columnDefs",
".",
"getType",
"(",
"i",
")",
".",
"getName",
"(",
")",
".",
"ordinal",
"(",
")",
")",
";",
"attribute",
".",
"setDataType",
"(",
"dataTypeMapEntry",
".",
"getDataTypeName",
"(",
")",
")",
";",
"attribute",
".",
"setDataTypeInt",
"(",
"dataTypeMapEntry",
".",
"getDataTypeInt",
"(",
")",
")",
";",
"attribute",
".",
"setJavaType",
"(",
"dataTypeMapEntry",
".",
"getJavaClass",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"attribute",
".",
"setJavaName",
"(",
"dataTypeMapEntry",
".",
"makeJavaName",
"(",
"columnDefs",
".",
"getName",
"(",
"i",
")",
")",
")",
";",
"attributes",
".",
"add",
"(",
"attribute",
")",
";",
"}",
"}",
"catch",
"(",
"Throwable",
"t",
")",
"{",
"logger",
".",
"error",
"(",
"ExceptionHelper",
".",
"getLocalizedMessage",
"(",
"t",
")",
",",
"t",
")",
";",
"throw",
"new",
"CpoException",
"(",
"\"Error Generating Attributes\"",
",",
"t",
")",
";",
"}",
"}",
"return",
"attributes",
";",
"}"
] |
Get the cpo attributes for this expression
@param expression - A string expression
@return A List of CpoAttribute
@throws CpoException
|
[
"Get",
"the",
"cpo",
"attributes",
"for",
"this",
"expression"
] |
dc745aca3b3206abf80b85d9689b0132f5baa694
|
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L1975-L2004
|
147,698
|
ZenHarbinger/l2fprod-properties-editor
|
src/main/java/com/l2fprod/common/beans/BeanInfoFactory.java
|
BeanInfoFactory.createBeanInfo
|
public static BeanInfo createBeanInfo(Class<? extends Object> c) {
BeanInfo bi = DefaultBeanInfoResolver.getBeanInfoHelper(c);
if (bi == null) {
bi = new ConfigBeanInfo(c);
DefaultBeanInfoResolver.addBeanInfo(c, bi);
}
return bi;
}
|
java
|
public static BeanInfo createBeanInfo(Class<? extends Object> c) {
BeanInfo bi = DefaultBeanInfoResolver.getBeanInfoHelper(c);
if (bi == null) {
bi = new ConfigBeanInfo(c);
DefaultBeanInfoResolver.addBeanInfo(c, bi);
}
return bi;
}
|
[
"public",
"static",
"BeanInfo",
"createBeanInfo",
"(",
"Class",
"<",
"?",
"extends",
"Object",
">",
"c",
")",
"{",
"BeanInfo",
"bi",
"=",
"DefaultBeanInfoResolver",
".",
"getBeanInfoHelper",
"(",
"c",
")",
";",
"if",
"(",
"bi",
"==",
"null",
")",
"{",
"bi",
"=",
"new",
"ConfigBeanInfo",
"(",
"c",
")",
";",
"DefaultBeanInfoResolver",
".",
"addBeanInfo",
"(",
"c",
",",
"bi",
")",
";",
"}",
"return",
"bi",
";",
"}"
] |
Get the bean information of a type.
@param c The type to get the bean information of.
@return The BeanInfo of the specified type.
|
[
"Get",
"the",
"bean",
"information",
"of",
"a",
"type",
"."
] |
d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32
|
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/beans/BeanInfoFactory.java#L49-L56
|
147,699
|
yfpeng/pengyifan-bioc
|
src/main/java/com/pengyifan/bioc/util/BioCValidate3.java
|
BioCValidate3.check
|
public void check(BioCDocument document) {
String text = checkText(document);
check(document, 0, text);
for (BioCPassage passage : document.getPassages()) {
check(passage, 0, text, document);
for (BioCSentence sentence : passage.getSentences()) {
check(sentence, 0, text, document, passage);
}
}
}
|
java
|
public void check(BioCDocument document) {
String text = checkText(document);
check(document, 0, text);
for (BioCPassage passage : document.getPassages()) {
check(passage, 0, text, document);
for (BioCSentence sentence : passage.getSentences()) {
check(sentence, 0, text, document, passage);
}
}
}
|
[
"public",
"void",
"check",
"(",
"BioCDocument",
"document",
")",
"{",
"String",
"text",
"=",
"checkText",
"(",
"document",
")",
";",
"check",
"(",
"document",
",",
"0",
",",
"text",
")",
";",
"for",
"(",
"BioCPassage",
"passage",
":",
"document",
".",
"getPassages",
"(",
")",
")",
"{",
"check",
"(",
"passage",
",",
"0",
",",
"text",
",",
"document",
")",
";",
"for",
"(",
"BioCSentence",
"sentence",
":",
"passage",
".",
"getSentences",
"(",
")",
")",
"{",
"check",
"(",
"sentence",
",",
"0",
",",
"text",
",",
"document",
",",
"passage",
")",
";",
"}",
"}",
"}"
] |
Checks text, annotations and relations of the document.
@param document input document
|
[
"Checks",
"text",
"annotations",
"and",
"relations",
"of",
"the",
"document",
"."
] |
e09cce1969aa598ff89e7957237375715d7a1a3a
|
https://github.com/yfpeng/pengyifan-bioc/blob/e09cce1969aa598ff89e7957237375715d7a1a3a/src/main/java/com/pengyifan/bioc/util/BioCValidate3.java#L56-L65
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.