repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
sebastiangraf/treetank | coremodules/commons/src/main/java/org/treetank/exception/TTException.java | TTException.concat | public static StringBuilder concat(final String... message) {
final StringBuilder builder = new StringBuilder();
for (final String mess : message) {
builder.append(mess);
builder.append(" ");
}
return builder;
} | java | public static StringBuilder concat(final String... message) {
final StringBuilder builder = new StringBuilder();
for (final String mess : message) {
builder.append(mess);
builder.append(" ");
}
return builder;
} | [
"public",
"static",
"StringBuilder",
"concat",
"(",
"final",
"String",
"...",
"message",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"final",
"String",
"mess",
":",
"message",
")",
"{",
"builder",
... | Util method to provide StringBuilder functionality.
@param message
to be concatenated
@return the StringBuilder for the combined string | [
"Util",
"method",
"to",
"provide",
"StringBuilder",
"functionality",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/commons/src/main/java/org/treetank/exception/TTException.java#L79-L86 | train |
sebastiangraf/treetank | coremodules/core/src/main/java/org/treetank/bucket/MetaBucket.java | MetaBucket.put | public IMetaEntry put(final IMetaEntry pKey, final IMetaEntry pVal) {
return mMetaMap.put(pKey, pVal);
} | java | public IMetaEntry put(final IMetaEntry pKey, final IMetaEntry pVal) {
return mMetaMap.put(pKey, pVal);
} | [
"public",
"IMetaEntry",
"put",
"(",
"final",
"IMetaEntry",
"pKey",
",",
"final",
"IMetaEntry",
"pVal",
")",
"{",
"return",
"mMetaMap",
".",
"put",
"(",
"pKey",
",",
"pVal",
")",
";",
"}"
] | Putting an entry to the map.
@param pKey
to be stored.
@param pVal
to be stored.
@return if entry already existing, return that one.
@see ConcurrentHashMap#put(Object, Object) | [
"Putting",
"an",
"entry",
"to",
"the",
"map",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/core/src/main/java/org/treetank/bucket/MetaBucket.java#L85-L87 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.call | @Override
public Void call() throws TTException {
updateOnly();
if (mCommit == EShredderCommit.COMMIT) {
mWtx.commit();
}
return null;
} | java | @Override
public Void call() throws TTException {
updateOnly();
if (mCommit == EShredderCommit.COMMIT) {
mWtx.commit();
}
return null;
} | [
"@",
"Override",
"public",
"Void",
"call",
"(",
")",
"throws",
"TTException",
"{",
"updateOnly",
"(",
")",
";",
"if",
"(",
"mCommit",
"==",
"EShredderCommit",
".",
"COMMIT",
")",
"{",
"mWtx",
".",
"commit",
"(",
")",
";",
"}",
"return",
"null",
";",
... | Invoking the shredder.
@throws TTException
if Treetank encounters something went wrong
@return revision of last revision (before commit) | [
"Invoking",
"the",
"shredder",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L270-L277 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.updateOnly | private void updateOnly() throws TTException {
try {
// Initialize variables.
mLevelInToShredder = 0;
// mElemsParsed = 0;
// mIsLastNode = false;
mMovedToRightSibling = false;
boolean firstEvent = true;
// // If structure alre... | java | private void updateOnly() throws TTException {
try {
// Initialize variables.
mLevelInToShredder = 0;
// mElemsParsed = 0;
// mIsLastNode = false;
mMovedToRightSibling = false;
boolean firstEvent = true;
// // If structure alre... | [
"private",
"void",
"updateOnly",
"(",
")",
"throws",
"TTException",
"{",
"try",
"{",
"// Initialize variables.",
"mLevelInToShredder",
"=",
"0",
";",
"// mElemsParsed = 0;",
"// mIsLastNode = false;",
"mMovedToRightSibling",
"=",
"false",
";",
"boolean",
"firstEvent",
"... | Update a shreddered file.
@throws TTException
if Treetank encounters something went wrong | [
"Update",
"a",
"shreddered",
"file",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L285-L413 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.processStartTag | private void processStartTag(final StartElement paramElem) throws IOException, XMLStreamException,
TTException {
assert paramElem != null;
// Initialize variables.
initializeVars();
// Main algorithm to determine if same, insert or a delete has to be
// made.
al... | java | private void processStartTag(final StartElement paramElem) throws IOException, XMLStreamException,
TTException {
assert paramElem != null;
// Initialize variables.
initializeVars();
// Main algorithm to determine if same, insert or a delete has to be
// made.
al... | [
"private",
"void",
"processStartTag",
"(",
"final",
"StartElement",
"paramElem",
")",
"throws",
"IOException",
",",
"XMLStreamException",
",",
"TTException",
"{",
"assert",
"paramElem",
"!=",
"null",
";",
"// Initialize variables.",
"initializeVars",
"(",
")",
";",
... | Process start tag.
@param paramElem
{@link StartElement} currently parsed.
@throws XMLStreamException
In case of any StAX parsing error.
@throws IOException
In case of any I/O error.
@throws TTException
In case of any Treetank error. | [
"Process",
"start",
"tag",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L427-L452 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.processCharacters | private void processCharacters(final Characters paramText) throws IOException, XMLStreamException,
TTException {
assert paramText != null;
// Initialize variables.
initializeVars();
final String text = paramText.getData().toString();
if (!text.isEmpty()) {
// ... | java | private void processCharacters(final Characters paramText) throws IOException, XMLStreamException,
TTException {
assert paramText != null;
// Initialize variables.
initializeVars();
final String text = paramText.getData().toString();
if (!text.isEmpty()) {
// ... | [
"private",
"void",
"processCharacters",
"(",
"final",
"Characters",
"paramText",
")",
"throws",
"IOException",
",",
"XMLStreamException",
",",
"TTException",
"{",
"assert",
"paramText",
"!=",
"null",
";",
"// Initialize variables.",
"initializeVars",
"(",
")",
";",
... | Process characters.
@param paramText
{@link Characters} currently parsed.
@throws XMLStreamException
In case of any StAX parsing error.
@throws IOException
In case of any I/O error.
@throws TTException
In case of any Treetank error. | [
"Process",
"characters",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L466-L494 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.processEndTag | private void processEndTag() throws XMLStreamException, TTException {
mLevelInToShredder--;
if (mInserted) {
mInsertedEndTag = true;
}
if (mRemovedNode) {
mRemovedNode = false;
} else {
// Move cursor to parent.
if (mWtx.getNode(... | java | private void processEndTag() throws XMLStreamException, TTException {
mLevelInToShredder--;
if (mInserted) {
mInsertedEndTag = true;
}
if (mRemovedNode) {
mRemovedNode = false;
} else {
// Move cursor to parent.
if (mWtx.getNode(... | [
"private",
"void",
"processEndTag",
"(",
")",
"throws",
"XMLStreamException",
",",
"TTException",
"{",
"mLevelInToShredder",
"--",
";",
"if",
"(",
"mInserted",
")",
"{",
"mInsertedEndTag",
"=",
"true",
";",
"}",
"if",
"(",
"mRemovedNode",
")",
"{",
"mRemovedNo... | Process end tag.
@throws XMLStreamException
In case of any parsing error.
@throws TTException
In case anything went wrong while moving/deleting nodes in
Treetank. | [
"Process",
"end",
"tag",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L505-L574 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.algorithm | private void algorithm(final XMLEvent paramEvent) throws IOException, XMLStreamException, TTIOException {
assert paramEvent != null;
do {
/*
* Check if a node in the shreddered file on the same level equals
* the current element node.
*/
if ... | java | private void algorithm(final XMLEvent paramEvent) throws IOException, XMLStreamException, TTIOException {
assert paramEvent != null;
do {
/*
* Check if a node in the shreddered file on the same level equals
* the current element node.
*/
if ... | [
"private",
"void",
"algorithm",
"(",
"final",
"XMLEvent",
"paramEvent",
")",
"throws",
"IOException",
",",
"XMLStreamException",
",",
"TTIOException",
"{",
"assert",
"paramEvent",
"!=",
"null",
";",
"do",
"{",
"/*\n * Check if a node in the shreddered file on ... | Main algorithm to determine if nodes are equal, have to be inserted, or
have to be removed.
@param paramEvent
The currently parsed StAX event.
@throws IOException
In case the open operation fails (delegated from
checkDescendants(...)).
@throws XMLStreamException
In case any StAX parser problem occurs.
@throws TTIOExce... | [
"Main",
"algorithm",
"to",
"determine",
"if",
"nodes",
"are",
"equal",
"have",
"to",
"be",
"inserted",
"or",
"have",
"to",
"be",
"removed",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L589-L630 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.checkText | private boolean checkText(final Characters paramEvent) {
assert paramEvent != null;
final String text = paramEvent.getData().trim();
return mWtx.getNode().getKind() == IConstants.TEXT && mWtx.getValueOfCurrentNode().equals(text);
} | java | private boolean checkText(final Characters paramEvent) {
assert paramEvent != null;
final String text = paramEvent.getData().trim();
return mWtx.getNode().getKind() == IConstants.TEXT && mWtx.getValueOfCurrentNode().equals(text);
} | [
"private",
"boolean",
"checkText",
"(",
"final",
"Characters",
"paramEvent",
")",
"{",
"assert",
"paramEvent",
"!=",
"null",
";",
"final",
"String",
"text",
"=",
"paramEvent",
".",
"getData",
"(",
")",
".",
"trim",
"(",
")",
";",
"return",
"mWtx",
".",
"... | Check if text event and text in Treetank storage match.
@param paramEvent
{@link XMLEvent}.
@return true if they match, otherwise false. | [
"Check",
"if",
"text",
"event",
"and",
"text",
"in",
"Treetank",
"storage",
"match",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L639-L643 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.sameTextNode | private void sameTextNode() throws TTIOException, XMLStreamException {
// Update variables.
mInsert = EInsert.NOINSERT;
mDelete = EDelete.NODELETE;
mInserted = false;
mInsertedEndTag = false;
mRemovedNode = false;
// Check if last node reached.
// checkIf... | java | private void sameTextNode() throws TTIOException, XMLStreamException {
// Update variables.
mInsert = EInsert.NOINSERT;
mDelete = EDelete.NODELETE;
mInserted = false;
mInsertedEndTag = false;
mRemovedNode = false;
// Check if last node reached.
// checkIf... | [
"private",
"void",
"sameTextNode",
"(",
")",
"throws",
"TTIOException",
",",
"XMLStreamException",
"{",
"// Update variables.",
"mInsert",
"=",
"EInsert",
".",
"NOINSERT",
";",
"mDelete",
"=",
"EDelete",
".",
"NODELETE",
";",
"mInserted",
"=",
"false",
";",
"mIn... | In case they are the same nodes move cursor to next node and update
stack.
@throws TTIOException
In case of any Treetank error.
@throws XMLStreamException
In case of any StAX parsing error. | [
"In",
"case",
"they",
"are",
"the",
"same",
"nodes",
"move",
"cursor",
"to",
"next",
"node",
"and",
"update",
"stack",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L654-L691 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.sameElementNode | private void sameElementNode() throws XMLStreamException, TTException {
// Update variables.
mInsert = EInsert.NOINSERT;
mDelete = EDelete.NODELETE;
mInserted = false;
mInsertedEndTag = false;
mRemovedNode = false;
// Check if last node reached.
// checkI... | java | private void sameElementNode() throws XMLStreamException, TTException {
// Update variables.
mInsert = EInsert.NOINSERT;
mDelete = EDelete.NODELETE;
mInserted = false;
mInsertedEndTag = false;
mRemovedNode = false;
// Check if last node reached.
// checkI... | [
"private",
"void",
"sameElementNode",
"(",
")",
"throws",
"XMLStreamException",
",",
"TTException",
"{",
"// Update variables.",
"mInsert",
"=",
"EInsert",
".",
"NOINSERT",
";",
"mDelete",
"=",
"EDelete",
".",
"NODELETE",
";",
"mInserted",
"=",
"false",
";",
"mI... | Nodes match, thus update stack and move cursor to first child if it is
not a leaf node.
@throws XMLStreamException
In case of any StAX parsing error.
@throws TTException
In case anything went wrong while moving the Treetank
transaction. | [
"Nodes",
"match",
"thus",
"update",
"stack",
"and",
"move",
"cursor",
"to",
"first",
"child",
"if",
"it",
"is",
"not",
"a",
"leaf",
"node",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L741-L798 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.skipWhitespaces | private void skipWhitespaces(final XMLEventReader paramReader) throws XMLStreamException {
while (paramReader.peek().getEventType() == XMLStreamConstants.CHARACTERS
&& paramReader.peek().asCharacters().isWhiteSpace()) {
paramReader.nextEvent();
}
} | java | private void skipWhitespaces(final XMLEventReader paramReader) throws XMLStreamException {
while (paramReader.peek().getEventType() == XMLStreamConstants.CHARACTERS
&& paramReader.peek().asCharacters().isWhiteSpace()) {
paramReader.nextEvent();
}
} | [
"private",
"void",
"skipWhitespaces",
"(",
"final",
"XMLEventReader",
"paramReader",
")",
"throws",
"XMLStreamException",
"{",
"while",
"(",
"paramReader",
".",
"peek",
"(",
")",
".",
"getEventType",
"(",
")",
"==",
"XMLStreamConstants",
".",
"CHARACTERS",
"&&",
... | Skip any whitespace event.
@param paramReader
the StAX {@link XMLEventReader} to use
@throws XMLStreamException
if any parsing error occurs while moving the StAX parser | [
"Skip",
"any",
"whitespace",
"event",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L808-L813 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.insertElementNode | private void insertElementNode(final StartElement paramElement) throws TTException, XMLStreamException {
assert paramElement != null;
/*
* Add node if it's either not found among right siblings (and the
* cursor on the shreddered file is on a right sibling) or if it's not
* fo... | java | private void insertElementNode(final StartElement paramElement) throws TTException, XMLStreamException {
assert paramElement != null;
/*
* Add node if it's either not found among right siblings (and the
* cursor on the shreddered file is on a right sibling) or if it's not
* fo... | [
"private",
"void",
"insertElementNode",
"(",
"final",
"StartElement",
"paramElement",
")",
"throws",
"TTException",
",",
"XMLStreamException",
"{",
"assert",
"paramElement",
"!=",
"null",
";",
"/*\n * Add node if it's either not found among right siblings (and the\n ... | Insert an element node.
@param paramElement
{@link StartElement}, which is going to be inserted.
@throws TTException
In case any exception occurs while moving the cursor or
deleting nodes in Treetank.
@throws XMLStreamException
In case of any StAX parsing error. | [
"Insert",
"an",
"element",
"node",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L826-L894 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.insertTextNode | private void insertTextNode(final Characters paramText) throws TTException, XMLStreamException {
assert paramText != null;
/*
* Add node if it's either not found among right siblings (and the
* cursor on the shreddered file is on a right sibling) or if it's not
* found in the ... | java | private void insertTextNode(final Characters paramText) throws TTException, XMLStreamException {
assert paramText != null;
/*
* Add node if it's either not found among right siblings (and the
* cursor on the shreddered file is on a right sibling) or if it's not
* found in the ... | [
"private",
"void",
"insertTextNode",
"(",
"final",
"Characters",
"paramText",
")",
"throws",
"TTException",
",",
"XMLStreamException",
"{",
"assert",
"paramText",
"!=",
"null",
";",
"/*\n * Add node if it's either not found among right siblings (and the\n * cursor... | Insert a text node.
@param paramText
{@link Characters}, which is going to be inserted.
@throws TTException
In case any exception occurs while moving the cursor or
deleting nodes in Treetank.
@throws XMLStreamException
In case of any StAX parsing error. | [
"Insert",
"a",
"text",
"node",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L907-L996 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.deleteNode | private void deleteNode() throws TTException {
/*
* If found in one of the rightsiblings in the current shreddered
* structure remove all nodes until the transaction points to the found
* node (keyMatches).
*/
if (mInserted && !mMovedToRightSibling) {
mIns... | java | private void deleteNode() throws TTException {
/*
* If found in one of the rightsiblings in the current shreddered
* structure remove all nodes until the transaction points to the found
* node (keyMatches).
*/
if (mInserted && !mMovedToRightSibling) {
mIns... | [
"private",
"void",
"deleteNode",
"(",
")",
"throws",
"TTException",
"{",
"/*\n * If found in one of the rightsiblings in the current shreddered\n * structure remove all nodes until the transaction points to the found\n * node (keyMatches).\n */",
"if",
"(",
"mIn... | Delete node.
@throws TTException
In case any exception occurs while moving the cursor or
deleting nodes in Treetank. | [
"Delete",
"node",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L1005-L1095 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.initializeVars | private void initializeVars() {
mNodeKey = mWtx.getNode().getDataKey();
mFound = false;
mIsRightSibling = false;
mKeyMatches = -1;
} | java | private void initializeVars() {
mNodeKey = mWtx.getNode().getDataKey();
mFound = false;
mIsRightSibling = false;
mKeyMatches = -1;
} | [
"private",
"void",
"initializeVars",
"(",
")",
"{",
"mNodeKey",
"=",
"mWtx",
".",
"getNode",
"(",
")",
".",
"getDataKey",
"(",
")",
";",
"mFound",
"=",
"false",
";",
"mIsRightSibling",
"=",
"false",
";",
"mKeyMatches",
"=",
"-",
"1",
";",
"}"
] | Initialize variables needed for the main algorithm. | [
"Initialize",
"variables",
"needed",
"for",
"the",
"main",
"algorithm",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L1100-L1105 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java | XMLUpdateShredder.checkElement | private boolean checkElement(final StartElement mEvent) throws TTIOException {
assert mEvent != null;
boolean retVal = false;
// Matching element names?
if (mWtx.getNode().getKind() == IConstants.ELEMENT
&& mWtx.getQNameOfCurrentNode().equals(mEvent.getName())) {
... | java | private boolean checkElement(final StartElement mEvent) throws TTIOException {
assert mEvent != null;
boolean retVal = false;
// Matching element names?
if (mWtx.getNode().getKind() == IConstants.ELEMENT
&& mWtx.getQNameOfCurrentNode().equals(mEvent.getName())) {
... | [
"private",
"boolean",
"checkElement",
"(",
"final",
"StartElement",
"mEvent",
")",
"throws",
"TTIOException",
"{",
"assert",
"mEvent",
"!=",
"null",
";",
"boolean",
"retVal",
"=",
"false",
";",
"// Matching element names?",
"if",
"(",
"mWtx",
".",
"getNode",
"("... | Check if current element matches the element in the shreddered file.
@param mEvent
StartElement event, from the XML file to shredder.
@return true if they are equal, false otherwise.
@throws TTIOException | [
"Check",
"if",
"current",
"element",
"matches",
"the",
"element",
"in",
"the",
"shreddered",
"file",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/shredder/XMLUpdateShredder.java#L1179-L1249 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/util/SortedProperties.java | SortedProperties.keys | @Override
@SuppressWarnings({ "unchecked" })
public synchronized Enumeration<Object> keys() {
Enumeration<Object> keysEnum = super.keys();
@SuppressWarnings("rawtypes")
Vector keyList = new Vector<>(); // NOPMD - vector used on purpose here...
while (keysEnum.hasMoreElements()) {
keyList.add(keysEnum.nextE... | java | @Override
@SuppressWarnings({ "unchecked" })
public synchronized Enumeration<Object> keys() {
Enumeration<Object> keysEnum = super.keys();
@SuppressWarnings("rawtypes")
Vector keyList = new Vector<>(); // NOPMD - vector used on purpose here...
while (keysEnum.hasMoreElements()) {
keyList.add(keysEnum.nextE... | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
"}",
")",
"public",
"synchronized",
"Enumeration",
"<",
"Object",
">",
"keys",
"(",
")",
"{",
"Enumeration",
"<",
"Object",
">",
"keysEnum",
"=",
"super",
".",
"keys",
"(",
")",
";",
"@... | Overrides, called by the store method. | [
"Overrides",
"called",
"by",
"the",
"store",
"method",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/util/SortedProperties.java#L22-L38 | train |
Bedework/bw-util | bw-util-struts/src/main/java/org/bedework/util/struts/UtilActionForm.java | UtilActionForm.setException | public void setException(Throwable t) {
if (err == null) {
t.printStackTrace();
} else {
err.emit(t);
}
} | java | public void setException(Throwable t) {
if (err == null) {
t.printStackTrace();
} else {
err.emit(t);
}
} | [
"public",
"void",
"setException",
"(",
"Throwable",
"t",
")",
"{",
"if",
"(",
"err",
"==",
"null",
")",
"{",
"t",
".",
"printStackTrace",
"(",
")",
";",
"}",
"else",
"{",
"err",
".",
"emit",
"(",
"t",
")",
";",
"}",
"}"
] | Can be called by a page to signal an exceptiuon
@param t | [
"Can",
"be",
"called",
"by",
"a",
"page",
"to",
"signal",
"an",
"exceptiuon"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-struts/src/main/java/org/bedework/util/struts/UtilActionForm.java#L323-L329 | train |
Bedework/bw-util | bw-util-struts/src/main/java/org/bedework/util/struts/UtilActionForm.java | UtilActionForm.processErrors | public boolean processErrors(MessageEmit err) {
if (valErrors.size() == 0) {
return false;
}
for (ValError ve: valErrors) {
processError(err, ve);
}
valErrors.clear();
return true;
} | java | public boolean processErrors(MessageEmit err) {
if (valErrors.size() == 0) {
return false;
}
for (ValError ve: valErrors) {
processError(err, ve);
}
valErrors.clear();
return true;
} | [
"public",
"boolean",
"processErrors",
"(",
"MessageEmit",
"err",
")",
"{",
"if",
"(",
"valErrors",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"ValError",
"ve",
":",
"valErrors",
")",
"{",
"processError",
"(",
... | processErrors is called to determine if there were any errors.
If so processError is called for each error adn the errors vector
is cleared.
Override the processError method to emit custom messages.
@param err MessageEmit object
@return boolean True if there were errors | [
"processErrors",
"is",
"called",
"to",
"determine",
"if",
"there",
"were",
"any",
"errors",
".",
"If",
"so",
"processError",
"is",
"called",
"for",
"each",
"error",
"adn",
"the",
"errors",
"vector",
"is",
"cleared",
".",
"Override",
"the",
"processError",
"m... | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-struts/src/main/java/org/bedework/util/struts/UtilActionForm.java#L616-L627 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/StorageManager.java | StorageManager.createResource | public static boolean createResource(String name, AbstractModule module)
throws StorageAlreadyExistsException, TTException {
File file = new File(ROOT_PATH);
File storageFile = new File(STORAGE_PATH);
if (!file.exists() || !storageFile.exists()) {
file.mkdirs();
... | java | public static boolean createResource(String name, AbstractModule module)
throws StorageAlreadyExistsException, TTException {
File file = new File(ROOT_PATH);
File storageFile = new File(STORAGE_PATH);
if (!file.exists() || !storageFile.exists()) {
file.mkdirs();
... | [
"public",
"static",
"boolean",
"createResource",
"(",
"String",
"name",
",",
"AbstractModule",
"module",
")",
"throws",
"StorageAlreadyExistsException",
",",
"TTException",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"ROOT_PATH",
")",
";",
"File",
"storageFile",... | Create a new storage with the given name and backend.
@param name
@param module
@return true if successful
@throws StorageAlreadyExistsException
@throws TTException | [
"Create",
"a",
"new",
"storage",
"with",
"the",
"given",
"name",
"and",
"backend",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/StorageManager.java#L60-L91 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/StorageManager.java | StorageManager.getResources | public static List<String> getResources() {
File resources = new File(STORAGE_PATH + File.separator + "/resources");
File[] children = resources.listFiles();
if (children == null) {
return new ArrayList<String>();
}
List<String> storages = new ArrayList<String>();
... | java | public static List<String> getResources() {
File resources = new File(STORAGE_PATH + File.separator + "/resources");
File[] children = resources.listFiles();
if (children == null) {
return new ArrayList<String>();
}
List<String> storages = new ArrayList<String>();
... | [
"public",
"static",
"List",
"<",
"String",
">",
"getResources",
"(",
")",
"{",
"File",
"resources",
"=",
"new",
"File",
"(",
"STORAGE_PATH",
"+",
"File",
".",
"separator",
"+",
"\"/resources\"",
")",
";",
"File",
"[",
"]",
"children",
"=",
"resources",
"... | Retrieve a list of all storages.
@return a list of all storage names | [
"Retrieve",
"a",
"list",
"of",
"all",
"storages",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/StorageManager.java#L98-L114 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/StorageManager.java | StorageManager.getSession | public static ISession getSession(String resourceName) throws ResourceNotExistingException, TTException {
File storageFile = new File(STORAGE_PATH);
ISession session = null;
if (!storageFile.exists()) {
throw new ResourceNotExistingException();
} else {
new Stor... | java | public static ISession getSession(String resourceName) throws ResourceNotExistingException, TTException {
File storageFile = new File(STORAGE_PATH);
ISession session = null;
if (!storageFile.exists()) {
throw new ResourceNotExistingException();
} else {
new Stor... | [
"public",
"static",
"ISession",
"getSession",
"(",
"String",
"resourceName",
")",
"throws",
"ResourceNotExistingException",
",",
"TTException",
"{",
"File",
"storageFile",
"=",
"new",
"File",
"(",
"STORAGE_PATH",
")",
";",
"ISession",
"session",
"=",
"null",
";",
... | Retrieve a session from the system for the given Storagename
@param resourceName
@return a new {@link ISession} for the resource
@throws ResourceNotExistingException
@throws TTException | [
"Retrieve",
"a",
"session",
"from",
"the",
"system",
"for",
"the",
"given",
"Storagename"
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/StorageManager.java#L124-L141 | train |
sebastiangraf/treetank | interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/StorageManager.java | StorageManager.removeResource | public static void removeResource(String pResourceName) throws TTException, ResourceNotExistingException {
ISession session = getSession(pResourceName);
session.truncate();
} | java | public static void removeResource(String pResourceName) throws TTException, ResourceNotExistingException {
ISession session = getSession(pResourceName);
session.truncate();
} | [
"public",
"static",
"void",
"removeResource",
"(",
"String",
"pResourceName",
")",
"throws",
"TTException",
",",
"ResourceNotExistingException",
"{",
"ISession",
"session",
"=",
"getSession",
"(",
"pResourceName",
")",
";",
"session",
".",
"truncate",
"(",
")",
";... | Via this method you can
remove a storage from the system.
It will delete the whole folder of the configuration.
@param pResourceName
@throws TTException
@throws ResourceNotExistingException | [
"Via",
"this",
"method",
"you",
"can",
"remove",
"a",
"storage",
"from",
"the",
"system",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/filelistener/src/main/java/org/treetank/filelistener/file/StorageManager.java#L153-L156 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/serialize/SAXSerializer.java | SAXSerializer.generateElement | private void generateElement(final INodeReadTrx paramRtx) throws TTIOException {
final AttributesImpl atts = new AttributesImpl();
final long key = paramRtx.getNode().getDataKey();
try {
// Process namespace nodes.
for (int i = 0, namesCount = ((ElementNode)paramRtx.getN... | java | private void generateElement(final INodeReadTrx paramRtx) throws TTIOException {
final AttributesImpl atts = new AttributesImpl();
final long key = paramRtx.getNode().getDataKey();
try {
// Process namespace nodes.
for (int i = 0, namesCount = ((ElementNode)paramRtx.getN... | [
"private",
"void",
"generateElement",
"(",
"final",
"INodeReadTrx",
"paramRtx",
")",
"throws",
"TTIOException",
"{",
"final",
"AttributesImpl",
"atts",
"=",
"new",
"AttributesImpl",
"(",
")",
";",
"final",
"long",
"key",
"=",
"paramRtx",
".",
"getNode",
"(",
"... | Generate a start element event.
@param paramRtx
Read Transaction
@throws TTIOException | [
"Generate",
"a",
"start",
"element",
"event",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/serialize/SAXSerializer.java#L166-L209 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/serialize/SAXSerializer.java | SAXSerializer.generateText | private void generateText(final INodeReadTrx paramRtx) {
try {
mContHandler.characters(paramRtx.getValueOfCurrentNode().toCharArray(), 0, paramRtx
.getValueOfCurrentNode().length());
} catch (final SAXException exc) {
exc.printStackTrace();
}
} | java | private void generateText(final INodeReadTrx paramRtx) {
try {
mContHandler.characters(paramRtx.getValueOfCurrentNode().toCharArray(), 0, paramRtx
.getValueOfCurrentNode().length());
} catch (final SAXException exc) {
exc.printStackTrace();
}
} | [
"private",
"void",
"generateText",
"(",
"final",
"INodeReadTrx",
"paramRtx",
")",
"{",
"try",
"{",
"mContHandler",
".",
"characters",
"(",
"paramRtx",
".",
"getValueOfCurrentNode",
"(",
")",
".",
"toCharArray",
"(",
")",
",",
"0",
",",
"paramRtx",
".",
"getV... | Generate a text event.
@param mRtx
Read Transaction. | [
"Generate",
"a",
"text",
"event",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/serialize/SAXSerializer.java#L217-L224 | train |
Bedework/bw-util | bw-util-jmx/src/main/java/org/bedework/util/jmx/MBeanUtil.java | MBeanUtil.getMBean | @SuppressWarnings("unchecked")
public static Object getMBean(final Class c,
final String name) throws Throwable {
final MBeanServer server = getMbeanServer();
// return MBeanProxyExt.create(c, name, server);
return JMX.newMBeanProxy(server, new ObjectName(name), c);
} | java | @SuppressWarnings("unchecked")
public static Object getMBean(final Class c,
final String name) throws Throwable {
final MBeanServer server = getMbeanServer();
// return MBeanProxyExt.create(c, name, server);
return JMX.newMBeanProxy(server, new ObjectName(name), c);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Object",
"getMBean",
"(",
"final",
"Class",
"c",
",",
"final",
"String",
"name",
")",
"throws",
"Throwable",
"{",
"final",
"MBeanServer",
"server",
"=",
"getMbeanServer",
"(",
")",
";",
... | Create a proxy to the given mbean
@param c
@param name
@return proxy to the mbean
@throws Throwable | [
"Create",
"a",
"proxy",
"to",
"the",
"given",
"mbean"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-jmx/src/main/java/org/bedework/util/jmx/MBeanUtil.java#L44-L51 | train |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/jaxrx/JettyServer.java | JettyServer.register | public static void register(final Server s) {
final ServletHolder sh = new ServletHolder(ServletContainer.class);
sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass",
"com.sun.jersey.api.core.PackagesResourceConfig");
sh.setInitParameter("com.sun.jersey.config.pr... | java | public static void register(final Server s) {
final ServletHolder sh = new ServletHolder(ServletContainer.class);
sh.setInitParameter("com.sun.jersey.config.property.resourceConfigClass",
"com.sun.jersey.api.core.PackagesResourceConfig");
sh.setInitParameter("com.sun.jersey.config.pr... | [
"public",
"static",
"void",
"register",
"(",
"final",
"Server",
"s",
")",
"{",
"final",
"ServletHolder",
"sh",
"=",
"new",
"ServletHolder",
"(",
"ServletContainer",
".",
"class",
")",
";",
"sh",
".",
"setInitParameter",
"(",
"\"com.sun.jersey.config.property.resou... | Constructor, attaching JAX-RX to the specified server.
@param s
server instance | [
"Constructor",
"attaching",
"JAX",
"-",
"RX",
"to",
"the",
"specified",
"server",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/JettyServer.java#L70-L77 | train |
sebastiangraf/treetank | coremodules/core/src/main/java/org/treetank/access/BucketReadTrx.java | BucketReadTrx.getData | public IData getData(final long pDataKey) throws TTIOException {
checkArgument(pDataKey >= 0);
checkState(!mClose, "Transaction already closed");
// Calculate bucket and data part for given datakey.
final long seqBucketKey = pDataKey >> IConstants.INDIRECT_BUCKET_COUNT[3];
final ... | java | public IData getData(final long pDataKey) throws TTIOException {
checkArgument(pDataKey >= 0);
checkState(!mClose, "Transaction already closed");
// Calculate bucket and data part for given datakey.
final long seqBucketKey = pDataKey >> IConstants.INDIRECT_BUCKET_COUNT[3];
final ... | [
"public",
"IData",
"getData",
"(",
"final",
"long",
"pDataKey",
")",
"throws",
"TTIOException",
"{",
"checkArgument",
"(",
"pDataKey",
">=",
"0",
")",
";",
"checkState",
"(",
"!",
"mClose",
",",
"\"Transaction already closed\"",
")",
";",
"// Calculate bucket and ... | Getting the data related to the given data key.
@param pDataKey
searched for
@return the related data
@throws TTIOException
if the read to the persistent storage fails | [
"Getting",
"the",
"data",
"related",
"to",
"the",
"given",
"data",
"key",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/core/src/main/java/org/treetank/access/BucketReadTrx.java#L132-L157 | train |
sebastiangraf/treetank | coremodules/core/src/main/java/org/treetank/access/BucketReadTrx.java | BucketReadTrx.close | public boolean close() throws TTIOException {
if (!mClose) {
mSession.deregisterBucketTrx(this);
mBucketReader.close();
mClose = true;
return true;
} else {
return false;
}
} | java | public boolean close() throws TTIOException {
if (!mClose) {
mSession.deregisterBucketTrx(this);
mBucketReader.close();
mClose = true;
return true;
} else {
return false;
}
} | [
"public",
"boolean",
"close",
"(",
")",
"throws",
"TTIOException",
"{",
"if",
"(",
"!",
"mClose",
")",
"{",
"mSession",
".",
"deregisterBucketTrx",
"(",
"this",
")",
";",
"mBucketReader",
".",
"close",
"(",
")",
";",
"mClose",
"=",
"true",
";",
"return",... | Closing this Readtransaction.
@throws TTIOException
if the closing to the persistent storage fails. | [
"Closing",
"this",
"Readtransaction",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/core/src/main/java/org/treetank/access/BucketReadTrx.java#L165-L175 | train |
sebastiangraf/treetank | coremodules/core/src/main/java/org/treetank/access/BucketReadTrx.java | BucketReadTrx.getSnapshotBuckets | protected final List<DataBucket> getSnapshotBuckets(final long pSeqDataBucketKey) throws TTIOException {
// Return Value, since the revision iterates a flexible number of version, this has to be a list
// first.
final List<DataBucket> dataBuckets = new ArrayList<DataBucket>();
// Getti... | java | protected final List<DataBucket> getSnapshotBuckets(final long pSeqDataBucketKey) throws TTIOException {
// Return Value, since the revision iterates a flexible number of version, this has to be a list
// first.
final List<DataBucket> dataBuckets = new ArrayList<DataBucket>();
// Getti... | [
"protected",
"final",
"List",
"<",
"DataBucket",
">",
"getSnapshotBuckets",
"(",
"final",
"long",
"pSeqDataBucketKey",
")",
"throws",
"TTIOException",
"{",
"// Return Value, since the revision iterates a flexible number of version, this has to be a list",
"// first.",
"final",
"L... | Dereference data bucket reference.
@param pSeqDataBucketKey
Key of data bucket.
@return Dereferenced bucket.
@throws TTIOException
if something odd happens within the creation process. | [
"Dereference",
"data",
"bucket",
"reference",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/core/src/main/java/org/treetank/access/BucketReadTrx.java#L229-L267 | train |
sebastiangraf/treetank | coremodules/core/src/main/java/org/treetank/access/BucketReadTrx.java | BucketReadTrx.dataBucketOffset | protected static final int dataBucketOffset(final long pDataKey) {
// INDIRECT_BUCKET_COUNT[3] is only taken to get the difference between 2^7 and the actual
// datakey as offset. It has nothing to do with the levels.
final long dataBucketOffset =
(pDataKey - ((pDataKey >> IConstants... | java | protected static final int dataBucketOffset(final long pDataKey) {
// INDIRECT_BUCKET_COUNT[3] is only taken to get the difference between 2^7 and the actual
// datakey as offset. It has nothing to do with the levels.
final long dataBucketOffset =
(pDataKey - ((pDataKey >> IConstants... | [
"protected",
"static",
"final",
"int",
"dataBucketOffset",
"(",
"final",
"long",
"pDataKey",
")",
"{",
"// INDIRECT_BUCKET_COUNT[3] is only taken to get the difference between 2^7 and the actual",
"// datakey as offset. It has nothing to do with the levels.",
"final",
"long",
"dataBuck... | Calculate data bucket offset for a given data key.
@param pDataKey
data key to find offset for.
@return Offset into data bucket. | [
"Calculate",
"data",
"bucket",
"offset",
"for",
"a",
"given",
"data",
"key",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/core/src/main/java/org/treetank/access/BucketReadTrx.java#L276-L282 | train |
sebastiangraf/treetank | coremodules/core/src/main/java/org/treetank/access/BucketReadTrx.java | BucketReadTrx.dereferenceLeafOfTree | protected static final long[] dereferenceLeafOfTree(final IBackendReader pReader, final long pStartKey,
final long pSeqBucketKey) throws TTIOException {
final long[] orderNumber = getOrderNumbers(pSeqBucketKey);
// Initial state pointing to the indirect bucket of level 0.
final long[] ... | java | protected static final long[] dereferenceLeafOfTree(final IBackendReader pReader, final long pStartKey,
final long pSeqBucketKey) throws TTIOException {
final long[] orderNumber = getOrderNumbers(pSeqBucketKey);
// Initial state pointing to the indirect bucket of level 0.
final long[] ... | [
"protected",
"static",
"final",
"long",
"[",
"]",
"dereferenceLeafOfTree",
"(",
"final",
"IBackendReader",
"pReader",
",",
"final",
"long",
"pStartKey",
",",
"final",
"long",
"pSeqBucketKey",
")",
"throws",
"TTIOException",
"{",
"final",
"long",
"[",
"]",
"order... | Find reference pointing to leaf bucket of an indirect tree.
@param pStartKey
Start reference pointing to the indirect tree.
@param pSeqBucketKey
Key to look up in the indirect tree.
@return Reference denoted by key pointing to the leaf bucket.
@throws TTIOException
if something odd happens within the creation process... | [
"Find",
"reference",
"pointing",
"to",
"leaf",
"bucket",
"of",
"an",
"indirect",
"tree",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/core/src/main/java/org/treetank/access/BucketReadTrx.java#L296-L321 | train |
Bedework/bw-util | bw-util-options/src/main/java/org/bedework/util/options/OptionsFactory.java | OptionsFactory.getOptions | public static OptionsI getOptions(final String globalPrefix,
final String appPrefix,
final String optionsFile,
final String outerTagName) throws OptionsException {
try {
Object o = Class.forName(envclas... | java | public static OptionsI getOptions(final String globalPrefix,
final String appPrefix,
final String optionsFile,
final String outerTagName) throws OptionsException {
try {
Object o = Class.forName(envclas... | [
"public",
"static",
"OptionsI",
"getOptions",
"(",
"final",
"String",
"globalPrefix",
",",
"final",
"String",
"appPrefix",
",",
"final",
"String",
"optionsFile",
",",
"final",
"String",
"outerTagName",
")",
"throws",
"OptionsException",
"{",
"try",
"{",
"Object",
... | Obtain and initialise an options object.
@param globalPrefix
@param appPrefix
@param optionsFile - path to file e.g. /properties/calendar/options.xml
@param outerTagName - surrounding tag in options file e.g. bedework-options
@return CalOptionsI
@throws OptionsException | [
"Obtain",
"and",
"initialise",
"an",
"options",
"object",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-options/src/main/java/org/bedework/util/options/OptionsFactory.java#L38-L65 | train |
Bedework/bw-util | bw-util-options/src/main/java/org/bedework/util/options/OptionsFactory.java | OptionsFactory.fromStream | public static Options fromStream(final String globalPrefix,
final String appPrefix,
final String outerTagName,
final InputStream is) throws OptionsException {
Options opts = new Options();
opts.init(globalP... | java | public static Options fromStream(final String globalPrefix,
final String appPrefix,
final String outerTagName,
final InputStream is) throws OptionsException {
Options opts = new Options();
opts.init(globalP... | [
"public",
"static",
"Options",
"fromStream",
"(",
"final",
"String",
"globalPrefix",
",",
"final",
"String",
"appPrefix",
",",
"final",
"String",
"outerTagName",
",",
"final",
"InputStream",
"is",
")",
"throws",
"OptionsException",
"{",
"Options",
"opts",
"=",
"... | Return an object that uses a local set of options parsed from the input stream.
@param globalPrefix
@param appPrefix
@param outerTagName
@param is
@return CalOptions
@throws OptionsException | [
"Return",
"an",
"object",
"that",
"uses",
"a",
"local",
"set",
"of",
"options",
"parsed",
"from",
"the",
"input",
"stream",
"."
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-options/src/main/java/org/bedework/util/options/OptionsFactory.java#L76-L85 | train |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/algorithm/fmes/LabelFMESVisitor.java | LabelFMESVisitor.addLeafLabel | private void addLeafLabel() {
final int nodeKind = mRtx.getNode().getKind();
if (!mLeafLabels.containsKey(nodeKind)) {
mLeafLabels.put(nodeKind, new ArrayList<ITreeData>());
}
mLeafLabels.get(nodeKind).add(mRtx.getNode());
} | java | private void addLeafLabel() {
final int nodeKind = mRtx.getNode().getKind();
if (!mLeafLabels.containsKey(nodeKind)) {
mLeafLabels.put(nodeKind, new ArrayList<ITreeData>());
}
mLeafLabels.get(nodeKind).add(mRtx.getNode());
} | [
"private",
"void",
"addLeafLabel",
"(",
")",
"{",
"final",
"int",
"nodeKind",
"=",
"mRtx",
".",
"getNode",
"(",
")",
".",
"getKind",
"(",
")",
";",
"if",
"(",
"!",
"mLeafLabels",
".",
"containsKey",
"(",
"nodeKind",
")",
")",
"{",
"mLeafLabels",
".",
... | Add leaf node label. | [
"Add",
"leaf",
"node",
"label",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/algorithm/fmes/LabelFMESVisitor.java#L117-L123 | train |
Bedework/bw-util | bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/AbstractFilter.java | AbstractFilter.getGlobals | public FilterGlobals getGlobals(final HttpServletRequest req) {
HttpSession sess = req.getSession();
if (sess == null) {
// We're screwed
return null;
}
Object o = sess.getAttribute(globalsName);
FilterGlobals fg;
if (o == null) {
fg = newFilterGlobals();
sess.setAttri... | java | public FilterGlobals getGlobals(final HttpServletRequest req) {
HttpSession sess = req.getSession();
if (sess == null) {
// We're screwed
return null;
}
Object o = sess.getAttribute(globalsName);
FilterGlobals fg;
if (o == null) {
fg = newFilterGlobals();
sess.setAttri... | [
"public",
"FilterGlobals",
"getGlobals",
"(",
"final",
"HttpServletRequest",
"req",
")",
"{",
"HttpSession",
"sess",
"=",
"req",
".",
"getSession",
"(",
")",
";",
"if",
"(",
"sess",
"==",
"null",
")",
"{",
"// We're screwed",
"return",
"null",
";",
"}",
"O... | Get the globals from the session
@param req
@return globals object | [
"Get",
"the",
"globals",
"from",
"the",
"session"
] | f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad | https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-servlet-filters/src/main/java/org/bedework/util/servlet/filters/AbstractFilter.java#L74-L101 | train |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/jaxrx/resource/XMLResource.java | XMLResource.putResource | @PUT
@Consumes({
MediaType.TEXT_XML, MediaType.APPLICATION_XML
})
public Response putResource(@PathParam(JaxRxConstants.SYSTEM) final String system,
@PathParam(JaxRxConstants.RESOURCE) final String resource, @Context final HttpHeaders headers,
final InputStream xml) {
final ... | java | @PUT
@Consumes({
MediaType.TEXT_XML, MediaType.APPLICATION_XML
})
public Response putResource(@PathParam(JaxRxConstants.SYSTEM) final String system,
@PathParam(JaxRxConstants.RESOURCE) final String resource, @Context final HttpHeaders headers,
final InputStream xml) {
final ... | [
"@",
"PUT",
"@",
"Consumes",
"(",
"{",
"MediaType",
".",
"TEXT_XML",
",",
"MediaType",
".",
"APPLICATION_XML",
"}",
")",
"public",
"Response",
"putResource",
"(",
"@",
"PathParam",
"(",
"JaxRxConstants",
".",
"SYSTEM",
")",
"final",
"String",
"system",
",",
... | This method will be called when a new XML file has to be stored within the
database. The user request will be forwarded to this method. Afterwards it
creates a response message with the 'created' HTTP status code, if the
storing has been successful.
@param system
The associated system with this request.
@param resourc... | [
"This",
"method",
"will",
"be",
"called",
"when",
"a",
"new",
"XML",
"file",
"has",
"to",
"be",
"stored",
"within",
"the",
"database",
".",
"The",
"user",
"request",
"will",
"be",
"forwarded",
"to",
"this",
"method",
".",
"Afterwards",
"it",
"creates",
"... | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/resource/XMLResource.java#L152-L163 | train |
sebastiangraf/treetank | interfacemodules/jax-rx/src/main/java/org/jaxrx/resource/XMLResource.java | XMLResource.deleteResource | @DELETE
public Response deleteResource(@PathParam(JaxRxConstants.SYSTEM) final String system,
@PathParam(JaxRxConstants.RESOURCE) final String resource, @Context final HttpHeaders headers) {
final JaxRx impl = Systems.getInstance(system);
final String info = impl.delete(new ResourcePath(res... | java | @DELETE
public Response deleteResource(@PathParam(JaxRxConstants.SYSTEM) final String system,
@PathParam(JaxRxConstants.RESOURCE) final String resource, @Context final HttpHeaders headers) {
final JaxRx impl = Systems.getInstance(system);
final String info = impl.delete(new ResourcePath(res... | [
"@",
"DELETE",
"public",
"Response",
"deleteResource",
"(",
"@",
"PathParam",
"(",
"JaxRxConstants",
".",
"SYSTEM",
")",
"final",
"String",
"system",
",",
"@",
"PathParam",
"(",
"JaxRxConstants",
".",
"RESOURCE",
")",
"final",
"String",
"resource",
",",
"@",
... | This method will be called when an HTTP client sends a DELETE request to
delete an existing resource.
@param system
The associated system with this request.
@param resource
The name of the existing resource that has to be deleted.
@param headers
HTTP header attributes.
@return The HTTP response code for this call. | [
"This",
"method",
"will",
"be",
"called",
"when",
"an",
"HTTP",
"client",
"sends",
"a",
"DELETE",
"request",
"to",
"delete",
"an",
"existing",
"resource",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/jax-rx/src/main/java/org/jaxrx/resource/XMLResource.java#L177-L184 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/exec/ExecutionHelper.java | ExecutionHelper.getCommandResult | public static InputStream getCommandResult(
CommandLine cmdLine, File dir, int expectedExit,
long timeout, InputStream input) throws IOException {
DefaultExecutor executor = getDefaultExecutor(dir, expectedExit, timeout);
try (ByteArrayOutputStream outStr = new ByteArrayOutputStream()) {
executor.setStrea... | java | public static InputStream getCommandResult(
CommandLine cmdLine, File dir, int expectedExit,
long timeout, InputStream input) throws IOException {
DefaultExecutor executor = getDefaultExecutor(dir, expectedExit, timeout);
try (ByteArrayOutputStream outStr = new ByteArrayOutputStream()) {
executor.setStrea... | [
"public",
"static",
"InputStream",
"getCommandResult",
"(",
"CommandLine",
"cmdLine",
",",
"File",
"dir",
",",
"int",
"expectedExit",
",",
"long",
"timeout",
",",
"InputStream",
"input",
")",
"throws",
"IOException",
"{",
"DefaultExecutor",
"executor",
"=",
"getDe... | Run the given commandline in the given directory and provide the given input to the command.
Also verify that the tool has the expected exit code and does finish in the timeout.
Note: The resulting output is stored in memory, running a command
which prints out a huge amount of data to stdout or stderr will
cause memor... | [
"Run",
"the",
"given",
"commandline",
"in",
"the",
"given",
"directory",
"and",
"provide",
"the",
"given",
"input",
"to",
"the",
"command",
".",
"Also",
"verify",
"that",
"the",
"tool",
"has",
"the",
"expected",
"exit",
"code",
"and",
"does",
"finish",
"in... | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/exec/ExecutionHelper.java#L70-L86 | train |
sebastiangraf/treetank | coremodules/node/src/main/java/org/treetank/data/NodeMetaPageFactory.java | NodeMetaPageFactory.deserializeEntry | public IMetaEntry deserializeEntry(final DataInput pData) throws TTIOException {
try {
final int kind = pData.readInt();
switch (kind) {
case KEY:
return new MetaKey(pData.readInt());
case VALUE:
final int valSize = pData.readInt();... | java | public IMetaEntry deserializeEntry(final DataInput pData) throws TTIOException {
try {
final int kind = pData.readInt();
switch (kind) {
case KEY:
return new MetaKey(pData.readInt());
case VALUE:
final int valSize = pData.readInt();... | [
"public",
"IMetaEntry",
"deserializeEntry",
"(",
"final",
"DataInput",
"pData",
")",
"throws",
"TTIOException",
"{",
"try",
"{",
"final",
"int",
"kind",
"=",
"pData",
".",
"readInt",
"(",
")",
";",
"switch",
"(",
"kind",
")",
"{",
"case",
"KEY",
":",
"re... | Create a meta-entry out of a serialized byte-representation.
@param pData
byte representation.
@return the created metaEntry.
@throws TTIOException
if anything weird happens | [
"Create",
"a",
"meta",
"-",
"entry",
"out",
"of",
"a",
"serialized",
"byte",
"-",
"representation",
"."
] | 9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60 | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/coremodules/node/src/main/java/org/treetank/data/NodeMetaPageFactory.java#L35-L52 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/zip/ZipUtils.java | ZipUtils.isZip | public static boolean isZip(String fileName) {
if (fileName == null) {
return false;
}
String tl = fileName.toLowerCase();
for (String element : ZIP_EXTENSIONS) {
if (tl.endsWith(element)) {
return true;
}
}
return false;
} | java | public static boolean isZip(String fileName) {
if (fileName == null) {
return false;
}
String tl = fileName.toLowerCase();
for (String element : ZIP_EXTENSIONS) {
if (tl.endsWith(element)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isZip",
"(",
"String",
"fileName",
")",
"{",
"if",
"(",
"fileName",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"String",
"tl",
"=",
"fileName",
".",
"toLowerCase",
"(",
")",
";",
"for",
"(",
"String",
"element"... | Determines if the file has an extension known to be a ZIP file,
currently this includes .zip, .jar, .war, .ear, .aar
@param fileName The name of the file to check.
@return True if the filename is of an extension that is a known zip file, false otherwise. | [
"Determines",
"if",
"the",
"file",
"has",
"an",
"extension",
"known",
"to",
"be",
"a",
"ZIP",
"file",
"currently",
"this",
"includes",
".",
"zip",
".",
"jar",
".",
"war",
".",
"ear",
".",
"aar"
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/zip/ZipUtils.java#L63-L75 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/zip/ZipUtils.java | ZipUtils.findZip | public static void findZip(String zipName, InputStream zipInput, FileFilter searchFilter, List<String> results)
throws IOException {
ZipInputStream zin = new ZipInputStream(zipInput);
while (true) {
final ZipEntry en;
try {
en = zin.getNextEntry();
} catch (IOException | IllegalArgumentException e) ... | java | public static void findZip(String zipName, InputStream zipInput, FileFilter searchFilter, List<String> results)
throws IOException {
ZipInputStream zin = new ZipInputStream(zipInput);
while (true) {
final ZipEntry en;
try {
en = zin.getNextEntry();
} catch (IOException | IllegalArgumentException e) ... | [
"public",
"static",
"void",
"findZip",
"(",
"String",
"zipName",
",",
"InputStream",
"zipInput",
",",
"FileFilter",
"searchFilter",
",",
"List",
"<",
"String",
">",
"results",
")",
"throws",
"IOException",
"{",
"ZipInputStream",
"zin",
"=",
"new",
"ZipInputStrea... | Looks in the ZIP file available via zipInput for files matching the provided file-filter,
recursing into sub-ZIP files.
@param zipName Name of the file to read, mainly used for building the resulting pointer into the zip-file
@param zipInput An InputStream which is positioned at the beginning of the zip-file contents
... | [
"Looks",
"in",
"the",
"ZIP",
"file",
"available",
"via",
"zipInput",
"for",
"files",
"matching",
"the",
"provided",
"file",
"-",
"filter",
"recursing",
"into",
"sub",
"-",
"ZIP",
"files",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/zip/ZipUtils.java#L109-L129 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/zip/ZipUtils.java | ZipUtils.getZipContentsRecursive | @SuppressWarnings("resource")
public static InputStream getZipContentsRecursive(final String file) throws IOException {
// return local file directly
int pos = file.indexOf('!');
if (pos == -1) {
if (!new File(file).exists()) {
throw new IOException("File " + file + " does not exist");
}
try {
... | java | @SuppressWarnings("resource")
public static InputStream getZipContentsRecursive(final String file) throws IOException {
// return local file directly
int pos = file.indexOf('!');
if (pos == -1) {
if (!new File(file).exists()) {
throw new IOException("File " + file + " does not exist");
}
try {
... | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"public",
"static",
"InputStream",
"getZipContentsRecursive",
"(",
"final",
"String",
"file",
")",
"throws",
"IOException",
"{",
"// return local file directly",
"int",
"pos",
"=",
"file",
".",
"indexOf",
"(",
"'",
... | Get a stream of the noted file which potentially resides inside ZIP files. An exclamation mark '!'
denotes a zip-entry. ZIP files can be nested inside one another.
e.g.
c:\temp\test.zip!sample.zip!my.zip!somefile.txt
If there is no exclamation mark contained in the file-parameter, an input stream to this file is
ret... | [
"Get",
"a",
"stream",
"of",
"the",
"noted",
"file",
"which",
"potentially",
"resides",
"inside",
"ZIP",
"files",
".",
"An",
"exclamation",
"mark",
"!",
"denotes",
"a",
"zip",
"-",
"entry",
".",
"ZIP",
"files",
"can",
"be",
"nested",
"inside",
"one",
"ano... | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/zip/ZipUtils.java#L151-L214 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/zip/ZipUtils.java | ZipUtils.getZipStringContentsRecursive | public static String getZipStringContentsRecursive(final String file) throws IOException {
// return local file directly
int pos = file.indexOf('!');
if (pos == -1) {
if (!new File(file).exists()) {
throw new IOException("File " + file + " does not exist");
}
try {
try (InputStream str = new Fil... | java | public static String getZipStringContentsRecursive(final String file) throws IOException {
// return local file directly
int pos = file.indexOf('!');
if (pos == -1) {
if (!new File(file).exists()) {
throw new IOException("File " + file + " does not exist");
}
try {
try (InputStream str = new Fil... | [
"public",
"static",
"String",
"getZipStringContentsRecursive",
"(",
"final",
"String",
"file",
")",
"throws",
"IOException",
"{",
"// return local file directly",
"int",
"pos",
"=",
"file",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"pos",
"==",
"-",
... | Get the text-contents of the noted file. An exclamation mark '!' denotes a zip-entry. ZIP files can
be nested inside one another.
e.g.
c:\temp\test.zip!sample.zip!my.zip!somefile.txt
If there is no exclamation mark contained in the file-parameter, an input stream to this file is
returned directly.
means that there ... | [
"Get",
"the",
"text",
"-",
"contents",
"of",
"the",
"noted",
"file",
".",
"An",
"exclamation",
"mark",
"!",
"denotes",
"a",
"zip",
"-",
"entry",
".",
"ZIP",
"files",
"can",
"be",
"nested",
"inside",
"one",
"another",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/zip/ZipUtils.java#L256-L325 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/zip/ZipUtils.java | ZipUtils.extractZip | public static void extractZip(File zip, File toDir) throws IOException{
if(!toDir.exists()) {
throw new IOException("Directory '" + toDir + "' does not exist.");
}
try (ZipFile zipFile = new ZipFile(zip)) {
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {... | java | public static void extractZip(File zip, File toDir) throws IOException{
if(!toDir.exists()) {
throw new IOException("Directory '" + toDir + "' does not exist.");
}
try (ZipFile zipFile = new ZipFile(zip)) {
Enumeration<? extends ZipEntry> entries = zipFile.entries();
while (entries.hasMoreElements()) {... | [
"public",
"static",
"void",
"extractZip",
"(",
"File",
"zip",
",",
"File",
"toDir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"toDir",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Directory '\"",
"+",
"toDir",
"+",
... | Extracts all files in the specified ZIP file and stores them in the
denoted directory. The directory needs to exist before running this method.
Note: nested ZIP files are not extracted here.
@param zip The zip-file to process
@param toDir Target directory, should already exist.
@throws IOException Thrown if files ca... | [
"Extracts",
"all",
"files",
"in",
"the",
"specified",
"ZIP",
"file",
"and",
"stores",
"them",
"in",
"the",
"denoted",
"directory",
".",
"The",
"directory",
"needs",
"to",
"exist",
"before",
"running",
"this",
"method",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/zip/ZipUtils.java#L338-L377 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/zip/ZipUtils.java | ZipUtils.extractZip | public static void extractZip(InputStream zip, final File toDir) throws IOException{
if(!toDir.exists()) {
throw new IOException("Directory '" + toDir + "' does not exist.");
}
// Use the ZipFileVisitor to walk all the entries in the Zip-Stream and create
// directories and files accordingly
new ZipFileVi... | java | public static void extractZip(InputStream zip, final File toDir) throws IOException{
if(!toDir.exists()) {
throw new IOException("Directory '" + toDir + "' does not exist.");
}
// Use the ZipFileVisitor to walk all the entries in the Zip-Stream and create
// directories and files accordingly
new ZipFileVi... | [
"public",
"static",
"void",
"extractZip",
"(",
"InputStream",
"zip",
",",
"final",
"File",
"toDir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"toDir",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Directory '\"",
"+",
... | Extracts all files in the ZIP file passed as InputStream and stores them in the
denoted directory. The directory needs to exist before running this method.
Note: nested ZIP files are not extracted here.
@param zip An {@link InputStream} to read zipped files from
@param toDir Target directory, should already exist.
@... | [
"Extracts",
"all",
"files",
"in",
"the",
"ZIP",
"file",
"passed",
"as",
"InputStream",
"and",
"stores",
"them",
"in",
"the",
"denoted",
"directory",
".",
"The",
"directory",
"needs",
"to",
"exist",
"before",
"running",
"this",
"method",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/zip/ZipUtils.java#L390-L426 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/zip/ZipUtils.java | ZipUtils.replaceInZip | public static void replaceInZip(String zipFile, String data, String encoding) throws IOException {
if(!isFileInZip(zipFile)) {
throw new IOException("Parameter should specify a file inside a ZIP file, but had: " + zipFile);
}
File zip = new File(zipFile.substring(0, zipFile.indexOf(ZIP_DELIMITER)));
String ... | java | public static void replaceInZip(String zipFile, String data, String encoding) throws IOException {
if(!isFileInZip(zipFile)) {
throw new IOException("Parameter should specify a file inside a ZIP file, but had: " + zipFile);
}
File zip = new File(zipFile.substring(0, zipFile.indexOf(ZIP_DELIMITER)));
String ... | [
"public",
"static",
"void",
"replaceInZip",
"(",
"String",
"zipFile",
",",
"String",
"data",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"isFileInZip",
"(",
"zipFile",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"... | Replace the file denoted by the zipFile with the provided data. The zipFile specifies
both the zip and the file inside the zip using '!' as separator.
@param zipFile The zip-file to process
@param data The string-data to replace
@param encoding The encoding that should be used when writing the string data to the file
... | [
"Replace",
"the",
"file",
"denoted",
"by",
"the",
"zipFile",
"with",
"the",
"provided",
"data",
".",
"The",
"zipFile",
"specifies",
"both",
"the",
"zip",
"and",
"the",
"file",
"inside",
"the",
"zip",
"using",
"!",
"as",
"separator",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/zip/ZipUtils.java#L437-L449 | train |
centic9/commons-dost | src/main/java/org/dstadler/commons/zip/ZipUtils.java | ZipUtils.replaceInZip | public static void replaceInZip(File zip, String file, String data, String encoding) throws IOException {
// open the output side
File zipOutFile = File.createTempFile("ZipReplace", ".zip");
try {
FileOutputStream fos = new FileOutputStream(zipOutFile);
try (ZipOutputStream zos = new ZipOutputStream(fos)) {... | java | public static void replaceInZip(File zip, String file, String data, String encoding) throws IOException {
// open the output side
File zipOutFile = File.createTempFile("ZipReplace", ".zip");
try {
FileOutputStream fos = new FileOutputStream(zipOutFile);
try (ZipOutputStream zos = new ZipOutputStream(fos)) {... | [
"public",
"static",
"void",
"replaceInZip",
"(",
"File",
"zip",
",",
"String",
"file",
",",
"String",
"data",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"// open the output side",
"File",
"zipOutFile",
"=",
"File",
".",
"createTempFile",
"(",
... | Replaces the specified file in the provided ZIP file with the
provided content.
@param zip The zip-file to process
@param file The file to look for
@param data The string-data to replace
@param encoding The encoding that should be used when writing the string data to the file
@throws IOException Thrown if files can no... | [
"Replaces",
"the",
"specified",
"file",
"in",
"the",
"provided",
"ZIP",
"file",
"with",
"the",
"provided",
"content",
"."
] | f6fa4e3e0b943ff103f918824319d8abf33d0e0f | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/zip/ZipUtils.java#L461-L509 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/util/GeoUtil.java | GeoUtil.getPosition | public static GeoPosition getPosition(Point2D pixelCoordinate, int zoom, TileFactoryInfo info)
{
// p(" --bitmap to latlon : " + coord + " " + zoom);
double wx = pixelCoordinate.getX();
double wy = pixelCoordinate.getY();
// this reverses getBitmapCoordinates
double flon = (w... | java | public static GeoPosition getPosition(Point2D pixelCoordinate, int zoom, TileFactoryInfo info)
{
// p(" --bitmap to latlon : " + coord + " " + zoom);
double wx = pixelCoordinate.getX();
double wy = pixelCoordinate.getY();
// this reverses getBitmapCoordinates
double flon = (w... | [
"public",
"static",
"GeoPosition",
"getPosition",
"(",
"Point2D",
"pixelCoordinate",
",",
"int",
"zoom",
",",
"TileFactoryInfo",
"info",
")",
"{",
"// p(\" --bitmap to latlon : \" + coord + \" \" + zoom);",
"double",
"wx",
"=",
"pixelCoordinate",
".",
"getX",
"(",
")",
... | Convert an on screen pixel coordinate and a zoom level to a geo position
@param pixelCoordinate the coordinate in pixels
@param zoom the zoom level
@param info the tile factory info
@return a geo position | [
"Convert",
"an",
"on",
"screen",
"pixel",
"coordinate",
"and",
"a",
"zoom",
"level",
"to",
"a",
"geo",
"position"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/util/GeoUtil.java#L123-L136 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/TileFactory.java | TileFactory.pixelToGeo | public GeoPosition pixelToGeo(Point2D pixelCoordinate, int zoom)
{
return GeoUtil.getPosition(pixelCoordinate, zoom, getInfo());
} | java | public GeoPosition pixelToGeo(Point2D pixelCoordinate, int zoom)
{
return GeoUtil.getPosition(pixelCoordinate, zoom, getInfo());
} | [
"public",
"GeoPosition",
"pixelToGeo",
"(",
"Point2D",
"pixelCoordinate",
",",
"int",
"zoom",
")",
"{",
"return",
"GeoUtil",
".",
"getPosition",
"(",
"pixelCoordinate",
",",
"zoom",
",",
"getInfo",
"(",
")",
")",
";",
"}"
] | Convert a pixel in the world bitmap at the specified zoom level into a GeoPosition
@param pixelCoordinate a Point2D representing a pixel in the world bitmap
@param zoom the zoom level of the world bitmap
@return the converted GeoPosition | [
"Convert",
"a",
"pixel",
"in",
"the",
"world",
"bitmap",
"at",
"the",
"specified",
"zoom",
"level",
"into",
"a",
"GeoPosition"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/TileFactory.java#L79-L82 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/TileFactory.java | TileFactory.geoToPixel | public Point2D geoToPixel(GeoPosition c, int zoomLevel)
{
return GeoUtil.getBitmapCoordinate(c, zoomLevel, getInfo());
} | java | public Point2D geoToPixel(GeoPosition c, int zoomLevel)
{
return GeoUtil.getBitmapCoordinate(c, zoomLevel, getInfo());
} | [
"public",
"Point2D",
"geoToPixel",
"(",
"GeoPosition",
"c",
",",
"int",
"zoomLevel",
")",
"{",
"return",
"GeoUtil",
".",
"getBitmapCoordinate",
"(",
"c",
",",
"zoomLevel",
",",
"getInfo",
"(",
")",
")",
";",
"}"
] | Convert a GeoPosition to a pixel position in the world bitmap a the specified zoom level.
@param c a GeoPosition
@param zoomLevel the zoom level to extract the pixel coordinate for
@return the pixel point | [
"Convert",
"a",
"GeoPosition",
"to",
"a",
"pixel",
"position",
"in",
"the",
"world",
"bitmap",
"a",
"the",
"specified",
"zoom",
"level",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/TileFactory.java#L90-L93 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java | JXMapViewer.doPaintComponent | private void doPaintComponent(Graphics g)
{/*
* if (isOpaque() || isDesignTime()) { g.setColor(getBackground()); g.fillRect(0,0,getWidth(),getHeight()); }
*/
if (isDesignTime())
{
// do nothing
}
else
{
int z = getZoom();
... | java | private void doPaintComponent(Graphics g)
{/*
* if (isOpaque() || isDesignTime()) { g.setColor(getBackground()); g.fillRect(0,0,getWidth(),getHeight()); }
*/
if (isDesignTime())
{
// do nothing
}
else
{
int z = getZoom();
... | [
"private",
"void",
"doPaintComponent",
"(",
"Graphics",
"g",
")",
"{",
"/*\r\n * if (isOpaque() || isDesignTime()) { g.setColor(getBackground()); g.fillRect(0,0,getWidth(),getHeight()); }\r\n */",
"if",
"(",
"isDesignTime",
"(",
")",
")",
"{",
"// do nothing\r",
"}",
"els... | the method that does the actual painting | [
"the",
"method",
"that",
"does",
"the",
"actual",
"painting"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java#L155-L173 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java | JXMapViewer.setZoom | public void setZoom(int zoom)
{
if (zoom == this.zoomLevel)
{
return;
}
TileFactoryInfo info = getTileFactory().getInfo();
// don't repaint if we are out of the valid zoom levels
if (info != null && (zoom < info.getMinimumZoomLevel() || zoom > in... | java | public void setZoom(int zoom)
{
if (zoom == this.zoomLevel)
{
return;
}
TileFactoryInfo info = getTileFactory().getInfo();
// don't repaint if we are out of the valid zoom levels
if (info != null && (zoom < info.getMinimumZoomLevel() || zoom > in... | [
"public",
"void",
"setZoom",
"(",
"int",
"zoom",
")",
"{",
"if",
"(",
"zoom",
"==",
"this",
".",
"zoomLevel",
")",
"{",
"return",
";",
"}",
"TileFactoryInfo",
"info",
"=",
"getTileFactory",
"(",
")",
".",
"getInfo",
"(",
")",
";",
"// don't repaint if we... | Set the current zoom level
@param zoom the new zoom level | [
"Set",
"the",
"current",
"zoom",
"level"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java#L383-L410 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java | JXMapViewer.setAddressLocation | public void setAddressLocation(GeoPosition addressLocation)
{
GeoPosition old = getAddressLocation();
this.addressLocation = addressLocation;
setCenter(getTileFactory().geoToPixel(addressLocation, getZoom()));
firePropertyChange("addressLocation", old, getAddressLocation());
... | java | public void setAddressLocation(GeoPosition addressLocation)
{
GeoPosition old = getAddressLocation();
this.addressLocation = addressLocation;
setCenter(getTileFactory().geoToPixel(addressLocation, getZoom()));
firePropertyChange("addressLocation", old, getAddressLocation());
... | [
"public",
"void",
"setAddressLocation",
"(",
"GeoPosition",
"addressLocation",
")",
"{",
"GeoPosition",
"old",
"=",
"getAddressLocation",
"(",
")",
";",
"this",
".",
"addressLocation",
"=",
"addressLocation",
";",
"setCenter",
"(",
"getTileFactory",
"(",
")",
".",... | Gets the current address location of the map
@param addressLocation the new address location | [
"Gets",
"the",
"current",
"address",
"location",
"of",
"the",
"map"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java#L435-L443 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java | JXMapViewer.setDrawTileBorders | public void setDrawTileBorders(boolean drawTileBorders)
{
boolean old = isDrawTileBorders();
this.drawTileBorders = drawTileBorders;
firePropertyChange("drawTileBorders", old, isDrawTileBorders());
repaint();
} | java | public void setDrawTileBorders(boolean drawTileBorders)
{
boolean old = isDrawTileBorders();
this.drawTileBorders = drawTileBorders;
firePropertyChange("drawTileBorders", old, isDrawTileBorders());
repaint();
} | [
"public",
"void",
"setDrawTileBorders",
"(",
"boolean",
"drawTileBorders",
")",
"{",
"boolean",
"old",
"=",
"isDrawTileBorders",
"(",
")",
";",
"this",
".",
"drawTileBorders",
"=",
"drawTileBorders",
";",
"firePropertyChange",
"(",
"\"drawTileBorders\"",
",",
"old",... | Set if the tile borders should be drawn. Mainly used for debugging.
@param drawTileBorders new value of this drawTileBorders | [
"Set",
"if",
"the",
"tile",
"borders",
"should",
"be",
"drawn",
".",
"Mainly",
"used",
"for",
"debugging",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java#L468-L474 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java | JXMapViewer.setCenterPosition | public void setCenterPosition(GeoPosition geoPosition)
{
GeoPosition oldVal = getCenterPosition();
setCenter(getTileFactory().geoToPixel(geoPosition, zoomLevel));
repaint();
GeoPosition newVal = getCenterPosition();
firePropertyChange("centerPosition", oldVal, newVal);
... | java | public void setCenterPosition(GeoPosition geoPosition)
{
GeoPosition oldVal = getCenterPosition();
setCenter(getTileFactory().geoToPixel(geoPosition, zoomLevel));
repaint();
GeoPosition newVal = getCenterPosition();
firePropertyChange("centerPosition", oldVal, newVal);
... | [
"public",
"void",
"setCenterPosition",
"(",
"GeoPosition",
"geoPosition",
")",
"{",
"GeoPosition",
"oldVal",
"=",
"getCenterPosition",
"(",
")",
";",
"setCenter",
"(",
"getTileFactory",
"(",
")",
".",
"geoToPixel",
"(",
"geoPosition",
",",
"zoomLevel",
")",
")",... | A property indicating the center position of the map
@param geoPosition the new property value | [
"A",
"property",
"indicating",
"the",
"center",
"position",
"of",
"the",
"map"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java#L480-L487 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java | JXMapViewer.setCenter | public void setCenter(Point2D center)
{
Point2D old = this.getCenter();
double centerX = center.getX();
double centerY = center.getY();
Dimension mapSize = getTileFactory().getMapSize(getZoom());
int mapHeight = (int) mapSize.getHeight() * getTileFactory().getTileSi... | java | public void setCenter(Point2D center)
{
Point2D old = this.getCenter();
double centerX = center.getX();
double centerY = center.getY();
Dimension mapSize = getTileFactory().getMapSize(getZoom());
int mapHeight = (int) mapSize.getHeight() * getTileFactory().getTileSi... | [
"public",
"void",
"setCenter",
"(",
"Point2D",
"center",
")",
"{",
"Point2D",
"old",
"=",
"this",
".",
"getCenter",
"(",
")",
";",
"double",
"centerX",
"=",
"center",
".",
"getX",
"(",
")",
";",
"double",
"centerY",
"=",
"center",
".",
"getY",
"(",
"... | Sets the new center of the map in pixel coordinates.
@param center the new center of the map in pixel coordinates | [
"Sets",
"the",
"new",
"center",
"of",
"the",
"map",
"in",
"pixel",
"coordinates",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java#L558-L631 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java | JXMapViewer.calculateZoomFrom | public void calculateZoomFrom(Set<GeoPosition> positions)
{
// u.p("calculating a zoom based on: ");
// u.p(positions);
if (positions.size() < 2)
{
return;
}
int zoom = getZoom();
Rectangle2D rect = generateBoundingRect(positions, zoom);... | java | public void calculateZoomFrom(Set<GeoPosition> positions)
{
// u.p("calculating a zoom based on: ");
// u.p(positions);
if (positions.size() < 2)
{
return;
}
int zoom = getZoom();
Rectangle2D rect = generateBoundingRect(positions, zoom);... | [
"public",
"void",
"calculateZoomFrom",
"(",
"Set",
"<",
"GeoPosition",
">",
"positions",
")",
"{",
"// u.p(\"calculating a zoom based on: \");\r",
"// u.p(positions);\r",
"if",
"(",
"positions",
".",
"size",
"(",
")",
"<",
"2",
")",
"{",
"return",
";",
"}",
"int... | Calculates a zoom level so that all points in the specified set will be visible on screen. This is useful if you
have a bunch of points in an area like a city and you want to zoom out so that the entire city and it's points
are visible without panning.
@param positions A set of GeoPositions to calculate the new zoom fr... | [
"Calculates",
"a",
"zoom",
"level",
"so",
"that",
"all",
"points",
"in",
"the",
"specified",
"set",
"will",
"be",
"visible",
"on",
"screen",
".",
"This",
"is",
"useful",
"if",
"you",
"have",
"a",
"bunch",
"of",
"points",
"in",
"an",
"area",
"like",
"a"... | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java#L639-L676 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java | JXMapViewer.zoomToBestFit | public void zoomToBestFit(Set<GeoPosition> positions, double maxFraction)
{
if (positions.isEmpty())
return;
if (maxFraction <= 0 || maxFraction > 1)
throw new IllegalArgumentException("maxFraction must be between 0 and 1");
TileFactory tileFactory = getTile... | java | public void zoomToBestFit(Set<GeoPosition> positions, double maxFraction)
{
if (positions.isEmpty())
return;
if (maxFraction <= 0 || maxFraction > 1)
throw new IllegalArgumentException("maxFraction must be between 0 and 1");
TileFactory tileFactory = getTile... | [
"public",
"void",
"zoomToBestFit",
"(",
"Set",
"<",
"GeoPosition",
">",
"positions",
",",
"double",
"maxFraction",
")",
"{",
"if",
"(",
"positions",
".",
"isEmpty",
"(",
")",
")",
"return",
";",
"if",
"(",
"maxFraction",
"<=",
"0",
"||",
"maxFraction",
"... | Zoom and center the map to a best fit around the input GeoPositions.
Best fit is defined as the most zoomed-in possible view where both
the width and height of a bounding box around the positions take up
no more than maxFraction of the viewport width or height respectively.
@param positions A set of GeoPositions to cal... | [
"Zoom",
"and",
"center",
"the",
"map",
"to",
"a",
"best",
"fit",
"around",
"the",
"input",
"GeoPositions",
".",
"Best",
"fit",
"is",
"defined",
"as",
"the",
"most",
"zoomed",
"-",
"in",
"possible",
"view",
"where",
"both",
"the",
"width",
"and",
"height"... | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java#L686-L727 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java | JXMapViewer.convertPointToGeoPosition | public GeoPosition convertPointToGeoPosition(Point2D pt)
{
// convert from local to world bitmap
Rectangle bounds = getViewportBounds();
Point2D pt2 = new Point2D.Double(pt.getX() + bounds.getX(), pt.getY() + bounds.getY());
// convert from world bitmap to geo
GeoPosi... | java | public GeoPosition convertPointToGeoPosition(Point2D pt)
{
// convert from local to world bitmap
Rectangle bounds = getViewportBounds();
Point2D pt2 = new Point2D.Double(pt.getX() + bounds.getX(), pt.getY() + bounds.getY());
// convert from world bitmap to geo
GeoPosi... | [
"public",
"GeoPosition",
"convertPointToGeoPosition",
"(",
"Point2D",
"pt",
")",
"{",
"// convert from local to world bitmap\r",
"Rectangle",
"bounds",
"=",
"getViewportBounds",
"(",
")",
";",
"Point2D",
"pt2",
"=",
"new",
"Point2D",
".",
"Double",
"(",
"pt",
".",
... | Converts the specified Point2D in the JXMapViewer's local coordinate space to a GeoPosition on the map. This
method is especially useful for determining the GeoPosition under the mouse cursor.
@param pt a point in the local coordinate space of the map
@return the point converted to a GeoPosition | [
"Converts",
"the",
"specified",
"Point2D",
"in",
"the",
"JXMapViewer",
"s",
"local",
"coordinate",
"space",
"to",
"a",
"GeoPosition",
"on",
"the",
"map",
".",
"This",
"method",
"is",
"especially",
"useful",
"for",
"determining",
"the",
"GeoPosition",
"under",
... | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapViewer.java#L857-L866 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/TileCache.java | TileCache.put | public void put(URI uri, byte[] bimg, BufferedImage img)
{
synchronized (bytemap)
{
while (bytesize > 1000 * 1000 * 50)
{
URI olduri = bytemapAccessQueue.removeFirst();
byte[] oldbimg = bytemap.remove(olduri);
bytesize -= oldbim... | java | public void put(URI uri, byte[] bimg, BufferedImage img)
{
synchronized (bytemap)
{
while (bytesize > 1000 * 1000 * 50)
{
URI olduri = bytemapAccessQueue.removeFirst();
byte[] oldbimg = bytemap.remove(olduri);
bytesize -= oldbim... | [
"public",
"void",
"put",
"(",
"URI",
"uri",
",",
"byte",
"[",
"]",
"bimg",
",",
"BufferedImage",
"img",
")",
"{",
"synchronized",
"(",
"bytemap",
")",
"{",
"while",
"(",
"bytesize",
">",
"1000",
"*",
"1000",
"*",
"50",
")",
"{",
"URI",
"olduri",
"=... | Put a tile image into the cache. This puts both a buffered image and array of bytes that make up the compressed
image.
@param uri URI of image that is being stored in the cache
@param bimg bytes of the compressed image, ie: the image file that was loaded over the network
@param img image to store in the cache | [
"Put",
"a",
"tile",
"image",
"into",
"the",
"cache",
".",
"This",
"puts",
"both",
"a",
"buffered",
"image",
"and",
"array",
"of",
"bytes",
"that",
"make",
"up",
"the",
"compressed",
"image",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/TileCache.java#L54-L71 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/AbstractTileFactory.java | AbstractTileFactory.getService | protected synchronized ExecutorService getService()
{
if (service == null)
{
// System.out.println("creating an executor service with a threadpool of size " + threadPoolSize);
service = Executors.newFixedThreadPool(threadPoolSize, new ThreadFactory()
{
... | java | protected synchronized ExecutorService getService()
{
if (service == null)
{
// System.out.println("creating an executor service with a threadpool of size " + threadPoolSize);
service = Executors.newFixedThreadPool(threadPoolSize, new ThreadFactory()
{
... | [
"protected",
"synchronized",
"ExecutorService",
"getService",
"(",
")",
"{",
"if",
"(",
"service",
"==",
"null",
")",
"{",
"// System.out.println(\"creating an executor service with a threadpool of size \" + threadPoolSize);",
"service",
"=",
"Executors",
".",
"newFixedThreadPo... | Subclasses may override this method to provide their own executor services. This method will be called each time
a tile needs to be loaded. Implementations should cache the ExecutorService when possible.
@return ExecutorService to load tiles with | [
"Subclasses",
"may",
"override",
"this",
"method",
"to",
"provide",
"their",
"own",
"executor",
"services",
".",
"This",
"method",
"will",
"be",
"called",
"each",
"time",
"a",
"tile",
"needs",
"to",
"be",
"loaded",
".",
"Implementations",
"should",
"cache",
... | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/AbstractTileFactory.java#L196-L216 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/AbstractTileFactory.java | AbstractTileFactory.setUserAgent | public void setUserAgent(String userAgent) {
if (userAgent == null || userAgent.isEmpty()) {
throw new IllegalArgumentException("User agent can't be null or empty.");
}
this.userAgent = userAgent;
} | java | public void setUserAgent(String userAgent) {
if (userAgent == null || userAgent.isEmpty()) {
throw new IllegalArgumentException("User agent can't be null or empty.");
}
this.userAgent = userAgent;
} | [
"public",
"void",
"setUserAgent",
"(",
"String",
"userAgent",
")",
"{",
"if",
"(",
"userAgent",
"==",
"null",
"||",
"userAgent",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"User agent can't be null or empty.\"",
")",
"... | Set the User agent that will be used when making a tile request.
Some tile server usage policies requires application to identify itself,
so please make sure that it is set properly.
@param userAgent User agent to be used. | [
"Set",
"the",
"User",
"agent",
"that",
"will",
"be",
"used",
"when",
"making",
"a",
"tile",
"request",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/AbstractTileFactory.java#L252-L258 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/AbstractTileFactory.java | AbstractTileFactory.promote | public synchronized void promote(Tile tile)
{
if (tileQueue.contains(tile))
{
try
{
tileQueue.remove(tile);
tile.setPriority(Tile.Priority.High);
tileQueue.put(tile);
}
catch (Exception ex)
{
... | java | public synchronized void promote(Tile tile)
{
if (tileQueue.contains(tile))
{
try
{
tileQueue.remove(tile);
tile.setPriority(Tile.Priority.High);
tileQueue.put(tile);
}
catch (Exception ex)
{
... | [
"public",
"synchronized",
"void",
"promote",
"(",
"Tile",
"tile",
")",
"{",
"if",
"(",
"tileQueue",
".",
"contains",
"(",
"tile",
")",
")",
"{",
"try",
"{",
"tileQueue",
".",
"remove",
"(",
"tile",
")",
";",
"tile",
".",
"setPriority",
"(",
"Tile",
"... | Increase the priority of this tile so it will be loaded sooner.
@param tile the tile | [
"Increase",
"the",
"priority",
"of",
"this",
"tile",
"so",
"it",
"will",
"be",
"loaded",
"sooner",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/AbstractTileFactory.java#L296-L311 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/painter/AbstractPainter.java | AbstractPainter.getFilters | public final BufferedImageOp[] getFilters() {
BufferedImageOp[] results = new BufferedImageOp[filters.length];
System.arraycopy(filters, 0, results, 0, results.length);
return results;
} | java | public final BufferedImageOp[] getFilters() {
BufferedImageOp[] results = new BufferedImageOp[filters.length];
System.arraycopy(filters, 0, results, 0, results.length);
return results;
} | [
"public",
"final",
"BufferedImageOp",
"[",
"]",
"getFilters",
"(",
")",
"{",
"BufferedImageOp",
"[",
"]",
"results",
"=",
"new",
"BufferedImageOp",
"[",
"filters",
".",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"filters",
",",
"0",
",",
"results... | A defensive copy of the Effects to apply to the results
of the AbstractPainter's painting operation. The array may
be empty but it will never be null.
@return the array of filters applied to this painter | [
"A",
"defensive",
"copy",
"of",
"the",
"Effects",
"to",
"apply",
"to",
"the",
"results",
"of",
"the",
"AbstractPainter",
"s",
"painting",
"operation",
".",
"The",
"array",
"may",
"be",
"empty",
"but",
"it",
"will",
"never",
"be",
"null",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/painter/AbstractPainter.java#L127-L131 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/painter/AbstractPainter.java | AbstractPainter.setAntialiasing | public void setAntialiasing(boolean value) {
boolean old = isAntialiasing();
antialiasing = value;
if (old != value) setDirty(true);
firePropertyChange("antialiasing", old, isAntialiasing());
} | java | public void setAntialiasing(boolean value) {
boolean old = isAntialiasing();
antialiasing = value;
if (old != value) setDirty(true);
firePropertyChange("antialiasing", old, isAntialiasing());
} | [
"public",
"void",
"setAntialiasing",
"(",
"boolean",
"value",
")",
"{",
"boolean",
"old",
"=",
"isAntialiasing",
"(",
")",
";",
"antialiasing",
"=",
"value",
";",
"if",
"(",
"old",
"!=",
"value",
")",
"setDirty",
"(",
"true",
")",
";",
"firePropertyChange"... | Sets the antialiasing setting. This is a bound property.
@param value the new antialiasing setting | [
"Sets",
"the",
"antialiasing",
"setting",
".",
"This",
"is",
"a",
"bound",
"property",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/painter/AbstractPainter.java#L163-L168 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/painter/AbstractPainter.java | AbstractPainter.setInterpolation | public void setInterpolation(Interpolation value) {
Object old = getInterpolation();
this.interpolation = value == null ? Interpolation.NearestNeighbor : value;
if (old != value) setDirty(true);
firePropertyChange("interpolation", old, getInterpolation());
} | java | public void setInterpolation(Interpolation value) {
Object old = getInterpolation();
this.interpolation = value == null ? Interpolation.NearestNeighbor : value;
if (old != value) setDirty(true);
firePropertyChange("interpolation", old, getInterpolation());
} | [
"public",
"void",
"setInterpolation",
"(",
"Interpolation",
"value",
")",
"{",
"Object",
"old",
"=",
"getInterpolation",
"(",
")",
";",
"this",
".",
"interpolation",
"=",
"value",
"==",
"null",
"?",
"Interpolation",
".",
"NearestNeighbor",
":",
"value",
";",
... | Sets a new value for the interpolation setting. This setting determines if interpolation
should be used when drawing scaled images. @see java.awt.RenderingHints.KEY_INTERPOLATION.
@param value the new interpolation setting | [
"Sets",
"a",
"new",
"value",
"for",
"the",
"interpolation",
"setting",
".",
"This",
"setting",
"determines",
"if",
"interpolation",
"should",
"be",
"used",
"when",
"drawing",
"scaled",
"images",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/painter/AbstractPainter.java#L184-L189 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/painter/AbstractPainter.java | AbstractPainter.setDirty | protected void setDirty(boolean d) {
boolean old = isDirty();
this.dirty = d;
firePropertyChange("dirty", old, isDirty());
if (isDirty()) {
clearCache();
}
} | java | protected void setDirty(boolean d) {
boolean old = isDirty();
this.dirty = d;
firePropertyChange("dirty", old, isDirty());
if (isDirty()) {
clearCache();
}
} | [
"protected",
"void",
"setDirty",
"(",
"boolean",
"d",
")",
"{",
"boolean",
"old",
"=",
"isDirty",
"(",
")",
";",
"this",
".",
"dirty",
"=",
"d",
";",
"firePropertyChange",
"(",
"\"dirty\"",
",",
"old",
",",
"isDirty",
"(",
")",
")",
";",
"if",
"(",
... | Sets the dirty bit. If true, then the painter is considered dirty, and the cache
will be cleared. This property is bound.
@param d whether this <code>Painter</code> is dirty. | [
"Sets",
"the",
"dirty",
"bit",
".",
"If",
"true",
"then",
"the",
"painter",
"is",
"considered",
"dirty",
"and",
"the",
"cache",
"will",
"be",
"cleared",
".",
"This",
"property",
"is",
"bound",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/painter/AbstractPainter.java#L308-L315 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/painter/CompoundPainter.java | CompoundPainter.addPainter | public void addPainter(Painter<T> painter)
{
Collection<Painter<T>> old = new ArrayList<Painter<T>>(getPainters());
this.painters.add(painter);
if (painter instanceof AbstractPainter)
{
((AbstractPainter<?>) painter).addPropertyChangeListener(handler... | java | public void addPainter(Painter<T> painter)
{
Collection<Painter<T>> old = new ArrayList<Painter<T>>(getPainters());
this.painters.add(painter);
if (painter instanceof AbstractPainter)
{
((AbstractPainter<?>) painter).addPropertyChangeListener(handler... | [
"public",
"void",
"addPainter",
"(",
"Painter",
"<",
"T",
">",
"painter",
")",
"{",
"Collection",
"<",
"Painter",
"<",
"T",
">>",
"old",
"=",
"new",
"ArrayList",
"<",
"Painter",
"<",
"T",
">",
">",
"(",
"getPainters",
"(",
")",
")",
";",
"this",
".... | Adds a painter to the queue of painters
@param painter the painter that is added | [
"Adds",
"a",
"painter",
"to",
"the",
"queue",
"of",
"painters"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/painter/CompoundPainter.java#L211-L224 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/painter/CompoundPainter.java | CompoundPainter.removePainter | public void removePainter(Painter<T> painter)
{
Collection<Painter<T>> old = new ArrayList<Painter<T>>(getPainters());
this.painters.remove(painter);
if (painter instanceof AbstractPainter)
{
((AbstractPainter<?>) painter).removePropertyChangeListener(ha... | java | public void removePainter(Painter<T> painter)
{
Collection<Painter<T>> old = new ArrayList<Painter<T>>(getPainters());
this.painters.remove(painter);
if (painter instanceof AbstractPainter)
{
((AbstractPainter<?>) painter).removePropertyChangeListener(ha... | [
"public",
"void",
"removePainter",
"(",
"Painter",
"<",
"T",
">",
"painter",
")",
"{",
"Collection",
"<",
"Painter",
"<",
"T",
">>",
"old",
"=",
"new",
"ArrayList",
"<",
"Painter",
"<",
"T",
">",
">",
"(",
"getPainters",
"(",
")",
")",
";",
"this",
... | Removes a painter from the queue of painters
@param painter the painter that is added | [
"Removes",
"a",
"painter",
"from",
"the",
"queue",
"of",
"painters"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/painter/CompoundPainter.java#L230-L243 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/painter/CompoundPainter.java | CompoundPainter.setClipPreserved | public void setClipPreserved(boolean shouldRestoreState)
{
boolean oldShouldRestoreState = isClipPreserved();
this.clipPreserved = shouldRestoreState;
setDirty(true);
firePropertyChange("clipPreserved", oldShouldRestoreState, shouldRestoreState);
} | java | public void setClipPreserved(boolean shouldRestoreState)
{
boolean oldShouldRestoreState = isClipPreserved();
this.clipPreserved = shouldRestoreState;
setDirty(true);
firePropertyChange("clipPreserved", oldShouldRestoreState, shouldRestoreState);
} | [
"public",
"void",
"setClipPreserved",
"(",
"boolean",
"shouldRestoreState",
")",
"{",
"boolean",
"oldShouldRestoreState",
"=",
"isClipPreserved",
"(",
")",
";",
"this",
".",
"clipPreserved",
"=",
"shouldRestoreState",
";",
"setDirty",
"(",
"true",
")",
";",
"fireP... | Sets if the clip should be preserved.
Normally the clip will be reset between each painter. Setting clipPreserved to
true can be used to let one painter mask other painters that come after it.
@param shouldRestoreState new value of the clipPreserved property
@see #isClipPreserved() | [
"Sets",
"if",
"the",
"clip",
"should",
"be",
"preserved",
".",
"Normally",
"the",
"clip",
"will",
"be",
"reset",
"between",
"each",
"painter",
".",
"Setting",
"clipPreserved",
"to",
"true",
"can",
"be",
"used",
"to",
"let",
"one",
"painter",
"mask",
"other... | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/painter/CompoundPainter.java#L276-L282 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/painter/CompoundPainter.java | CompoundPainter.setTransform | public void setTransform(AffineTransform transform)
{
AffineTransform old = getTransform();
this.transform = transform;
setDirty(true);
firePropertyChange("transform", old, transform);
} | java | public void setTransform(AffineTransform transform)
{
AffineTransform old = getTransform();
this.transform = transform;
setDirty(true);
firePropertyChange("transform", old, transform);
} | [
"public",
"void",
"setTransform",
"(",
"AffineTransform",
"transform",
")",
"{",
"AffineTransform",
"old",
"=",
"getTransform",
"(",
")",
";",
"this",
".",
"transform",
"=",
"transform",
";",
"setDirty",
"(",
"true",
")",
";",
"firePropertyChange",
"(",
"\"tra... | Set a transform to be applied to all painters contained in this CompoundPainter
@param transform a new AffineTransform | [
"Set",
"a",
"transform",
"to",
"be",
"applied",
"to",
"all",
"painters",
"contained",
"in",
"this",
"CompoundPainter"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/painter/CompoundPainter.java#L297-L303 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/empty/EmptyTileFactory.java | EmptyTileFactory.getTile | @Override
public Tile getTile(int x, int y, int zoom)
{
return new Tile(x, y, zoom)
{
@Override
public synchronized boolean isLoaded()
{
return true;
}
@Override
public BufferedImage getImage()
{... | java | @Override
public Tile getTile(int x, int y, int zoom)
{
return new Tile(x, y, zoom)
{
@Override
public synchronized boolean isLoaded()
{
return true;
}
@Override
public BufferedImage getImage()
{... | [
"@",
"Override",
"public",
"Tile",
"getTile",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"zoom",
")",
"{",
"return",
"new",
"Tile",
"(",
"x",
",",
"y",
",",
"zoom",
")",
"{",
"@",
"Override",
"public",
"synchronized",
"boolean",
"isLoaded",
"(",
... | Gets an instance of an empty tile for the given tile position and zoom on the world map.
@param x The tile's x position on the world map.
@param y The tile's y position on the world map.
@param zoom The current zoom level. | [
"Gets",
"an",
"instance",
"of",
"an",
"empty",
"tile",
"for",
"the",
"given",
"tile",
"position",
"and",
"zoom",
"on",
"the",
"world",
"map",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/empty/EmptyTileFactory.java#L67-L85 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/LocalResponseCache.java | LocalResponseCache.installResponseCache | @Deprecated
public static void installResponseCache(String baseURL, File cacheDir, boolean checkForUpdates)
{
ResponseCache.setDefault(new LocalResponseCache(baseURL, cacheDir, checkForUpdates));
} | java | @Deprecated
public static void installResponseCache(String baseURL, File cacheDir, boolean checkForUpdates)
{
ResponseCache.setDefault(new LocalResponseCache(baseURL, cacheDir, checkForUpdates));
} | [
"@",
"Deprecated",
"public",
"static",
"void",
"installResponseCache",
"(",
"String",
"baseURL",
",",
"File",
"cacheDir",
",",
"boolean",
"checkForUpdates",
")",
"{",
"ResponseCache",
".",
"setDefault",
"(",
"new",
"LocalResponseCache",
"(",
"baseURL",
",",
"cache... | Sets this cache as default response cache
@param baseURL the URL, the caching should be restricted to or <code>null</code> for none
@param cacheDir the cache directory
@param checkForUpdates true if the URL is queried for newer versions of a file first
@deprecated Use {@link TileFactory#setLocalCache(LocalCache)} inste... | [
"Sets",
"this",
"cache",
"as",
"default",
"response",
"cache"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/LocalResponseCache.java#L55-L59 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapKit.java | JXMapKit.setZoom | public void setZoom(int zoom)
{
zoomChanging = true;
mainMap.setZoom(zoom);
miniMap.setZoom(mainMap.getZoom() + 4);
if (sliderReversed)
{
zoomSlider.setValue(zoomSlider.getMaximum() - zoom);
}
else
{
zoomSlider.setVal... | java | public void setZoom(int zoom)
{
zoomChanging = true;
mainMap.setZoom(zoom);
miniMap.setZoom(mainMap.getZoom() + 4);
if (sliderReversed)
{
zoomSlider.setValue(zoomSlider.getMaximum() - zoom);
}
else
{
zoomSlider.setVal... | [
"public",
"void",
"setZoom",
"(",
"int",
"zoom",
")",
"{",
"zoomChanging",
"=",
"true",
";",
"mainMap",
".",
"setZoom",
"(",
"zoom",
")",
";",
"miniMap",
".",
"setZoom",
"(",
"mainMap",
".",
"getZoom",
"(",
")",
"+",
"4",
")",
";",
"if",
"(",
"slid... | Set the current zoomlevel for the main map. The minimap will be updated accordingly
@param zoom the new zoom level | [
"Set",
"the",
"current",
"zoomlevel",
"for",
"the",
"main",
"map",
".",
"The",
"minimap",
"will",
"be",
"updated",
"accordingly"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapKit.java#L233-L247 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapKit.java | JXMapKit.getZoomOutAction | public Action getZoomOutAction()
{
Action act = new AbstractAction()
{
/**
*
*/
private static final long serialVersionUID = 5525706163434375107L;
@Override
public void actionPerformed(ActionEvent e)
{
... | java | public Action getZoomOutAction()
{
Action act = new AbstractAction()
{
/**
*
*/
private static final long serialVersionUID = 5525706163434375107L;
@Override
public void actionPerformed(ActionEvent e)
{
... | [
"public",
"Action",
"getZoomOutAction",
"(",
")",
"{",
"Action",
"act",
"=",
"new",
"AbstractAction",
"(",
")",
"{",
"/**\r\n *\r\n */",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"5525706163434375107L",
";",
"@",
"Override"... | Returns an action which can be attached to buttons or menu items to make the map zoom out
@return a preconfigured Zoom Out action | [
"Returns",
"an",
"action",
"which",
"can",
"be",
"attached",
"to",
"buttons",
"or",
"menu",
"items",
"to",
"make",
"the",
"map",
"zoom",
"out"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapKit.java#L253-L270 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapKit.java | JXMapKit.setMiniMapVisible | public void setMiniMapVisible(boolean miniMapVisible)
{
boolean old = this.isMiniMapVisible();
this.miniMapVisible = miniMapVisible;
miniMap.setVisible(miniMapVisible);
firePropertyChange("miniMapVisible", old, this.isMiniMapVisible());
} | java | public void setMiniMapVisible(boolean miniMapVisible)
{
boolean old = this.isMiniMapVisible();
this.miniMapVisible = miniMapVisible;
miniMap.setVisible(miniMapVisible);
firePropertyChange("miniMapVisible", old, this.isMiniMapVisible());
} | [
"public",
"void",
"setMiniMapVisible",
"(",
"boolean",
"miniMapVisible",
")",
"{",
"boolean",
"old",
"=",
"this",
".",
"isMiniMapVisible",
"(",
")",
";",
"this",
".",
"miniMapVisible",
"=",
"miniMapVisible",
";",
"miniMap",
".",
"setVisible",
"(",
"miniMapVisibl... | Sets if the mini-map should be visible
@param miniMapVisible a new value for the miniMap property | [
"Sets",
"if",
"the",
"mini",
"-",
"map",
"should",
"be",
"visible"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapKit.java#L447-L453 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapKit.java | JXMapKit.setZoomSliderVisible | public void setZoomSliderVisible(boolean zoomSliderVisible)
{
boolean old = this.isZoomSliderVisible();
this.zoomSliderVisible = zoomSliderVisible;
zoomSlider.setVisible(zoomSliderVisible);
firePropertyChange("zoomSliderVisible", old, this.isZoomSliderVisible());
} | java | public void setZoomSliderVisible(boolean zoomSliderVisible)
{
boolean old = this.isZoomSliderVisible();
this.zoomSliderVisible = zoomSliderVisible;
zoomSlider.setVisible(zoomSliderVisible);
firePropertyChange("zoomSliderVisible", old, this.isZoomSliderVisible());
} | [
"public",
"void",
"setZoomSliderVisible",
"(",
"boolean",
"zoomSliderVisible",
")",
"{",
"boolean",
"old",
"=",
"this",
".",
"isZoomSliderVisible",
"(",
")",
";",
"this",
".",
"zoomSliderVisible",
"=",
"zoomSliderVisible",
";",
"zoomSlider",
".",
"setVisible",
"("... | Sets if the zoom slider should be visible
@param zoomSliderVisible the new value of the zoomSliderVisible property | [
"Sets",
"if",
"the",
"zoom",
"slider",
"should",
"be",
"visible"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapKit.java#L468-L474 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapKit.java | JXMapKit.setZoomButtonsVisible | public void setZoomButtonsVisible(boolean zoomButtonsVisible)
{
boolean old = this.isZoomButtonsVisible();
this.zoomButtonsVisible = zoomButtonsVisible;
zoomInButton.setVisible(zoomButtonsVisible);
zoomOutButton.setVisible(zoomButtonsVisible);
firePropertyChange("zoomBu... | java | public void setZoomButtonsVisible(boolean zoomButtonsVisible)
{
boolean old = this.isZoomButtonsVisible();
this.zoomButtonsVisible = zoomButtonsVisible;
zoomInButton.setVisible(zoomButtonsVisible);
zoomOutButton.setVisible(zoomButtonsVisible);
firePropertyChange("zoomBu... | [
"public",
"void",
"setZoomButtonsVisible",
"(",
"boolean",
"zoomButtonsVisible",
")",
"{",
"boolean",
"old",
"=",
"this",
".",
"isZoomButtonsVisible",
"(",
")",
";",
"this",
".",
"zoomButtonsVisible",
"=",
"zoomButtonsVisible",
";",
"zoomInButton",
".",
"setVisible"... | Sets if the zoom buttons should be visible. This ia bound property. Changes can be listened for using a
PropertyChaneListener
@param zoomButtonsVisible new value of the zoomButtonsVisible property | [
"Sets",
"if",
"the",
"zoom",
"buttons",
"should",
"be",
"visible",
".",
"This",
"ia",
"bound",
"property",
".",
"Changes",
"can",
"be",
"listened",
"for",
"using",
"a",
"PropertyChaneListener"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapKit.java#L491-L498 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/JXMapKit.java | JXMapKit.setTileFactory | public void setTileFactory(TileFactory fact)
{
mainMap.setTileFactory(fact);
mainMap.setZoom(fact.getInfo().getDefaultZoomLevel());
mainMap.setCenterPosition(new GeoPosition(0, 0));
miniMap.setTileFactory(fact);
miniMap.setZoom(fact.getInfo().getDefaultZoomLevel() + 3);... | java | public void setTileFactory(TileFactory fact)
{
mainMap.setTileFactory(fact);
mainMap.setZoom(fact.getInfo().getDefaultZoomLevel());
mainMap.setCenterPosition(new GeoPosition(0, 0));
miniMap.setTileFactory(fact);
miniMap.setZoom(fact.getInfo().getDefaultZoomLevel() + 3);... | [
"public",
"void",
"setTileFactory",
"(",
"TileFactory",
"fact",
")",
"{",
"mainMap",
".",
"setTileFactory",
"(",
"fact",
")",
";",
"mainMap",
".",
"setZoom",
"(",
"fact",
".",
"getInfo",
"(",
")",
".",
"getDefaultZoomLevel",
"(",
")",
")",
";",
"mainMap",
... | Sets the tile factory for both embedded JXMapViewer components. Calling this method will also reset the center
and zoom levels of both maps, as well as the bounds of the zoom slider.
@param fact the new TileFactory | [
"Sets",
"the",
"tile",
"factory",
"for",
"both",
"embedded",
"JXMapViewer",
"components",
".",
"Calling",
"this",
"method",
"will",
"also",
"reset",
"the",
"center",
"and",
"zoom",
"levels",
"of",
"both",
"maps",
"as",
"well",
"as",
"the",
"bounds",
"of",
... | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/JXMapKit.java#L505-L515 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/cache/FileBasedLocalCache.java | FileBasedLocalCache.getLocalFile | public File getLocalFile(URL remoteUri)
{
StringBuilder sb = new StringBuilder();
String host = remoteUri.getHost();
String query = remoteUri.getQuery();
String path = remoteUri.getPath();
if (host != null)
{
sb.append(host);
}
... | java | public File getLocalFile(URL remoteUri)
{
StringBuilder sb = new StringBuilder();
String host = remoteUri.getHost();
String query = remoteUri.getQuery();
String path = remoteUri.getPath();
if (host != null)
{
sb.append(host);
}
... | [
"public",
"File",
"getLocalFile",
"(",
"URL",
"remoteUri",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"String",
"host",
"=",
"remoteUri",
".",
"getHost",
"(",
")",
";",
"String",
"query",
"=",
"remoteUri",
".",
"getQuery",... | Returns the local File corresponding to the given remote URI.
@param remoteUri the remote URI
@return the corresponding local file | [
"Returns",
"the",
"local",
"File",
"corresponding",
"to",
"the",
"given",
"remote",
"URI",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/cache/FileBasedLocalCache.java#L78-L123 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/DefaultWaypoint.java | DefaultWaypoint.setPosition | public void setPosition(GeoPosition coordinate)
{
GeoPosition old = getPosition();
this.position = coordinate;
firePropertyChange("position", old, getPosition());
} | java | public void setPosition(GeoPosition coordinate)
{
GeoPosition old = getPosition();
this.position = coordinate;
firePropertyChange("position", old, getPosition());
} | [
"public",
"void",
"setPosition",
"(",
"GeoPosition",
"coordinate",
")",
"{",
"GeoPosition",
"old",
"=",
"getPosition",
"(",
")",
";",
"this",
".",
"position",
"=",
"coordinate",
";",
"firePropertyChange",
"(",
"\"position\"",
",",
"old",
",",
"getPosition",
"(... | Set a new GeoPosition for this Waypoint
@param coordinate a new position | [
"Set",
"a",
"new",
"GeoPosition",
"for",
"this",
"Waypoint"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/DefaultWaypoint.java#L56-L61 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/wms/WMSService.java | WMSService.toWMSURL | public String toWMSURL(int x, int y, int zoom, int tileSize)
{
String format = "image/jpeg";
String styles = "";
String srs = "EPSG:4326";
int ts = tileSize;
int circumference = widthOfWorldInPixels(zoom, tileSize);
double radius = circumference / (2 * Math.PI);
... | java | public String toWMSURL(int x, int y, int zoom, int tileSize)
{
String format = "image/jpeg";
String styles = "";
String srs = "EPSG:4326";
int ts = tileSize;
int circumference = widthOfWorldInPixels(zoom, tileSize);
double radius = circumference / (2 * Math.PI);
... | [
"public",
"String",
"toWMSURL",
"(",
"int",
"x",
",",
"int",
"y",
",",
"int",
"zoom",
",",
"int",
"tileSize",
")",
"{",
"String",
"format",
"=",
"\"image/jpeg\"",
";",
"String",
"styles",
"=",
"\"\"",
";",
"String",
"srs",
"=",
"\"EPSG:4326\"",
";",
"i... | Convertes to a WMS URL
@param x the x coordinate
@param y the y coordinate
@param zoom the zomm factor
@param tileSize the tile size
@return a URL request string | [
"Convertes",
"to",
"a",
"WMS",
"URL"
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/wms/WMSService.java#L53-L71 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/util/GraphicsUtilities.java | GraphicsUtilities.convertToBufferedImage | public static BufferedImage convertToBufferedImage(Image img) {
BufferedImage buff = createCompatibleTranslucentImage(
img.getWidth(null), img.getHeight(null));
Graphics2D g2 = buff.createGraphics();
try {
g2.drawImage(img, 0, 0, null);
} finally {
... | java | public static BufferedImage convertToBufferedImage(Image img) {
BufferedImage buff = createCompatibleTranslucentImage(
img.getWidth(null), img.getHeight(null));
Graphics2D g2 = buff.createGraphics();
try {
g2.drawImage(img, 0, 0, null);
} finally {
... | [
"public",
"static",
"BufferedImage",
"convertToBufferedImage",
"(",
"Image",
"img",
")",
"{",
"BufferedImage",
"buff",
"=",
"createCompatibleTranslucentImage",
"(",
"img",
".",
"getWidth",
"(",
"null",
")",
",",
"img",
".",
"getHeight",
"(",
"null",
")",
")",
... | Converts the specified image into a compatible buffered image.
@param img
the image to convert
@return a compatible buffered image of the input | [
"Converts",
"the",
"specified",
"image",
"into",
"a",
"compatible",
"buffered",
"image",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/util/GraphicsUtilities.java#L116-L128 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/util/GraphicsUtilities.java | GraphicsUtilities.clear | public static void clear(Image img) {
Graphics g = img.getGraphics();
try {
if (g instanceof Graphics2D) {
((Graphics2D) g).setComposite(AlphaComposite.Clear);
} else {
g.setColor(new Color(0, 0, 0, 0));
}
... | java | public static void clear(Image img) {
Graphics g = img.getGraphics();
try {
if (g instanceof Graphics2D) {
((Graphics2D) g).setComposite(AlphaComposite.Clear);
} else {
g.setColor(new Color(0, 0, 0, 0));
}
... | [
"public",
"static",
"void",
"clear",
"(",
"Image",
"img",
")",
"{",
"Graphics",
"g",
"=",
"img",
".",
"getGraphics",
"(",
")",
";",
"try",
"{",
"if",
"(",
"g",
"instanceof",
"Graphics2D",
")",
"{",
"(",
"(",
"Graphics2D",
")",
"g",
")",
".",
"setCo... | Clears the data from the image.
@param img
the image to erase | [
"Clears",
"the",
"data",
"from",
"the",
"image",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/util/GraphicsUtilities.java#L757-L771 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/util/GraphicsUtilities.java | GraphicsUtilities.tileStretchPaint | public static void tileStretchPaint(Graphics g,
JComponent comp,
BufferedImage img,
Insets ins) {
int left = ins.left;
int right = ins.right;
int top = ins.top;
int bottom = ins.bottom;
// top
g.drawImage(... | java | public static void tileStretchPaint(Graphics g,
JComponent comp,
BufferedImage img,
Insets ins) {
int left = ins.left;
int right = ins.right;
int top = ins.top;
int bottom = ins.bottom;
// top
g.drawImage(... | [
"public",
"static",
"void",
"tileStretchPaint",
"(",
"Graphics",
"g",
",",
"JComponent",
"comp",
",",
"BufferedImage",
"img",
",",
"Insets",
"ins",
")",
"{",
"int",
"left",
"=",
"ins",
".",
"left",
";",
"int",
"right",
"=",
"ins",
".",
"right",
";",
"i... | Draws an image on top of a component by doing a 3x3 grid stretch of the image
using the specified insets.
@param g the graphics object
@param comp the component
@param img the image
@param ins the insets | [
"Draws",
"an",
"image",
"on",
"top",
"of",
"a",
"component",
"by",
"doing",
"a",
"3x3",
"grid",
"stretch",
"of",
"the",
"image",
"using",
"the",
"specified",
"insets",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/util/GraphicsUtilities.java#L801-L870 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/input/MapClickListener.java | MapClickListener.mouseClicked | @Override
public void mouseClicked(MouseEvent evt) {
final boolean left = SwingUtilities.isLeftMouseButton(evt);
final boolean singleClick = (evt.getClickCount() == 1);
if ((left && singleClick)) {
Rectangle bounds = viewer.getViewportBounds();
int x = bounds.x + evt... | java | @Override
public void mouseClicked(MouseEvent evt) {
final boolean left = SwingUtilities.isLeftMouseButton(evt);
final boolean singleClick = (evt.getClickCount() == 1);
if ((left && singleClick)) {
Rectangle bounds = viewer.getViewportBounds();
int x = bounds.x + evt... | [
"@",
"Override",
"public",
"void",
"mouseClicked",
"(",
"MouseEvent",
"evt",
")",
"{",
"final",
"boolean",
"left",
"=",
"SwingUtilities",
".",
"isLeftMouseButton",
"(",
"evt",
")",
";",
"final",
"boolean",
"singleClick",
"=",
"(",
"evt",
".",
"getClickCount",
... | Gets called on mouseClicked events, calculates the GeoPosition and fires
the mapClicked method that the extending class needs to implement.
@param evt the mouse event | [
"Gets",
"called",
"on",
"mouseClicked",
"events",
"calculates",
"the",
"GeoPosition",
"and",
"fires",
"the",
"mapClicked",
"method",
"that",
"the",
"extending",
"class",
"needs",
"to",
"implement",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/input/MapClickListener.java#L39-L51 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/GeoBounds.java | GeoBounds.setRect | private void setRect(double minLat, double minLng, double maxLat, double maxLng)
{
if (!(minLat < maxLat))
{
throw new IllegalArgumentException("GeoBounds is not valid - minLat must be less that maxLat.");
}
if (!(minLng < maxLng))
{
if (minLng > 0 && ... | java | private void setRect(double minLat, double minLng, double maxLat, double maxLng)
{
if (!(minLat < maxLat))
{
throw new IllegalArgumentException("GeoBounds is not valid - minLat must be less that maxLat.");
}
if (!(minLng < maxLng))
{
if (minLng > 0 && ... | [
"private",
"void",
"setRect",
"(",
"double",
"minLat",
",",
"double",
"minLng",
",",
"double",
"maxLat",
",",
"double",
"maxLng",
")",
"{",
"if",
"(",
"!",
"(",
"minLat",
"<",
"maxLat",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"G... | Sets the internal rectangle representation.
@param minLat The minimum latitude.
@param minLng The minimum longitude.
@param maxLat The maximum latitude.
@param maxLng The maximum longitude. | [
"Sets",
"the",
"internal",
"rectangle",
"representation",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/GeoBounds.java#L62-L90 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/GeoBounds.java | GeoBounds.intersects | public boolean intersects(GeoBounds other)
{
boolean rv = false;
for (Rectangle2D r1 : rects)
{
for (Rectangle2D r2 : other.rects)
{
rv = r1.intersects(r2);
if (rv)
{
break;
}
... | java | public boolean intersects(GeoBounds other)
{
boolean rv = false;
for (Rectangle2D r1 : rects)
{
for (Rectangle2D r2 : other.rects)
{
rv = r1.intersects(r2);
if (rv)
{
break;
}
... | [
"public",
"boolean",
"intersects",
"(",
"GeoBounds",
"other",
")",
"{",
"boolean",
"rv",
"=",
"false",
";",
"for",
"(",
"Rectangle2D",
"r1",
":",
"rects",
")",
"{",
"for",
"(",
"Rectangle2D",
"r2",
":",
"other",
".",
"rects",
")",
"{",
"rv",
"=",
"r1... | Determines if this bounds intersects the other bounds.
@param other The other bounds to test for intersection with.
@return Returns true if bounds intersect. | [
"Determines",
"if",
"this",
"bounds",
"intersects",
"the",
"other",
"bounds",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/GeoBounds.java#L97-L117 | train |
msteiger/jxmapviewer2 | jxmapviewer2/src/main/java/org/jxmapviewer/viewer/GeoBounds.java | GeoBounds.getSouthEast | public GeoPosition getSouthEast()
{
Rectangle2D r = rects[0];
if (rects.length > 1)
{
r = rects[1];
}
return new GeoPosition(r.getY(), r.getMaxX());
} | java | public GeoPosition getSouthEast()
{
Rectangle2D r = rects[0];
if (rects.length > 1)
{
r = rects[1];
}
return new GeoPosition(r.getY(), r.getMaxX());
} | [
"public",
"GeoPosition",
"getSouthEast",
"(",
")",
"{",
"Rectangle2D",
"r",
"=",
"rects",
"[",
"0",
"]",
";",
"if",
"(",
"rects",
".",
"length",
">",
"1",
")",
"{",
"r",
"=",
"rects",
"[",
"1",
"]",
";",
"}",
"return",
"new",
"GeoPosition",
"(",
... | Gets the south east position.
@return Returns the south east position. | [
"Gets",
"the",
"south",
"east",
"position",
"."
] | 82639273b0aac983b6026fb90aa925c0cf596410 | https://github.com/msteiger/jxmapviewer2/blob/82639273b0aac983b6026fb90aa925c0cf596410/jxmapviewer2/src/main/java/org/jxmapviewer/viewer/GeoBounds.java#L132-L140 | train |
zhangyingwei/cockroach | cockroach-core/src/main/java/com/zhangyingwei/cockroach/executer/ExecuterManager.java | ExecuterManager.bindListener | public ExecuterManager bindListener(Class<? extends IExecutersListener> listener) throws IllegalAccessException, InstantiationException {
if (listener != null) {
this.executerListeners.add(listener.newInstance());
}
return this;
} | java | public ExecuterManager bindListener(Class<? extends IExecutersListener> listener) throws IllegalAccessException, InstantiationException {
if (listener != null) {
this.executerListeners.add(listener.newInstance());
}
return this;
} | [
"public",
"ExecuterManager",
"bindListener",
"(",
"Class",
"<",
"?",
"extends",
"IExecutersListener",
">",
"listener",
")",
"throws",
"IllegalAccessException",
",",
"InstantiationException",
"{",
"if",
"(",
"listener",
"!=",
"null",
")",
"{",
"this",
".",
"execute... | bind executer listener
@param listener
@return | [
"bind",
"executer",
"listener"
] | a8139dea1b4e3e6ec2451520cb9f7700ff0f704e | https://github.com/zhangyingwei/cockroach/blob/a8139dea1b4e3e6ec2451520cb9f7700ff0f704e/cockroach-core/src/main/java/com/zhangyingwei/cockroach/executer/ExecuterManager.java#L105-L110 | train |
zhangyingwei/cockroach | cockroach-core/src/main/java/com/zhangyingwei/cockroach/common/utils/FileUtils.java | FileUtils.save | public static void save(byte[] bytes,String filePath,String fileName) throws IOException {
Path path = Paths.get(filePath, fileName);
mkirDirs(path.getParent());
String pathStr = path.toString();
File file = new File(pathStr);
write(bytes,file);
} | java | public static void save(byte[] bytes,String filePath,String fileName) throws IOException {
Path path = Paths.get(filePath, fileName);
mkirDirs(path.getParent());
String pathStr = path.toString();
File file = new File(pathStr);
write(bytes,file);
} | [
"public",
"static",
"void",
"save",
"(",
"byte",
"[",
"]",
"bytes",
",",
"String",
"filePath",
",",
"String",
"fileName",
")",
"throws",
"IOException",
"{",
"Path",
"path",
"=",
"Paths",
".",
"get",
"(",
"filePath",
",",
"fileName",
")",
";",
"mkirDirs",... | save bytes into file
@param bytes
@param filePath
@param fileName
@throws IOException | [
"save",
"bytes",
"into",
"file"
] | a8139dea1b4e3e6ec2451520cb9f7700ff0f704e | https://github.com/zhangyingwei/cockroach/blob/a8139dea1b4e3e6ec2451520cb9f7700ff0f704e/cockroach-core/src/main/java/com/zhangyingwei/cockroach/common/utils/FileUtils.java#L28-L34 | train |
zhangyingwei/cockroach | cockroach-core/src/main/java/com/zhangyingwei/cockroach/common/utils/FileUtils.java | FileUtils.write | public static void write(byte[] bytes,File file) throws IOException {
BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(file));
outputStream.write(bytes);
outputStream.close();
} | java | public static void write(byte[] bytes,File file) throws IOException {
BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(file));
outputStream.write(bytes);
outputStream.close();
} | [
"public",
"static",
"void",
"write",
"(",
"byte",
"[",
"]",
"bytes",
",",
"File",
"file",
")",
"throws",
"IOException",
"{",
"BufferedOutputStream",
"outputStream",
"=",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"file",
")",
")",
";",... | wtire bytes into file
@param bytes
@param file
@throws IOException | [
"wtire",
"bytes",
"into",
"file"
] | a8139dea1b4e3e6ec2451520cb9f7700ff0f704e | https://github.com/zhangyingwei/cockroach/blob/a8139dea1b4e3e6ec2451520cb9f7700ff0f704e/cockroach-core/src/main/java/com/zhangyingwei/cockroach/common/utils/FileUtils.java#L52-L56 | train |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/UnsignedUtils.java | UnsignedUtils.forDigit | public static char forDigit(int digit, int radix) {
if (digit >= 0 && digit < radix && radix >= Character.MIN_RADIX && radix <= MAX_RADIX) {
return digits[digit];
}
return '\u0000';
} | java | public static char forDigit(int digit, int radix) {
if (digit >= 0 && digit < radix && radix >= Character.MIN_RADIX && radix <= MAX_RADIX) {
return digits[digit];
}
return '\u0000';
} | [
"public",
"static",
"char",
"forDigit",
"(",
"int",
"digit",
",",
"int",
"radix",
")",
"{",
"if",
"(",
"digit",
">=",
"0",
"&&",
"digit",
"<",
"radix",
"&&",
"radix",
">=",
"Character",
".",
"MIN_RADIX",
"&&",
"radix",
"<=",
"MAX_RADIX",
")",
"{",
"r... | Determines the character representation for a specific digit in the
specified radix.
Note: If the value of radix is not a valid radix, or the value of digit
is not a valid digit in the specified radix, the null character
('\u0000') is returned.
@param digit
@param radix
@return | [
"Determines",
"the",
"character",
"representation",
"for",
"a",
"specific",
"digit",
"in",
"the",
"specified",
"radix",
"."
] | 734f0e77321d41eeca78a557be9884df9874e46e | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/UnsignedUtils.java#L76-L81 | train |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/RequestResponse.java | RequestResponse.setRequestData | public RequestResponse setRequestData(Object requestData) {
this.requestData = requestData;
requestJson = requestData != null
? (requestData instanceof JsonNode ? (JsonNode) requestData
: SerializationUtils.toJson(requestData))
: null;
retu... | java | public RequestResponse setRequestData(Object requestData) {
this.requestData = requestData;
requestJson = requestData != null
? (requestData instanceof JsonNode ? (JsonNode) requestData
: SerializationUtils.toJson(requestData))
: null;
retu... | [
"public",
"RequestResponse",
"setRequestData",
"(",
"Object",
"requestData",
")",
"{",
"this",
".",
"requestData",
"=",
"requestData",
";",
"requestJson",
"=",
"requestData",
"!=",
"null",
"?",
"(",
"requestData",
"instanceof",
"JsonNode",
"?",
"(",
"JsonNode",
... | HTTP request body.
@param requestData
@return | [
"HTTP",
"request",
"body",
"."
] | 734f0e77321d41eeca78a557be9884df9874e46e | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/RequestResponse.java#L202-L209 | train |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/RequestResponse.java | RequestResponse.setResponseData | public RequestResponse setResponseData(byte[] responseData) {
this.responseData = responseData;
try {
responseJson = responseData != null ? SerializationUtils.readJson(responseData) : null;
} catch (Exception e) {
responseJson = null;
LOGGER.error(e.getMessage... | java | public RequestResponse setResponseData(byte[] responseData) {
this.responseData = responseData;
try {
responseJson = responseData != null ? SerializationUtils.readJson(responseData) : null;
} catch (Exception e) {
responseJson = null;
LOGGER.error(e.getMessage... | [
"public",
"RequestResponse",
"setResponseData",
"(",
"byte",
"[",
"]",
"responseData",
")",
"{",
"this",
".",
"responseData",
"=",
"responseData",
";",
"try",
"{",
"responseJson",
"=",
"responseData",
"!=",
"null",
"?",
"SerializationUtils",
".",
"readJson",
"("... | Raw HTTP response data.
@param responseData
@return | [
"Raw",
"HTTP",
"response",
"data",
"."
] | 734f0e77321d41eeca78a557be9884df9874e46e | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/jsonrpc/RequestResponse.java#L298-L307 | train |
RestExpress/PluginExpress | metrics/src/main/java/com/strategicgains/restexpress/plugin/metrics/LogOutputFactory.java | LogOutputFactory.create | public String create(Request request, Response response, Long duration)
{
return createStringBuilder(request, response, duration).toString();
} | java | public String create(Request request, Response response, Long duration)
{
return createStringBuilder(request, response, duration).toString();
} | [
"public",
"String",
"create",
"(",
"Request",
"request",
",",
"Response",
"response",
",",
"Long",
"duration",
")",
"{",
"return",
"createStringBuilder",
"(",
"request",
",",
"response",
",",
"duration",
")",
".",
"toString",
"(",
")",
";",
"}"
] | Creates a string suitable for logging output.
@param request a RestExpress Request instance.
@param response a RestExpress Response instance.
@param duration the duration of the request, in milliseconds.
@return a String as described above. | [
"Creates",
"a",
"string",
"suitable",
"for",
"logging",
"output",
"."
] | aeb13907c23bf31ef2b2b17ae4c0ca4a6f5bee69 | https://github.com/RestExpress/PluginExpress/blob/aeb13907c23bf31ef2b2b17ae4c0ca4a6f5bee69/metrics/src/main/java/com/strategicgains/restexpress/plugin/metrics/LogOutputFactory.java#L116-L119 | train |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/IdGenerator.java | IdGenerator.getMacAddr | public static long getMacAddr() {
if (macAddr == 0) {
try {
InetAddress ip = InetAddress.getLocalHost();
NetworkInterface network = NetworkInterface.getByInetAddress(ip);
byte[] mac = network.getHardwareAddress();
for (byte temp : mac) ... | java | public static long getMacAddr() {
if (macAddr == 0) {
try {
InetAddress ip = InetAddress.getLocalHost();
NetworkInterface network = NetworkInterface.getByInetAddress(ip);
byte[] mac = network.getHardwareAddress();
for (byte temp : mac) ... | [
"public",
"static",
"long",
"getMacAddr",
"(",
")",
"{",
"if",
"(",
"macAddr",
"==",
"0",
")",
"{",
"try",
"{",
"InetAddress",
"ip",
"=",
"InetAddress",
".",
"getLocalHost",
"(",
")",
";",
"NetworkInterface",
"network",
"=",
"NetworkInterface",
".",
"getBy... | Returns host's MAC address.
@return | [
"Returns",
"host",
"s",
"MAC",
"address",
"."
] | 734f0e77321d41eeca78a557be9884df9874e46e | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/IdGenerator.java#L35-L49 | train |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/IdGenerator.java | IdGenerator.waitTillNextMillisec | public static long waitTillNextMillisec(long currentMillisec) {
long nextMillisec = System.currentTimeMillis();
for (; nextMillisec <= currentMillisec; nextMillisec = System.currentTimeMillis()) {
Thread.yield();
}
return nextMillisec;
} | java | public static long waitTillNextMillisec(long currentMillisec) {
long nextMillisec = System.currentTimeMillis();
for (; nextMillisec <= currentMillisec; nextMillisec = System.currentTimeMillis()) {
Thread.yield();
}
return nextMillisec;
} | [
"public",
"static",
"long",
"waitTillNextMillisec",
"(",
"long",
"currentMillisec",
")",
"{",
"long",
"nextMillisec",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"for",
"(",
";",
"nextMillisec",
"<=",
"currentMillisec",
";",
"nextMillisec",
"=",
"Sys... | Waits till clock moves to the next millisecond.
@param currentMillisec
@return the "next" millisecond | [
"Waits",
"till",
"clock",
"moves",
"to",
"the",
"next",
"millisecond",
"."
] | 734f0e77321d41eeca78a557be9884df9874e46e | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/IdGenerator.java#L164-L170 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.