id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
7,600 | rhiot/rhiot | gateway/components/camel-kura/src/main/java/io/rhiot/component/kura/router/RhiotKuraRouter.java | RhiotKuraRouter.start | @Override
public void start(BundleContext bundleContext) throws Exception {
try {
super.start(bundleContext);
} catch (Throwable e) {
String errorMessage = "Problem when starting Kura module " + getClass().getName() + ":";
log.warn(errorMessage, e);
// Print error to the Kura console.
System.err.println(errorMessage);
e.printStackTrace();
throw e;
}
} | java | @Override
public void start(BundleContext bundleContext) throws Exception {
try {
super.start(bundleContext);
} catch (Throwable e) {
String errorMessage = "Problem when starting Kura module " + getClass().getName() + ":";
log.warn(errorMessage, e);
// Print error to the Kura console.
System.err.println(errorMessage);
e.printStackTrace();
throw e;
}
} | [
"@",
"Override",
"public",
"void",
"start",
"(",
"BundleContext",
"bundleContext",
")",
"throws",
"Exception",
"{",
"try",
"{",
"super",
".",
"start",
"(",
"bundleContext",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"String",
"errorMessage",
... | CAMEL-9314) | [
"CAMEL",
"-",
"9314",
")"
] | 82eac10e365f72bab9248b8c3bd0ec9a2fc0a721 | https://github.com/rhiot/rhiot/blob/82eac10e365f72bab9248b8c3bd0ec9a2fc0a721/gateway/components/camel-kura/src/main/java/io/rhiot/component/kura/router/RhiotKuraRouter.java#L78-L92 |
7,601 | rhiot/rhiot | gateway/components/camel-kura/src/main/java/io/rhiot/component/kura/router/RhiotKuraRouter.java | RhiotKuraRouter.activate | protected void activate(ComponentContext componentContext, Map<String, Object> properties) throws Exception {
m_properties = properties;
start(componentContext.getBundleContext());
updated(properties); // TODO Keep this line even when Camel 2.17 is out
} | java | protected void activate(ComponentContext componentContext, Map<String, Object> properties) throws Exception {
m_properties = properties;
start(componentContext.getBundleContext());
updated(properties); // TODO Keep this line even when Camel 2.17 is out
} | [
"protected",
"void",
"activate",
"(",
"ComponentContext",
"componentContext",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"throws",
"Exception",
"{",
"m_properties",
"=",
"properties",
";",
"start",
"(",
"componentContext",
".",
"getBundleCon... | CAMEL-9351) | [
"CAMEL",
"-",
"9351",
")"
] | 82eac10e365f72bab9248b8c3bd0ec9a2fc0a721 | https://github.com/rhiot/rhiot/blob/82eac10e365f72bab9248b8c3bd0ec9a2fc0a721/gateway/components/camel-kura/src/main/java/io/rhiot/component/kura/router/RhiotKuraRouter.java#L96-L100 |
7,602 | gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/SynchronisationService.java | SynchronisationService.waitForExpectedCondition | public boolean waitForExpectedCondition(ExpectedCondition<?> condition, int timeout) {
WebDriver driver = getWebDriver();
boolean conditionMet = true;
try {
new WebDriverWait(driver, timeout).until(condition);
} catch (TimeoutException e) {
conditionMet = false;
}
return conditionMet;
} | java | public boolean waitForExpectedCondition(ExpectedCondition<?> condition, int timeout) {
WebDriver driver = getWebDriver();
boolean conditionMet = true;
try {
new WebDriverWait(driver, timeout).until(condition);
} catch (TimeoutException e) {
conditionMet = false;
}
return conditionMet;
} | [
"public",
"boolean",
"waitForExpectedCondition",
"(",
"ExpectedCondition",
"<",
"?",
">",
"condition",
",",
"int",
"timeout",
")",
"{",
"WebDriver",
"driver",
"=",
"getWebDriver",
"(",
")",
";",
"boolean",
"conditionMet",
"=",
"true",
";",
"try",
"{",
"new",
... | Waits until the expectations are full filled or timeout runs out
@param condition The conditions the element should meet
@param timeout The timeout to wait
@return True if element meets the condition | [
"Waits",
"until",
"the",
"expectations",
"are",
"full",
"filled",
"or",
"timeout",
"runs",
"out"
] | e9a152aa67be48b1bb13a4691655caf6d873b553 | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/SynchronisationService.java#L37-L46 |
7,603 | gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/SynchronisationService.java | SynchronisationService.waitAndAssertForExpectedCondition | public void waitAndAssertForExpectedCondition(ExpectedCondition<?> condition, int timeout) {
if (!waitForExpectedCondition(condition, timeout)) {
fail(String.format("Element does not meet condition %1$s", condition.toString()));
}
} | java | public void waitAndAssertForExpectedCondition(ExpectedCondition<?> condition, int timeout) {
if (!waitForExpectedCondition(condition, timeout)) {
fail(String.format("Element does not meet condition %1$s", condition.toString()));
}
} | [
"public",
"void",
"waitAndAssertForExpectedCondition",
"(",
"ExpectedCondition",
"<",
"?",
">",
"condition",
",",
"int",
"timeout",
")",
"{",
"if",
"(",
"!",
"waitForExpectedCondition",
"(",
"condition",
",",
"timeout",
")",
")",
"{",
"fail",
"(",
"String",
".... | Waits until the expectations are met and throws an assert if not
@param condition The conditions the element should meet
@param timeout The timeout to wait | [
"Waits",
"until",
"the",
"expectations",
"are",
"met",
"and",
"throws",
"an",
"assert",
"if",
"not"
] | e9a152aa67be48b1bb13a4691655caf6d873b553 | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/SynchronisationService.java#L64-L68 |
7,604 | gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/SynchronisationService.java | SynchronisationService.checkAndAssertForExpectedCondition | public void checkAndAssertForExpectedCondition(ExpectedCondition<?> condition) {
if (!waitForExpectedCondition(condition, 0)) {
fail(String.format("Element does not meet condition %1$s", condition.toString()));
}
} | java | public void checkAndAssertForExpectedCondition(ExpectedCondition<?> condition) {
if (!waitForExpectedCondition(condition, 0)) {
fail(String.format("Element does not meet condition %1$s", condition.toString()));
}
} | [
"public",
"void",
"checkAndAssertForExpectedCondition",
"(",
"ExpectedCondition",
"<",
"?",
">",
"condition",
")",
"{",
"if",
"(",
"!",
"waitForExpectedCondition",
"(",
"condition",
",",
"0",
")",
")",
"{",
"fail",
"(",
"String",
".",
"format",
"(",
"\"Element... | Checks if the expectations are met and throws an assert if not
@param condition The conditions the element should meet | [
"Checks",
"if",
"the",
"expectations",
"are",
"met",
"and",
"throws",
"an",
"assert",
"if",
"not"
] | e9a152aa67be48b1bb13a4691655caf6d873b553 | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/SynchronisationService.java#L94-L98 |
7,605 | gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/SynchronisationService.java | SynchronisationService.waitAndSwitchToNewBrowserWindow | public void waitAndSwitchToNewBrowserWindow(int timeout) {
final Set<String> handles = SenBotContext.getSeleniumDriver().getWindowHandles();
mainWindowHandle.set(SenBotContext.getSeleniumDriver().getWindowHandles().iterator().next());
if (getWebDriver() instanceof InternetExplorerDriver) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
String newWindow = (new WebDriverWait(getWebDriver(), timeout)).until(new ExpectedCondition<String>() {
public String apply(WebDriver input) {
if (input.getWindowHandles().size() > 1) {
Iterator<String> iterator = input.getWindowHandles().iterator();
String found = iterator.next();
found = iterator.next();
return found;
}
return null;
}
});
assertTrue(!newWindow.equals(mainWindowHandle.get()));
assertTrue(!newWindow.isEmpty());
popupWindowHandle.set(newWindow);
SenBotContext.getSeleniumDriver().switchTo().window(newWindow);
} | java | public void waitAndSwitchToNewBrowserWindow(int timeout) {
final Set<String> handles = SenBotContext.getSeleniumDriver().getWindowHandles();
mainWindowHandle.set(SenBotContext.getSeleniumDriver().getWindowHandles().iterator().next());
if (getWebDriver() instanceof InternetExplorerDriver) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
String newWindow = (new WebDriverWait(getWebDriver(), timeout)).until(new ExpectedCondition<String>() {
public String apply(WebDriver input) {
if (input.getWindowHandles().size() > 1) {
Iterator<String> iterator = input.getWindowHandles().iterator();
String found = iterator.next();
found = iterator.next();
return found;
}
return null;
}
});
assertTrue(!newWindow.equals(mainWindowHandle.get()));
assertTrue(!newWindow.isEmpty());
popupWindowHandle.set(newWindow);
SenBotContext.getSeleniumDriver().switchTo().window(newWindow);
} | [
"public",
"void",
"waitAndSwitchToNewBrowserWindow",
"(",
"int",
"timeout",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"handles",
"=",
"SenBotContext",
".",
"getSeleniumDriver",
"(",
")",
".",
"getWindowHandles",
"(",
")",
";",
"mainWindowHandle",
".",
"set",... | Waits for a new browser window to pop up and switches to it
@param timeout Timeout to wait for | [
"Waits",
"for",
"a",
"new",
"browser",
"window",
"to",
"pop",
"up",
"and",
"switches",
"to",
"it"
] | e9a152aa67be48b1bb13a4691655caf6d873b553 | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/SynchronisationService.java#L105-L134 |
7,606 | waldheinz/fat32-lib | src/main/java/de/waldheinz/fs/fat/FatLfnDirectory.java | FatLfnDirectory.remove | @Override
public void remove(String name)
throws IOException, IllegalArgumentException {
checkWritable();
final FatLfnDirectoryEntry entry = getEntry(name);
if (entry == null) return;
unlinkEntry(entry);
final ClusterChain cc = new ClusterChain(
fat, entry.realEntry.getStartCluster(), false);
cc.setChainLength(0);
updateLFN();
} | java | @Override
public void remove(String name)
throws IOException, IllegalArgumentException {
checkWritable();
final FatLfnDirectoryEntry entry = getEntry(name);
if (entry == null) return;
unlinkEntry(entry);
final ClusterChain cc = new ClusterChain(
fat, entry.realEntry.getStartCluster(), false);
cc.setChainLength(0);
updateLFN();
} | [
"@",
"Override",
"public",
"void",
"remove",
"(",
"String",
"name",
")",
"throws",
"IOException",
",",
"IllegalArgumentException",
"{",
"checkWritable",
"(",
")",
";",
"final",
"FatLfnDirectoryEntry",
"entry",
"=",
"getEntry",
"(",
"name",
")",
";",
"if",
"(",... | Remove the entry with the given name from this directory.
@param name the name of the entry to remove
@throws IOException on error removing the entry
@throws IllegalArgumentException on an attempt to remove the dot entries | [
"Remove",
"the",
"entry",
"with",
"the",
"given",
"name",
"from",
"this",
"directory",
"."
] | 3d8f1a986339573576e02eb0b6ea49bfdc9cce26 | https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/FatLfnDirectory.java#L359-L376 |
7,607 | waldheinz/fat32-lib | src/main/java/de/waldheinz/fs/fat/FatLfnDirectory.java | FatLfnDirectory.unlinkEntry | void unlinkEntry(FatLfnDirectoryEntry entry) {
final ShortName sn = entry.realEntry.getShortName();
if (sn.equals(ShortName.DOT) || sn.equals(ShortName.DOT_DOT)) throw
new IllegalArgumentException(
"the dot entries can not be removed");
final String lowerName = entry.getName().toLowerCase(Locale.ROOT);
assert (this.longNameIndex.containsKey(lowerName));
this.longNameIndex.remove(lowerName);
assert (this.shortNameIndex.containsKey(sn));
this.shortNameIndex.remove(sn);
this.usedNames.remove(sn.asSimpleString().toLowerCase(Locale.ROOT));
assert (this.usedNames.contains(lowerName));
this.usedNames.remove(lowerName);
if (entry.isFile()) {
this.entryToFile.remove(entry.realEntry);
} else {
this.entryToDirectory.remove(entry.realEntry);
}
} | java | void unlinkEntry(FatLfnDirectoryEntry entry) {
final ShortName sn = entry.realEntry.getShortName();
if (sn.equals(ShortName.DOT) || sn.equals(ShortName.DOT_DOT)) throw
new IllegalArgumentException(
"the dot entries can not be removed");
final String lowerName = entry.getName().toLowerCase(Locale.ROOT);
assert (this.longNameIndex.containsKey(lowerName));
this.longNameIndex.remove(lowerName);
assert (this.shortNameIndex.containsKey(sn));
this.shortNameIndex.remove(sn);
this.usedNames.remove(sn.asSimpleString().toLowerCase(Locale.ROOT));
assert (this.usedNames.contains(lowerName));
this.usedNames.remove(lowerName);
if (entry.isFile()) {
this.entryToFile.remove(entry.realEntry);
} else {
this.entryToDirectory.remove(entry.realEntry);
}
} | [
"void",
"unlinkEntry",
"(",
"FatLfnDirectoryEntry",
"entry",
")",
"{",
"final",
"ShortName",
"sn",
"=",
"entry",
".",
"realEntry",
".",
"getShortName",
"(",
")",
";",
"if",
"(",
"sn",
".",
"equals",
"(",
"ShortName",
".",
"DOT",
")",
"||",
"sn",
".",
"... | Unlinks the specified entry from this directory without actually
deleting it.
@param e the entry to be unlinked
@see #linkEntry(de.waldheinz.fs.fat.FatLfnDirectoryEntry) | [
"Unlinks",
"the",
"specified",
"entry",
"from",
"this",
"directory",
"without",
"actually",
"deleting",
"it",
"."
] | 3d8f1a986339573576e02eb0b6ea49bfdc9cce26 | https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/FatLfnDirectory.java#L385-L409 |
7,608 | waldheinz/fat32-lib | src/main/java/de/waldheinz/fs/fat/FatLfnDirectory.java | FatLfnDirectory.linkEntry | void linkEntry(FatLfnDirectoryEntry entry) throws IOException {
checkUniqueName(entry.getName());
final ShortName sn = makeShortName(entry.getName());
entry.realEntry.setShortName(sn);
this.longNameIndex.put(entry.getName().toLowerCase(Locale.ROOT), entry);
this.shortNameIndex.put(entry.realEntry.getShortName(), entry);
updateLFN();
} | java | void linkEntry(FatLfnDirectoryEntry entry) throws IOException {
checkUniqueName(entry.getName());
final ShortName sn = makeShortName(entry.getName());
entry.realEntry.setShortName(sn);
this.longNameIndex.put(entry.getName().toLowerCase(Locale.ROOT), entry);
this.shortNameIndex.put(entry.realEntry.getShortName(), entry);
updateLFN();
} | [
"void",
"linkEntry",
"(",
"FatLfnDirectoryEntry",
"entry",
")",
"throws",
"IOException",
"{",
"checkUniqueName",
"(",
"entry",
".",
"getName",
"(",
")",
")",
";",
"final",
"ShortName",
"sn",
"=",
"makeShortName",
"(",
"entry",
".",
"getName",
"(",
")",
")",
... | Links the specified entry to this directory, updating the entrie's
short name.
@param entry the entry to be linked (added) to this directory
@see #unlinkEntry(de.waldheinz.fs.fat.FatLfnDirectoryEntry) | [
"Links",
"the",
"specified",
"entry",
"to",
"this",
"directory",
"updating",
"the",
"entrie",
"s",
"short",
"name",
"."
] | 3d8f1a986339573576e02eb0b6ea49bfdc9cce26 | https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/FatLfnDirectory.java#L418-L428 |
7,609 | waldheinz/fat32-lib | src/main/java/de/waldheinz/fs/fat/FatFileSystem.java | FatFileSystem.getVolumeLabel | public String getVolumeLabel() {
checkClosed();
final String fromDir = rootDirStore.getLabel();
if (fromDir == null && fatType != FatType.FAT32) {
return ((Fat16BootSector)bs).getVolumeLabel();
} else {
return fromDir;
}
} | java | public String getVolumeLabel() {
checkClosed();
final String fromDir = rootDirStore.getLabel();
if (fromDir == null && fatType != FatType.FAT32) {
return ((Fat16BootSector)bs).getVolumeLabel();
} else {
return fromDir;
}
} | [
"public",
"String",
"getVolumeLabel",
"(",
")",
"{",
"checkClosed",
"(",
")",
";",
"final",
"String",
"fromDir",
"=",
"rootDirStore",
".",
"getLabel",
"(",
")",
";",
"if",
"(",
"fromDir",
"==",
"null",
"&&",
"fatType",
"!=",
"FatType",
".",
"FAT32",
")",... | Returns the volume label of this file system.
@return the volume label | [
"Returns",
"the",
"volume",
"label",
"of",
"this",
"file",
"system",
"."
] | 3d8f1a986339573576e02eb0b6ea49bfdc9cce26 | https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/FatFileSystem.java#L148-L158 |
7,610 | waldheinz/fat32-lib | src/main/java/de/waldheinz/fs/fat/FatFileSystem.java | FatFileSystem.setVolumeLabel | public void setVolumeLabel(String label)
throws ReadOnlyException, IOException {
checkClosed();
checkReadOnly();
rootDirStore.setLabel(label);
if (fatType != FatType.FAT32) {
((Fat16BootSector)bs).setVolumeLabel(label);
}
} | java | public void setVolumeLabel(String label)
throws ReadOnlyException, IOException {
checkClosed();
checkReadOnly();
rootDirStore.setLabel(label);
if (fatType != FatType.FAT32) {
((Fat16BootSector)bs).setVolumeLabel(label);
}
} | [
"public",
"void",
"setVolumeLabel",
"(",
"String",
"label",
")",
"throws",
"ReadOnlyException",
",",
"IOException",
"{",
"checkClosed",
"(",
")",
";",
"checkReadOnly",
"(",
")",
";",
"rootDirStore",
".",
"setLabel",
"(",
"label",
")",
";",
"if",
"(",
"fatTyp... | Sets the volume label for this file system.
@param label the new volume label, may be {@code null}
@throws ReadOnlyException if the file system is read-only
@throws IOException on write error | [
"Sets",
"the",
"volume",
"label",
"for",
"this",
"file",
"system",
"."
] | 3d8f1a986339573576e02eb0b6ea49bfdc9cce26 | https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/FatFileSystem.java#L167-L178 |
7,611 | waldheinz/fat32-lib | src/main/java/de/waldheinz/fs/fat/FatFileSystem.java | FatFileSystem.flush | @Override
public void flush() throws IOException {
checkClosed();
if (bs.isDirty()) {
bs.write();
}
for (int i = 0; i < bs.getNrFats(); i++) {
fat.writeCopy(bs.getFatOffset(i));
}
rootDir.flush();
if (fsiSector != null) {
fsiSector.setFreeClusterCount(fat.getFreeClusterCount());
fsiSector.setLastAllocatedCluster(fat.getLastAllocatedCluster());
fsiSector.write();
}
} | java | @Override
public void flush() throws IOException {
checkClosed();
if (bs.isDirty()) {
bs.write();
}
for (int i = 0; i < bs.getNrFats(); i++) {
fat.writeCopy(bs.getFatOffset(i));
}
rootDir.flush();
if (fsiSector != null) {
fsiSector.setFreeClusterCount(fat.getFreeClusterCount());
fsiSector.setLastAllocatedCluster(fat.getLastAllocatedCluster());
fsiSector.write();
}
} | [
"@",
"Override",
"public",
"void",
"flush",
"(",
")",
"throws",
"IOException",
"{",
"checkClosed",
"(",
")",
";",
"if",
"(",
"bs",
".",
"isDirty",
"(",
")",
")",
"{",
"bs",
".",
"write",
"(",
")",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";"... | Flush all changed structures to the device.
@throws IOException on write error | [
"Flush",
"all",
"changed",
"structures",
"to",
"the",
"device",
"."
] | 3d8f1a986339573576e02eb0b6ea49bfdc9cce26 | https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/FatFileSystem.java#L191-L210 |
7,612 | waldheinz/fat32-lib | src/main/java/de/waldheinz/fs/fat/FatFileSystem.java | FatFileSystem.getTotalSpace | @Override
public long getTotalSpace() {
checkClosed();
if (fatType == FatType.FAT32) {
return bs.getNrTotalSectors() * bs.getBytesPerSector();
}
return -1;
} | java | @Override
public long getTotalSpace() {
checkClosed();
if (fatType == FatType.FAT32) {
return bs.getNrTotalSectors() * bs.getBytesPerSector();
}
return -1;
} | [
"@",
"Override",
"public",
"long",
"getTotalSpace",
"(",
")",
"{",
"checkClosed",
"(",
")",
";",
"if",
"(",
"fatType",
"==",
"FatType",
".",
"FAT32",
")",
"{",
"return",
"bs",
".",
"getNrTotalSectors",
"(",
")",
"*",
"bs",
".",
"getBytesPerSector",
"(",
... | The total size of this file system.
@return if -1 this feature is unsupported | [
"The",
"total",
"size",
"of",
"this",
"file",
"system",
"."
] | 3d8f1a986339573576e02eb0b6ea49bfdc9cce26 | https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/FatFileSystem.java#L256-L265 |
7,613 | protegeproject/sparql-dl-api | src/main/java/de/derivo/sparqldlapi/impl/QueryEngineImpl.java | QueryEngineImpl.execute | public QueryResult execute(Query query) throws QueryEngineException {
if (!(query instanceof QueryImpl)) {
throw new QueryEngineException("Couldn't cast Query to QueryImpl.");
}
QueryImpl q = (QueryImpl) query;
// search for unbound results vars
resvarsLoop:
for (QueryArgument arg : q.getResultVars()) {
for (QueryAtomGroup g : q.getAtomGroups()) {
for (QueryAtom a : g.getAtoms()) {
if (a.getArguments().contains(arg)) {
continue resvarsLoop;
}
}
}
// throw new QueryEngineException("Query contains an unbound result argument " + arg + ".");
}
Queue<QueryResultImpl> results = new LinkedList<>();
for (QueryAtomGroup g : q.getAtomGroups()) {
QueryAtomGroupImpl group = (QueryAtomGroupImpl) g;
List<QueryAtomGroupImpl> components = findComponents(group);
Queue<QueryResultImpl> componentResults = new LinkedList<>();
boolean groupAsk = true;
for (QueryAtomGroupImpl component : components) {
QueryAtomGroupImpl preorderedGroup = preorder(component);
QueryResultImpl result = new QueryResultImpl(query);
if (eval(q, preorderedGroup, result, new QueryBindingImpl(), BoundChecking.CHECK_BOUND)) {
if (query.isSelectDistinct()) {
result = eliminateDuplicates(result);
}
componentResults.add(result);
}
else {
groupAsk = false;
break;
}
}
if (groupAsk) {
results.add(combineResults(componentResults,
query.getType() == SELECT_DISTINCT));
}
else {
// return only empty result with no solution for this group
QueryResultImpl ret = new QueryResultImpl(query);
ret.setAsk(false);
results.add(ret);
}
}
return unionResults(q, results, query.getType() == SELECT_DISTINCT);
} | java | public QueryResult execute(Query query) throws QueryEngineException {
if (!(query instanceof QueryImpl)) {
throw new QueryEngineException("Couldn't cast Query to QueryImpl.");
}
QueryImpl q = (QueryImpl) query;
// search for unbound results vars
resvarsLoop:
for (QueryArgument arg : q.getResultVars()) {
for (QueryAtomGroup g : q.getAtomGroups()) {
for (QueryAtom a : g.getAtoms()) {
if (a.getArguments().contains(arg)) {
continue resvarsLoop;
}
}
}
// throw new QueryEngineException("Query contains an unbound result argument " + arg + ".");
}
Queue<QueryResultImpl> results = new LinkedList<>();
for (QueryAtomGroup g : q.getAtomGroups()) {
QueryAtomGroupImpl group = (QueryAtomGroupImpl) g;
List<QueryAtomGroupImpl> components = findComponents(group);
Queue<QueryResultImpl> componentResults = new LinkedList<>();
boolean groupAsk = true;
for (QueryAtomGroupImpl component : components) {
QueryAtomGroupImpl preorderedGroup = preorder(component);
QueryResultImpl result = new QueryResultImpl(query);
if (eval(q, preorderedGroup, result, new QueryBindingImpl(), BoundChecking.CHECK_BOUND)) {
if (query.isSelectDistinct()) {
result = eliminateDuplicates(result);
}
componentResults.add(result);
}
else {
groupAsk = false;
break;
}
}
if (groupAsk) {
results.add(combineResults(componentResults,
query.getType() == SELECT_DISTINCT));
}
else {
// return only empty result with no solution for this group
QueryResultImpl ret = new QueryResultImpl(query);
ret.setAsk(false);
results.add(ret);
}
}
return unionResults(q, results, query.getType() == SELECT_DISTINCT);
} | [
"public",
"QueryResult",
"execute",
"(",
"Query",
"query",
")",
"throws",
"QueryEngineException",
"{",
"if",
"(",
"!",
"(",
"query",
"instanceof",
"QueryImpl",
")",
")",
"{",
"throw",
"new",
"QueryEngineException",
"(",
"\"Couldn't cast Query to QueryImpl.\"",
")",
... | Execute a sparql-dl query and generate the result set.
@return The query result set. | [
"Execute",
"a",
"sparql",
"-",
"dl",
"query",
"and",
"generate",
"the",
"result",
"set",
"."
] | 80d430d439e17a691d0111819af2d3613e28d625 | https://github.com/protegeproject/sparql-dl-api/blob/80d430d439e17a691d0111819af2d3613e28d625/src/main/java/de/derivo/sparqldlapi/impl/QueryEngineImpl.java#L114-L173 |
7,614 | protegeproject/sparql-dl-api | src/main/java/de/derivo/sparqldlapi/impl/QueryEngineImpl.java | QueryEngineImpl.findComponents | private List<QueryAtomGroupImpl> findComponents(QueryAtomGroupImpl group) {
List<QueryAtom> atoms = new LinkedList<>();
atoms.addAll(group.getAtoms());
List<QueryAtomGroupImpl> components = new LinkedList<>();
// if we have no atoms at all we simply return the same query as a single component
if (atoms.isEmpty()) {
components.add(group);
return components;
}
// find all atoms containing no variables
// and build a component
QueryAtomGroupImpl component = new QueryAtomGroupImpl();
for (QueryAtom atom : atoms) {
boolean noVar = true;
for (QueryArgument arg : atom.getArguments()) {
if (arg.isVar()) {
noVar = false;
break;
}
}
if (noVar) {
component.addAtom(atom);
}
}
component.getAtoms().forEach(atoms::remove);
if (!component.isEmpty()) {
components.add(component);
}
// find connected components
UnionFind<QueryArgument> unionFind = new UnionFind<>();
for (QueryAtom atom : atoms) {
QueryArgument firstVar = null;
for (QueryArgument arg : atom.getArguments()) {
if (arg.isVar()) {
if (firstVar == null) {
firstVar = arg;
}
else {
unionFind.union(firstVar, arg);
}
}
}
}
while (!atoms.isEmpty()) {
component = new QueryAtomGroupImpl();
QueryAtom nextAtom = atoms.get(0);
atoms.remove(nextAtom);
component.addAtom(nextAtom);
QueryArgument args = null;
for (QueryArgument arg : nextAtom.getArguments()) {
if (arg.isVar()) {
args = unionFind.find(arg);
break;
}
}
for (QueryAtom atom : atoms) {
QueryArgument args2 = null;
for (QueryArgument arg : atom.getArguments()) {
if (arg.isVar()) {
args2 = unionFind.find(arg);
break;
}
}
if (args.equals(args2)) {
component.addAtom(atom);
}
}
for (QueryAtom atom : component.getAtoms()) {
atoms.remove(atom);
}
components.add(component);
}
return components;
} | java | private List<QueryAtomGroupImpl> findComponents(QueryAtomGroupImpl group) {
List<QueryAtom> atoms = new LinkedList<>();
atoms.addAll(group.getAtoms());
List<QueryAtomGroupImpl> components = new LinkedList<>();
// if we have no atoms at all we simply return the same query as a single component
if (atoms.isEmpty()) {
components.add(group);
return components;
}
// find all atoms containing no variables
// and build a component
QueryAtomGroupImpl component = new QueryAtomGroupImpl();
for (QueryAtom atom : atoms) {
boolean noVar = true;
for (QueryArgument arg : atom.getArguments()) {
if (arg.isVar()) {
noVar = false;
break;
}
}
if (noVar) {
component.addAtom(atom);
}
}
component.getAtoms().forEach(atoms::remove);
if (!component.isEmpty()) {
components.add(component);
}
// find connected components
UnionFind<QueryArgument> unionFind = new UnionFind<>();
for (QueryAtom atom : atoms) {
QueryArgument firstVar = null;
for (QueryArgument arg : atom.getArguments()) {
if (arg.isVar()) {
if (firstVar == null) {
firstVar = arg;
}
else {
unionFind.union(firstVar, arg);
}
}
}
}
while (!atoms.isEmpty()) {
component = new QueryAtomGroupImpl();
QueryAtom nextAtom = atoms.get(0);
atoms.remove(nextAtom);
component.addAtom(nextAtom);
QueryArgument args = null;
for (QueryArgument arg : nextAtom.getArguments()) {
if (arg.isVar()) {
args = unionFind.find(arg);
break;
}
}
for (QueryAtom atom : atoms) {
QueryArgument args2 = null;
for (QueryArgument arg : atom.getArguments()) {
if (arg.isVar()) {
args2 = unionFind.find(arg);
break;
}
}
if (args.equals(args2)) {
component.addAtom(atom);
}
}
for (QueryAtom atom : component.getAtoms()) {
atoms.remove(atom);
}
components.add(component);
}
return components;
} | [
"private",
"List",
"<",
"QueryAtomGroupImpl",
">",
"findComponents",
"(",
"QueryAtomGroupImpl",
"group",
")",
"{",
"List",
"<",
"QueryAtom",
">",
"atoms",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"atoms",
".",
"addAll",
"(",
"group",
".",
"getAtoms",
... | Split the query into individual components if possible to avoid cross-products in later evaluation.
The first component will contain all atoms with no variables if there exist some.
@return a set of group components | [
"Split",
"the",
"query",
"into",
"individual",
"components",
"if",
"possible",
"to",
"avoid",
"cross",
"-",
"products",
"in",
"later",
"evaluation",
".",
"The",
"first",
"component",
"will",
"contain",
"all",
"atoms",
"with",
"no",
"variables",
"if",
"there",
... | 80d430d439e17a691d0111819af2d3613e28d625 | https://github.com/protegeproject/sparql-dl-api/blob/80d430d439e17a691d0111819af2d3613e28d625/src/main/java/de/derivo/sparqldlapi/impl/QueryEngineImpl.java#L181-L266 |
7,615 | protegeproject/sparql-dl-api | src/main/java/de/derivo/sparqldlapi/impl/QueryEngineImpl.java | QueryEngineImpl.combineResults | private QueryResultImpl combineResults(Queue<QueryResultImpl> results, boolean distinct) {
while (results.size() > 1) {
QueryResultImpl a = results.remove();
QueryResultImpl b = results.remove();
results.add(combineResults(a, b, distinct));
}
return results.remove();
} | java | private QueryResultImpl combineResults(Queue<QueryResultImpl> results, boolean distinct) {
while (results.size() > 1) {
QueryResultImpl a = results.remove();
QueryResultImpl b = results.remove();
results.add(combineResults(a, b, distinct));
}
return results.remove();
} | [
"private",
"QueryResultImpl",
"combineResults",
"(",
"Queue",
"<",
"QueryResultImpl",
">",
"results",
",",
"boolean",
"distinct",
")",
"{",
"while",
"(",
"results",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"QueryResultImpl",
"a",
"=",
"results",
".",
"re... | Combine the results of the individual components with the cartesian product.
@return the combined result | [
"Combine",
"the",
"results",
"of",
"the",
"individual",
"components",
"with",
"the",
"cartesian",
"product",
"."
] | 80d430d439e17a691d0111819af2d3613e28d625 | https://github.com/protegeproject/sparql-dl-api/blob/80d430d439e17a691d0111819af2d3613e28d625/src/main/java/de/derivo/sparqldlapi/impl/QueryEngineImpl.java#L273-L281 |
7,616 | protegeproject/sparql-dl-api | src/main/java/de/derivo/sparqldlapi/impl/QueryEngineImpl.java | QueryEngineImpl.combineResults | private QueryResultImpl combineResults(QueryResultImpl a, QueryResultImpl b, boolean distinct) {
QueryResultImpl result = new QueryResultImpl(a.getQuery());
for (QueryBindingImpl bindingA : a.getBindings()) {
for (QueryBindingImpl bindingB : b.getBindings()) {
QueryBindingImpl binding = new QueryBindingImpl();
binding.set(bindingA);
binding.set(bindingB);
result.add(binding);
}
}
if (distinct) {
return eliminateDuplicates(result);
}
return result;
} | java | private QueryResultImpl combineResults(QueryResultImpl a, QueryResultImpl b, boolean distinct) {
QueryResultImpl result = new QueryResultImpl(a.getQuery());
for (QueryBindingImpl bindingA : a.getBindings()) {
for (QueryBindingImpl bindingB : b.getBindings()) {
QueryBindingImpl binding = new QueryBindingImpl();
binding.set(bindingA);
binding.set(bindingB);
result.add(binding);
}
}
if (distinct) {
return eliminateDuplicates(result);
}
return result;
} | [
"private",
"QueryResultImpl",
"combineResults",
"(",
"QueryResultImpl",
"a",
",",
"QueryResultImpl",
"b",
",",
"boolean",
"distinct",
")",
"{",
"QueryResultImpl",
"result",
"=",
"new",
"QueryResultImpl",
"(",
"a",
".",
"getQuery",
"(",
")",
")",
";",
"for",
"(... | Combine two results with the cartesian product.
@return the combined result | [
"Combine",
"two",
"results",
"with",
"the",
"cartesian",
"product",
"."
] | 80d430d439e17a691d0111819af2d3613e28d625 | https://github.com/protegeproject/sparql-dl-api/blob/80d430d439e17a691d0111819af2d3613e28d625/src/main/java/de/derivo/sparqldlapi/impl/QueryEngineImpl.java#L288-L304 |
7,617 | protegeproject/sparql-dl-api | src/main/java/de/derivo/sparqldlapi/impl/QueryEngineImpl.java | QueryEngineImpl.eliminateDuplicates | private QueryResultImpl eliminateDuplicates(QueryResultImpl result) {
QueryResultImpl ret = new QueryResultImpl(result.getQuery());
Set<QueryBindingImpl> distinctSet = new HashSet<>(result.getBindings());
distinctSet.forEach(ret::add);
return ret;
} | java | private QueryResultImpl eliminateDuplicates(QueryResultImpl result) {
QueryResultImpl ret = new QueryResultImpl(result.getQuery());
Set<QueryBindingImpl> distinctSet = new HashSet<>(result.getBindings());
distinctSet.forEach(ret::add);
return ret;
} | [
"private",
"QueryResultImpl",
"eliminateDuplicates",
"(",
"QueryResultImpl",
"result",
")",
"{",
"QueryResultImpl",
"ret",
"=",
"new",
"QueryResultImpl",
"(",
"result",
".",
"getQuery",
"(",
")",
")",
";",
"Set",
"<",
"QueryBindingImpl",
">",
"distinctSet",
"=",
... | Eliminate duplicate bindings.
@return A new QueryResultImpl instance without diplicates | [
"Eliminate",
"duplicate",
"bindings",
"."
] | 80d430d439e17a691d0111819af2d3613e28d625 | https://github.com/protegeproject/sparql-dl-api/blob/80d430d439e17a691d0111819af2d3613e28d625/src/main/java/de/derivo/sparqldlapi/impl/QueryEngineImpl.java#L336-L341 |
7,618 | SahaginOrg/sahagin-java | src/main/java/org/sahagin/runlib/runresultsgen/StackLineUtils.java | StackLineUtils.getStackLine | private static StackLine getStackLine(SrcTree srcTree,
String classQualifiedName, String methodSimpleName, int line) {
StackLine rootStackLine = getStackLine(
srcTree.getRootMethodTable(), classQualifiedName, methodSimpleName, line);
if (rootStackLine != null) {
return rootStackLine;
}
StackLine subStackLine = getStackLine(
srcTree.getSubMethodTable(), classQualifiedName, methodSimpleName, line);
if (subStackLine != null) {
return subStackLine;
}
return null;
} | java | private static StackLine getStackLine(SrcTree srcTree,
String classQualifiedName, String methodSimpleName, int line) {
StackLine rootStackLine = getStackLine(
srcTree.getRootMethodTable(), classQualifiedName, methodSimpleName, line);
if (rootStackLine != null) {
return rootStackLine;
}
StackLine subStackLine = getStackLine(
srcTree.getSubMethodTable(), classQualifiedName, methodSimpleName, line);
if (subStackLine != null) {
return subStackLine;
}
return null;
} | [
"private",
"static",
"StackLine",
"getStackLine",
"(",
"SrcTree",
"srcTree",
",",
"String",
"classQualifiedName",
",",
"String",
"methodSimpleName",
",",
"int",
"line",
")",
"{",
"StackLine",
"rootStackLine",
"=",
"getStackLine",
"(",
"srcTree",
".",
"getRootMethodT... | null means method does not exists in srcTree | [
"null",
"means",
"method",
"does",
"not",
"exists",
"in",
"srcTree"
] | 7ace428adebe3466ceb5826bc9681f8e3d52be68 | https://github.com/SahaginOrg/sahagin-java/blob/7ace428adebe3466ceb5826bc9681f8e3d52be68/src/main/java/org/sahagin/runlib/runresultsgen/StackLineUtils.java#L92-L105 |
7,619 | gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/FormService.java | FormService.fillFormField_locator | public WebElement fillFormField_locator(String locator, String value) {
WebElement fieldEl = seleniumElementService.translateLocatorToWebElement(locator);
fieldEl.clear();
fieldEl.sendKeys(getReferenceService().namespaceString(value));
return fieldEl;
} | java | public WebElement fillFormField_locator(String locator, String value) {
WebElement fieldEl = seleniumElementService.translateLocatorToWebElement(locator);
fieldEl.clear();
fieldEl.sendKeys(getReferenceService().namespaceString(value));
return fieldEl;
} | [
"public",
"WebElement",
"fillFormField_locator",
"(",
"String",
"locator",
",",
"String",
"value",
")",
"{",
"WebElement",
"fieldEl",
"=",
"seleniumElementService",
".",
"translateLocatorToWebElement",
"(",
"locator",
")",
";",
"fieldEl",
".",
"clear",
"(",
")",
"... | Fill out a form field with the passed value
@param locator as specified in {@link ElementService#translateLocatorToWebElement(String)}
@param value the value to fill the field with
@return the {@link WebElement} representing the form field | [
"Fill",
"out",
"a",
"form",
"field",
"with",
"the",
"passed",
"value"
] | e9a152aa67be48b1bb13a4691655caf6d873b553 | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/FormService.java#L32-L37 |
7,620 | rhiot/rhiot | cloudplatform/connector/src/main/java/io/rhiot/cloudplatform/connector/IoTConnector.java | IoTConnector.toBus | public void toBus(String channel, Object payload, Header... headers) {
producerTemplate.sendBodyAndHeaders("amqp:" + channel, encodedPayload(payload), arguments(headers));
} | java | public void toBus(String channel, Object payload, Header... headers) {
producerTemplate.sendBodyAndHeaders("amqp:" + channel, encodedPayload(payload), arguments(headers));
} | [
"public",
"void",
"toBus",
"(",
"String",
"channel",
",",
"Object",
"payload",
",",
"Header",
"...",
"headers",
")",
"{",
"producerTemplate",
".",
"sendBodyAndHeaders",
"(",
"\"amqp:\"",
"+",
"channel",
",",
"encodedPayload",
"(",
"payload",
")",
",",
"argumen... | Connector channels API | [
"Connector",
"channels",
"API"
] | 82eac10e365f72bab9248b8c3bd0ec9a2fc0a721 | https://github.com/rhiot/rhiot/blob/82eac10e365f72bab9248b8c3bd0ec9a2fc0a721/cloudplatform/connector/src/main/java/io/rhiot/cloudplatform/connector/IoTConnector.java#L50-L52 |
7,621 | gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/ExpectedTableDefinition.java | ExpectedTableDefinition.cacheIncludeAndIgnore | public void cacheIncludeAndIgnore(WebElement table) {
if (getIgnoreByMatches() == null) {
setIgnoreByMatches(new ArrayList<WebElement>());
for (By by : getIgnoreRowsMatching()) {
getIgnoreByMatches().addAll(table.findElements(by));
}
}
if (getIncludeByMatches() == null) {
setIncludeByMatches(new ArrayList<WebElement>());
for (By by : getIncludeOnlyRowsMatching()) {
getIncludeByMatches().addAll(table.findElements(by));
}
}
} | java | public void cacheIncludeAndIgnore(WebElement table) {
if (getIgnoreByMatches() == null) {
setIgnoreByMatches(new ArrayList<WebElement>());
for (By by : getIgnoreRowsMatching()) {
getIgnoreByMatches().addAll(table.findElements(by));
}
}
if (getIncludeByMatches() == null) {
setIncludeByMatches(new ArrayList<WebElement>());
for (By by : getIncludeOnlyRowsMatching()) {
getIncludeByMatches().addAll(table.findElements(by));
}
}
} | [
"public",
"void",
"cacheIncludeAndIgnore",
"(",
"WebElement",
"table",
")",
"{",
"if",
"(",
"getIgnoreByMatches",
"(",
")",
"==",
"null",
")",
"{",
"setIgnoreByMatches",
"(",
"new",
"ArrayList",
"<",
"WebElement",
">",
"(",
")",
")",
";",
"for",
"(",
"By",... | Does the table comparison
@param table | [
"Does",
"the",
"table",
"comparison"
] | e9a152aa67be48b1bb13a4691655caf6d873b553 | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/services/selenium/ExpectedTableDefinition.java#L105-L118 |
7,622 | gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/context/SenBotContext.java | SenBotContext.getBean | public static <T> T getBean(Class<T> clazz) {
return getSenBotContext().context.getBean(clazz);
} | java | public static <T> T getBean(Class<T> clazz) {
return getSenBotContext().context.getBean(clazz);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getBean",
"(",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"getSenBotContext",
"(",
")",
".",
"context",
".",
"getBean",
"(",
"clazz",
")",
";",
"}"
] | Gets the bean class
@param clazz
@return {@link Object} Spring service mapped to the passed in class | [
"Gets",
"the",
"bean",
"class"
] | e9a152aa67be48b1bb13a4691655caf6d873b553 | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/context/SenBotContext.java#L131-L133 |
7,623 | gfk-ba/senbot | SenBotRunner/src/main/java/com/gfk/senbot/framework/context/SenBotContext.java | SenBotContext.getOrCreateFile | public static File getOrCreateFile(String url, boolean createIfNotFound) throws IOException {
File file = null;
if (url.contains(ResourceUtils.CLASSPATH_URL_PREFIX)) {
url = url.replaceAll(ResourceUtils.CLASSPATH_URL_PREFIX, "");
if (url.startsWith("/")) {
url = url.substring(1);
}
URL resource = SenBotContext.class.getClassLoader().getResource("");
if (resource == null) {
throw new IOException("creating a new folder on the classpath is not allowed");
} else {
file = new File(resource.getFile() + "/" + url);
}
} else {
file = new File(url);
}
if (createIfNotFound && !file.exists()) {
file.mkdirs();
}
return file;
} | java | public static File getOrCreateFile(String url, boolean createIfNotFound) throws IOException {
File file = null;
if (url.contains(ResourceUtils.CLASSPATH_URL_PREFIX)) {
url = url.replaceAll(ResourceUtils.CLASSPATH_URL_PREFIX, "");
if (url.startsWith("/")) {
url = url.substring(1);
}
URL resource = SenBotContext.class.getClassLoader().getResource("");
if (resource == null) {
throw new IOException("creating a new folder on the classpath is not allowed");
} else {
file = new File(resource.getFile() + "/" + url);
}
} else {
file = new File(url);
}
if (createIfNotFound && !file.exists()) {
file.mkdirs();
}
return file;
} | [
"public",
"static",
"File",
"getOrCreateFile",
"(",
"String",
"url",
",",
"boolean",
"createIfNotFound",
")",
"throws",
"IOException",
"{",
"File",
"file",
"=",
"null",
";",
"if",
"(",
"url",
".",
"contains",
"(",
"ResourceUtils",
".",
"CLASSPATH_URL_PREFIX",
... | Get a File on the class path or file system or create it if it does not
exist | [
"Get",
"a",
"File",
"on",
"the",
"class",
"path",
"or",
"file",
"system",
"or",
"create",
"it",
"if",
"it",
"does",
"not",
"exist"
] | e9a152aa67be48b1bb13a4691655caf6d873b553 | https://github.com/gfk-ba/senbot/blob/e9a152aa67be48b1bb13a4691655caf6d873b553/SenBotRunner/src/main/java/com/gfk/senbot/framework/context/SenBotContext.java#L197-L217 |
7,624 | waldheinz/fat32-lib | src/main/java/de/waldheinz/fs/fat/ClusterChain.java | ClusterChain.setChainLength | public void setChainLength(int nrClusters) throws IOException {
if (nrClusters < 0) throw new IllegalArgumentException(
"negative cluster count"); //NOI18N
if ((this.startCluster == 0) && (nrClusters == 0)) {
/* nothing to do */
} else if ((this.startCluster == 0) && (nrClusters > 0)) {
final long[] chain = fat.allocNew(nrClusters);
this.startCluster = chain[0];
} else {
final long[] chain = fat.getChain(startCluster);
if (nrClusters != chain.length) {
if (nrClusters > chain.length) {
/* grow the chain */
int count = nrClusters - chain.length;
while (count > 0) {
fat.allocAppend(getStartCluster());
count--;
}
} else {
/* shrink the chain */
if (nrClusters > 0) {
fat.setEof(chain[nrClusters - 1]);
for (int i = nrClusters; i < chain.length; i++) {
fat.setFree(chain[i]);
}
} else {
for (int i=0; i < chain.length; i++) {
fat.setFree(chain[i]);
}
this.startCluster = 0;
}
}
}
}
} | java | public void setChainLength(int nrClusters) throws IOException {
if (nrClusters < 0) throw new IllegalArgumentException(
"negative cluster count"); //NOI18N
if ((this.startCluster == 0) && (nrClusters == 0)) {
/* nothing to do */
} else if ((this.startCluster == 0) && (nrClusters > 0)) {
final long[] chain = fat.allocNew(nrClusters);
this.startCluster = chain[0];
} else {
final long[] chain = fat.getChain(startCluster);
if (nrClusters != chain.length) {
if (nrClusters > chain.length) {
/* grow the chain */
int count = nrClusters - chain.length;
while (count > 0) {
fat.allocAppend(getStartCluster());
count--;
}
} else {
/* shrink the chain */
if (nrClusters > 0) {
fat.setEof(chain[nrClusters - 1]);
for (int i = nrClusters; i < chain.length; i++) {
fat.setFree(chain[i]);
}
} else {
for (int i=0; i < chain.length; i++) {
fat.setFree(chain[i]);
}
this.startCluster = 0;
}
}
}
}
} | [
"public",
"void",
"setChainLength",
"(",
"int",
"nrClusters",
")",
"throws",
"IOException",
"{",
"if",
"(",
"nrClusters",
"<",
"0",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"negative cluster count\"",
")",
";",
"//NOI18N",
"if",
"(",
"(",
"this",
... | Sets the length of this cluster chain in clusters.
@param nrClusters the new number of clusters this chain should contain,
must be {@code >= 0}
@throws IOException on error updating the chain length
@see #setSize(long) | [
"Sets",
"the",
"length",
"of",
"this",
"cluster",
"chain",
"in",
"clusters",
"."
] | 3d8f1a986339573576e02eb0b6ea49bfdc9cce26 | https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/ClusterChain.java#L158-L196 |
7,625 | waldheinz/fat32-lib | src/main/java/de/waldheinz/fs/fat/FatLfnDirectoryEntry.java | FatLfnDirectoryEntry.moveTo | public void moveTo(FatLfnDirectory target, String newName)
throws IOException, ReadOnlyException {
checkWritable();
if (!target.isFreeName(newName)) {
throw new IOException(
"the name \"" + newName + "\" is already in use");
}
this.parent.unlinkEntry(this);
this.parent = target;
this.fileName = newName;
this.parent.linkEntry(this);
} | java | public void moveTo(FatLfnDirectory target, String newName)
throws IOException, ReadOnlyException {
checkWritable();
if (!target.isFreeName(newName)) {
throw new IOException(
"the name \"" + newName + "\" is already in use");
}
this.parent.unlinkEntry(this);
this.parent = target;
this.fileName = newName;
this.parent.linkEntry(this);
} | [
"public",
"void",
"moveTo",
"(",
"FatLfnDirectory",
"target",
",",
"String",
"newName",
")",
"throws",
"IOException",
",",
"ReadOnlyException",
"{",
"checkWritable",
"(",
")",
";",
"if",
"(",
"!",
"target",
".",
"isFreeName",
"(",
"newName",
")",
")",
"{",
... | Moves this entry to a new directory under the specified name.
@param target the direcrory where this entry should be moved to
@param newName the new name under which this entry will be accessible
in the target directory
@throws IOException on error moving this entry
@throws ReadOnlyException if this directory is read-only | [
"Moves",
"this",
"entry",
"to",
"a",
"new",
"directory",
"under",
"the",
"specified",
"name",
"."
] | 3d8f1a986339573576e02eb0b6ea49bfdc9cce26 | https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/FatLfnDirectoryEntry.java#L281-L295 |
7,626 | rhiot/rhiot | gateway/components/camel-gp2y1010au0f/src/main/java/io/rhiot/component/gp2y1010au0f/Gp2y1010au0fEndpoint.java | Gp2y1010au0fEndpoint.getPin | private Pin getPin() {
if (LOG.isDebugEnabled()) {
LOG.debug(" Pin Id > " + iled);
}
Pin ret = getPinPerFieldName();
if (ret == null) {
ret = getPinPerPinAddress();
if (ret == null) {
ret = getPinPerPinName();
}
}
if (ret == null) {
throw new IllegalArgumentException("Cannot find gpio [" + this.iled + "] ");
}
return ret;
} | java | private Pin getPin() {
if (LOG.isDebugEnabled()) {
LOG.debug(" Pin Id > " + iled);
}
Pin ret = getPinPerFieldName();
if (ret == null) {
ret = getPinPerPinAddress();
if (ret == null) {
ret = getPinPerPinName();
}
}
if (ret == null) {
throw new IllegalArgumentException("Cannot find gpio [" + this.iled + "] ");
}
return ret;
} | [
"private",
"Pin",
"getPin",
"(",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\" Pin Id > \"",
"+",
"iled",
")",
";",
"}",
"Pin",
"ret",
"=",
"getPinPerFieldName",
"(",
")",
";",
"if",
"(",
"ret"... | Hack to retrieve the correct Pin from RaspiPin.class lib
@return the correct Pin | [
"Hack",
"to",
"retrieve",
"the",
"correct",
"Pin",
"from",
"RaspiPin",
".",
"class",
"lib"
] | 82eac10e365f72bab9248b8c3bd0ec9a2fc0a721 | https://github.com/rhiot/rhiot/blob/82eac10e365f72bab9248b8c3bd0ec9a2fc0a721/gateway/components/camel-gp2y1010au0f/src/main/java/io/rhiot/component/gp2y1010au0f/Gp2y1010au0fEndpoint.java#L94-L114 |
7,627 | waldheinz/fat32-lib | src/main/java/de/waldheinz/fs/fat/FatDirectoryEntry.java | FatDirectoryEntry.getStartCluster | public long getStartCluster() {
if (type == FatType.FAT32) {
return
(LittleEndian.getUInt16(data, 0x14) << 16) |
LittleEndian.getUInt16(data, 0x1a);
} else {
return LittleEndian.getUInt16(data, 0x1a);
}
} | java | public long getStartCluster() {
if (type == FatType.FAT32) {
return
(LittleEndian.getUInt16(data, 0x14) << 16) |
LittleEndian.getUInt16(data, 0x1a);
} else {
return LittleEndian.getUInt16(data, 0x1a);
}
} | [
"public",
"long",
"getStartCluster",
"(",
")",
"{",
"if",
"(",
"type",
"==",
"FatType",
".",
"FAT32",
")",
"{",
"return",
"(",
"LittleEndian",
".",
"getUInt16",
"(",
"data",
",",
"0x14",
")",
"<<",
"16",
")",
"|",
"LittleEndian",
".",
"getUInt16",
"(",... | Returns the start of the file in clusters.
@return int the first cluster of a file / directory | [
"Returns",
"the",
"start",
"of",
"the",
"file",
"in",
"clusters",
"."
] | 3d8f1a986339573576e02eb0b6ea49bfdc9cce26 | https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/FatDirectoryEntry.java#L350-L358 |
7,628 | waldheinz/fat32-lib | src/main/java/de/waldheinz/fs/fat/FatDirectoryEntry.java | FatDirectoryEntry.setStartCluster | void setStartCluster(long startCluster) {
if (startCluster > Integer.MAX_VALUE) throw new AssertionError();
if (this.type == FatType.FAT32) {
LittleEndian.setInt16(data, 0x1a, (int) (startCluster & 0xffff));
LittleEndian.setInt16(data, 0x14, (int) ((startCluster >> 16) & 0xffff));
} else {
LittleEndian.setInt16(data, 0x1a, (int) startCluster);
}
} | java | void setStartCluster(long startCluster) {
if (startCluster > Integer.MAX_VALUE) throw new AssertionError();
if (this.type == FatType.FAT32) {
LittleEndian.setInt16(data, 0x1a, (int) (startCluster & 0xffff));
LittleEndian.setInt16(data, 0x14, (int) ((startCluster >> 16) & 0xffff));
} else {
LittleEndian.setInt16(data, 0x1a, (int) startCluster);
}
} | [
"void",
"setStartCluster",
"(",
"long",
"startCluster",
")",
"{",
"if",
"(",
"startCluster",
">",
"Integer",
".",
"MAX_VALUE",
")",
"throw",
"new",
"AssertionError",
"(",
")",
";",
"if",
"(",
"this",
".",
"type",
"==",
"FatType",
".",
"FAT32",
")",
"{",
... | Sets the startCluster.
@param startCluster The startCluster to set | [
"Sets",
"the",
"startCluster",
"."
] | 3d8f1a986339573576e02eb0b6ea49bfdc9cce26 | https://github.com/waldheinz/fat32-lib/blob/3d8f1a986339573576e02eb0b6ea49bfdc9cce26/src/main/java/de/waldheinz/fs/fat/FatDirectoryEntry.java#L365-L374 |
7,629 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/PacketCompressor.java | PacketCompressor.decompress | public static Packet decompress(final Packet packet) throws IOException
{
final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(packet.getData());
final GZIPInputStream gzipInputStream = new GZIPInputStream(byteArrayInputStream);
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
// Read from input until everything is inflated
final byte buffer[] = new byte[INFLATE_BUFFER_SIZE];
int bytesInflated;
while ((bytesInflated = gzipInputStream.read(buffer)) >= 0)
{
byteArrayOutputStream.write(buffer, 0, bytesInflated);
}
return new Packet(
packet.getPacketType(),
packet.getPacketID(),
byteArrayOutputStream.toByteArray()
);
} | java | public static Packet decompress(final Packet packet) throws IOException
{
final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(packet.getData());
final GZIPInputStream gzipInputStream = new GZIPInputStream(byteArrayInputStream);
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
// Read from input until everything is inflated
final byte buffer[] = new byte[INFLATE_BUFFER_SIZE];
int bytesInflated;
while ((bytesInflated = gzipInputStream.read(buffer)) >= 0)
{
byteArrayOutputStream.write(buffer, 0, bytesInflated);
}
return new Packet(
packet.getPacketType(),
packet.getPacketID(),
byteArrayOutputStream.toByteArray()
);
} | [
"public",
"static",
"Packet",
"decompress",
"(",
"final",
"Packet",
"packet",
")",
"throws",
"IOException",
"{",
"final",
"ByteArrayInputStream",
"byteArrayInputStream",
"=",
"new",
"ByteArrayInputStream",
"(",
"packet",
".",
"getData",
"(",
")",
")",
";",
"final"... | Decompresses given Packet
@param packet Compressed Packet
@return Decompressed Packet
@throws IOException when unable to decompress | [
"Decompresses",
"given",
"Packet"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/PacketCompressor.java#L44-L64 |
7,630 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/PacketCompressor.java | PacketCompressor.compress | public static Packet compress(final Packet packet) throws IOException
{
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayOutputStream)
{
{
def.setLevel(Deflater.BEST_COMPRESSION);
}
};
// Deflate all data
gzipOutputStream.write(packet.getData());
gzipOutputStream.close();
return new Packet(
packet.getPacketType(),
packet.getPacketID(),
byteArrayOutputStream.toByteArray()
);
} | java | public static Packet compress(final Packet packet) throws IOException
{
final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(byteArrayOutputStream)
{
{
def.setLevel(Deflater.BEST_COMPRESSION);
}
};
// Deflate all data
gzipOutputStream.write(packet.getData());
gzipOutputStream.close();
return new Packet(
packet.getPacketType(),
packet.getPacketID(),
byteArrayOutputStream.toByteArray()
);
} | [
"public",
"static",
"Packet",
"compress",
"(",
"final",
"Packet",
"packet",
")",
"throws",
"IOException",
"{",
"final",
"ByteArrayOutputStream",
"byteArrayOutputStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"final",
"GZIPOutputStream",
"gzipOutputStream",... | Compresses given Packet. Note that this can increase the total size when used incorrectly
@param packet Packet to compress
@return Compressed Packet
@throws IOException when unable to compress | [
"Compresses",
"given",
"Packet",
".",
"Note",
"that",
"this",
"can",
"increase",
"the",
"total",
"size",
"when",
"used",
"incorrectly"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/PacketCompressor.java#L72-L91 |
7,631 | jenkinsci/sectioned-view-plugin | src/main/java/hudson/plugins/sectioned_view/ViewListingSection.java | ViewListingSection.getViewsString | public String getViewsString() {
if (views == null || views.isEmpty()) return "";
char delim = ',';
// Build string connected with delimiter, quoting as needed
StringBuilder buf = new StringBuilder();
for (String value : views)
buf.append(delim).append(value);
return buf.substring(1);
} | java | public String getViewsString() {
if (views == null || views.isEmpty()) return "";
char delim = ',';
// Build string connected with delimiter, quoting as needed
StringBuilder buf = new StringBuilder();
for (String value : views)
buf.append(delim).append(value);
return buf.substring(1);
} | [
"public",
"String",
"getViewsString",
"(",
")",
"{",
"if",
"(",
"views",
"==",
"null",
"||",
"views",
".",
"isEmpty",
"(",
")",
")",
"return",
"\"\"",
";",
"char",
"delim",
"=",
"'",
"'",
";",
"// Build string connected with delimiter, quoting as needed",
"Str... | Used for generating the config UI. | [
"Used",
"for",
"generating",
"the",
"config",
"UI",
"."
] | dc8a23c018c4c329b8e75e91cea2b7f466ce0320 | https://github.com/jenkinsci/sectioned-view-plugin/blob/dc8a23c018c4c329b8e75e91cea2b7f466ce0320/src/main/java/hudson/plugins/sectioned_view/ViewListingSection.java#L66-L75 |
7,632 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/security/TLSBuilder.java | TLSBuilder.withTrustStore | public TLSBuilder withTrustStore(final String trustStoreType, final InputStream trustStoreStream, final char[] trustStorePassword)
{
return withKeyStore(trustStoreType, trustStoreStream, trustStorePassword);
} | java | public TLSBuilder withTrustStore(final String trustStoreType, final InputStream trustStoreStream, final char[] trustStorePassword)
{
return withKeyStore(trustStoreType, trustStoreStream, trustStorePassword);
} | [
"public",
"TLSBuilder",
"withTrustStore",
"(",
"final",
"String",
"trustStoreType",
",",
"final",
"InputStream",
"trustStoreStream",
",",
"final",
"char",
"[",
"]",
"trustStorePassword",
")",
"{",
"return",
"withKeyStore",
"(",
"trustStoreType",
",",
"trustStoreStream... | Sets trust store | [
"Sets",
"trust",
"store"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/security/TLSBuilder.java#L84-L87 |
7,633 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/security/TLSBuilder.java | TLSBuilder.buildSocket | public SSLSocket buildSocket() throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException, UnrecoverableKeyException, KeyManagementException
{
if (host == null) throw new IllegalStateException("Cannot create socket without host");
// Get socket
final SSLSocket s = (SSLSocket) build().getSocketFactory().createSocket(host, port);
// Set protocols
s.setEnabledProtocols(TLS.getUsable(TLS.TLS_PROTOCOLS, s.getSupportedProtocols()));
s.setEnabledCipherSuites(TLS.getUsable(TLS.TLS_CIPHER_SUITES, s.getSupportedCipherSuites()));
return s;
} | java | public SSLSocket buildSocket() throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException, UnrecoverableKeyException, KeyManagementException
{
if (host == null) throw new IllegalStateException("Cannot create socket without host");
// Get socket
final SSLSocket s = (SSLSocket) build().getSocketFactory().createSocket(host, port);
// Set protocols
s.setEnabledProtocols(TLS.getUsable(TLS.TLS_PROTOCOLS, s.getSupportedProtocols()));
s.setEnabledCipherSuites(TLS.getUsable(TLS.TLS_CIPHER_SUITES, s.getSupportedCipherSuites()));
return s;
} | [
"public",
"SSLSocket",
"buildSocket",
"(",
")",
"throws",
"KeyStoreException",
",",
"CertificateException",
",",
"NoSuchAlgorithmException",
",",
"IOException",
",",
"UnrecoverableKeyException",
",",
"KeyManagementException",
"{",
"if",
"(",
"host",
"==",
"null",
")",
... | Builds a new Socket
@return SSLSocket | [
"Builds",
"a",
"new",
"Socket"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/security/TLSBuilder.java#L144-L156 |
7,634 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/security/TLSBuilder.java | TLSBuilder.buildServerSocket | public SSLServerSocket buildServerSocket() throws CertificateException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException
{
// Get socket
final SSLServerSocket s = (SSLServerSocket) build().getServerSocketFactory().createServerSocket(port);
// Set protocols
s.setEnabledProtocols(TLS.getUsable(TLS.TLS_PROTOCOLS, s.getSupportedProtocols()));
s.setEnabledCipherSuites(TLS.getUsable(TLS.TLS_CIPHER_SUITES, s.getSupportedCipherSuites()));
return s;
} | java | public SSLServerSocket buildServerSocket() throws CertificateException, UnrecoverableKeyException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException
{
// Get socket
final SSLServerSocket s = (SSLServerSocket) build().getServerSocketFactory().createServerSocket(port);
// Set protocols
s.setEnabledProtocols(TLS.getUsable(TLS.TLS_PROTOCOLS, s.getSupportedProtocols()));
s.setEnabledCipherSuites(TLS.getUsable(TLS.TLS_CIPHER_SUITES, s.getSupportedCipherSuites()));
return s;
} | [
"public",
"SSLServerSocket",
"buildServerSocket",
"(",
")",
"throws",
"CertificateException",
",",
"UnrecoverableKeyException",
",",
"NoSuchAlgorithmException",
",",
"KeyStoreException",
",",
"KeyManagementException",
",",
"IOException",
"{",
"// Get socket\r",
"final",
"SSLS... | Builds a new ServerSocket
@return SSLServerSocket | [
"Builds",
"a",
"new",
"ServerSocket"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/security/TLSBuilder.java#L162-L172 |
7,635 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/Packet.java | Packet.write | public void write(final DataOutputStream out) throws IOException
{
// Packet Type
out.writeByte(packetType.ordinal());
// Packet ID
out.writeShort(packetID);
// Data Length
out.writeInt(dataLength);
// Data
out.write(data);
} | java | public void write(final DataOutputStream out) throws IOException
{
// Packet Type
out.writeByte(packetType.ordinal());
// Packet ID
out.writeShort(packetID);
// Data Length
out.writeInt(dataLength);
// Data
out.write(data);
} | [
"public",
"void",
"write",
"(",
"final",
"DataOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"// Packet Type",
"out",
".",
"writeByte",
"(",
"packetType",
".",
"ordinal",
"(",
")",
")",
";",
"// Packet ID",
"out",
".",
"writeShort",
"(",
"packetID",
... | Writes Packet into DataOutputStream
@param out DataOutputStream to write into
@throws IOException when unable to write to stream | [
"Writes",
"Packet",
"into",
"DataOutputStream"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/Packet.java#L117-L130 |
7,636 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/Packet.java | Packet.fromStream | public static Packet fromStream(final DataInputStream in) throws IOException
{
// Packet Type
final Packet.PacketType packetType = Packet.PacketType.fastValues[in.readByte()];
// Packet ID
final short packetID = in.readShort();
// Data Length
final int dataLength = in.readInt();
// Data
final byte[] data = new byte[dataLength];
in.readFully(data);
return new Packet(
packetType,
packetID,
data
);
} | java | public static Packet fromStream(final DataInputStream in) throws IOException
{
// Packet Type
final Packet.PacketType packetType = Packet.PacketType.fastValues[in.readByte()];
// Packet ID
final short packetID = in.readShort();
// Data Length
final int dataLength = in.readInt();
// Data
final byte[] data = new byte[dataLength];
in.readFully(data);
return new Packet(
packetType,
packetID,
data
);
} | [
"public",
"static",
"Packet",
"fromStream",
"(",
"final",
"DataInputStream",
"in",
")",
"throws",
"IOException",
"{",
"// Packet Type",
"final",
"Packet",
".",
"PacketType",
"packetType",
"=",
"Packet",
".",
"PacketType",
".",
"fastValues",
"[",
"in",
".",
"read... | Reads a Packet from raw input data
@param in DataInputStream to fromStream from
@return Packet created from input
@throws IOException when unable to read from stream | [
"Reads",
"a",
"Packet",
"from",
"raw",
"input",
"data"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/Packet.java#L138-L158 |
7,637 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/PacketReader.java | PacketReader.readBytes | public synchronized byte[] readBytes() throws IOException
{
final int dataLength = dataInputStream.readInt();
final byte[] data = new byte[dataLength];
final int dataRead = dataInputStream.read(data, 0, dataLength);
if (dataRead != dataLength) throw new IOException("Not enough data available");
return data;
} | java | public synchronized byte[] readBytes() throws IOException
{
final int dataLength = dataInputStream.readInt();
final byte[] data = new byte[dataLength];
final int dataRead = dataInputStream.read(data, 0, dataLength);
if (dataRead != dataLength) throw new IOException("Not enough data available");
return data;
} | [
"public",
"synchronized",
"byte",
"[",
"]",
"readBytes",
"(",
")",
"throws",
"IOException",
"{",
"final",
"int",
"dataLength",
"=",
"dataInputStream",
".",
"readInt",
"(",
")",
";",
"final",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"dataLength",
... | Reads byte array into output
@return Bytes
@throws IOException when not enough data is available | [
"Reads",
"byte",
"array",
"into",
"output"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/PacketReader.java#L69-L78 |
7,638 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/security/TLS.java | TLS.getUsable | static String[] getUsable(final List<String> available, final String[] supported)
{
final List<String> filtered = new ArrayList<String>(available.size());
final List<String> supportedList = Arrays.asList(supported);
for (final String s : available)
{
if (supportedList.contains(s)) filtered.add(s);
}
final String[] filteredArray = new String[filtered.size()];
filtered.toArray(filteredArray);
return filteredArray;
} | java | static String[] getUsable(final List<String> available, final String[] supported)
{
final List<String> filtered = new ArrayList<String>(available.size());
final List<String> supportedList = Arrays.asList(supported);
for (final String s : available)
{
if (supportedList.contains(s)) filtered.add(s);
}
final String[] filteredArray = new String[filtered.size()];
filtered.toArray(filteredArray);
return filteredArray;
} | [
"static",
"String",
"[",
"]",
"getUsable",
"(",
"final",
"List",
"<",
"String",
">",
"available",
",",
"final",
"String",
"[",
"]",
"supported",
")",
"{",
"final",
"List",
"<",
"String",
">",
"filtered",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"("... | Returns intersection of available and supported
@return Intersection of available and supported | [
"Returns",
"intersection",
"of",
"available",
"and",
"supported"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/security/TLS.java#L42-L55 |
7,639 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/event/PacketDistributer.java | PacketDistributer.addHandler | public synchronized void addHandler(final short packetID, final PacketHandler packetHandler)
{
if (registry.containsKey(packetID)) throw new IllegalArgumentException("Handler for ID: " + packetID + " already exists");
registry.put(packetID, packetHandler);
} | java | public synchronized void addHandler(final short packetID, final PacketHandler packetHandler)
{
if (registry.containsKey(packetID)) throw new IllegalArgumentException("Handler for ID: " + packetID + " already exists");
registry.put(packetID, packetHandler);
} | [
"public",
"synchronized",
"void",
"addHandler",
"(",
"final",
"short",
"packetID",
",",
"final",
"PacketHandler",
"packetHandler",
")",
"{",
"if",
"(",
"registry",
".",
"containsKey",
"(",
"packetID",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\... | Adds a new handler for this specific Packet ID
@param packetID Packet ID to add handler for
@param packetHandler Handler for given Packet ID
@throws IllegalArgumentException when Packet ID already has a registered handler | [
"Adds",
"a",
"new",
"handler",
"for",
"this",
"specific",
"Packet",
"ID"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/event/PacketDistributer.java#L70-L74 |
7,640 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java | PacketBuilder.withByte | public synchronized PacketBuilder withByte(final byte b)
{
checkBuilt();
try
{
dataOutputStream.writeByte(b);
}
catch (final IOException e)
{
logger.error("Unable to add byte: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | java | public synchronized PacketBuilder withByte(final byte b)
{
checkBuilt();
try
{
dataOutputStream.writeByte(b);
}
catch (final IOException e)
{
logger.error("Unable to add byte: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | [
"public",
"synchronized",
"PacketBuilder",
"withByte",
"(",
"final",
"byte",
"b",
")",
"{",
"checkBuilt",
"(",
")",
";",
"try",
"{",
"dataOutputStream",
".",
"writeByte",
"(",
"b",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"logg... | Adds a byte
@param b Byte
@throws IllegalStateException see {@link #checkBuilt()} | [
"Adds",
"a",
"byte"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java#L82-L94 |
7,641 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java | PacketBuilder.withBytes | public synchronized PacketBuilder withBytes(final byte[] b)
{
checkBuilt();
try
{
dataOutputStream.writeInt(b.length);
dataOutputStream.write(b);
}
catch (final IOException e)
{
logger.error("Unable to add bytes: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | java | public synchronized PacketBuilder withBytes(final byte[] b)
{
checkBuilt();
try
{
dataOutputStream.writeInt(b.length);
dataOutputStream.write(b);
}
catch (final IOException e)
{
logger.error("Unable to add bytes: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | [
"public",
"synchronized",
"PacketBuilder",
"withBytes",
"(",
"final",
"byte",
"[",
"]",
"b",
")",
"{",
"checkBuilt",
"(",
")",
";",
"try",
"{",
"dataOutputStream",
".",
"writeInt",
"(",
"b",
".",
"length",
")",
";",
"dataOutputStream",
".",
"write",
"(",
... | Adds byte array
@param b Byte array
@throws IllegalStateException see {@link #checkBuilt()} | [
"Adds",
"byte",
"array"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java#L101-L114 |
7,642 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java | PacketBuilder.withInt | public synchronized PacketBuilder withInt(final int i)
{
checkBuilt();
try
{
dataOutputStream.writeInt(i);
}
catch (final IOException e)
{
logger.error("Unable to add integer: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | java | public synchronized PacketBuilder withInt(final int i)
{
checkBuilt();
try
{
dataOutputStream.writeInt(i);
}
catch (final IOException e)
{
logger.error("Unable to add integer: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | [
"public",
"synchronized",
"PacketBuilder",
"withInt",
"(",
"final",
"int",
"i",
")",
"{",
"checkBuilt",
"(",
")",
";",
"try",
"{",
"dataOutputStream",
".",
"writeInt",
"(",
"i",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"logger"... | Adds an integer
@param i Integer
@throws IllegalStateException see {@link #checkBuilt()} | [
"Adds",
"an",
"integer"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java#L121-L133 |
7,643 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java | PacketBuilder.withString | public synchronized PacketBuilder withString(final String s)
{
try
{
withBytes(s.getBytes("utf-8"));
}
catch (final UnsupportedEncodingException e)
{
logger.error("UTF-8 encoding is not supported");
}
return this;
} | java | public synchronized PacketBuilder withString(final String s)
{
try
{
withBytes(s.getBytes("utf-8"));
}
catch (final UnsupportedEncodingException e)
{
logger.error("UTF-8 encoding is not supported");
}
return this;
} | [
"public",
"synchronized",
"PacketBuilder",
"withString",
"(",
"final",
"String",
"s",
")",
"{",
"try",
"{",
"withBytes",
"(",
"s",
".",
"getBytes",
"(",
"\"utf-8\"",
")",
")",
";",
"}",
"catch",
"(",
"final",
"UnsupportedEncodingException",
"e",
")",
"{",
... | Adds a String
@param s UTF-8 String
@throws IllegalStateException see {@link #checkBuilt()} | [
"Adds",
"a",
"String"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java#L140-L152 |
7,644 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java | PacketBuilder.withBoolean | public synchronized PacketBuilder withBoolean(final boolean b)
{
checkBuilt();
try
{
dataOutputStream.writeBoolean(b);
}
catch (final IOException e)
{
logger.error("Unable to add boolean: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | java | public synchronized PacketBuilder withBoolean(final boolean b)
{
checkBuilt();
try
{
dataOutputStream.writeBoolean(b);
}
catch (final IOException e)
{
logger.error("Unable to add boolean: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | [
"public",
"synchronized",
"PacketBuilder",
"withBoolean",
"(",
"final",
"boolean",
"b",
")",
"{",
"checkBuilt",
"(",
")",
";",
"try",
"{",
"dataOutputStream",
".",
"writeBoolean",
"(",
"b",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{"... | Adds a boolean
@param b Boolean
@throws IllegalStateException see {@link #checkBuilt()} | [
"Adds",
"a",
"boolean"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java#L159-L171 |
7,645 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java | PacketBuilder.withFloat | public synchronized PacketBuilder withFloat(final float f)
{
checkBuilt();
try
{
dataOutputStream.writeFloat(f);
}
catch (final IOException e)
{
logger.error("Unable to add float: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | java | public synchronized PacketBuilder withFloat(final float f)
{
checkBuilt();
try
{
dataOutputStream.writeFloat(f);
}
catch (final IOException e)
{
logger.error("Unable to add float: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | [
"public",
"synchronized",
"PacketBuilder",
"withFloat",
"(",
"final",
"float",
"f",
")",
"{",
"checkBuilt",
"(",
")",
";",
"try",
"{",
"dataOutputStream",
".",
"writeFloat",
"(",
"f",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"l... | Adds a float
@param f Float
@throws IllegalStateException see {@link #checkBuilt()} | [
"Adds",
"a",
"float"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java#L178-L190 |
7,646 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java | PacketBuilder.withDouble | public synchronized PacketBuilder withDouble(final double d)
{
checkBuilt();
try
{
dataOutputStream.writeDouble(d);
}
catch (final IOException e)
{
logger.error("Unable to add double: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | java | public synchronized PacketBuilder withDouble(final double d)
{
checkBuilt();
try
{
dataOutputStream.writeDouble(d);
}
catch (final IOException e)
{
logger.error("Unable to add double: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | [
"public",
"synchronized",
"PacketBuilder",
"withDouble",
"(",
"final",
"double",
"d",
")",
"{",
"checkBuilt",
"(",
")",
";",
"try",
"{",
"dataOutputStream",
".",
"writeDouble",
"(",
"d",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
... | Adds a double
@param d Double
@throws IllegalStateException see {@link #checkBuilt()} | [
"Adds",
"a",
"double"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java#L197-L209 |
7,647 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java | PacketBuilder.withLong | public synchronized PacketBuilder withLong(final long l)
{
checkBuilt();
try
{
dataOutputStream.writeLong(l);
}
catch (final IOException e)
{
logger.error("Unable to add long: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | java | public synchronized PacketBuilder withLong(final long l)
{
checkBuilt();
try
{
dataOutputStream.writeLong(l);
}
catch (final IOException e)
{
logger.error("Unable to add long: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | [
"public",
"synchronized",
"PacketBuilder",
"withLong",
"(",
"final",
"long",
"l",
")",
"{",
"checkBuilt",
"(",
")",
";",
"try",
"{",
"dataOutputStream",
".",
"writeLong",
"(",
"l",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"logg... | Adds a long
@param l Long
@throws IllegalStateException see {@link #checkBuilt()} | [
"Adds",
"a",
"long"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java#L216-L228 |
7,648 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java | PacketBuilder.withShort | public synchronized PacketBuilder withShort(final short s)
{
checkBuilt();
try
{
dataOutputStream.writeShort(s);
}
catch (final IOException e)
{
logger.error("Unable to add short: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | java | public synchronized PacketBuilder withShort(final short s)
{
checkBuilt();
try
{
dataOutputStream.writeShort(s);
}
catch (final IOException e)
{
logger.error("Unable to add short: {} : {}", e.getClass(), e.getMessage());
}
return this;
} | [
"public",
"synchronized",
"PacketBuilder",
"withShort",
"(",
"final",
"short",
"s",
")",
"{",
"checkBuilt",
"(",
")",
";",
"try",
"{",
"dataOutputStream",
".",
"writeShort",
"(",
"s",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"l... | Adds a short
@param s Short
@throws IllegalStateException see {@link #checkBuilt()} | [
"Adds",
"a",
"short"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java#L235-L247 |
7,649 | PvdBerg1998/PNet | src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java | PacketBuilder.build | public synchronized Packet build()
{
checkBuilt();
isBuilt = true;
try
{
dataOutputStream.close();
}
catch (final IOException e)
{
logger.error("Unable to build packet: {} : {}", e.getClass(), e.getMessage());
}
return new Packet(
packetType,
packetID,
byteArrayOutputStream.toByteArray()
);
} | java | public synchronized Packet build()
{
checkBuilt();
isBuilt = true;
try
{
dataOutputStream.close();
}
catch (final IOException e)
{
logger.error("Unable to build packet: {} : {}", e.getClass(), e.getMessage());
}
return new Packet(
packetType,
packetID,
byteArrayOutputStream.toByteArray()
);
} | [
"public",
"synchronized",
"Packet",
"build",
"(",
")",
"{",
"checkBuilt",
"(",
")",
";",
"isBuilt",
"=",
"true",
";",
"try",
"{",
"dataOutputStream",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"logger",
".",
... | Builds Packet with given data
@return Packet
@throws IllegalStateException see {@link #checkBuilt()} | [
"Builds",
"Packet",
"with",
"given",
"data"
] | d3dfff2ceaf69c244e0593e3f7606f171ec718bb | https://github.com/PvdBerg1998/PNet/blob/d3dfff2ceaf69c244e0593e3f7606f171ec718bb/src/main/java/nl/pvdberg/pnet/packet/PacketBuilder.java#L263-L282 |
7,650 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/transform/coordinate/XYToAnyTransform.java | XYToAnyTransform.setTargetNormal | public void setTargetNormal( double nx, double ny, double nz )
{
double h,f,c,vx,vy,hvx;
vx = ny;
vy = -nx;
c = nz;
h = (1-c)/(1-c*c);
hvx = h*vx;
f = (c < 0) ? -c : c;
if( f < 1.0 - 1.0E-4 )
{
m00=c + hvx*vx;
m01=hvx*vy;
m02=-vy;
m10=hvx*vy;
m11=c + h*vy*vy;
m12=vx;
m20=vy;
m21=-vx;
m22=c;
}
else
{
// if "from" and "to" vectors are nearly parallel
m00=1;
m01=0;
m02=0;
m10=0;
m11=1;
m12=0;
m20=0;
m21=0;
if( c > 0 )
{
m22=1;
}
else
{
m22=-1;
}
}
} | java | public void setTargetNormal( double nx, double ny, double nz )
{
double h,f,c,vx,vy,hvx;
vx = ny;
vy = -nx;
c = nz;
h = (1-c)/(1-c*c);
hvx = h*vx;
f = (c < 0) ? -c : c;
if( f < 1.0 - 1.0E-4 )
{
m00=c + hvx*vx;
m01=hvx*vy;
m02=-vy;
m10=hvx*vy;
m11=c + h*vy*vy;
m12=vx;
m20=vy;
m21=-vx;
m22=c;
}
else
{
// if "from" and "to" vectors are nearly parallel
m00=1;
m01=0;
m02=0;
m10=0;
m11=1;
m12=0;
m20=0;
m21=0;
if( c > 0 )
{
m22=1;
}
else
{
m22=-1;
}
}
} | [
"public",
"void",
"setTargetNormal",
"(",
"double",
"nx",
",",
"double",
"ny",
",",
"double",
"nz",
")",
"{",
"double",
"h",
",",
"f",
",",
"c",
",",
"vx",
",",
"vy",
",",
"hvx",
";",
"vx",
"=",
"ny",
";",
"vy",
"=",
"-",
"nx",
";",
"c",
"=",... | Assumes target normal is normalized
@param nx
@param ny
@param nz | [
"Assumes",
"target",
"normal",
"is",
"normalized"
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/transform/coordinate/XYToAnyTransform.java#L28-L73 |
7,651 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/geometry/polygon/Polygon.java | Polygon.insertPointAfter | public void insertPointAfter( PolygonPoint a, PolygonPoint newPoint )
{
// Validate that
int index = _points.indexOf( a );
if( index != -1 )
{
newPoint.setNext( a.getNext() );
newPoint.setPrevious( a );
a.getNext().setPrevious( newPoint );
a.setNext( newPoint );
_points.add( index+1, newPoint );
}
else
{
throw new RuntimeException( "Tried to insert a point into a Polygon after a point not belonging to the Polygon" );
}
} | java | public void insertPointAfter( PolygonPoint a, PolygonPoint newPoint )
{
// Validate that
int index = _points.indexOf( a );
if( index != -1 )
{
newPoint.setNext( a.getNext() );
newPoint.setPrevious( a );
a.getNext().setPrevious( newPoint );
a.setNext( newPoint );
_points.add( index+1, newPoint );
}
else
{
throw new RuntimeException( "Tried to insert a point into a Polygon after a point not belonging to the Polygon" );
}
} | [
"public",
"void",
"insertPointAfter",
"(",
"PolygonPoint",
"a",
",",
"PolygonPoint",
"newPoint",
")",
"{",
"// Validate that \r",
"int",
"index",
"=",
"_points",
".",
"indexOf",
"(",
"a",
")",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"newPoint",
... | Will insert a point in the polygon after given point | [
"Will",
"insert",
"a",
"point",
"in",
"the",
"polygon",
"after",
"given",
"point"
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/geometry/polygon/Polygon.java#L131-L147 |
7,652 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/geometry/polygon/Polygon.java | Polygon.addPoint | public void addPoint(PolygonPoint p )
{
p.setPrevious( _last );
p.setNext( _last.getNext() );
_last.setNext( p );
_points.add( p );
} | java | public void addPoint(PolygonPoint p )
{
p.setPrevious( _last );
p.setNext( _last.getNext() );
_last.setNext( p );
_points.add( p );
} | [
"public",
"void",
"addPoint",
"(",
"PolygonPoint",
"p",
")",
"{",
"p",
".",
"setPrevious",
"(",
"_last",
")",
";",
"p",
".",
"setNext",
"(",
"_last",
".",
"getNext",
"(",
")",
")",
";",
"_last",
".",
"setNext",
"(",
"p",
")",
";",
"_points",
".",
... | Will add a point after the last point added
@param p | [
"Will",
"add",
"a",
"point",
"after",
"the",
"last",
"point",
"added"
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/geometry/polygon/Polygon.java#L173-L179 |
7,653 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/geometry/polygon/Polygon.java | Polygon.prepareTriangulation | public void prepareTriangulation( TriangulationContext<?> tcx )
{
int hint = _points.size();
if(_steinerPoints != null) {
hint += _steinerPoints.size();
}
if( _holes != null ) {
for (Polygon p : _holes) {
hint += p.pointCount();
}
}
HashMap<TriangulationPoint, TriangulationPoint> uniquePts = new HashMap<TriangulationPoint, TriangulationPoint>(hint);
TriangulationPoint.mergeInstances(uniquePts, _points);
if(_steinerPoints != null) {
TriangulationPoint.mergeInstances(uniquePts, _steinerPoints);
}
if( _holes != null ) {
for (Polygon p : _holes) {
TriangulationPoint.mergeInstances(uniquePts, p._points);
}
}
if( m_triangles == null )
{
m_triangles = new ArrayList<DelaunayTriangle>( _points.size() );
}
else
{
m_triangles.clear();
}
// Outer constraints
for( int i = 0; i < _points.size()-1 ; i++ )
{
tcx.newConstraint( _points.get( i ), _points.get( i+1 ) );
}
tcx.newConstraint( _points.get( 0 ), _points.get( _points.size()-1 ) );
// Hole constraints
if( _holes != null )
{
for( Polygon p : _holes )
{
for( int i = 0; i < p._points.size()-1 ; i++ )
{
tcx.newConstraint( p._points.get( i ), p._points.get( i+1 ) );
}
tcx.newConstraint( p._points.get( 0 ), p._points.get( p._points.size()-1 ) );
}
}
tcx.addPoints(uniquePts.keySet());
} | java | public void prepareTriangulation( TriangulationContext<?> tcx )
{
int hint = _points.size();
if(_steinerPoints != null) {
hint += _steinerPoints.size();
}
if( _holes != null ) {
for (Polygon p : _holes) {
hint += p.pointCount();
}
}
HashMap<TriangulationPoint, TriangulationPoint> uniquePts = new HashMap<TriangulationPoint, TriangulationPoint>(hint);
TriangulationPoint.mergeInstances(uniquePts, _points);
if(_steinerPoints != null) {
TriangulationPoint.mergeInstances(uniquePts, _steinerPoints);
}
if( _holes != null ) {
for (Polygon p : _holes) {
TriangulationPoint.mergeInstances(uniquePts, p._points);
}
}
if( m_triangles == null )
{
m_triangles = new ArrayList<DelaunayTriangle>( _points.size() );
}
else
{
m_triangles.clear();
}
// Outer constraints
for( int i = 0; i < _points.size()-1 ; i++ )
{
tcx.newConstraint( _points.get( i ), _points.get( i+1 ) );
}
tcx.newConstraint( _points.get( 0 ), _points.get( _points.size()-1 ) );
// Hole constraints
if( _holes != null )
{
for( Polygon p : _holes )
{
for( int i = 0; i < p._points.size()-1 ; i++ )
{
tcx.newConstraint( p._points.get( i ), p._points.get( i+1 ) );
}
tcx.newConstraint( p._points.get( 0 ), p._points.get( p._points.size()-1 ) );
}
}
tcx.addPoints(uniquePts.keySet());
} | [
"public",
"void",
"prepareTriangulation",
"(",
"TriangulationContext",
"<",
"?",
">",
"tcx",
")",
"{",
"int",
"hint",
"=",
"_points",
".",
"size",
"(",
")",
";",
"if",
"(",
"_steinerPoints",
"!=",
"null",
")",
"{",
"hint",
"+=",
"_steinerPoints",
".",
"s... | Merge equals points.
Creates constraints and populates the context with points. | [
"Merge",
"equals",
"points",
".",
"Creates",
"constraints",
"and",
"populates",
"the",
"context",
"with",
"points",
"."
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/geometry/polygon/Polygon.java#L236-L286 |
7,654 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/Poly2Tri.java | Poly2Tri.warmup | public static void warmup()
{
/*
* After a method is run 10000 times, the Hotspot compiler will compile
* it into native code. Periodically, the Hotspot compiler may recompile
* the method. After an unspecified amount of time, then the compilation
* system should become quiet.
*/
Polygon poly = PolygonGenerator.RandomCircleSweep2( 50, 50000 );
TriangulationProcess process = new TriangulationProcess();
process.triangulate( poly );
} | java | public static void warmup()
{
/*
* After a method is run 10000 times, the Hotspot compiler will compile
* it into native code. Periodically, the Hotspot compiler may recompile
* the method. After an unspecified amount of time, then the compilation
* system should become quiet.
*/
Polygon poly = PolygonGenerator.RandomCircleSweep2( 50, 50000 );
TriangulationProcess process = new TriangulationProcess();
process.triangulate( poly );
} | [
"public",
"static",
"void",
"warmup",
"(",
")",
"{",
"/*\r\n * After a method is run 10000 times, the Hotspot compiler will compile\r\n * it into native code. Periodically, the Hotspot compiler may recompile\r\n * the method. After an unspecified amount of time, then the compil... | Will do a warmup run to let the JVM optimize the triangulation code | [
"Will",
"do",
"a",
"warmup",
"run",
"to",
"let",
"the",
"JVM",
"optimize",
"the",
"triangulation",
"code"
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/Poly2Tri.java#L115-L126 |
7,655 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java | DelaunayTriangle.markNeighbor | private void markNeighbor( TriangulationPoint p1,
TriangulationPoint p2,
DelaunayTriangle t )
{
if( ( p1 == points[2] && p2 == points[1] ) || ( p1 == points[1] && p2 == points[2] ) )
{
neighbors[0] = t;
}
else if( ( p1 == points[0] && p2 == points[2] ) || ( p1 == points[2] && p2 == points[0] ) )
{
neighbors[1] = t;
}
else if( ( p1 == points[0] && p2 == points[1] ) || ( p1 == points[1] && p2 == points[0] ) )
{
neighbors[2] = t;
}
else
{
logger.error( "Neighbor error, please report!" );
// throw new Exception("Neighbor error, please report!");
}
} | java | private void markNeighbor( TriangulationPoint p1,
TriangulationPoint p2,
DelaunayTriangle t )
{
if( ( p1 == points[2] && p2 == points[1] ) || ( p1 == points[1] && p2 == points[2] ) )
{
neighbors[0] = t;
}
else if( ( p1 == points[0] && p2 == points[2] ) || ( p1 == points[2] && p2 == points[0] ) )
{
neighbors[1] = t;
}
else if( ( p1 == points[0] && p2 == points[1] ) || ( p1 == points[1] && p2 == points[0] ) )
{
neighbors[2] = t;
}
else
{
logger.error( "Neighbor error, please report!" );
// throw new Exception("Neighbor error, please report!");
}
} | [
"private",
"void",
"markNeighbor",
"(",
"TriangulationPoint",
"p1",
",",
"TriangulationPoint",
"p2",
",",
"DelaunayTriangle",
"t",
")",
"{",
"if",
"(",
"(",
"p1",
"==",
"points",
"[",
"2",
"]",
"&&",
"p2",
"==",
"points",
"[",
"1",
"]",
")",
"||",
"(",... | Update neighbor pointers | [
"Update",
"neighbor",
"pointers"
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java#L120-L141 |
7,656 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java | DelaunayTriangle.clear | public void clear()
{
DelaunayTriangle t;
for( int i=0; i<3; i++ )
{
t = neighbors[i];
if( t != null )
{
t.clearNeighbor( this );
}
}
clearNeighbors();
points[0]=points[1]=points[2]=null;
} | java | public void clear()
{
DelaunayTriangle t;
for( int i=0; i<3; i++ )
{
t = neighbors[i];
if( t != null )
{
t.clearNeighbor( this );
}
}
clearNeighbors();
points[0]=points[1]=points[2]=null;
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"DelaunayTriangle",
"t",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"3",
";",
"i",
"++",
")",
"{",
"t",
"=",
"neighbors",
"[",
"i",
"]",
";",
"if",
"(",
"t",
"!=",
"null",
")",
"{",
"t",
... | Clears all references to all other triangles and points | [
"Clears",
"all",
"references",
"to",
"all",
"other",
"triangles",
"and",
"points"
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java#L191-L204 |
7,657 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java | DelaunayTriangle.neighborCW | public DelaunayTriangle neighborCW( TriangulationPoint point )
{
if( point == points[0] )
{
return neighbors[1];
}
else if( point == points[1] )
{
return neighbors[2];
}
return neighbors[0];
} | java | public DelaunayTriangle neighborCW( TriangulationPoint point )
{
if( point == points[0] )
{
return neighbors[1];
}
else if( point == points[1] )
{
return neighbors[2];
}
return neighbors[0];
} | [
"public",
"DelaunayTriangle",
"neighborCW",
"(",
"TriangulationPoint",
"point",
")",
"{",
"if",
"(",
"point",
"==",
"points",
"[",
"0",
"]",
")",
"{",
"return",
"neighbors",
"[",
"1",
"]",
";",
"}",
"else",
"if",
"(",
"point",
"==",
"points",
"[",
"1",... | The neighbor clockwise to given point | [
"The",
"neighbor",
"clockwise",
"to",
"given",
"point"
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java#L217-L228 |
7,658 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java | DelaunayTriangle.neighborCCW | public DelaunayTriangle neighborCCW( TriangulationPoint point )
{
if( point == points[0] )
{
return neighbors[2];
}
else if( point == points[1] )
{
return neighbors[0];
}
return neighbors[1];
} | java | public DelaunayTriangle neighborCCW( TriangulationPoint point )
{
if( point == points[0] )
{
return neighbors[2];
}
else if( point == points[1] )
{
return neighbors[0];
}
return neighbors[1];
} | [
"public",
"DelaunayTriangle",
"neighborCCW",
"(",
"TriangulationPoint",
"point",
")",
"{",
"if",
"(",
"point",
"==",
"points",
"[",
"0",
"]",
")",
"{",
"return",
"neighbors",
"[",
"2",
"]",
";",
"}",
"else",
"if",
"(",
"point",
"==",
"points",
"[",
"1"... | The neighbor counter-clockwise to given point | [
"The",
"neighbor",
"counter",
"-",
"clockwise",
"to",
"given",
"point"
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java#L231-L242 |
7,659 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java | DelaunayTriangle.neighborAcross | public DelaunayTriangle neighborAcross( TriangulationPoint opoint )
{
if( opoint == points[0] )
{
return neighbors[0];
}
else if( opoint == points[1] )
{
return neighbors[1];
}
return neighbors[2];
} | java | public DelaunayTriangle neighborAcross( TriangulationPoint opoint )
{
if( opoint == points[0] )
{
return neighbors[0];
}
else if( opoint == points[1] )
{
return neighbors[1];
}
return neighbors[2];
} | [
"public",
"DelaunayTriangle",
"neighborAcross",
"(",
"TriangulationPoint",
"opoint",
")",
"{",
"if",
"(",
"opoint",
"==",
"points",
"[",
"0",
"]",
")",
"{",
"return",
"neighbors",
"[",
"0",
"]",
";",
"}",
"else",
"if",
"(",
"opoint",
"==",
"points",
"[",... | The neighbor across to given point | [
"The",
"neighbor",
"across",
"to",
"given",
"point"
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java#L245-L256 |
7,660 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java | DelaunayTriangle.legalize | public void legalize( TriangulationPoint oPoint, TriangulationPoint nPoint )
{
if( oPoint == points[0] )
{
points[1] = points[0];
points[0] = points[2];
points[2] = nPoint;
}
else if( oPoint == points[1] )
{
points[2] = points[1];
points[1] = points[0];
points[0] = nPoint;
}
else if( oPoint == points[2] )
{
points[0] = points[2];
points[2] = points[1];
points[1] = nPoint;
}
else
{
logger.error( "legalization error" );
throw new RuntimeException("legalization bug");
}
} | java | public void legalize( TriangulationPoint oPoint, TriangulationPoint nPoint )
{
if( oPoint == points[0] )
{
points[1] = points[0];
points[0] = points[2];
points[2] = nPoint;
}
else if( oPoint == points[1] )
{
points[2] = points[1];
points[1] = points[0];
points[0] = nPoint;
}
else if( oPoint == points[2] )
{
points[0] = points[2];
points[2] = points[1];
points[1] = nPoint;
}
else
{
logger.error( "legalization error" );
throw new RuntimeException("legalization bug");
}
} | [
"public",
"void",
"legalize",
"(",
"TriangulationPoint",
"oPoint",
",",
"TriangulationPoint",
"nPoint",
")",
"{",
"if",
"(",
"oPoint",
"==",
"points",
"[",
"0",
"]",
")",
"{",
"points",
"[",
"1",
"]",
"=",
"points",
"[",
"0",
"]",
";",
"points",
"[",
... | Legalize triangle by rotating clockwise around oPoint | [
"Legalize",
"triangle",
"by",
"rotating",
"clockwise",
"around",
"oPoint"
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java#L297-L322 |
7,661 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java | DelaunayTriangle.markNeighborEdges | public void markNeighborEdges()
{
for( int i = 0; i < 3; i++ )
{
if( cEdge[i] )
{
switch( i )
{
case 0:
if( neighbors[0] != null )
neighbors[0].markConstrainedEdge( points[1], points[2] );
break;
case 1:
if( neighbors[1] != null )
neighbors[1].markConstrainedEdge( points[0], points[2] );
break;
case 2:
if( neighbors[2] != null )
neighbors[2].markConstrainedEdge( points[0], points[1] );
break;
}
}
}
} | java | public void markNeighborEdges()
{
for( int i = 0; i < 3; i++ )
{
if( cEdge[i] )
{
switch( i )
{
case 0:
if( neighbors[0] != null )
neighbors[0].markConstrainedEdge( points[1], points[2] );
break;
case 1:
if( neighbors[1] != null )
neighbors[1].markConstrainedEdge( points[0], points[2] );
break;
case 2:
if( neighbors[2] != null )
neighbors[2].markConstrainedEdge( points[0], points[1] );
break;
}
}
}
} | [
"public",
"void",
"markNeighborEdges",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"3",
";",
"i",
"++",
")",
"{",
"if",
"(",
"cEdge",
"[",
"i",
"]",
")",
"{",
"switch",
"(",
"i",
")",
"{",
"case",
"0",
":",
"if",
"(",
... | Finalize edge marking | [
"Finalize",
"edge",
"marking"
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java#L349-L372 |
7,662 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java | DelaunayTriangle.markConstrainedEdge | public void markConstrainedEdge( TriangulationPoint p, TriangulationPoint q )
{
if( ( q == points[0] && p == points[1] ) || ( q == points[1] && p == points[0] ) )
{
cEdge[2] = true;
}
else if( ( q == points[0] && p == points[2] ) || ( q == points[2] && p == points[0] ) )
{
cEdge[1] = true;
}
else if( ( q == points[1] && p == points[2] ) || ( q == points[2] && p == points[1] ) )
{
cEdge[0] = true;
}
} | java | public void markConstrainedEdge( TriangulationPoint p, TriangulationPoint q )
{
if( ( q == points[0] && p == points[1] ) || ( q == points[1] && p == points[0] ) )
{
cEdge[2] = true;
}
else if( ( q == points[0] && p == points[2] ) || ( q == points[2] && p == points[0] ) )
{
cEdge[1] = true;
}
else if( ( q == points[1] && p == points[2] ) || ( q == points[2] && p == points[1] ) )
{
cEdge[0] = true;
}
} | [
"public",
"void",
"markConstrainedEdge",
"(",
"TriangulationPoint",
"p",
",",
"TriangulationPoint",
"q",
")",
"{",
"if",
"(",
"(",
"q",
"==",
"points",
"[",
"0",
"]",
"&&",
"p",
"==",
"points",
"[",
"1",
"]",
")",
"||",
"(",
"q",
"==",
"points",
"[",... | Mark edge as constrained | [
"Mark",
"edge",
"as",
"constrained"
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java#L448-L462 |
7,663 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java | DelaunayTriangle.edgeIndex | public int edgeIndex( TriangulationPoint p1, TriangulationPoint p2 )
{
if( points[0] == p1 )
{
if( points[1] == p2 )
{
return 2;
}
else if( points[2] == p2 )
{
return 1;
}
}
else if( points[1] == p1 )
{
if( points[2] == p2 )
{
return 0;
}
else if( points[0] == p2 )
{
return 2;
}
}
else if( points[2] == p1 )
{
if( points[0] == p2 )
{
return 1;
}
else if( points[1] == p2 )
{
return 0;
}
}
return -1;
} | java | public int edgeIndex( TriangulationPoint p1, TriangulationPoint p2 )
{
if( points[0] == p1 )
{
if( points[1] == p2 )
{
return 2;
}
else if( points[2] == p2 )
{
return 1;
}
}
else if( points[1] == p1 )
{
if( points[2] == p2 )
{
return 0;
}
else if( points[0] == p2 )
{
return 2;
}
}
else if( points[2] == p1 )
{
if( points[0] == p2 )
{
return 1;
}
else if( points[1] == p2 )
{
return 0;
}
}
return -1;
} | [
"public",
"int",
"edgeIndex",
"(",
"TriangulationPoint",
"p1",
",",
"TriangulationPoint",
"p2",
")",
"{",
"if",
"(",
"points",
"[",
"0",
"]",
"==",
"p1",
")",
"{",
"if",
"(",
"points",
"[",
"1",
"]",
"==",
"p2",
")",
"{",
"return",
"2",
";",
"}",
... | Get the neighbor that share this edge
@param constrainedEdge
@return index of the shared edge or -1 if edge isn't shared | [
"Get",
"the",
"neighbor",
"that",
"share",
"this",
"edge"
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/triangulation/delaunay/DelaunayTriangle.java#L485-L521 |
7,664 | airbrake/javabrake | src/main/java/Notifier.java | Notifier.report | public Future<Notice> report(Throwable e) {
Notice notice = this.buildNotice(e);
return this.send(notice);
} | java | public Future<Notice> report(Throwable e) {
Notice notice = this.buildNotice(e);
return this.send(notice);
} | [
"public",
"Future",
"<",
"Notice",
">",
"report",
"(",
"Throwable",
"e",
")",
"{",
"Notice",
"notice",
"=",
"this",
".",
"buildNotice",
"(",
"e",
")",
";",
"return",
"this",
".",
"send",
"(",
"notice",
")",
";",
"}"
] | Asynchronously reports an exception to Airbrake. | [
"Asynchronously",
"reports",
"an",
"exception",
"to",
"Airbrake",
"."
] | 2c33014aa6bca393fc28c06aedd059fd2990c551 | https://github.com/airbrake/javabrake/blob/2c33014aa6bca393fc28c06aedd059fd2990c551/src/main/java/Notifier.java#L60-L63 |
7,665 | airbrake/javabrake | src/main/java/Notifier.java | Notifier.send | public Future<Notice> send(Notice notice) {
notice = this.filterNotice(notice);
CompletableFuture<Notice> future = this.asyncSender.send(notice);
final Notice finalNotice = notice;
future.whenComplete(
(value, exception) -> {
this.applyHooks(finalNotice);
});
return future;
} | java | public Future<Notice> send(Notice notice) {
notice = this.filterNotice(notice);
CompletableFuture<Notice> future = this.asyncSender.send(notice);
final Notice finalNotice = notice;
future.whenComplete(
(value, exception) -> {
this.applyHooks(finalNotice);
});
return future;
} | [
"public",
"Future",
"<",
"Notice",
">",
"send",
"(",
"Notice",
"notice",
")",
"{",
"notice",
"=",
"this",
".",
"filterNotice",
"(",
"notice",
")",
";",
"CompletableFuture",
"<",
"Notice",
">",
"future",
"=",
"this",
".",
"asyncSender",
".",
"send",
"(",
... | Asynchronously sends a Notice to Airbrake. | [
"Asynchronously",
"sends",
"a",
"Notice",
"to",
"Airbrake",
"."
] | 2c33014aa6bca393fc28c06aedd059fd2990c551 | https://github.com/airbrake/javabrake/blob/2c33014aa6bca393fc28c06aedd059fd2990c551/src/main/java/Notifier.java#L66-L77 |
7,666 | airbrake/javabrake | src/main/java/Notifier.java | Notifier.reportSync | public Notice reportSync(Throwable e) {
Notice notice = this.buildNotice(e);
return this.sendSync(notice);
} | java | public Notice reportSync(Throwable e) {
Notice notice = this.buildNotice(e);
return this.sendSync(notice);
} | [
"public",
"Notice",
"reportSync",
"(",
"Throwable",
"e",
")",
"{",
"Notice",
"notice",
"=",
"this",
".",
"buildNotice",
"(",
"e",
")",
";",
"return",
"this",
".",
"sendSync",
"(",
"notice",
")",
";",
"}"
] | Sychronously reports an exception to Airbrake. | [
"Sychronously",
"reports",
"an",
"exception",
"to",
"Airbrake",
"."
] | 2c33014aa6bca393fc28c06aedd059fd2990c551 | https://github.com/airbrake/javabrake/blob/2c33014aa6bca393fc28c06aedd059fd2990c551/src/main/java/Notifier.java#L80-L83 |
7,667 | airbrake/javabrake | src/main/java/Notifier.java | Notifier.sendSync | public Notice sendSync(Notice notice) {
notice = this.filterNotice(notice);
notice = this.syncSender.send(notice);
this.applyHooks(notice);
return notice;
} | java | public Notice sendSync(Notice notice) {
notice = this.filterNotice(notice);
notice = this.syncSender.send(notice);
this.applyHooks(notice);
return notice;
} | [
"public",
"Notice",
"sendSync",
"(",
"Notice",
"notice",
")",
"{",
"notice",
"=",
"this",
".",
"filterNotice",
"(",
"notice",
")",
";",
"notice",
"=",
"this",
".",
"syncSender",
".",
"send",
"(",
"notice",
")",
";",
"this",
".",
"applyHooks",
"(",
"not... | Synchronously sends a Notice to Airbrake. | [
"Synchronously",
"sends",
"a",
"Notice",
"to",
"Airbrake",
"."
] | 2c33014aa6bca393fc28c06aedd059fd2990c551 | https://github.com/airbrake/javabrake/blob/2c33014aa6bca393fc28c06aedd059fd2990c551/src/main/java/Notifier.java#L86-L91 |
7,668 | orbisgis/poly2tri.java | poly2tri-examples/src/main/java/org/poly2tri/examples/ardor3d/CDTModelExample.java | CDTModelExample.updateText | protected void updateText()
{
super.updateText();
_exampleInfo[3].setText("[PageUp] Next model");
_exampleInfo[4].setText("[PageDown] Previous model");
_exampleInfo[5].setText("[1] Generate polygon type A ");
_exampleInfo[6].setText("[2] Generate polygon type B ");
} | java | protected void updateText()
{
super.updateText();
_exampleInfo[3].setText("[PageUp] Next model");
_exampleInfo[4].setText("[PageDown] Previous model");
_exampleInfo[5].setText("[1] Generate polygon type A ");
_exampleInfo[6].setText("[2] Generate polygon type B ");
} | [
"protected",
"void",
"updateText",
"(",
")",
"{",
"super",
".",
"updateText",
"(",
")",
";",
"_exampleInfo",
"[",
"3",
"]",
".",
"setText",
"(",
"\"[PageUp] Next model\"",
")",
";",
"_exampleInfo",
"[",
"4",
"]",
".",
"setText",
"(",
"\"[PageDown] Previous m... | Update text information. | [
"Update",
"text",
"information",
"."
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-examples/src/main/java/org/poly2tri/examples/ardor3d/CDTModelExample.java#L174-L181 |
7,669 | orbisgis/poly2tri.java | poly2tri-core/src/main/java/org/poly2tri/triangulation/TriangulationPoint.java | TriangulationPoint.mergeInstances | public static void mergeInstances(Map<TriangulationPoint, TriangulationPoint> uniquePts, List<TriangulationPoint> ptList) {
for(int idPoint = 0; idPoint < ptList.size(); idPoint++) {
TriangulationPoint pt = ptList.get(idPoint);
TriangulationPoint uniquePt = uniquePts.get(pt);
if(uniquePt == null) {
uniquePts.put(pt, pt);
} else {
// Duplicate point
ptList.set(idPoint, uniquePt);
}
}
} | java | public static void mergeInstances(Map<TriangulationPoint, TriangulationPoint> uniquePts, List<TriangulationPoint> ptList) {
for(int idPoint = 0; idPoint < ptList.size(); idPoint++) {
TriangulationPoint pt = ptList.get(idPoint);
TriangulationPoint uniquePt = uniquePts.get(pt);
if(uniquePt == null) {
uniquePts.put(pt, pt);
} else {
// Duplicate point
ptList.set(idPoint, uniquePt);
}
}
} | [
"public",
"static",
"void",
"mergeInstances",
"(",
"Map",
"<",
"TriangulationPoint",
",",
"TriangulationPoint",
">",
"uniquePts",
",",
"List",
"<",
"TriangulationPoint",
">",
"ptList",
")",
"{",
"for",
"(",
"int",
"idPoint",
"=",
"0",
";",
"idPoint",
"<",
"p... | Replace points in ptList for all equals object in uniquePts.
@param uniquePts Map of triangulation points
@param ptList Point list, updated, but always the same size. | [
"Replace",
"points",
"in",
"ptList",
"for",
"all",
"equals",
"object",
"in",
"uniquePts",
"."
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/triangulation/TriangulationPoint.java#L120-L131 |
7,670 | orbisgis/poly2tri.java | poly2tri-ardor3d/src/main/java/org/poly2tri/triangulation/tools/ardor3d/ArdorMeshMapper.java | ArdorMeshMapper.updateTextureCoordinates | public static void updateTextureCoordinates( Mesh mesh,
List<DelaunayTriangle> triangles,
double scale,
double angle )
{
TriangulationPoint vertex;
FloatBuffer tcBuf;
float width,maxX,minX,maxY,minY,x,y,xn,yn;
maxX = Float.NEGATIVE_INFINITY;
minX = Float.POSITIVE_INFINITY;
maxY = Float.NEGATIVE_INFINITY;
minY = Float.POSITIVE_INFINITY;
for( DelaunayTriangle t : triangles )
{
for( int i=0; i<3; i++ )
{
vertex = t.points[i];
x = vertex.getXf();
y = vertex.getYf();
maxX = x > maxX ? x : maxX;
minX = x < minX ? x : minX;
maxY = y > maxY ? y : maxY;
minY = y < minY ? x : minY;
}
}
width = maxX-minX > maxY-minY ? maxX-minX : maxY-minY;
width *= scale;
tcBuf = prepareTextureCoordinateBuffer(mesh,0,2*3*triangles.size());
tcBuf.rewind();
for( DelaunayTriangle t : triangles )
{
for( int i=0; i<3; i++ )
{
vertex = t.points[i];
x = vertex.getXf()-(maxX-minX)/2;
y = vertex.getYf()-(maxY-minY)/2;
xn = (float)(x*Math.cos(angle)-y*Math.sin(angle));
yn = (float)(y*Math.cos(angle)+x*Math.sin(angle));
tcBuf.put( xn/width );
tcBuf.put( yn/width );
}
}
} | java | public static void updateTextureCoordinates( Mesh mesh,
List<DelaunayTriangle> triangles,
double scale,
double angle )
{
TriangulationPoint vertex;
FloatBuffer tcBuf;
float width,maxX,minX,maxY,minY,x,y,xn,yn;
maxX = Float.NEGATIVE_INFINITY;
minX = Float.POSITIVE_INFINITY;
maxY = Float.NEGATIVE_INFINITY;
minY = Float.POSITIVE_INFINITY;
for( DelaunayTriangle t : triangles )
{
for( int i=0; i<3; i++ )
{
vertex = t.points[i];
x = vertex.getXf();
y = vertex.getYf();
maxX = x > maxX ? x : maxX;
minX = x < minX ? x : minX;
maxY = y > maxY ? y : maxY;
minY = y < minY ? x : minY;
}
}
width = maxX-minX > maxY-minY ? maxX-minX : maxY-minY;
width *= scale;
tcBuf = prepareTextureCoordinateBuffer(mesh,0,2*3*triangles.size());
tcBuf.rewind();
for( DelaunayTriangle t : triangles )
{
for( int i=0; i<3; i++ )
{
vertex = t.points[i];
x = vertex.getXf()-(maxX-minX)/2;
y = vertex.getYf()-(maxY-minY)/2;
xn = (float)(x*Math.cos(angle)-y*Math.sin(angle));
yn = (float)(y*Math.cos(angle)+x*Math.sin(angle));
tcBuf.put( xn/width );
tcBuf.put( yn/width );
}
}
} | [
"public",
"static",
"void",
"updateTextureCoordinates",
"(",
"Mesh",
"mesh",
",",
"List",
"<",
"DelaunayTriangle",
">",
"triangles",
",",
"double",
"scale",
",",
"double",
"angle",
")",
"{",
"TriangulationPoint",
"vertex",
";",
"FloatBuffer",
"tcBuf",
";",
"floa... | For now very primitive!
Assumes a single texture and that the triangles form a xy-monotone surface
<p>
A continuous surface S in R3 is called xy-monotone, if every line parallel
to the z-axis intersects it at a single point at most.
@param mesh
@param scale | [
"For",
"now",
"very",
"primitive!"
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-ardor3d/src/main/java/org/poly2tri/triangulation/tools/ardor3d/ArdorMeshMapper.java#L213-L262 |
7,671 | orbisgis/poly2tri.java | poly2tri-examples-geotools/src/main/java/org/poly2tri/examples/geotools/WorldExample.java | WorldExample.buildSkyBox | private void buildSkyBox()
{
_skybox = new Skybox("skybox", 300, 300, 300);
try {
SimpleResourceLocator sr2 = new SimpleResourceLocator(ExampleBase.class.getClassLoader().getResource("org/poly2tri/examples/geotools/textures/"));
ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, sr2);
} catch (final URISyntaxException ex) {
ex.printStackTrace();
}
final String dir = "";
final Texture stars = TextureManager.load(dir + "stars.gif",
Texture.MinificationFilter.Trilinear,
Image.Format.GuessNoCompression, true);
_skybox.setTexture(Skybox.Face.North, stars);
_skybox.setTexture(Skybox.Face.West, stars);
_skybox.setTexture(Skybox.Face.South, stars);
_skybox.setTexture(Skybox.Face.East, stars);
_skybox.setTexture(Skybox.Face.Up, stars);
_skybox.setTexture(Skybox.Face.Down, stars);
_skybox.getTexture( Skybox.Face.North ).setWrap( WrapMode.Repeat );
for( Face f : Face.values() )
{
FloatBufferData fbd = _skybox.getFace(f).getMeshData().getTextureCoords().get( 0 );
fbd.getBuffer().clear();
fbd.getBuffer().put( 0 ).put( 4 );
fbd.getBuffer().put( 0 ).put( 0 );
fbd.getBuffer().put( 4 ).put( 0 );
fbd.getBuffer().put( 4 ).put( 4 );
}
_node.attachChild( _skybox );
} | java | private void buildSkyBox()
{
_skybox = new Skybox("skybox", 300, 300, 300);
try {
SimpleResourceLocator sr2 = new SimpleResourceLocator(ExampleBase.class.getClassLoader().getResource("org/poly2tri/examples/geotools/textures/"));
ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE, sr2);
} catch (final URISyntaxException ex) {
ex.printStackTrace();
}
final String dir = "";
final Texture stars = TextureManager.load(dir + "stars.gif",
Texture.MinificationFilter.Trilinear,
Image.Format.GuessNoCompression, true);
_skybox.setTexture(Skybox.Face.North, stars);
_skybox.setTexture(Skybox.Face.West, stars);
_skybox.setTexture(Skybox.Face.South, stars);
_skybox.setTexture(Skybox.Face.East, stars);
_skybox.setTexture(Skybox.Face.Up, stars);
_skybox.setTexture(Skybox.Face.Down, stars);
_skybox.getTexture( Skybox.Face.North ).setWrap( WrapMode.Repeat );
for( Face f : Face.values() )
{
FloatBufferData fbd = _skybox.getFace(f).getMeshData().getTextureCoords().get( 0 );
fbd.getBuffer().clear();
fbd.getBuffer().put( 0 ).put( 4 );
fbd.getBuffer().put( 0 ).put( 0 );
fbd.getBuffer().put( 4 ).put( 0 );
fbd.getBuffer().put( 4 ).put( 4 );
}
_node.attachChild( _skybox );
} | [
"private",
"void",
"buildSkyBox",
"(",
")",
"{",
"_skybox",
"=",
"new",
"Skybox",
"(",
"\"skybox\"",
",",
"300",
",",
"300",
",",
"300",
")",
";",
"try",
"{",
"SimpleResourceLocator",
"sr2",
"=",
"new",
"SimpleResourceLocator",
"(",
"ExampleBase",
".",
"cl... | Builds the sky box. | [
"Builds",
"the",
"sky",
"box",
"."
] | 8b312c8d5fc23c52ffbacb3a7b66afae328fa827 | https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-examples-geotools/src/main/java/org/poly2tri/examples/geotools/WorldExample.java#L294-L326 |
7,672 | neokree/GoogleNavigationDrawer | GoogleNavigationDrawerModule/src/main/java/it/neokree/googlenavigationdrawer/GoogleNavigationDrawer.java | GoogleNavigationDrawer.addSection | public void addSection(GSection section) {
section.setPosition(sectionList.size());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,(int)(48 * density));
sectionList.add(section);
sections.addView(section.getView(),params);
} | java | public void addSection(GSection section) {
section.setPosition(sectionList.size());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,(int)(48 * density));
sectionList.add(section);
sections.addView(section.getView(),params);
} | [
"public",
"void",
"addSection",
"(",
"GSection",
"section",
")",
"{",
"section",
".",
"setPosition",
"(",
"sectionList",
".",
"size",
"(",
")",
")",
";",
"LinearLayout",
".",
"LayoutParams",
"params",
"=",
"new",
"LinearLayout",
".",
"LayoutParams",
"(",
"Vi... | Method used for customize layout | [
"Method",
"used",
"for",
"customize",
"layout"
] | 0e512e8b9777879368952e4ce4996807a432997d | https://github.com/neokree/GoogleNavigationDrawer/blob/0e512e8b9777879368952e4ce4996807a432997d/GoogleNavigationDrawerModule/src/main/java/it/neokree/googlenavigationdrawer/GoogleNavigationDrawer.java#L354-L359 |
7,673 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/daten/DatenFilm.java | DatenFilm.setFileSize | public void setFileSize() {
if (arr[DatenFilm.FILM_GROESSE].isEmpty())
arr[DatenFilm.FILM_GROESSE] = FileSize.laengeString(arr[DatenFilm.FILM_URL]);
} | java | public void setFileSize() {
if (arr[DatenFilm.FILM_GROESSE].isEmpty())
arr[DatenFilm.FILM_GROESSE] = FileSize.laengeString(arr[DatenFilm.FILM_URL]);
} | [
"public",
"void",
"setFileSize",
"(",
")",
"{",
"if",
"(",
"arr",
"[",
"DatenFilm",
".",
"FILM_GROESSE",
"]",
".",
"isEmpty",
"(",
")",
")",
"arr",
"[",
"DatenFilm",
".",
"FILM_GROESSE",
"]",
"=",
"FileSize",
".",
"laengeString",
"(",
"arr",
"[",
"Date... | Determine file size from remote location. | [
"Determine",
"file",
"size",
"from",
"remote",
"location",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/daten/DatenFilm.java#L155-L158 |
7,674 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/filmlisten/FilmlisteLesen.java | FilmlisteLesen.processFromFile | private void processFromFile(String source, ListeFilme listeFilme) {
notifyProgress(source, PROGRESS_MAX);
try (InputStream in = selectDecompressor(source, new FileInputStream(source));
JsonParser jp = new JsonFactory().createParser(in)) {
readData(jp, listeFilme);
} catch (FileNotFoundException ex) {
Log.errorLog(894512369, "FilmListe existiert nicht: " + source);
listeFilme.clear();
} catch (Exception ex) {
Log.errorLog(945123641, ex, "FilmListe: " + source);
listeFilme.clear();
}
} | java | private void processFromFile(String source, ListeFilme listeFilme) {
notifyProgress(source, PROGRESS_MAX);
try (InputStream in = selectDecompressor(source, new FileInputStream(source));
JsonParser jp = new JsonFactory().createParser(in)) {
readData(jp, listeFilme);
} catch (FileNotFoundException ex) {
Log.errorLog(894512369, "FilmListe existiert nicht: " + source);
listeFilme.clear();
} catch (Exception ex) {
Log.errorLog(945123641, ex, "FilmListe: " + source);
listeFilme.clear();
}
} | [
"private",
"void",
"processFromFile",
"(",
"String",
"source",
",",
"ListeFilme",
"listeFilme",
")",
"{",
"notifyProgress",
"(",
"source",
",",
"PROGRESS_MAX",
")",
";",
"try",
"(",
"InputStream",
"in",
"=",
"selectDecompressor",
"(",
"source",
",",
"new",
"Fi... | Read a locally available filmlist.
@param source file path as string
@param listeFilme the list to read to | [
"Read",
"a",
"locally",
"available",
"filmlist",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/filmlisten/FilmlisteLesen.java#L177-L189 |
7,675 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/filmlisten/FilmlisteLesen.java | FilmlisteLesen.processFromWeb | private void processFromWeb(URL source, ListeFilme listeFilme) {
Request.Builder builder = new Request.Builder().url(source);
builder.addHeader("User-Agent", Config.getUserAgent());
//our progress monitor callback
InputStreamProgressMonitor monitor = new InputStreamProgressMonitor() {
private int oldProgress = 0;
@Override
public void progress(long bytesRead, long size) {
final int iProgress = (int) (bytesRead * 100 / size);
if (iProgress != oldProgress) {
oldProgress = iProgress;
notifyProgress(source.toString(), iProgress);
}
}
};
try (Response response = MVHttpClient.getInstance().getHttpClient().newCall(builder.build()).execute();
ResponseBody body = response.body()) {
if (response.isSuccessful()) {
try (InputStream input = new ProgressMonitorInputStream(body.byteStream(), body.contentLength(), monitor)) {
try (InputStream is = selectDecompressor(source.toString(), input);
JsonParser jp = new JsonFactory().createParser(is)) {
readData(jp, listeFilme);
}
}
}
} catch (Exception ex) {
Log.errorLog(945123641, ex, "FilmListe: " + source);
listeFilme.clear();
}
} | java | private void processFromWeb(URL source, ListeFilme listeFilme) {
Request.Builder builder = new Request.Builder().url(source);
builder.addHeader("User-Agent", Config.getUserAgent());
//our progress monitor callback
InputStreamProgressMonitor monitor = new InputStreamProgressMonitor() {
private int oldProgress = 0;
@Override
public void progress(long bytesRead, long size) {
final int iProgress = (int) (bytesRead * 100 / size);
if (iProgress != oldProgress) {
oldProgress = iProgress;
notifyProgress(source.toString(), iProgress);
}
}
};
try (Response response = MVHttpClient.getInstance().getHttpClient().newCall(builder.build()).execute();
ResponseBody body = response.body()) {
if (response.isSuccessful()) {
try (InputStream input = new ProgressMonitorInputStream(body.byteStream(), body.contentLength(), monitor)) {
try (InputStream is = selectDecompressor(source.toString(), input);
JsonParser jp = new JsonFactory().createParser(is)) {
readData(jp, listeFilme);
}
}
}
} catch (Exception ex) {
Log.errorLog(945123641, ex, "FilmListe: " + source);
listeFilme.clear();
}
} | [
"private",
"void",
"processFromWeb",
"(",
"URL",
"source",
",",
"ListeFilme",
"listeFilme",
")",
"{",
"Request",
".",
"Builder",
"builder",
"=",
"new",
"Request",
".",
"Builder",
"(",
")",
".",
"url",
"(",
"source",
")",
";",
"builder",
".",
"addHeader",
... | Download a process a filmliste from the web.
@param source source url as string
@param listeFilme the list to read to | [
"Download",
"a",
"process",
"a",
"filmliste",
"from",
"the",
"web",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/filmlisten/FilmlisteLesen.java#L230-L262 |
7,676 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/filmlisten/ListeFilmlistenUrls.java | ListeFilmlistenUrls.addWithCheck | public boolean addWithCheck(DatenFilmlisteUrl filmliste) {
for (DatenFilmlisteUrl datenUrlFilmliste : this) {
if (datenUrlFilmliste.arr[DatenFilmlisteUrl.FILM_UPDATE_SERVER_URL_NR].equals(filmliste.arr[DatenFilmlisteUrl.FILM_UPDATE_SERVER_URL_NR])) {
return false;
}
}
return add(filmliste);
} | java | public boolean addWithCheck(DatenFilmlisteUrl filmliste) {
for (DatenFilmlisteUrl datenUrlFilmliste : this) {
if (datenUrlFilmliste.arr[DatenFilmlisteUrl.FILM_UPDATE_SERVER_URL_NR].equals(filmliste.arr[DatenFilmlisteUrl.FILM_UPDATE_SERVER_URL_NR])) {
return false;
}
}
return add(filmliste);
} | [
"public",
"boolean",
"addWithCheck",
"(",
"DatenFilmlisteUrl",
"filmliste",
")",
"{",
"for",
"(",
"DatenFilmlisteUrl",
"datenUrlFilmliste",
":",
"this",
")",
"{",
"if",
"(",
"datenUrlFilmliste",
".",
"arr",
"[",
"DatenFilmlisteUrl",
".",
"FILM_UPDATE_SERVER_URL_NR",
... | ist die Liste mit den URLs zum Download einer Filmliste | [
"ist",
"die",
"Liste",
"mit",
"den",
"URLs",
"zum",
"Download",
"einer",
"Filmliste"
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/filmlisten/ListeFilmlistenUrls.java#L31-L38 |
7,677 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/filmlisten/FilmlistenSuchen.java | FilmlistenSuchen.insertDefaultActiveServers | private void insertDefaultActiveServers()
{
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://m.picn.de/f/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://m1.picn.de/f/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://m2.picn.de/f/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://download10.onlinetvrecorder.com/mediathekview/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://mediathekview.jankal.me/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://verteiler1.mediathekview.de/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://verteiler2.mediathekview.de/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://verteiler3.mediathekview.de/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
} | java | private void insertDefaultActiveServers()
{
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://m.picn.de/f/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://m1.picn.de/f/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://m2.picn.de/f/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://download10.onlinetvrecorder.com/mediathekview/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://mediathekview.jankal.me/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://verteiler1.mediathekview.de/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://verteiler2.mediathekview.de/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
listeFilmlistenUrls_akt.add(new DatenFilmlisteUrl("http://verteiler3.mediathekview.de/Filmliste-akt.xz", DatenFilmlisteUrl.SERVER_ART_AKT));
} | [
"private",
"void",
"insertDefaultActiveServers",
"(",
")",
"{",
"listeFilmlistenUrls_akt",
".",
"add",
"(",
"new",
"DatenFilmlisteUrl",
"(",
"\"http://m.picn.de/f/Filmliste-akt.xz\"",
",",
"DatenFilmlisteUrl",
".",
"SERVER_ART_AKT",
")",
")",
";",
"listeFilmlistenUrls_akt",... | Add our default full list servers. | [
"Add",
"our",
"default",
"full",
"list",
"servers",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/filmlisten/FilmlistenSuchen.java#L98-L108 |
7,678 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/filmlisten/FilmlistenSuchen.java | FilmlistenSuchen.insertDefaultDifferentialListServers | private void insertDefaultDifferentialListServers()
{
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://m.picn.de/f/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://m1.picn.de/f/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://m2.picn.de/f/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://download10.onlinetvrecorder.com/mediathekview/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://mediathekview.jankal.me/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://verteiler1.mediathekview.de/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://verteiler2.mediathekview.de/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://verteiler3.mediathekview.de/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
} | java | private void insertDefaultDifferentialListServers()
{
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://m.picn.de/f/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://m1.picn.de/f/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://m2.picn.de/f/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://download10.onlinetvrecorder.com/mediathekview/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://mediathekview.jankal.me/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://verteiler1.mediathekview.de/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://verteiler2.mediathekview.de/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
listeFilmlistenUrls_diff.add(new DatenFilmlisteUrl("http://verteiler3.mediathekview.de/Filmliste-diff.xz", DatenFilmlisteUrl.SERVER_ART_DIFF));
} | [
"private",
"void",
"insertDefaultDifferentialListServers",
"(",
")",
"{",
"listeFilmlistenUrls_diff",
".",
"add",
"(",
"new",
"DatenFilmlisteUrl",
"(",
"\"http://m.picn.de/f/Filmliste-diff.xz\"",
",",
"DatenFilmlisteUrl",
".",
"SERVER_ART_DIFF",
")",
")",
";",
"listeFilmlis... | Add our default diff list servers. | [
"Add",
"our",
"default",
"diff",
"list",
"servers",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/filmlisten/FilmlistenSuchen.java#L113-L123 |
7,679 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/filmlisten/FilmlistenSuchen.java | FilmlistenSuchen.updateURLsFilmlisten | public void updateURLsFilmlisten(final boolean updateFullList) {
ListeFilmlistenUrls tmp = new ListeFilmlistenUrls();
if (updateFullList) {
getDownloadUrlsFilmlisten(Const.ADRESSE_FILMLISTEN_SERVER_AKT, tmp, Config.getUserAgent(), DatenFilmlisteUrl.SERVER_ART_AKT);
if (!tmp.isEmpty()) {
listeFilmlistenUrls_akt = tmp;
} else if (listeFilmlistenUrls_akt.isEmpty()) {
insertDefaultActiveServers();
}
listeFilmlistenUrls_akt.sort();
} else {
getDownloadUrlsFilmlisten(Const.ADRESSE_FILMLISTEN_SERVER_DIFF, tmp, Config.getUserAgent(), DatenFilmlisteUrl.SERVER_ART_DIFF);
if (!tmp.isEmpty()) {
listeFilmlistenUrls_diff = tmp;
} else if (listeFilmlistenUrls_diff.isEmpty()) {
insertDefaultDifferentialListServers();
}
listeFilmlistenUrls_diff.sort();
}
if (tmp.isEmpty()) {
Log.errorLog(491203216, new String[]{"Es ist ein Fehler aufgetreten!",
"Es konnten keine Updateserver zum aktualisieren der Filme",
"gefunden werden."});
}
} | java | public void updateURLsFilmlisten(final boolean updateFullList) {
ListeFilmlistenUrls tmp = new ListeFilmlistenUrls();
if (updateFullList) {
getDownloadUrlsFilmlisten(Const.ADRESSE_FILMLISTEN_SERVER_AKT, tmp, Config.getUserAgent(), DatenFilmlisteUrl.SERVER_ART_AKT);
if (!tmp.isEmpty()) {
listeFilmlistenUrls_akt = tmp;
} else if (listeFilmlistenUrls_akt.isEmpty()) {
insertDefaultActiveServers();
}
listeFilmlistenUrls_akt.sort();
} else {
getDownloadUrlsFilmlisten(Const.ADRESSE_FILMLISTEN_SERVER_DIFF, tmp, Config.getUserAgent(), DatenFilmlisteUrl.SERVER_ART_DIFF);
if (!tmp.isEmpty()) {
listeFilmlistenUrls_diff = tmp;
} else if (listeFilmlistenUrls_diff.isEmpty()) {
insertDefaultDifferentialListServers();
}
listeFilmlistenUrls_diff.sort();
}
if (tmp.isEmpty()) {
Log.errorLog(491203216, new String[]{"Es ist ein Fehler aufgetreten!",
"Es konnten keine Updateserver zum aktualisieren der Filme",
"gefunden werden."});
}
} | [
"public",
"void",
"updateURLsFilmlisten",
"(",
"final",
"boolean",
"updateFullList",
")",
"{",
"ListeFilmlistenUrls",
"tmp",
"=",
"new",
"ListeFilmlistenUrls",
"(",
")",
";",
"if",
"(",
"updateFullList",
")",
"{",
"getDownloadUrlsFilmlisten",
"(",
"Const",
".",
"A... | Update the download server URLs.
@param updateFullList if true, update full list server, otherwise diff servers. | [
"Update",
"the",
"download",
"server",
"URLs",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/filmlisten/FilmlistenSuchen.java#L129-L153 |
7,680 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/filmlisten/FilmlistenSuchen.java | FilmlistenSuchen.parseServerEntry | private void parseServerEntry(XMLStreamReader parser, ListeFilmlistenUrls listeFilmlistenUrls, String art) {
String serverUrl = "";
String prio = "";
int event;
try {
while (parser.hasNext()) {
event = parser.next();
if (event == XMLStreamConstants.START_ELEMENT) {
//parsername = parser.getLocalName();
switch (parser.getLocalName()) {
case "URL":
serverUrl = parser.getElementText();
break;
case "Prio":
prio = parser.getElementText();
break;
}
}
if (event == XMLStreamConstants.END_ELEMENT) {
//parsername = parser.getLocalName();
if (parser.getLocalName().equals("Server")) {
if (!serverUrl.equals("")) {
//public DatenFilmUpdate(String url, String prio, String zeit, String datum, String anzahl) {
if (prio.equals("")) {
prio = DatenFilmlisteUrl.FILM_UPDATE_SERVER_PRIO_1;
}
listeFilmlistenUrls.addWithCheck(new DatenFilmlisteUrl(serverUrl, prio, art));
}
break;
}
}
}
} catch (XMLStreamException ignored) {
}
} | java | private void parseServerEntry(XMLStreamReader parser, ListeFilmlistenUrls listeFilmlistenUrls, String art) {
String serverUrl = "";
String prio = "";
int event;
try {
while (parser.hasNext()) {
event = parser.next();
if (event == XMLStreamConstants.START_ELEMENT) {
//parsername = parser.getLocalName();
switch (parser.getLocalName()) {
case "URL":
serverUrl = parser.getElementText();
break;
case "Prio":
prio = parser.getElementText();
break;
}
}
if (event == XMLStreamConstants.END_ELEMENT) {
//parsername = parser.getLocalName();
if (parser.getLocalName().equals("Server")) {
if (!serverUrl.equals("")) {
//public DatenFilmUpdate(String url, String prio, String zeit, String datum, String anzahl) {
if (prio.equals("")) {
prio = DatenFilmlisteUrl.FILM_UPDATE_SERVER_PRIO_1;
}
listeFilmlistenUrls.addWithCheck(new DatenFilmlisteUrl(serverUrl, prio, art));
}
break;
}
}
}
} catch (XMLStreamException ignored) {
}
} | [
"private",
"void",
"parseServerEntry",
"(",
"XMLStreamReader",
"parser",
",",
"ListeFilmlistenUrls",
"listeFilmlistenUrls",
",",
"String",
"art",
")",
"{",
"String",
"serverUrl",
"=",
"\"\"",
";",
"String",
"prio",
"=",
"\"\"",
";",
"int",
"event",
";",
"try",
... | Parse the server XML file.
@param parser
@param listeFilmlistenUrls
@param art | [
"Parse",
"the",
"server",
"XML",
"file",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/filmlisten/FilmlistenSuchen.java#L202-L237 |
7,681 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/tool/TimedTextMarkupLanguageParser.java | TimedTextMarkupLanguageParser.buildColorMap | private void buildColorMap() {
final NodeList styleData = doc.getElementsByTagName("tt:style");
for (int i = 0; i < styleData.getLength(); i++) {
final Node subnode = styleData.item(i);
if (subnode.hasAttributes()) {
final NamedNodeMap attrMap = subnode.getAttributes();
final Node idNode = attrMap.getNamedItem("xml:id");
final Node colorNode = attrMap.getNamedItem("tts:color");
if (idNode != null && colorNode != null) {
colorMap.put(idNode.getNodeValue(), colorNode.getNodeValue());
}
}
}
} | java | private void buildColorMap() {
final NodeList styleData = doc.getElementsByTagName("tt:style");
for (int i = 0; i < styleData.getLength(); i++) {
final Node subnode = styleData.item(i);
if (subnode.hasAttributes()) {
final NamedNodeMap attrMap = subnode.getAttributes();
final Node idNode = attrMap.getNamedItem("xml:id");
final Node colorNode = attrMap.getNamedItem("tts:color");
if (idNode != null && colorNode != null) {
colorMap.put(idNode.getNodeValue(), colorNode.getNodeValue());
}
}
}
} | [
"private",
"void",
"buildColorMap",
"(",
")",
"{",
"final",
"NodeList",
"styleData",
"=",
"doc",
".",
"getElementsByTagName",
"(",
"\"tt:style\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"styleData",
".",
"getLength",
"(",
")",
";",
... | Build a map of used colors within the TTML file. | [
"Build",
"a",
"map",
"of",
"used",
"colors",
"within",
"the",
"TTML",
"file",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/tool/TimedTextMarkupLanguageParser.java#L63-L76 |
7,682 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/tool/TimedTextMarkupLanguageParser.java | TimedTextMarkupLanguageParser.parse | public boolean parse(Path ttmlFilePath) {
boolean ret;
try {
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
final DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse(ttmlFilePath.toFile());
//Check that we have TTML v1.0 file as we have tested only them...
final NodeList metaData = doc.getElementsByTagName("ebuttm:documentEbuttVersion");
if (metaData != null) {
final Node versionNode = metaData.item(0);
if (versionNode == null || !versionNode.getTextContent().equalsIgnoreCase("v1.0")) {
throw new Exception("Unknown TTML file version");
}
} else {
throw new Exception("Unknown File Format");
}
buildColorMap();
buildFilmList();
ret = true;
} catch (Exception ex) {
//Log.errorLog(912036478, ex, new String[]{ex.getLocalizedMessage(), "File: " + ttmlFilePath});
Log.errorLog(912036478, new String[]{ex.getLocalizedMessage(), "File: " + ttmlFilePath});
ret = false;
}
return ret;
} | java | public boolean parse(Path ttmlFilePath) {
boolean ret;
try {
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
final DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse(ttmlFilePath.toFile());
//Check that we have TTML v1.0 file as we have tested only them...
final NodeList metaData = doc.getElementsByTagName("ebuttm:documentEbuttVersion");
if (metaData != null) {
final Node versionNode = metaData.item(0);
if (versionNode == null || !versionNode.getTextContent().equalsIgnoreCase("v1.0")) {
throw new Exception("Unknown TTML file version");
}
} else {
throw new Exception("Unknown File Format");
}
buildColorMap();
buildFilmList();
ret = true;
} catch (Exception ex) {
//Log.errorLog(912036478, ex, new String[]{ex.getLocalizedMessage(), "File: " + ttmlFilePath});
Log.errorLog(912036478, new String[]{ex.getLocalizedMessage(), "File: " + ttmlFilePath});
ret = false;
}
return ret;
} | [
"public",
"boolean",
"parse",
"(",
"Path",
"ttmlFilePath",
")",
"{",
"boolean",
"ret",
";",
"try",
"{",
"final",
"DocumentBuilderFactory",
"dbf",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"dbf",
".",
"setNamespaceAware",
"(",
"true",
")... | Parse the TTML file into internal representation.
@param ttmlFilePath the TTML file to parse | [
"Parse",
"the",
"TTML",
"file",
"into",
"internal",
"representation",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/tool/TimedTextMarkupLanguageParser.java#L192-L221 |
7,683 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/tool/TimedTextMarkupLanguageParser.java | TimedTextMarkupLanguageParser.parseXmlFlash | public boolean parseXmlFlash(Path ttmlFilePath) {
boolean ret;
try {
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
final DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse(ttmlFilePath.toFile());
//Check that we have TTML v1.0 file as we have tested only them...
final NodeList metaData = doc.getElementsByTagName("tt");
final NodeList colorNote = doc.getElementsByTagName("style");
if (metaData != null) {
final Node node = metaData.item(0);
if (node.hasAttributes()) {
// retrieve the begin and end attributes...
final NamedNodeMap attrMap = node.getAttributes();
final Node xmlns = attrMap.getNamedItem("xmlns");
if (xmlns != null) {
final String s = xmlns.getNodeValue();
if (!s.equals("http://www.w3.org/2006/04/ttaf1")
&& !s.equals("http://www.w3.org/ns/ttml")) {
throw new Exception("Unknown TTML file version");
}
}
} else {
throw new Exception("Unknown File Format");
}
} else {
throw new Exception("Unknown File Format");
}
if (colorNote != null) {
if (colorNote.getLength() == 0) {
this.color = "#FFFFFF";
} else {
final Node node = colorNote.item(0);
if (node.hasAttributes()) {
// retrieve the begin and end attributes...
final NamedNodeMap attrMap = node.getAttributes();
final Node col = attrMap.getNamedItem("tts:color");
if (col != null) {
if (!col.getNodeValue().isEmpty()) {
this.color = col.getNodeValue();
}
}
} else {
throw new Exception("Unknown File Format");
}
}
} else {
throw new Exception("Unknown File Format");
}
buildFilmListFlash();
ret = true;
} catch (Exception ex) {
//Log.errorLog(46231470, ex, "File: " + ttmlFilePath);
Log.errorLog(46231470, new String[]{ex.getLocalizedMessage(), "File: " + ttmlFilePath});
ret = false;
}
return ret;
} | java | public boolean parseXmlFlash(Path ttmlFilePath) {
boolean ret;
try {
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
final DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse(ttmlFilePath.toFile());
//Check that we have TTML v1.0 file as we have tested only them...
final NodeList metaData = doc.getElementsByTagName("tt");
final NodeList colorNote = doc.getElementsByTagName("style");
if (metaData != null) {
final Node node = metaData.item(0);
if (node.hasAttributes()) {
// retrieve the begin and end attributes...
final NamedNodeMap attrMap = node.getAttributes();
final Node xmlns = attrMap.getNamedItem("xmlns");
if (xmlns != null) {
final String s = xmlns.getNodeValue();
if (!s.equals("http://www.w3.org/2006/04/ttaf1")
&& !s.equals("http://www.w3.org/ns/ttml")) {
throw new Exception("Unknown TTML file version");
}
}
} else {
throw new Exception("Unknown File Format");
}
} else {
throw new Exception("Unknown File Format");
}
if (colorNote != null) {
if (colorNote.getLength() == 0) {
this.color = "#FFFFFF";
} else {
final Node node = colorNote.item(0);
if (node.hasAttributes()) {
// retrieve the begin and end attributes...
final NamedNodeMap attrMap = node.getAttributes();
final Node col = attrMap.getNamedItem("tts:color");
if (col != null) {
if (!col.getNodeValue().isEmpty()) {
this.color = col.getNodeValue();
}
}
} else {
throw new Exception("Unknown File Format");
}
}
} else {
throw new Exception("Unknown File Format");
}
buildFilmListFlash();
ret = true;
} catch (Exception ex) {
//Log.errorLog(46231470, ex, "File: " + ttmlFilePath);
Log.errorLog(46231470, new String[]{ex.getLocalizedMessage(), "File: " + ttmlFilePath});
ret = false;
}
return ret;
} | [
"public",
"boolean",
"parseXmlFlash",
"(",
"Path",
"ttmlFilePath",
")",
"{",
"boolean",
"ret",
";",
"try",
"{",
"final",
"DocumentBuilderFactory",
"dbf",
"=",
"DocumentBuilderFactory",
".",
"newInstance",
"(",
")",
";",
"dbf",
".",
"setNamespaceAware",
"(",
"tru... | Parse the XML Subtitle File for Flash Player into internal representation.
@param ttmlFilePath the TTML file to parse
@return | [
"Parse",
"the",
"XML",
"Subtitle",
"File",
"for",
"Flash",
"Player",
"into",
"internal",
"representation",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/tool/TimedTextMarkupLanguageParser.java#L229-L291 |
7,684 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/tool/TimedTextMarkupLanguageParser.java | TimedTextMarkupLanguageParser.toSrt | public void toSrt(Path srtFile) {
try (FileOutputStream fos = new FileOutputStream(srtFile.toFile());
OutputStreamWriter osw = new OutputStreamWriter(fos, Charset.forName("UTF-8"));
PrintWriter writer = new PrintWriter(osw)) {
long counter = 1;
for (Subtitle title : subtitleList) {
writer.println(counter);
writer.println(srtFormat.format(title.begin) + " --> " + srtFormat.format(title.end));
for (StyledString entry : title.listOfStrings) {
if (!entry.color.isEmpty()) {
writer.print("<font color=\"" + entry.color + "\">");
}
writer.print(entry.text);
if (!entry.color.isEmpty()) {
writer.print("</font>");
}
writer.println();
}
writer.println("");
counter++;
}
} catch (Exception ex) {
Log.errorLog(201036470, ex, "File: " + srtFile);
}
} | java | public void toSrt(Path srtFile) {
try (FileOutputStream fos = new FileOutputStream(srtFile.toFile());
OutputStreamWriter osw = new OutputStreamWriter(fos, Charset.forName("UTF-8"));
PrintWriter writer = new PrintWriter(osw)) {
long counter = 1;
for (Subtitle title : subtitleList) {
writer.println(counter);
writer.println(srtFormat.format(title.begin) + " --> " + srtFormat.format(title.end));
for (StyledString entry : title.listOfStrings) {
if (!entry.color.isEmpty()) {
writer.print("<font color=\"" + entry.color + "\">");
}
writer.print(entry.text);
if (!entry.color.isEmpty()) {
writer.print("</font>");
}
writer.println();
}
writer.println("");
counter++;
}
} catch (Exception ex) {
Log.errorLog(201036470, ex, "File: " + srtFile);
}
} | [
"public",
"void",
"toSrt",
"(",
"Path",
"srtFile",
")",
"{",
"try",
"(",
"FileOutputStream",
"fos",
"=",
"new",
"FileOutputStream",
"(",
"srtFile",
".",
"toFile",
"(",
")",
")",
";",
"OutputStreamWriter",
"osw",
"=",
"new",
"OutputStreamWriter",
"(",
"fos",
... | Convert internal representation into SubRip Text Format and save to file. | [
"Convert",
"internal",
"representation",
"into",
"SubRip",
"Text",
"Format",
"and",
"save",
"to",
"file",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/tool/TimedTextMarkupLanguageParser.java#L296-L320 |
7,685 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/tool/FileSize.java | FileSize.getFileSizeFromUrl | private static long getFileSizeFromUrl(String url) {
if (!url.toLowerCase().startsWith("http")) {
return -1;
}
final Request request = new Request.Builder().url(url).head().build();
long respLength = -1;
try (Response response = MVHttpClient.getInstance().getReducedTimeOutClient().newCall(request).execute();
ResponseBody body = response.body()) {
if (response.isSuccessful())
respLength = body.contentLength();
} catch (IOException ignored) {
respLength = -1;
}
if (respLength < 1_000_000) {
// alles unter 1MB sind Playlisten, ORF: Trailer bei im Ausland gesperrten Filmen, ...
// dann wars nix
respLength = -1;
}
return respLength;
} | java | private static long getFileSizeFromUrl(String url) {
if (!url.toLowerCase().startsWith("http")) {
return -1;
}
final Request request = new Request.Builder().url(url).head().build();
long respLength = -1;
try (Response response = MVHttpClient.getInstance().getReducedTimeOutClient().newCall(request).execute();
ResponseBody body = response.body()) {
if (response.isSuccessful())
respLength = body.contentLength();
} catch (IOException ignored) {
respLength = -1;
}
if (respLength < 1_000_000) {
// alles unter 1MB sind Playlisten, ORF: Trailer bei im Ausland gesperrten Filmen, ...
// dann wars nix
respLength = -1;
}
return respLength;
} | [
"private",
"static",
"long",
"getFileSizeFromUrl",
"(",
"String",
"url",
")",
"{",
"if",
"(",
"!",
"url",
".",
"toLowerCase",
"(",
")",
".",
"startsWith",
"(",
"\"http\"",
")",
")",
"{",
"return",
"-",
"1",
";",
"}",
"final",
"Request",
"request",
"=",... | Return the size of a URL in bytes.
@param url URL as String to query.
@return size in bytes or -1. | [
"Return",
"the",
"size",
"of",
"a",
"URL",
"in",
"bytes",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/tool/FileSize.java#L31-L52 |
7,686 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/tool/FilenameUtils.java | FilenameUtils.removeWindowsTrailingDots | private static String removeWindowsTrailingDots(String fileName) {
// machte unter Win noch Probleme, zB. bei dem Titel: "betrifft: ..."
// "." und " " am Ende machen Probleme
while (!fileName.isEmpty() && (fileName.endsWith(".") || fileName.endsWith(" "))) {
fileName = fileName.substring(0, fileName.length() - 1);
}
return fileName;
} | java | private static String removeWindowsTrailingDots(String fileName) {
// machte unter Win noch Probleme, zB. bei dem Titel: "betrifft: ..."
// "." und " " am Ende machen Probleme
while (!fileName.isEmpty() && (fileName.endsWith(".") || fileName.endsWith(" "))) {
fileName = fileName.substring(0, fileName.length() - 1);
}
return fileName;
} | [
"private",
"static",
"String",
"removeWindowsTrailingDots",
"(",
"String",
"fileName",
")",
"{",
"// machte unter Win noch Probleme, zB. bei dem Titel: \"betrifft: ...\"",
"// \".\" und \" \" am Ende machen Probleme",
"while",
"(",
"!",
"fileName",
".",
"isEmpty",
"(",
")",
"&&... | Remove stray trailing dots from string when we are on Windows OS.
@param fileName A filename string that might include trailing dots.
@return Cleanup string with no dots anymore. | [
"Remove",
"stray",
"trailing",
"dots",
"from",
"string",
"when",
"we",
"are",
"on",
"Windows",
"OS",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/tool/FilenameUtils.java#L95-L102 |
7,687 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/tool/FilenameUtils.java | FilenameUtils.removeIllegalCharacters | public static String removeIllegalCharacters(final String input, boolean isPath) {
String ret = input;
switch (Functions.getOs()) {
case MAC:
case LINUX:
//On OSX the VFS take care of writing correct filenames to FAT filesystems...
//Just remove the default illegal characters
ret = removeStartingDots(ret);
ret = ret.replaceAll(isPath ? REGEXP_ILLEGAL_CHARACTERS_OTHERS_PATH : REGEXP_ILLEGAL_CHARACTERS_OTHERS, "_");
break;
case WIN64:
case WIN32:
//we need to be more careful on Windows when using e.g. FAT32
//Therefore be more conservative by default and replace more characters.
ret = removeWindowsTrailingDots(ret);
ret = ret.replaceAll(isPath ? REGEXP_ILLEGAL_CHARACTERS_WINDOWS_PATH : REGEXP_ILLEGAL_CHARACTERS_WINDOWS, "_");
break;
default:
//we need to be more careful on Linux when using e.g. FAT32
//Therefore be more conservative by default and replace more characters.
ret = removeStartingDots(ret);
ret = ret.replaceAll(isPath ? REGEXP_ILLEGAL_CHARACTERS_WINDOWS_PATH : REGEXP_ILLEGAL_CHARACTERS_WINDOWS, "_");
break;
}
return ret;
} | java | public static String removeIllegalCharacters(final String input, boolean isPath) {
String ret = input;
switch (Functions.getOs()) {
case MAC:
case LINUX:
//On OSX the VFS take care of writing correct filenames to FAT filesystems...
//Just remove the default illegal characters
ret = removeStartingDots(ret);
ret = ret.replaceAll(isPath ? REGEXP_ILLEGAL_CHARACTERS_OTHERS_PATH : REGEXP_ILLEGAL_CHARACTERS_OTHERS, "_");
break;
case WIN64:
case WIN32:
//we need to be more careful on Windows when using e.g. FAT32
//Therefore be more conservative by default and replace more characters.
ret = removeWindowsTrailingDots(ret);
ret = ret.replaceAll(isPath ? REGEXP_ILLEGAL_CHARACTERS_WINDOWS_PATH : REGEXP_ILLEGAL_CHARACTERS_WINDOWS, "_");
break;
default:
//we need to be more careful on Linux when using e.g. FAT32
//Therefore be more conservative by default and replace more characters.
ret = removeStartingDots(ret);
ret = ret.replaceAll(isPath ? REGEXP_ILLEGAL_CHARACTERS_WINDOWS_PATH : REGEXP_ILLEGAL_CHARACTERS_WINDOWS, "_");
break;
}
return ret;
} | [
"public",
"static",
"String",
"removeIllegalCharacters",
"(",
"final",
"String",
"input",
",",
"boolean",
"isPath",
")",
"{",
"String",
"ret",
"=",
"input",
";",
"switch",
"(",
"Functions",
".",
"getOs",
"(",
")",
")",
"{",
"case",
"MAC",
":",
"case",
"L... | Remove illegal characters from String based on current OS.
@param input The input string
@param isPath
@return Cleaned-up string. | [
"Remove",
"illegal",
"characters",
"from",
"String",
"based",
"on",
"current",
"OS",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/tool/FilenameUtils.java#L283-L312 |
7,688 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/tool/FilenameUtils.java | FilenameUtils.replaceLeerDateiname | public static String replaceLeerDateiname(String name, boolean isPath, boolean userReplace, boolean onlyAscii) {
String ret = name;
boolean isWindowsPath = false;
if (SystemInfo.isWindows() && isPath && ret.length() > 1 && ret.charAt(1) == ':') {
// damit auch "d:" und nicht nur "d:\" als Pfad geht
isWindowsPath = true;
ret = ret.replaceFirst(":", ""); // muss zum Schluss wieder rein, kann aber so nicht ersetzt werden
}
// zuerst die Ersetzungstabelle mit den Wünschen des Users
if (userReplace) {
ret = ReplaceList.replace(ret, isPath);
}
// und wenn gewünscht: "NUR Ascii-Zeichen"
if (onlyAscii) {
ret = convertToASCIIEncoding(ret, isPath);
} else {
ret = convertToNativeEncoding(ret, isPath);
}
if (isWindowsPath) {
// c: wieder herstellen
if (ret.length() == 1) {
ret = ret + ":";
} else if (ret.length() > 1) {
ret = ret.charAt(0) + ":" + ret.substring(1);
}
}
return ret;
} | java | public static String replaceLeerDateiname(String name, boolean isPath, boolean userReplace, boolean onlyAscii) {
String ret = name;
boolean isWindowsPath = false;
if (SystemInfo.isWindows() && isPath && ret.length() > 1 && ret.charAt(1) == ':') {
// damit auch "d:" und nicht nur "d:\" als Pfad geht
isWindowsPath = true;
ret = ret.replaceFirst(":", ""); // muss zum Schluss wieder rein, kann aber so nicht ersetzt werden
}
// zuerst die Ersetzungstabelle mit den Wünschen des Users
if (userReplace) {
ret = ReplaceList.replace(ret, isPath);
}
// und wenn gewünscht: "NUR Ascii-Zeichen"
if (onlyAscii) {
ret = convertToASCIIEncoding(ret, isPath);
} else {
ret = convertToNativeEncoding(ret, isPath);
}
if (isWindowsPath) {
// c: wieder herstellen
if (ret.length() == 1) {
ret = ret + ":";
} else if (ret.length() > 1) {
ret = ret.charAt(0) + ":" + ret.substring(1);
}
}
return ret;
} | [
"public",
"static",
"String",
"replaceLeerDateiname",
"(",
"String",
"name",
",",
"boolean",
"isPath",
",",
"boolean",
"userReplace",
",",
"boolean",
"onlyAscii",
")",
"{",
"String",
"ret",
"=",
"name",
";",
"boolean",
"isWindowsPath",
"=",
"false",
";",
"if",... | Entferne verbotene Zeichen aus Dateiname.
@param name Dateiname
@param isPath
@param userReplace
@param onlyAscii
@return Bereinigte Fassung | [
"Entferne",
"verbotene",
"Zeichen",
"aus",
"Dateiname",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/tool/FilenameUtils.java#L323-L353 |
7,689 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/tool/Functions.java | Functions.getOs | public static OperatingSystemType getOs() {
OperatingSystemType os = OperatingSystemType.UNKNOWN;
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
if (System.getenv("ProgramFiles(x86)") != null) {
// win 64Bit
os = OperatingSystemType.WIN64;
} else if (System.getenv("ProgramFiles") != null) {
// win 32Bit
os = OperatingSystemType.WIN32;
}
} else if (SystemInfo.isLinux()) {
os = OperatingSystemType.LINUX;
} else if (System.getProperty("os.name").toLowerCase().contains("freebsd")) {
os = OperatingSystemType.LINUX;
} else if (SystemInfo.isMacOSX()) {
os = OperatingSystemType.MAC;
}
return os;
} | java | public static OperatingSystemType getOs() {
OperatingSystemType os = OperatingSystemType.UNKNOWN;
if (System.getProperty("os.name").toLowerCase().contains("windows")) {
if (System.getenv("ProgramFiles(x86)") != null) {
// win 64Bit
os = OperatingSystemType.WIN64;
} else if (System.getenv("ProgramFiles") != null) {
// win 32Bit
os = OperatingSystemType.WIN32;
}
} else if (SystemInfo.isLinux()) {
os = OperatingSystemType.LINUX;
} else if (System.getProperty("os.name").toLowerCase().contains("freebsd")) {
os = OperatingSystemType.LINUX;
} else if (SystemInfo.isMacOSX()) {
os = OperatingSystemType.MAC;
}
return os;
} | [
"public",
"static",
"OperatingSystemType",
"getOs",
"(",
")",
"{",
"OperatingSystemType",
"os",
"=",
"OperatingSystemType",
".",
"UNKNOWN",
";",
"if",
"(",
"System",
".",
"getProperty",
"(",
"\"os.name\"",
")",
".",
"toLowerCase",
"(",
")",
".",
"contains",
"(... | Detect and return the currently used operating system.
@return The enum for supported Operating Systems. | [
"Detect",
"and",
"return",
"the",
"currently",
"used",
"operating",
"system",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/tool/Functions.java#L82-L103 |
7,690 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/tool/Datum.java | Datum.diffInSekunden | public int diffInSekunden() {
final int ret = new Long((this.getTime() - new Datum().getTime()) / (1000)).intValue();
return Math.abs(ret);
} | java | public int diffInSekunden() {
final int ret = new Long((this.getTime() - new Datum().getTime()) / (1000)).intValue();
return Math.abs(ret);
} | [
"public",
"int",
"diffInSekunden",
"(",
")",
"{",
"final",
"int",
"ret",
"=",
"new",
"Long",
"(",
"(",
"this",
".",
"getTime",
"(",
")",
"-",
"new",
"Datum",
"(",
")",
".",
"getTime",
"(",
")",
")",
"/",
"(",
"1000",
")",
")",
".",
"intValue",
... | Liefert den Betrag der Zeitdifferenz zu jetzt.
@return Differenz in Sekunden. | [
"Liefert",
"den",
"Betrag",
"der",
"Zeitdifferenz",
"zu",
"jetzt",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/tool/Datum.java#L60-L63 |
7,691 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/filmlisten/WriteFilmlistJson.java | WriteFilmlistJson.filmlisteSchreibenJsonCompressed | public void filmlisteSchreibenJsonCompressed(String datei, ListeFilme listeFilme) {
final String tempFile = datei + "_temp";
filmlisteSchreibenJson(tempFile, listeFilme);
try {
Log.sysLog("Komprimiere Datei: " + datei);
if (datei.endsWith(Const.FORMAT_XZ)) {
final Path xz = testNativeXz();
if (xz != null) {
Process p = new ProcessBuilder(xz.toString(), "-9", tempFile).start();
final int exitCode = p.waitFor();
if (exitCode == 0) {
Files.move(Paths.get(tempFile + ".xz"), Paths.get(datei), StandardCopyOption.REPLACE_EXISTING);
}
} else
compressFile(tempFile, datei);
}
Files.deleteIfExists(Paths.get(tempFile));
} catch (IOException | InterruptedException ex) {
Log.sysLog("Komprimieren fehlgeschlagen");
}
} | java | public void filmlisteSchreibenJsonCompressed(String datei, ListeFilme listeFilme) {
final String tempFile = datei + "_temp";
filmlisteSchreibenJson(tempFile, listeFilme);
try {
Log.sysLog("Komprimiere Datei: " + datei);
if (datei.endsWith(Const.FORMAT_XZ)) {
final Path xz = testNativeXz();
if (xz != null) {
Process p = new ProcessBuilder(xz.toString(), "-9", tempFile).start();
final int exitCode = p.waitFor();
if (exitCode == 0) {
Files.move(Paths.get(tempFile + ".xz"), Paths.get(datei), StandardCopyOption.REPLACE_EXISTING);
}
} else
compressFile(tempFile, datei);
}
Files.deleteIfExists(Paths.get(tempFile));
} catch (IOException | InterruptedException ex) {
Log.sysLog("Komprimieren fehlgeschlagen");
}
} | [
"public",
"void",
"filmlisteSchreibenJsonCompressed",
"(",
"String",
"datei",
",",
"ListeFilme",
"listeFilme",
")",
"{",
"final",
"String",
"tempFile",
"=",
"datei",
"+",
"\"_temp\"",
";",
"filmlisteSchreibenJson",
"(",
"tempFile",
",",
"listeFilme",
")",
";",
"tr... | Write film data and compress with LZMA2.
@param datei file path
@param listeFilme film data | [
"Write",
"film",
"data",
"and",
"compress",
"with",
"LZMA2",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/filmlisten/WriteFilmlistJson.java#L74-L96 |
7,692 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/daten/ListeFilme.java | ListeFilme.deleteAllFilms | public synchronized void deleteAllFilms(String sender) {
removeIf(film -> film.arr[DatenFilm.FILM_SENDER].equalsIgnoreCase(sender));
} | java | public synchronized void deleteAllFilms(String sender) {
removeIf(film -> film.arr[DatenFilm.FILM_SENDER].equalsIgnoreCase(sender));
} | [
"public",
"synchronized",
"void",
"deleteAllFilms",
"(",
"String",
"sender",
")",
"{",
"removeIf",
"(",
"film",
"->",
"film",
".",
"arr",
"[",
"DatenFilm",
".",
"FILM_SENDER",
"]",
".",
"equalsIgnoreCase",
"(",
"sender",
")",
")",
";",
"}"
] | Delete all films from specified sender.
@param sender Sender which films are to be deleted. | [
"Delete",
"all",
"films",
"from",
"specified",
"sender",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/daten/ListeFilme.java#L271-L273 |
7,693 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/daten/ListeFilme.java | ListeFilme.isTooOldForDiff | public synchronized boolean isTooOldForDiff() {
if (isEmpty()) {
return true;
}
try {
final String dateMaxDiff_str = new SimpleDateFormat("yyyy.MM.dd__").format(new Date()) + Const.TIME_MAX_AGE_FOR_DIFF + ":00:00";
final Date dateMaxDiff = new SimpleDateFormat("yyyy.MM.dd__HH:mm:ss").parse(dateMaxDiff_str);
final Date dateFilmliste = getAgeAsDate();
if (dateFilmliste != null) {
return dateFilmliste.getTime() < dateMaxDiff.getTime();
}
} catch (Exception ignored) {
}
return true;
} | java | public synchronized boolean isTooOldForDiff() {
if (isEmpty()) {
return true;
}
try {
final String dateMaxDiff_str = new SimpleDateFormat("yyyy.MM.dd__").format(new Date()) + Const.TIME_MAX_AGE_FOR_DIFF + ":00:00";
final Date dateMaxDiff = new SimpleDateFormat("yyyy.MM.dd__HH:mm:ss").parse(dateMaxDiff_str);
final Date dateFilmliste = getAgeAsDate();
if (dateFilmliste != null) {
return dateFilmliste.getTime() < dateMaxDiff.getTime();
}
} catch (Exception ignored) {
}
return true;
} | [
"public",
"synchronized",
"boolean",
"isTooOldForDiff",
"(",
")",
"{",
"if",
"(",
"isEmpty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"try",
"{",
"final",
"String",
"dateMaxDiff_str",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy.MM.dd__\"",
")",
".",
... | Check if Filmlist is too old for using a diff list.
@return true if empty or too old. | [
"Check",
"if",
"Filmlist",
"is",
"too",
"old",
"for",
"using",
"a",
"diff",
"list",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/daten/ListeFilme.java#L400-L414 |
7,694 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/daten/ListeFilme.java | ListeFilme.isOlderThan | public boolean isOlderThan(int sekunden) {
int ret = getAge();
if (ret != 0) {
Log.sysLog("Die Filmliste ist " + ret / 60 + " Minuten alt");
}
return ret > sekunden;
} | java | public boolean isOlderThan(int sekunden) {
int ret = getAge();
if (ret != 0) {
Log.sysLog("Die Filmliste ist " + ret / 60 + " Minuten alt");
}
return ret > sekunden;
} | [
"public",
"boolean",
"isOlderThan",
"(",
"int",
"sekunden",
")",
"{",
"int",
"ret",
"=",
"getAge",
"(",
")",
";",
"if",
"(",
"ret",
"!=",
"0",
")",
"{",
"Log",
".",
"sysLog",
"(",
"\"Die Filmliste ist \"",
"+",
"ret",
"/",
"60",
"+",
"\" Minuten alt\""... | Check if list is older than specified parameter.
@param sekunden The age in seconds.
@return true if older. | [
"Check",
"if",
"list",
"is",
"older",
"than",
"specified",
"parameter",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/daten/ListeFilme.java#L422-L428 |
7,695 | mediathekview/MLib | src/main/java/de/mediathekview/mlib/daten/ListeFilme.java | ListeFilme.createChecksum | private String createChecksum(String input) {
StringBuilder sb = new StringBuilder();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(input.getBytes());
byte[] digest = md.digest();
for (byte b : digest) {
sb.append(Integer.toString((b & 0xff) + 0x100, 16).substring(1));
}
} catch (Exception ignored) {
}
return sb.toString();
} | java | private String createChecksum(String input) {
StringBuilder sb = new StringBuilder();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(input.getBytes());
byte[] digest = md.digest();
for (byte b : digest) {
sb.append(Integer.toString((b & 0xff) + 0x100, 16).substring(1));
}
} catch (Exception ignored) {
}
return sb.toString();
} | [
"private",
"String",
"createChecksum",
"(",
"String",
"input",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"try",
"{",
"MessageDigest",
"md",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"MD5\"",
")",
";",
"md",
".",
"u... | Create a checksum string as a unique identifier.
@param input The base string for the checksum.
@return MD5-hashed checksum string. | [
"Create",
"a",
"checksum",
"string",
"as",
"a",
"unique",
"identifier",
"."
] | 01fd5791d87390fea7536275b8a2d4407fc00908 | https://github.com/mediathekview/MLib/blob/01fd5791d87390fea7536275b8a2d4407fc00908/src/main/java/de/mediathekview/mlib/daten/ListeFilme.java#L447-L459 |
7,696 | gperfutils/gprof | src/main/groovy/groovyx/gprof/Profiler.java | Profiler.run | public Report run(Map<String, Object> options, Closure profiled) {
try {
List refs = new ArrayList();
try {
for (Field field : profiled.getClass().getDeclaredFields()) {
if (field.getType().equals(Reference.class)) {
field.setAccessible(true);
Reference ref = (Reference) field.get(profiled);
refs.add(ref);
}
}
} catch(Exception e) {}
refs.add(new Reference(profiled));
refs.add(new Reference(profiled.getDelegate()));
Map<String, Object> _options = new HashMap(options);
_options.put("references", refs);
options = null;
start(_options);
try {
profiled.call();
} catch (Exception e) {
e.printStackTrace();
}
stop();
return getReport();
} finally {
reset();
}
} | java | public Report run(Map<String, Object> options, Closure profiled) {
try {
List refs = new ArrayList();
try {
for (Field field : profiled.getClass().getDeclaredFields()) {
if (field.getType().equals(Reference.class)) {
field.setAccessible(true);
Reference ref = (Reference) field.get(profiled);
refs.add(ref);
}
}
} catch(Exception e) {}
refs.add(new Reference(profiled));
refs.add(new Reference(profiled.getDelegate()));
Map<String, Object> _options = new HashMap(options);
_options.put("references", refs);
options = null;
start(_options);
try {
profiled.call();
} catch (Exception e) {
e.printStackTrace();
}
stop();
return getReport();
} finally {
reset();
}
} | [
"public",
"Report",
"run",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
",",
"Closure",
"profiled",
")",
"{",
"try",
"{",
"List",
"refs",
"=",
"new",
"ArrayList",
"(",
")",
";",
"try",
"{",
"for",
"(",
"Field",
"field",
":",
"profiled",
... | Runs the specified closure and profiles it.
@param options
<ul>
<li>includeMethods a method name to be included.</li>
<li>excludeMethods a method name to be excluded.</li>
<li>includeThreads a thread name to be included.</li>
<li>excludeThreads a thread name to be excluded.</li>
</ul>
@param profiled
a callable object to be run and profiled.
@return the report | [
"Runs",
"the",
"specified",
"closure",
"and",
"profiles",
"it",
"."
] | b05f0829f1df0deb23ff90f4beee16db9747c756 | https://github.com/gperfutils/gprof/blob/b05f0829f1df0deb23ff90f4beee16db9747c756/src/main/groovy/groovyx/gprof/Profiler.java#L79-L107 |
7,697 | gperfutils/gprof | src/main/groovy/groovyx/gprof/Profiler.java | Profiler.start | public void start(Map<String, Object> options) {
MethodCallFilter methodFilter = new MethodCallFilter();
ThreadRunFilter threadFilter = new ThreadRunFilter();
Map<String, Object> opts = new HashMap(defaultOptions);
opts.putAll(options);
methodFilter.addIncludes((List) opts.get("includeMethods"));
methodFilter.addExcludes((List) opts.get("excludeMethods"));
threadFilter.addIncludes((List) opts.get("includeThreads"));
threadFilter.addExcludes((List) opts.get("excludeThreads"));
if (interceptor == null) {
this.interceptor = new CallInterceptor(methodFilter, threadFilter);
}
proxyMetaClasses();
List<Reference> refs = (List) opts.get("references");
if (refs != null) {
proxyPerInstanceMetaClasses(refs);
}
} | java | public void start(Map<String, Object> options) {
MethodCallFilter methodFilter = new MethodCallFilter();
ThreadRunFilter threadFilter = new ThreadRunFilter();
Map<String, Object> opts = new HashMap(defaultOptions);
opts.putAll(options);
methodFilter.addIncludes((List) opts.get("includeMethods"));
methodFilter.addExcludes((List) opts.get("excludeMethods"));
threadFilter.addIncludes((List) opts.get("includeThreads"));
threadFilter.addExcludes((List) opts.get("excludeThreads"));
if (interceptor == null) {
this.interceptor = new CallInterceptor(methodFilter, threadFilter);
}
proxyMetaClasses();
List<Reference> refs = (List) opts.get("references");
if (refs != null) {
proxyPerInstanceMetaClasses(refs);
}
} | [
"public",
"void",
"start",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"options",
")",
"{",
"MethodCallFilter",
"methodFilter",
"=",
"new",
"MethodCallFilter",
"(",
")",
";",
"ThreadRunFilter",
"threadFilter",
"=",
"new",
"ThreadRunFilter",
"(",
")",
";",
... | Starts profiling with the specified options.
@param options
<ul>
<li>includeMethods a method name to be included.</li>
<li>excludeMethods a method name to be excluded.</li>
<li>includeThreads a thread name to be included.</li>
<li>excludeThreads a thread name to be excluded.</li>
</ul> | [
"Starts",
"profiling",
"with",
"the",
"specified",
"options",
"."
] | b05f0829f1df0deb23ff90f4beee16db9747c756 | https://github.com/gperfutils/gprof/blob/b05f0829f1df0deb23ff90f4beee16db9747c756/src/main/groovy/groovyx/gprof/Profiler.java#L126-L145 |
7,698 | gperfutils/gprof | src/main/groovy/groovyx/gprof/Profiler.java | Profiler.stop | public void stop() {
MetaClassRegistry registry = GroovySystem.getMetaClassRegistry();
Set<ProfileMetaClass> proxyMetaClasses = new HashSet();
for (ClassInfo classInfo : ClassInfo.getAllClassInfo()) {
/* $if version < 2.4 $ */
Class theClass = classInfo.get();
MetaClass metaClass = registry.getMetaClass(theClass);
/* $endif */
/* $if version >= 2.4 $ */
MetaClass metaClass = classInfo.getMetaClass();
/* $endif */
if (metaClass instanceof ProfileMetaClass) {
proxyMetaClasses.add((ProfileMetaClass) metaClass);
}
}
// resetting the meta class creation handler clears all the meta classes.
registry.setMetaClassCreationHandle(originalMetaClassCreationHandle);
for (ProfileMetaClass proxyMetaClass : proxyMetaClasses) {
registry.setMetaClass(proxyMetaClass.getTheClass(), proxyMetaClass.getAdaptee());
}
} | java | public void stop() {
MetaClassRegistry registry = GroovySystem.getMetaClassRegistry();
Set<ProfileMetaClass> proxyMetaClasses = new HashSet();
for (ClassInfo classInfo : ClassInfo.getAllClassInfo()) {
/* $if version < 2.4 $ */
Class theClass = classInfo.get();
MetaClass metaClass = registry.getMetaClass(theClass);
/* $endif */
/* $if version >= 2.4 $ */
MetaClass metaClass = classInfo.getMetaClass();
/* $endif */
if (metaClass instanceof ProfileMetaClass) {
proxyMetaClasses.add((ProfileMetaClass) metaClass);
}
}
// resetting the meta class creation handler clears all the meta classes.
registry.setMetaClassCreationHandle(originalMetaClassCreationHandle);
for (ProfileMetaClass proxyMetaClass : proxyMetaClasses) {
registry.setMetaClass(proxyMetaClass.getTheClass(), proxyMetaClass.getAdaptee());
}
} | [
"public",
"void",
"stop",
"(",
")",
"{",
"MetaClassRegistry",
"registry",
"=",
"GroovySystem",
".",
"getMetaClassRegistry",
"(",
")",
";",
"Set",
"<",
"ProfileMetaClass",
">",
"proxyMetaClasses",
"=",
"new",
"HashSet",
"(",
")",
";",
"for",
"(",
"ClassInfo",
... | Stops profiling. | [
"Stops",
"profiling",
"."
] | b05f0829f1df0deb23ff90f4beee16db9747c756 | https://github.com/gperfutils/gprof/blob/b05f0829f1df0deb23ff90f4beee16db9747c756/src/main/groovy/groovyx/gprof/Profiler.java#L217-L239 |
7,699 | cchantep/acolyte | studio/src/main/java/acolyte/Native.java | Native.setDockIcon | public static boolean setDockIcon(final Image icon) {
try {
final Class<?> clazz = Class.forName("com.apple.eawt.Application");
final Method am = clazz.getMethod("getApplication");
final Object app = am.invoke(null, new Object[0]);
final Method si = clazz.getMethod("setDockIconImage",
new Class[] { Image.class });
si.invoke(app, new Object[] { icon });
return true;
} catch (Exception e) {
e.printStackTrace();
} // end of catch
return false;
} | java | public static boolean setDockIcon(final Image icon) {
try {
final Class<?> clazz = Class.forName("com.apple.eawt.Application");
final Method am = clazz.getMethod("getApplication");
final Object app = am.invoke(null, new Object[0]);
final Method si = clazz.getMethod("setDockIconImage",
new Class[] { Image.class });
si.invoke(app, new Object[] { icon });
return true;
} catch (Exception e) {
e.printStackTrace();
} // end of catch
return false;
} | [
"public",
"static",
"boolean",
"setDockIcon",
"(",
"final",
"Image",
"icon",
")",
"{",
"try",
"{",
"final",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"\"com.apple.eawt.Application\"",
")",
";",
"final",
"Method",
"am",
"=",
"clazz... | Sets |icon| for Mac OS X dock.
@return true if set | [
"Sets",
"|icon|",
"for",
"Mac",
"OS",
"X",
"dock",
"."
] | a383dff20fadc08ec9306f2f1f24b2a7e0047449 | https://github.com/cchantep/acolyte/blob/a383dff20fadc08ec9306f2f1f24b2a7e0047449/studio/src/main/java/acolyte/Native.java#L18-L34 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.