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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
137,100 | stackify/stackify-api-java | src/main/java/com/stackify/api/common/lang/StackTraceElements.java | StackTraceElements.toTraceFrame | public static TraceFrame toTraceFrame(final StackTraceElement element) {
TraceFrame.Builder builder = TraceFrame.newBuilder();
builder.codeFileName(element.getFileName());
if (0 < element.getLineNumber()) {
builder.lineNum(element.getLineNumber());
}
builder.method(element.getClassName() + "." + element.getMethodName());
return builder.build();
} | java | public static TraceFrame toTraceFrame(final StackTraceElement element) {
TraceFrame.Builder builder = TraceFrame.newBuilder();
builder.codeFileName(element.getFileName());
if (0 < element.getLineNumber()) {
builder.lineNum(element.getLineNumber());
}
builder.method(element.getClassName() + "." + element.getMethodName());
return builder.build();
} | [
"public",
"static",
"TraceFrame",
"toTraceFrame",
"(",
"final",
"StackTraceElement",
"element",
")",
"{",
"TraceFrame",
".",
"Builder",
"builder",
"=",
"TraceFrame",
".",
"newBuilder",
"(",
")",
";",
"builder",
".",
"codeFileName",
"(",
"element",
".",
"getFileN... | Converts a StackTraceElement to a TraceFrame
@param element The StackTraceElement to be converted
@return The TraceFrame | [
"Converts",
"a",
"StackTraceElement",
"to",
"a",
"TraceFrame"
] | d3000b7c87ed53a88b302939b0c88405d63d7b67 | https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/lang/StackTraceElements.java#L32-L43 |
137,101 | stackify/stackify-api-java | src/main/java/com/stackify/api/common/http/HttpResendQueue.java | HttpResendQueue.offer | public void offer(final byte[] request, final HttpException e) {
if (!e.isClientError()) {
resendQueue.offer(new HttpResendQueueItem(request));
}
} | java | public void offer(final byte[] request, final HttpException e) {
if (!e.isClientError()) {
resendQueue.offer(new HttpResendQueueItem(request));
}
} | [
"public",
"void",
"offer",
"(",
"final",
"byte",
"[",
"]",
"request",
",",
"final",
"HttpException",
"e",
")",
"{",
"if",
"(",
"!",
"e",
".",
"isClientError",
"(",
")",
")",
"{",
"resendQueue",
".",
"offer",
"(",
"new",
"HttpResendQueueItem",
"(",
"req... | Offers a failed request to the resend queue
@param request The failed request
@param e HttpException | [
"Offers",
"a",
"failed",
"request",
"to",
"the",
"resend",
"queue"
] | d3000b7c87ed53a88b302939b0c88405d63d7b67 | https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/http/HttpResendQueue.java#L78-L82 |
137,102 | stackify/stackify-api-java | src/main/java/com/stackify/api/common/http/HttpResendQueue.java | HttpResendQueue.drain | public void drain(final HttpClient httpClient, final String path, final boolean gzip) {
if (!resendQueue.isEmpty()) {
// queued items are available for retransmission
try {
// drain resend queue until empty or first exception
LOGGER.info("Attempting to retransmit {} requests", resendQueue.size());
while (!resendQueue.isEmpty()) {
// get next item off queue
HttpResendQueueItem item = resendQueue.peek();
try {
// retransmit queued request
byte[] jsonBytes = item.getJsonBytes();
httpClient.post(path, jsonBytes, gzip);
// retransmission successful
// remove from queue and sleep for 250ms
resendQueue.remove();
Threads.sleepQuietly(250, TimeUnit.MILLISECONDS);
} catch (Throwable t) {
// retransmission failed
// increment the item's counter
item.failed();
// remove it from the queue if we have had MAX_POST_ATTEMPTS (3) failures for the same request
if (MAX_POST_ATTEMPTS <= item.getNumFailures())
{
resendQueue.remove();
}
// rethrow original exception from retransmission
throw t;
}
}
} catch (Throwable t) {
LOGGER.info("Failure retransmitting queued requests", t);
}
}
} | java | public void drain(final HttpClient httpClient, final String path, final boolean gzip) {
if (!resendQueue.isEmpty()) {
// queued items are available for retransmission
try {
// drain resend queue until empty or first exception
LOGGER.info("Attempting to retransmit {} requests", resendQueue.size());
while (!resendQueue.isEmpty()) {
// get next item off queue
HttpResendQueueItem item = resendQueue.peek();
try {
// retransmit queued request
byte[] jsonBytes = item.getJsonBytes();
httpClient.post(path, jsonBytes, gzip);
// retransmission successful
// remove from queue and sleep for 250ms
resendQueue.remove();
Threads.sleepQuietly(250, TimeUnit.MILLISECONDS);
} catch (Throwable t) {
// retransmission failed
// increment the item's counter
item.failed();
// remove it from the queue if we have had MAX_POST_ATTEMPTS (3) failures for the same request
if (MAX_POST_ATTEMPTS <= item.getNumFailures())
{
resendQueue.remove();
}
// rethrow original exception from retransmission
throw t;
}
}
} catch (Throwable t) {
LOGGER.info("Failure retransmitting queued requests", t);
}
}
} | [
"public",
"void",
"drain",
"(",
"final",
"HttpClient",
"httpClient",
",",
"final",
"String",
"path",
",",
"final",
"boolean",
"gzip",
")",
"{",
"if",
"(",
"!",
"resendQueue",
".",
"isEmpty",
"(",
")",
")",
"{",
"// queued items are available for retransmission",... | Drains the resend queue until empty or error
@param httpClient The HTTP client
@param path REST path
@param gzip True if the post should be gzipped, false otherwise | [
"Drains",
"the",
"resend",
"queue",
"until",
"empty",
"or",
"error"
] | d3000b7c87ed53a88b302939b0c88405d63d7b67 | https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/http/HttpResendQueue.java#L99-L153 |
137,103 | stackify/stackify-api-java | src/main/java/com/stackify/api/common/log/LogCollector.java | LogCollector.flush | public int flush(final LogSender sender) throws IOException, HttpException {
int numSent = 0;
int maxToSend = queue.size();
if (0 < maxToSend) {
AppIdentity appIdentity = appIdentityService.getAppIdentity();
while (numSent < maxToSend) {
// get the next batch of messages
int batchSize = Math.min(maxToSend - numSent, MAX_BATCH);
List<LogMsg> batch = new ArrayList<LogMsg>(batchSize);
for (int i = 0; i < batchSize; ++i) {
batch.add(queue.remove());
}
// build the log message group
LogMsgGroup group = createLogMessageGroup(batch, platform, logger, envDetail, appIdentity);
// send the batch to Stackify
int httpStatus = sender.send(group);
// if the batch failed to transmit, return the appropriate transmission status
if (httpStatus != HttpURLConnection.HTTP_OK) {
throw new HttpException(httpStatus);
}
// next iteration
numSent += batchSize;
}
}
return numSent;
} | java | public int flush(final LogSender sender) throws IOException, HttpException {
int numSent = 0;
int maxToSend = queue.size();
if (0 < maxToSend) {
AppIdentity appIdentity = appIdentityService.getAppIdentity();
while (numSent < maxToSend) {
// get the next batch of messages
int batchSize = Math.min(maxToSend - numSent, MAX_BATCH);
List<LogMsg> batch = new ArrayList<LogMsg>(batchSize);
for (int i = 0; i < batchSize; ++i) {
batch.add(queue.remove());
}
// build the log message group
LogMsgGroup group = createLogMessageGroup(batch, platform, logger, envDetail, appIdentity);
// send the batch to Stackify
int httpStatus = sender.send(group);
// if the batch failed to transmit, return the appropriate transmission status
if (httpStatus != HttpURLConnection.HTTP_OK) {
throw new HttpException(httpStatus);
}
// next iteration
numSent += batchSize;
}
}
return numSent;
} | [
"public",
"int",
"flush",
"(",
"final",
"LogSender",
"sender",
")",
"throws",
"IOException",
",",
"HttpException",
"{",
"int",
"numSent",
"=",
"0",
";",
"int",
"maxToSend",
"=",
"queue",
".",
"size",
"(",
")",
";",
"if",
"(",
"0",
"<",
"maxToSend",
")"... | Flushes the queue by sending all messages to Stackify
@param sender The LogMsgGroup sender
@return The number of messages sent to Stackify
@throws IOException
@throws HttpException | [
"Flushes",
"the",
"queue",
"by",
"sending",
"all",
"messages",
"to",
"Stackify"
] | d3000b7c87ed53a88b302939b0c88405d63d7b67 | https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/log/LogCollector.java#L117-L153 |
137,104 | stackify/stackify-api-java | src/main/java/com/stackify/api/common/http/HttpClient.java | HttpClient.readAndClose | private String readAndClose(final InputStream stream) throws IOException {
String contents = null;
if (stream != null) {
contents = CharStreams.toString(new InputStreamReader(new BufferedInputStream(stream), "UTF-8"));
stream.close();
}
return contents;
} | java | private String readAndClose(final InputStream stream) throws IOException {
String contents = null;
if (stream != null) {
contents = CharStreams.toString(new InputStreamReader(new BufferedInputStream(stream), "UTF-8"));
stream.close();
}
return contents;
} | [
"private",
"String",
"readAndClose",
"(",
"final",
"InputStream",
"stream",
")",
"throws",
"IOException",
"{",
"String",
"contents",
"=",
"null",
";",
"if",
"(",
"stream",
"!=",
"null",
")",
"{",
"contents",
"=",
"CharStreams",
".",
"toString",
"(",
"new",
... | Reads all remaining contents from the stream and closes it
@param stream The stream
@return The contents of the stream
@throws IOException | [
"Reads",
"all",
"remaining",
"contents",
"from",
"the",
"stream",
"and",
"closes",
"it"
] | d3000b7c87ed53a88b302939b0c88405d63d7b67 | https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/http/HttpClient.java#L179-L188 |
137,105 | stackify/stackify-api-java | src/main/java/com/stackify/api/common/util/PropertyUtil.java | PropertyUtil.loadProperties | public static Properties loadProperties(final String path) {
if (path != null) {
// try as file
try {
File file = new File(path);
if (file.exists()) {
try {
Properties p = new Properties();
p.load(new FileInputStream(file));
return p;
} catch (Exception e) {
log.error("Error loading properties from file: " + path);
}
}
} catch (Throwable e) {
log.debug(e.getMessage(), e);
}
// try as resource
InputStream inputStream = null;
try {
inputStream = PropertyUtil.class.getResourceAsStream(path);
if (inputStream != null) {
try {
Properties p = new Properties();
p.load(inputStream);
return p;
} catch (Exception e) {
log.error("Error loading properties from resource: " + path);
}
}
} catch (Exception e) {
log.error("Error loading properties from resource: " + path);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (Throwable t) {
log.debug("Error closing: " + path, t);
}
}
}
}
// return empty Properties by default
return new Properties();
} | java | public static Properties loadProperties(final String path) {
if (path != null) {
// try as file
try {
File file = new File(path);
if (file.exists()) {
try {
Properties p = new Properties();
p.load(new FileInputStream(file));
return p;
} catch (Exception e) {
log.error("Error loading properties from file: " + path);
}
}
} catch (Throwable e) {
log.debug(e.getMessage(), e);
}
// try as resource
InputStream inputStream = null;
try {
inputStream = PropertyUtil.class.getResourceAsStream(path);
if (inputStream != null) {
try {
Properties p = new Properties();
p.load(inputStream);
return p;
} catch (Exception e) {
log.error("Error loading properties from resource: " + path);
}
}
} catch (Exception e) {
log.error("Error loading properties from resource: " + path);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (Throwable t) {
log.debug("Error closing: " + path, t);
}
}
}
}
// return empty Properties by default
return new Properties();
} | [
"public",
"static",
"Properties",
"loadProperties",
"(",
"final",
"String",
"path",
")",
"{",
"if",
"(",
"path",
"!=",
"null",
")",
"{",
"// try as file",
"try",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"path",
")",
";",
"if",
"(",
"file",
".",
... | Loads properties with given path - will load as file is able or classpath resource | [
"Loads",
"properties",
"with",
"given",
"path",
"-",
"will",
"load",
"as",
"file",
"is",
"able",
"or",
"classpath",
"resource"
] | d3000b7c87ed53a88b302939b0c88405d63d7b67 | https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/util/PropertyUtil.java#L38-L86 |
137,106 | stackify/stackify-api-java | src/main/java/com/stackify/api/common/util/PropertyUtil.java | PropertyUtil.read | public static Map<String, String> read(final String path) {
Map<String, String> map = new HashMap<String, String>();
if (path != null) {
try {
Properties p = loadProperties(path);
for (Object key : p.keySet()) {
String value = p.getProperty(String.valueOf(key));
// remove single/double quotes
if ((value.startsWith("\"") && value.endsWith("\"")) ||
(value.startsWith("\'") && value.endsWith("\'"))) {
value = value.substring(1, value.length() - 1);
}
value = value.trim();
if (!value.equals("")) {
map.put(String.valueOf(key), value);
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
return map;
} | java | public static Map<String, String> read(final String path) {
Map<String, String> map = new HashMap<String, String>();
if (path != null) {
try {
Properties p = loadProperties(path);
for (Object key : p.keySet()) {
String value = p.getProperty(String.valueOf(key));
// remove single/double quotes
if ((value.startsWith("\"") && value.endsWith("\"")) ||
(value.startsWith("\'") && value.endsWith("\'"))) {
value = value.substring(1, value.length() - 1);
}
value = value.trim();
if (!value.equals("")) {
map.put(String.valueOf(key), value);
}
}
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
return map;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"read",
"(",
"final",
"String",
"path",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"if",
"(",
"... | Reads properties from file path or classpath | [
"Reads",
"properties",
"from",
"file",
"path",
"or",
"classpath"
] | d3000b7c87ed53a88b302939b0c88405d63d7b67 | https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/util/PropertyUtil.java#L91-L122 |
137,107 | stackify/stackify-api-java | src/main/java/com/stackify/api/common/lang/Threads.java | Threads.sleepQuietly | public static void sleepQuietly(final long sleepFor, final TimeUnit unit) {
try {
Thread.sleep(unit.toMillis(sleepFor));
} catch (Throwable t) {
// do nothing
}
} | java | public static void sleepQuietly(final long sleepFor, final TimeUnit unit) {
try {
Thread.sleep(unit.toMillis(sleepFor));
} catch (Throwable t) {
// do nothing
}
} | [
"public",
"static",
"void",
"sleepQuietly",
"(",
"final",
"long",
"sleepFor",
",",
"final",
"TimeUnit",
"unit",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"unit",
".",
"toMillis",
"(",
"sleepFor",
")",
")",
";",
"}",
"catch",
"(",
"Throwable",
... | Sleeps and eats any exceptions
@param sleepFor Sleep for value
@param unit Unit of measure | [
"Sleeps",
"and",
"eats",
"any",
"exceptions"
] | d3000b7c87ed53a88b302939b0c88405d63d7b67 | https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/lang/Threads.java#L31-L37 |
137,108 | stackify/stackify-api-java | src/main/java/com/stackify/api/common/log/LogAppender.java | LogAppender.activate | public void activate(final ApiConfiguration apiConfig) {
Preconditions.checkNotNull(apiConfig);
Preconditions.checkNotNull(apiConfig.getApiUrl());
Preconditions.checkArgument(!apiConfig.getApiUrl().isEmpty());
Preconditions.checkNotNull(apiConfig.getApiKey());
Preconditions.checkArgument(!apiConfig.getApiKey().isEmpty());
// Single JSON object mapper for all services
ObjectMapper objectMapper = new ObjectMapper();
// build the app identity service
AppIdentityService appIdentityService = new AppIdentityService(apiConfig, objectMapper);
// build the services for collecting and sending log messages
this.collector = new LogCollector(logger, apiConfig.getEnvDetail(), appIdentityService);
LogSender sender = new LogSender(apiConfig, objectMapper, this.masker, this.skipJson);
// set allowComDotStackify
if (Boolean.TRUE.equals(apiConfig.getAllowComDotStackify())) {
this.allowComDotStackify = true;
}
// build the background service to asynchronously post errors to Stackify
// startup the background service
this.backgroundService = new LogBackgroundService(collector, sender);
this.backgroundService.start();
} | java | public void activate(final ApiConfiguration apiConfig) {
Preconditions.checkNotNull(apiConfig);
Preconditions.checkNotNull(apiConfig.getApiUrl());
Preconditions.checkArgument(!apiConfig.getApiUrl().isEmpty());
Preconditions.checkNotNull(apiConfig.getApiKey());
Preconditions.checkArgument(!apiConfig.getApiKey().isEmpty());
// Single JSON object mapper for all services
ObjectMapper objectMapper = new ObjectMapper();
// build the app identity service
AppIdentityService appIdentityService = new AppIdentityService(apiConfig, objectMapper);
// build the services for collecting and sending log messages
this.collector = new LogCollector(logger, apiConfig.getEnvDetail(), appIdentityService);
LogSender sender = new LogSender(apiConfig, objectMapper, this.masker, this.skipJson);
// set allowComDotStackify
if (Boolean.TRUE.equals(apiConfig.getAllowComDotStackify())) {
this.allowComDotStackify = true;
}
// build the background service to asynchronously post errors to Stackify
// startup the background service
this.backgroundService = new LogBackgroundService(collector, sender);
this.backgroundService.start();
} | [
"public",
"void",
"activate",
"(",
"final",
"ApiConfiguration",
"apiConfig",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"apiConfig",
")",
";",
"Preconditions",
".",
"checkNotNull",
"(",
"apiConfig",
".",
"getApiUrl",
"(",
")",
")",
";",
"Preconditions"... | Activates the appender
@param apiConfig API configuration | [
"Activates",
"the",
"appender"
] | d3000b7c87ed53a88b302939b0c88405d63d7b67 | https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/log/LogAppender.java#L104-L136 |
137,109 | stackify/stackify-api-java | src/main/java/com/stackify/api/common/log/LogAppender.java | LogAppender.append | public void append(final T event) {
// make sure we can append the log message
if (backgroundService == null) {
return;
}
if (!backgroundService.isRunning()) {
return;
}
// skip internal logging
if (!allowComDotStackify) {
String className = eventAdapter.getClassName(event);
if (className != null) {
if (className.startsWith(COM_DOT_STACKIFY)) {
return;
}
}
}
// build the log message and queue it to be sent to Stackify
Throwable exception = eventAdapter.getThrowable(event);
StackifyError error = null;
if ((exception != null) || (eventAdapter.isErrorLevel(event))) {
StackifyError e = eventAdapter.getStackifyError(event, exception);
if (errorGovernor.errorShouldBeSent(e)) {
error = e;
}
}
LogMsg logMsg = eventAdapter.getLogMsg(event, error);
collector.addLogMsg(logMsg);
} | java | public void append(final T event) {
// make sure we can append the log message
if (backgroundService == null) {
return;
}
if (!backgroundService.isRunning()) {
return;
}
// skip internal logging
if (!allowComDotStackify) {
String className = eventAdapter.getClassName(event);
if (className != null) {
if (className.startsWith(COM_DOT_STACKIFY)) {
return;
}
}
}
// build the log message and queue it to be sent to Stackify
Throwable exception = eventAdapter.getThrowable(event);
StackifyError error = null;
if ((exception != null) || (eventAdapter.isErrorLevel(event))) {
StackifyError e = eventAdapter.getStackifyError(event, exception);
if (errorGovernor.errorShouldBeSent(e)) {
error = e;
}
}
LogMsg logMsg = eventAdapter.getLogMsg(event, error);
collector.addLogMsg(logMsg);
} | [
"public",
"void",
"append",
"(",
"final",
"T",
"event",
")",
"{",
"// make sure we can append the log message",
"if",
"(",
"backgroundService",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"backgroundService",
".",
"isRunning",
"(",
")",
")",
... | Adds the log message to the collector
@param event | [
"Adds",
"the",
"log",
"message",
"to",
"the",
"collector"
] | d3000b7c87ed53a88b302939b0c88405d63d7b67 | https://github.com/stackify/stackify-api-java/blob/d3000b7c87ed53a88b302939b0c88405d63d7b67/src/main/java/com/stackify/api/common/log/LogAppender.java#L152-L193 |
137,110 | SpoonLabs/spoon-maven-plugin | src/main/java/fr/inria/gforge/spoon/configuration/XMLSpoonConfiguration.java | XMLSpoonConfiguration.buildTemplates | private String buildTemplates() {
String[] templateString = new String[model.getTemplates().size()];
for (int i = 0; i < (model.getTemplates().size()); i++) {
String templateLoaded = loadTemplateFile(
model.getTemplates().get(i));
if (templateLoaded != null) {
templateString[i] = templateLoaded;
}
}
return implode(templateString, File.pathSeparator);
} | java | private String buildTemplates() {
String[] templateString = new String[model.getTemplates().size()];
for (int i = 0; i < (model.getTemplates().size()); i++) {
String templateLoaded = loadTemplateFile(
model.getTemplates().get(i));
if (templateLoaded != null) {
templateString[i] = templateLoaded;
}
}
return implode(templateString, File.pathSeparator);
} | [
"private",
"String",
"buildTemplates",
"(",
")",
"{",
"String",
"[",
"]",
"templateString",
"=",
"new",
"String",
"[",
"model",
".",
"getTemplates",
"(",
")",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"(",
... | Builds the path for the list of templates. | [
"Builds",
"the",
"path",
"for",
"the",
"list",
"of",
"templates",
"."
] | d38172c33792ec04ac29b0742840f746a9758b8d | https://github.com/SpoonLabs/spoon-maven-plugin/blob/d38172c33792ec04ac29b0742840f746a9758b8d/src/main/java/fr/inria/gforge/spoon/configuration/XMLSpoonConfiguration.java#L59-L69 |
137,111 | SpoonLabs/spoon-maven-plugin | src/main/java/fr/inria/gforge/spoon/configuration/XMLSpoonConfiguration.java | XMLSpoonConfiguration.loadTemplateFile | private String loadTemplateFile(String templateName) {
String name = templateName.replace('.', '/') + ".java";
InputStream in = SpoonMojoGenerate.class.getClassLoader().getResourceAsStream(name);
String packageName = templateName.substring(0, templateName.lastIndexOf('.'));
String fileName = templateName.substring(templateName.lastIndexOf('.') + 1) + ".java";
try {
return TemplateLoader.loadToTmpFolder(in, packageName, fileName)
.getAbsolutePath();
} catch (IOException e) {
LogWrapper.warn(spoon, String.format("Template %s cannot be loaded.", templateName), e);
return null;
}
} | java | private String loadTemplateFile(String templateName) {
String name = templateName.replace('.', '/') + ".java";
InputStream in = SpoonMojoGenerate.class.getClassLoader().getResourceAsStream(name);
String packageName = templateName.substring(0, templateName.lastIndexOf('.'));
String fileName = templateName.substring(templateName.lastIndexOf('.') + 1) + ".java";
try {
return TemplateLoader.loadToTmpFolder(in, packageName, fileName)
.getAbsolutePath();
} catch (IOException e) {
LogWrapper.warn(spoon, String.format("Template %s cannot be loaded.", templateName), e);
return null;
}
} | [
"private",
"String",
"loadTemplateFile",
"(",
"String",
"templateName",
")",
"{",
"String",
"name",
"=",
"templateName",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\".java\"",
";",
"InputStream",
"in",
"=",
"SpoonMojoGenerate",
".",
"class",
... | Loads the template file at the path given. | [
"Loads",
"the",
"template",
"file",
"at",
"the",
"path",
"given",
"."
] | d38172c33792ec04ac29b0742840f746a9758b8d | https://github.com/SpoonLabs/spoon-maven-plugin/blob/d38172c33792ec04ac29b0742840f746a9758b8d/src/main/java/fr/inria/gforge/spoon/configuration/XMLSpoonConfiguration.java#L74-L86 |
137,112 | SpoonLabs/spoon-maven-plugin | src/main/java/fr/inria/gforge/spoon/logging/ReportDaoImpl.java | ReportDaoImpl.addRoot | private Element addRoot(Document document,
Map<ReportBuilderImpl.ReportKey, Object> reportsData) {
Element rootElement = document.createElement("project");
if (reportsData.containsKey(ReportKey.PROJECT_NAME)) {
rootElement.setAttribute("name",
(String) reportsData.get(ReportKey.PROJECT_NAME));
}
document.appendChild(rootElement);
return rootElement;
} | java | private Element addRoot(Document document,
Map<ReportBuilderImpl.ReportKey, Object> reportsData) {
Element rootElement = document.createElement("project");
if (reportsData.containsKey(ReportKey.PROJECT_NAME)) {
rootElement.setAttribute("name",
(String) reportsData.get(ReportKey.PROJECT_NAME));
}
document.appendChild(rootElement);
return rootElement;
} | [
"private",
"Element",
"addRoot",
"(",
"Document",
"document",
",",
"Map",
"<",
"ReportBuilderImpl",
".",
"ReportKey",
",",
"Object",
">",
"reportsData",
")",
"{",
"Element",
"rootElement",
"=",
"document",
".",
"createElement",
"(",
"\"project\"",
")",
";",
"i... | Adds root element. | [
"Adds",
"root",
"element",
"."
] | d38172c33792ec04ac29b0742840f746a9758b8d | https://github.com/SpoonLabs/spoon-maven-plugin/blob/d38172c33792ec04ac29b0742840f746a9758b8d/src/main/java/fr/inria/gforge/spoon/logging/ReportDaoImpl.java#L66-L75 |
137,113 | SpoonLabs/spoon-maven-plugin | src/main/java/fr/inria/gforge/spoon/logging/ReportDaoImpl.java | ReportDaoImpl.addProcessors | private Element addProcessors(Document document, Element root,
Map<ReportBuilderImpl.ReportKey, Object> reportsData) {
if (reportsData.containsKey(ReportKey.PROCESSORS)) {
// Adds root tag "processors".
Element processors = document.createElement("processors");
root.appendChild(processors);
// Adds all processors in child of "processors" tag.
String[] tabProcessors = (String[]) reportsData
.get(ReportKey.PROCESSORS);
for (String processor : tabProcessors) {
Element current = document.createElement("processor");
current.appendChild(document.createTextNode(processor));
processors.appendChild(current);
}
return processors;
}
return null;
} | java | private Element addProcessors(Document document, Element root,
Map<ReportBuilderImpl.ReportKey, Object> reportsData) {
if (reportsData.containsKey(ReportKey.PROCESSORS)) {
// Adds root tag "processors".
Element processors = document.createElement("processors");
root.appendChild(processors);
// Adds all processors in child of "processors" tag.
String[] tabProcessors = (String[]) reportsData
.get(ReportKey.PROCESSORS);
for (String processor : tabProcessors) {
Element current = document.createElement("processor");
current.appendChild(document.createTextNode(processor));
processors.appendChild(current);
}
return processors;
}
return null;
} | [
"private",
"Element",
"addProcessors",
"(",
"Document",
"document",
",",
"Element",
"root",
",",
"Map",
"<",
"ReportBuilderImpl",
".",
"ReportKey",
",",
"Object",
">",
"reportsData",
")",
"{",
"if",
"(",
"reportsData",
".",
"containsKey",
"(",
"ReportKey",
"."... | Adds processors, child of root element. | [
"Adds",
"processors",
"child",
"of",
"root",
"element",
"."
] | d38172c33792ec04ac29b0742840f746a9758b8d | https://github.com/SpoonLabs/spoon-maven-plugin/blob/d38172c33792ec04ac29b0742840f746a9758b8d/src/main/java/fr/inria/gforge/spoon/logging/ReportDaoImpl.java#L80-L98 |
137,114 | SpoonLabs/spoon-maven-plugin | src/main/java/fr/inria/gforge/spoon/logging/ReportDaoImpl.java | ReportDaoImpl.addElement | private Element addElement(Document document, Element parent,
Map<ReportKey, Object> reportsData, ReportKey key, String value) {
if (reportsData.containsKey(key)) {
Element child = document.createElement(key.name().toLowerCase());
child.appendChild(document.createTextNode(value));
parent.appendChild(child);
return child;
}
return null;
} | java | private Element addElement(Document document, Element parent,
Map<ReportKey, Object> reportsData, ReportKey key, String value) {
if (reportsData.containsKey(key)) {
Element child = document.createElement(key.name().toLowerCase());
child.appendChild(document.createTextNode(value));
parent.appendChild(child);
return child;
}
return null;
} | [
"private",
"Element",
"addElement",
"(",
"Document",
"document",
",",
"Element",
"parent",
",",
"Map",
"<",
"ReportKey",
",",
"Object",
">",
"reportsData",
",",
"ReportKey",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"reportsData",
".",
"containsKey... | Generic method to add a element for a parent element given. | [
"Generic",
"method",
"to",
"add",
"a",
"element",
"for",
"a",
"parent",
"element",
"given",
"."
] | d38172c33792ec04ac29b0742840f746a9758b8d | https://github.com/SpoonLabs/spoon-maven-plugin/blob/d38172c33792ec04ac29b0742840f746a9758b8d/src/main/java/fr/inria/gforge/spoon/logging/ReportDaoImpl.java#L103-L112 |
137,115 | SpoonLabs/spoon-maven-plugin | src/main/java/fr/inria/gforge/spoon/configuration/AbstractSpoonConfigurationBuilder.java | AbstractSpoonConfigurationBuilder.implode | protected String implode(String[] tabToConcatenate, String pathSeparator) {
final StringBuilder builder = new StringBuilder();
for (int i = 0; i < tabToConcatenate.length; i++) {
builder.append(tabToConcatenate[i]);
if (i < tabToConcatenate.length - 1) {
builder.append(pathSeparator);
}
}
return builder.toString();
} | java | protected String implode(String[] tabToConcatenate, String pathSeparator) {
final StringBuilder builder = new StringBuilder();
for (int i = 0; i < tabToConcatenate.length; i++) {
builder.append(tabToConcatenate[i]);
if (i < tabToConcatenate.length - 1) {
builder.append(pathSeparator);
}
}
return builder.toString();
} | [
"protected",
"String",
"implode",
"(",
"String",
"[",
"]",
"tabToConcatenate",
",",
"String",
"pathSeparator",
")",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ta... | Concatenates a tab in a string with a path separator given. | [
"Concatenates",
"a",
"tab",
"in",
"a",
"string",
"with",
"a",
"path",
"separator",
"given",
"."
] | d38172c33792ec04ac29b0742840f746a9758b8d | https://github.com/SpoonLabs/spoon-maven-plugin/blob/d38172c33792ec04ac29b0742840f746a9758b8d/src/main/java/fr/inria/gforge/spoon/configuration/AbstractSpoonConfigurationBuilder.java#L181-L190 |
137,116 | pardom-zz/Ollie | core/src/main/java/ollie/OllieProvider.java | OllieProvider.createUri | public static Uri createUri(Class<? extends Model> type, Long id) {
final StringBuilder uri = new StringBuilder();
uri.append("content://");
uri.append(sAuthority);
uri.append("/");
uri.append(Ollie.getTableName(type).toLowerCase());
if (id != null) {
uri.append("/");
uri.append(id.toString());
}
return Uri.parse(uri.toString());
} | java | public static Uri createUri(Class<? extends Model> type, Long id) {
final StringBuilder uri = new StringBuilder();
uri.append("content://");
uri.append(sAuthority);
uri.append("/");
uri.append(Ollie.getTableName(type).toLowerCase());
if (id != null) {
uri.append("/");
uri.append(id.toString());
}
return Uri.parse(uri.toString());
} | [
"public",
"static",
"Uri",
"createUri",
"(",
"Class",
"<",
"?",
"extends",
"Model",
">",
"type",
",",
"Long",
"id",
")",
"{",
"final",
"StringBuilder",
"uri",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"uri",
".",
"append",
"(",
"\"content://\"",
")",
... | Create a Uri for a model row.
@param type The model type.
@param id The row Id.
@return The Uri for the model row. | [
"Create",
"a",
"Uri",
"for",
"a",
"model",
"row",
"."
] | 9d20468ca78064002187f2c5db3be06d1d29e310 | https://github.com/pardom-zz/Ollie/blob/9d20468ca78064002187f2c5db3be06d1d29e310/core/src/main/java/ollie/OllieProvider.java#L77-L90 |
137,117 | pardom-zz/Ollie | core/src/main/java/ollie/Ollie.java | Ollie.processCursor | public static <T extends Model> List<T> processCursor(Class<T> cls, Cursor cursor) {
final List<T> entities = new ArrayList<T>();
try {
Constructor<T> entityConstructor = cls.getConstructor();
if (cursor.moveToFirst()) {
do {
T entity = getEntity(cls, cursor.getLong(cursor.getColumnIndex(BaseColumns._ID)));
if (entity == null) {
entity = entityConstructor.newInstance();
}
entity.load(cursor);
entities.add(entity);
}
while (cursor.moveToNext());
}
} catch (Exception e) {
Log.e(TAG, "Failed to process cursor.", e);
}
return entities;
} | java | public static <T extends Model> List<T> processCursor(Class<T> cls, Cursor cursor) {
final List<T> entities = new ArrayList<T>();
try {
Constructor<T> entityConstructor = cls.getConstructor();
if (cursor.moveToFirst()) {
do {
T entity = getEntity(cls, cursor.getLong(cursor.getColumnIndex(BaseColumns._ID)));
if (entity == null) {
entity = entityConstructor.newInstance();
}
entity.load(cursor);
entities.add(entity);
}
while (cursor.moveToNext());
}
} catch (Exception e) {
Log.e(TAG, "Failed to process cursor.", e);
}
return entities;
} | [
"public",
"static",
"<",
"T",
"extends",
"Model",
">",
"List",
"<",
"T",
">",
"processCursor",
"(",
"Class",
"<",
"T",
">",
"cls",
",",
"Cursor",
"cursor",
")",
"{",
"final",
"List",
"<",
"T",
">",
"entities",
"=",
"new",
"ArrayList",
"<",
"T",
">"... | Iterate over a cursor and load entities.
@param cls The model class.
@param cursor The result cursor.
@return The list of entities. | [
"Iterate",
"over",
"a",
"cursor",
"and",
"load",
"entities",
"."
] | 9d20468ca78064002187f2c5db3be06d1d29e310 | https://github.com/pardom-zz/Ollie/blob/9d20468ca78064002187f2c5db3be06d1d29e310/core/src/main/java/ollie/Ollie.java#L170-L191 |
137,118 | pardom-zz/Ollie | core/src/main/java/ollie/Ollie.java | Ollie.processAndCloseCursor | public static <T extends Model> List<T> processAndCloseCursor(Class<T> cls, Cursor cursor) {
List<T> entities = processCursor(cls, cursor);
cursor.close();
return entities;
} | java | public static <T extends Model> List<T> processAndCloseCursor(Class<T> cls, Cursor cursor) {
List<T> entities = processCursor(cls, cursor);
cursor.close();
return entities;
} | [
"public",
"static",
"<",
"T",
"extends",
"Model",
">",
"List",
"<",
"T",
">",
"processAndCloseCursor",
"(",
"Class",
"<",
"T",
">",
"cls",
",",
"Cursor",
"cursor",
")",
"{",
"List",
"<",
"T",
">",
"entities",
"=",
"processCursor",
"(",
"cls",
",",
"c... | Iterate over a cursor and load entities. Closes the cursor when finished.
@param cls The model class.
@param cursor The result cursor.
@return The list of entities. | [
"Iterate",
"over",
"a",
"cursor",
"and",
"load",
"entities",
".",
"Closes",
"the",
"cursor",
"when",
"finished",
"."
] | 9d20468ca78064002187f2c5db3be06d1d29e310 | https://github.com/pardom-zz/Ollie/blob/9d20468ca78064002187f2c5db3be06d1d29e310/core/src/main/java/ollie/Ollie.java#L200-L204 |
137,119 | pardom-zz/Ollie | core/src/main/java/ollie/Ollie.java | Ollie.load | static synchronized <T extends Model> void load(T entity, Cursor cursor) {
sAdapterHolder.getModelAdapter(entity.getClass()).load(entity, cursor);
} | java | static synchronized <T extends Model> void load(T entity, Cursor cursor) {
sAdapterHolder.getModelAdapter(entity.getClass()).load(entity, cursor);
} | [
"static",
"synchronized",
"<",
"T",
"extends",
"Model",
">",
"void",
"load",
"(",
"T",
"entity",
",",
"Cursor",
"cursor",
")",
"{",
"sAdapterHolder",
".",
"getModelAdapter",
"(",
"entity",
".",
"getClass",
"(",
")",
")",
".",
"load",
"(",
"entity",
",",
... | Model adapter methods | [
"Model",
"adapter",
"methods"
] | 9d20468ca78064002187f2c5db3be06d1d29e310 | https://github.com/pardom-zz/Ollie/blob/9d20468ca78064002187f2c5db3be06d1d29e310/core/src/main/java/ollie/Ollie.java#L242-L244 |
137,120 | jhades/jhades | jhades/src/main/java/org/jhades/model/ClasspathEntry.java | ClasspathEntry.getResourceVersions | public List<ClasspathResourceVersion> getResourceVersions() throws URISyntaxException, IOException {
if (!lazyLoadDone) {
if (isClassFolder()) {
logger.debug("\nScanning class folder: " + getUrl());
URI uri = new URI(getUrl());
Path start = Paths.get(uri);
scanClasspathEntry(start);
} else if (isJar()) {
logger.debug("\nScanning jar: " + getUrl());
URI uri = new URI("jar:" + getUrl());
try (FileSystem jarFS = FileSystems.newFileSystem(uri, new HashMap<String, String>())) {
Path zipInJarPath = jarFS.getPath("/");
scanClasspathEntry(zipInJarPath);
} catch (Exception exc) {
logger.debug("Could not scan jar: " + getUrl() + " - reason:" + exc.getMessage());
}
}
lazyLoadDone = true;
}
return resourceVersions;
} | java | public List<ClasspathResourceVersion> getResourceVersions() throws URISyntaxException, IOException {
if (!lazyLoadDone) {
if (isClassFolder()) {
logger.debug("\nScanning class folder: " + getUrl());
URI uri = new URI(getUrl());
Path start = Paths.get(uri);
scanClasspathEntry(start);
} else if (isJar()) {
logger.debug("\nScanning jar: " + getUrl());
URI uri = new URI("jar:" + getUrl());
try (FileSystem jarFS = FileSystems.newFileSystem(uri, new HashMap<String, String>())) {
Path zipInJarPath = jarFS.getPath("/");
scanClasspathEntry(zipInJarPath);
} catch (Exception exc) {
logger.debug("Could not scan jar: " + getUrl() + " - reason:" + exc.getMessage());
}
}
lazyLoadDone = true;
}
return resourceVersions;
} | [
"public",
"List",
"<",
"ClasspathResourceVersion",
">",
"getResourceVersions",
"(",
")",
"throws",
"URISyntaxException",
",",
"IOException",
"{",
"if",
"(",
"!",
"lazyLoadDone",
")",
"{",
"if",
"(",
"isClassFolder",
"(",
")",
")",
"{",
"logger",
".",
"debug",
... | The contents of a jar are only loaded if accessed the first time. | [
"The",
"contents",
"of",
"a",
"jar",
"are",
"only",
"loaded",
"if",
"accessed",
"the",
"first",
"time",
"."
] | 51e20b7d67f51697f947fcab94494c93f6bf1b01 | https://github.com/jhades/jhades/blob/51e20b7d67f51697f947fcab94494c93f6bf1b01/jhades/src/main/java/org/jhades/model/ClasspathEntry.java#L94-L122 |
137,121 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/dom/CSSStyleSheetListImpl.java | CSSStyleSheetListImpl.merge | public CSSStyleSheetImpl merge() {
final CSSStyleSheetImpl merged = new CSSStyleSheetImpl();
final CSSRuleListImpl cssRuleList = new CSSRuleListImpl();
final Iterator<CSSStyleSheetImpl> it = getCSSStyleSheets().iterator();
while (it.hasNext()) {
final CSSStyleSheetImpl cssStyleSheet = it.next();
final CSSMediaRuleImpl cssMediaRule = new CSSMediaRuleImpl(merged, null, cssStyleSheet.getMedia());
cssMediaRule.setRuleList(cssStyleSheet.getCssRules());
cssRuleList.add(cssMediaRule);
}
merged.setCssRules(cssRuleList);
merged.setMediaText("all");
return merged;
} | java | public CSSStyleSheetImpl merge() {
final CSSStyleSheetImpl merged = new CSSStyleSheetImpl();
final CSSRuleListImpl cssRuleList = new CSSRuleListImpl();
final Iterator<CSSStyleSheetImpl> it = getCSSStyleSheets().iterator();
while (it.hasNext()) {
final CSSStyleSheetImpl cssStyleSheet = it.next();
final CSSMediaRuleImpl cssMediaRule = new CSSMediaRuleImpl(merged, null, cssStyleSheet.getMedia());
cssMediaRule.setRuleList(cssStyleSheet.getCssRules());
cssRuleList.add(cssMediaRule);
}
merged.setCssRules(cssRuleList);
merged.setMediaText("all");
return merged;
} | [
"public",
"CSSStyleSheetImpl",
"merge",
"(",
")",
"{",
"final",
"CSSStyleSheetImpl",
"merged",
"=",
"new",
"CSSStyleSheetImpl",
"(",
")",
";",
"final",
"CSSRuleListImpl",
"cssRuleList",
"=",
"new",
"CSSRuleListImpl",
"(",
")",
";",
"final",
"Iterator",
"<",
"CSS... | Merges all StyleSheets in this list into one.
@return the new (merged) StyleSheet | [
"Merges",
"all",
"StyleSheets",
"in",
"this",
"list",
"into",
"one",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/dom/CSSStyleSheetListImpl.java#L63-L76 |
137,122 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/dom/CSSStyleSheetImpl.java | CSSStyleSheetImpl.insertRule | public void insertRule(final String rule, final int index) throws DOMException {
try {
final CSSOMParser parser = new CSSOMParser();
parser.setParentStyleSheet(this);
parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE);
final AbstractCSSRuleImpl r = parser.parseRule(rule);
if (r == null) {
// this should neven happen because of the ThrowCssExceptionErrorHandler
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
"Parsing rule '" + rule + "' failed.");
}
if (getCssRules().getLength() > 0) {
// We need to check that this type of rule can legally go into
// the requested position.
int msg = -1;
if (r instanceof CSSCharsetRuleImpl) {
// Index must be 0, and there can be only one charset rule
if (index != 0) {
msg = DOMExceptionImpl.CHARSET_NOT_FIRST;
}
else if (getCssRules().getRules().get(0) instanceof CSSCharsetRuleImpl) {
msg = DOMExceptionImpl.CHARSET_NOT_UNIQUE;
}
}
else if (r instanceof CSSImportRuleImpl) {
// Import rules must preceed all other rules (except
// charset rules)
if (index <= getCssRules().getLength()) {
for (int i = 0; i < index; i++) {
final AbstractCSSRuleImpl ri = getCssRules().getRules().get(i);
if (!(ri instanceof CSSCharsetRuleImpl) && !(ri instanceof CSSImportRuleImpl)) {
msg = DOMExceptionImpl.IMPORT_NOT_FIRST;
break;
}
}
}
}
else {
if (index <= getCssRules().getLength()) {
for (int i = index; i < getCssRules().getLength(); i++) {
final AbstractCSSRuleImpl ri = getCssRules().getRules().get(i);
if ((ri instanceof CSSCharsetRuleImpl) || (ri instanceof CSSImportRuleImpl)) {
msg = DOMExceptionImpl.INSERT_BEFORE_IMPORT;
break;
}
}
}
}
if (msg > -1) {
throw new DOMExceptionImpl(DOMException.HIERARCHY_REQUEST_ERR, msg);
}
}
// Insert the rule into the list of rules
getCssRules().insert(r, index);
}
catch (final IndexOutOfBoundsException e) {
throw new DOMExceptionImpl(
DOMException.INDEX_SIZE_ERR,
DOMExceptionImpl.INDEX_OUT_OF_BOUNDS,
e.getMessage());
}
catch (final CSSException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
catch (final IOException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
} | java | public void insertRule(final String rule, final int index) throws DOMException {
try {
final CSSOMParser parser = new CSSOMParser();
parser.setParentStyleSheet(this);
parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE);
final AbstractCSSRuleImpl r = parser.parseRule(rule);
if (r == null) {
// this should neven happen because of the ThrowCssExceptionErrorHandler
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
"Parsing rule '" + rule + "' failed.");
}
if (getCssRules().getLength() > 0) {
// We need to check that this type of rule can legally go into
// the requested position.
int msg = -1;
if (r instanceof CSSCharsetRuleImpl) {
// Index must be 0, and there can be only one charset rule
if (index != 0) {
msg = DOMExceptionImpl.CHARSET_NOT_FIRST;
}
else if (getCssRules().getRules().get(0) instanceof CSSCharsetRuleImpl) {
msg = DOMExceptionImpl.CHARSET_NOT_UNIQUE;
}
}
else if (r instanceof CSSImportRuleImpl) {
// Import rules must preceed all other rules (except
// charset rules)
if (index <= getCssRules().getLength()) {
for (int i = 0; i < index; i++) {
final AbstractCSSRuleImpl ri = getCssRules().getRules().get(i);
if (!(ri instanceof CSSCharsetRuleImpl) && !(ri instanceof CSSImportRuleImpl)) {
msg = DOMExceptionImpl.IMPORT_NOT_FIRST;
break;
}
}
}
}
else {
if (index <= getCssRules().getLength()) {
for (int i = index; i < getCssRules().getLength(); i++) {
final AbstractCSSRuleImpl ri = getCssRules().getRules().get(i);
if ((ri instanceof CSSCharsetRuleImpl) || (ri instanceof CSSImportRuleImpl)) {
msg = DOMExceptionImpl.INSERT_BEFORE_IMPORT;
break;
}
}
}
}
if (msg > -1) {
throw new DOMExceptionImpl(DOMException.HIERARCHY_REQUEST_ERR, msg);
}
}
// Insert the rule into the list of rules
getCssRules().insert(r, index);
}
catch (final IndexOutOfBoundsException e) {
throw new DOMExceptionImpl(
DOMException.INDEX_SIZE_ERR,
DOMExceptionImpl.INDEX_OUT_OF_BOUNDS,
e.getMessage());
}
catch (final CSSException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
catch (final IOException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
} | [
"public",
"void",
"insertRule",
"(",
"final",
"String",
"rule",
",",
"final",
"int",
"index",
")",
"throws",
"DOMException",
"{",
"try",
"{",
"final",
"CSSOMParser",
"parser",
"=",
"new",
"CSSOMParser",
"(",
")",
";",
"parser",
".",
"setParentStyleSheet",
"(... | inserts a new rule.
@param rule the rule to insert
@param index the insert pos
@throws DOMException in case of error | [
"inserts",
"a",
"new",
"rule",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/dom/CSSStyleSheetImpl.java#L131-L211 |
137,123 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/dom/CSSStyleSheetImpl.java | CSSStyleSheetImpl.deleteRule | public void deleteRule(final int index) throws DOMException {
try {
getCssRules().delete(index);
}
catch (final IndexOutOfBoundsException e) {
throw new DOMExceptionImpl(
DOMException.INDEX_SIZE_ERR,
DOMExceptionImpl.INDEX_OUT_OF_BOUNDS,
e.getMessage());
}
} | java | public void deleteRule(final int index) throws DOMException {
try {
getCssRules().delete(index);
}
catch (final IndexOutOfBoundsException e) {
throw new DOMExceptionImpl(
DOMException.INDEX_SIZE_ERR,
DOMExceptionImpl.INDEX_OUT_OF_BOUNDS,
e.getMessage());
}
} | [
"public",
"void",
"deleteRule",
"(",
"final",
"int",
"index",
")",
"throws",
"DOMException",
"{",
"try",
"{",
"getCssRules",
"(",
")",
".",
"delete",
"(",
"index",
")",
";",
"}",
"catch",
"(",
"final",
"IndexOutOfBoundsException",
"e",
")",
"{",
"throw",
... | delete the rule at the given pos.
@param index the pos
@throws DOMException in case of error | [
"delete",
"the",
"rule",
"at",
"the",
"given",
"pos",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/dom/CSSStyleSheetImpl.java#L219-L229 |
137,124 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/dom/CSSStyleSheetImpl.java | CSSStyleSheetImpl.setMediaText | public void setMediaText(final String mediaText) {
try {
final CSSOMParser parser = new CSSOMParser();
final MediaQueryList sml = parser.parseMedia(mediaText);
media_ = new MediaListImpl(sml);
}
catch (final IOException e) {
// TODO handle exception
}
} | java | public void setMediaText(final String mediaText) {
try {
final CSSOMParser parser = new CSSOMParser();
final MediaQueryList sml = parser.parseMedia(mediaText);
media_ = new MediaListImpl(sml);
}
catch (final IOException e) {
// TODO handle exception
}
} | [
"public",
"void",
"setMediaText",
"(",
"final",
"String",
"mediaText",
")",
"{",
"try",
"{",
"final",
"CSSOMParser",
"parser",
"=",
"new",
"CSSOMParser",
"(",
")",
";",
"final",
"MediaQueryList",
"sml",
"=",
"parser",
".",
"parseMedia",
"(",
"mediaText",
")"... | Set the media text.
@param mediaText the new media text | [
"Set",
"the",
"media",
"text",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/dom/CSSStyleSheetImpl.java#L259-L268 |
137,125 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java | AbstractCSSParser.createLocator | protected Locator createLocator(final Token t) {
return new Locator(getInputSource().getURI(),
t == null ? 0 : t.beginLine,
t == null ? 0 : t.beginColumn);
} | java | protected Locator createLocator(final Token t) {
return new Locator(getInputSource().getURI(),
t == null ? 0 : t.beginLine,
t == null ? 0 : t.beginColumn);
} | [
"protected",
"Locator",
"createLocator",
"(",
"final",
"Token",
"t",
")",
"{",
"return",
"new",
"Locator",
"(",
"getInputSource",
"(",
")",
".",
"getURI",
"(",
")",
",",
"t",
"==",
"null",
"?",
"0",
":",
"t",
".",
"beginLine",
",",
"t",
"==",
"null",... | Returns a new locator for the given token.
@param t the token to generate the locator for
@return a new locator | [
"Returns",
"a",
"new",
"locator",
"for",
"the",
"given",
"token",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java#L155-L159 |
137,126 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java | AbstractCSSParser.addEscapes | protected String addEscapes(final String str) {
final StringBuilder sb = new StringBuilder();
char ch;
for (int i = 0; i < str.length(); i++) {
ch = str.charAt(i);
switch (ch) {
case 0 :
continue;
case '\b':
sb.append("\\b");
continue;
case '\t':
sb.append("\\t");
continue;
case '\n':
sb.append("\\n");
continue;
case '\f':
sb.append("\\f");
continue;
case '\r':
sb.append("\\r");
continue;
case '\"':
sb.append("\\\"");
continue;
case '\'':
sb.append("\\\'");
continue;
case '\\':
sb.append("\\\\");
continue;
default:
if (ch < 0x20 || ch > 0x7e) {
final String s = "0000" + Integer.toString(ch, 16);
sb.append("\\u" + s.substring(s.length() - 4, s.length()));
}
else {
sb.append(ch);
}
continue;
}
}
return sb.toString();
} | java | protected String addEscapes(final String str) {
final StringBuilder sb = new StringBuilder();
char ch;
for (int i = 0; i < str.length(); i++) {
ch = str.charAt(i);
switch (ch) {
case 0 :
continue;
case '\b':
sb.append("\\b");
continue;
case '\t':
sb.append("\\t");
continue;
case '\n':
sb.append("\\n");
continue;
case '\f':
sb.append("\\f");
continue;
case '\r':
sb.append("\\r");
continue;
case '\"':
sb.append("\\\"");
continue;
case '\'':
sb.append("\\\'");
continue;
case '\\':
sb.append("\\\\");
continue;
default:
if (ch < 0x20 || ch > 0x7e) {
final String s = "0000" + Integer.toString(ch, 16);
sb.append("\\u" + s.substring(s.length() - 4, s.length()));
}
else {
sb.append(ch);
}
continue;
}
}
return sb.toString();
} | [
"protected",
"String",
"addEscapes",
"(",
"final",
"String",
"str",
")",
"{",
"final",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"char",
"ch",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"str",
".",
"length",
"(",
... | Escapes some chars in the given string.
@param str the input
@return a new string with the escaped values | [
"Escapes",
"some",
"chars",
"in",
"the",
"given",
"string",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java#L166-L210 |
137,127 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java | AbstractCSSParser.parseMedia | public MediaQueryList parseMedia(final InputSource source) throws IOException {
source_ = source;
ReInit(getCharStream(source));
final MediaQueryList ml = new MediaQueryList();
try {
mediaList(ml);
}
catch (final ParseException e) {
getErrorHandler().error(toCSSParseException("invalidMediaList", e));
}
catch (final TokenMgrError e) {
getErrorHandler().error(toCSSParseException(e));
}
catch (final CSSParseException e) {
getErrorHandler().error(e);
}
return ml;
} | java | public MediaQueryList parseMedia(final InputSource source) throws IOException {
source_ = source;
ReInit(getCharStream(source));
final MediaQueryList ml = new MediaQueryList();
try {
mediaList(ml);
}
catch (final ParseException e) {
getErrorHandler().error(toCSSParseException("invalidMediaList", e));
}
catch (final TokenMgrError e) {
getErrorHandler().error(toCSSParseException(e));
}
catch (final CSSParseException e) {
getErrorHandler().error(e);
}
return ml;
} | [
"public",
"MediaQueryList",
"parseMedia",
"(",
"final",
"InputSource",
"source",
")",
"throws",
"IOException",
"{",
"source_",
"=",
"source",
";",
"ReInit",
"(",
"getCharStream",
"(",
"source",
")",
")",
";",
"final",
"MediaQueryList",
"ml",
"=",
"new",
"Media... | Parse the given input source and return the media list.
@param source the input source
@return new media list
@throws IOException in case of errors | [
"Parse",
"the",
"given",
"input",
"source",
"and",
"return",
"the",
"media",
"list",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java#L421-L438 |
137,128 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java | AbstractCSSParser.handleImportStyle | protected void handleImportStyle(final String uri, final MediaQueryList media,
final String defaultNamespaceURI, final Locator locator) {
getDocumentHandler().importStyle(uri, media, defaultNamespaceURI, locator);
} | java | protected void handleImportStyle(final String uri, final MediaQueryList media,
final String defaultNamespaceURI, final Locator locator) {
getDocumentHandler().importStyle(uri, media, defaultNamespaceURI, locator);
} | [
"protected",
"void",
"handleImportStyle",
"(",
"final",
"String",
"uri",
",",
"final",
"MediaQueryList",
"media",
",",
"final",
"String",
"defaultNamespaceURI",
",",
"final",
"Locator",
"locator",
")",
"{",
"getDocumentHandler",
"(",
")",
".",
"importStyle",
"(",
... | import style handler.
@param uri the uri
@param media the media query list
@param defaultNamespaceURI the namespace uri
@param locator the locator | [
"import",
"style",
"handler",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java#L556-L559 |
137,129 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java | AbstractCSSParser.handleStartPage | protected void handleStartPage(final String name, final String pseudoPage, final Locator locator) {
getDocumentHandler().startPage(name, pseudoPage, locator);
} | java | protected void handleStartPage(final String name, final String pseudoPage, final Locator locator) {
getDocumentHandler().startPage(name, pseudoPage, locator);
} | [
"protected",
"void",
"handleStartPage",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"pseudoPage",
",",
"final",
"Locator",
"locator",
")",
"{",
"getDocumentHandler",
"(",
")",
".",
"startPage",
"(",
"name",
",",
"pseudoPage",
",",
"locator",
")",
... | start page handler.
@param name the name
@param pseudoPage the pseudo page
@param locator the locator | [
"start",
"page",
"handler",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java#L597-L599 |
137,130 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java | AbstractCSSParser.handleProperty | protected void handleProperty(final String name, final LexicalUnit value,
final boolean important, final Locator locator) {
getDocumentHandler().property(name, value, important, locator);
} | java | protected void handleProperty(final String name, final LexicalUnit value,
final boolean important, final Locator locator) {
getDocumentHandler().property(name, value, important, locator);
} | [
"protected",
"void",
"handleProperty",
"(",
"final",
"String",
"name",
",",
"final",
"LexicalUnit",
"value",
",",
"final",
"boolean",
"important",
",",
"final",
"Locator",
"locator",
")",
"{",
"getDocumentHandler",
"(",
")",
".",
"property",
"(",
"name",
",",
... | property handler.
@param name the name
@param value the value
@param important important flag
@param locator the locator | [
"property",
"handler",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java#L654-L657 |
137,131 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java | AbstractCSSParser.functionInternal | protected LexicalUnit functionInternal(final LexicalUnit prev, final String funct,
final LexicalUnit params) {
if ("counter(".equalsIgnoreCase(funct)) {
return LexicalUnitImpl.createCounter(prev, params);
}
else if ("counters(".equalsIgnoreCase(funct)) {
return LexicalUnitImpl.createCounters(prev, params);
}
else if ("attr(".equalsIgnoreCase(funct)) {
return LexicalUnitImpl.createAttr(prev, params.getStringValue());
}
else if ("rect(".equalsIgnoreCase(funct)) {
return LexicalUnitImpl.createRect(prev, params);
}
else if ("rgb(".equalsIgnoreCase(funct)) {
return LexicalUnitImpl.createRgbColor(prev, params);
}
return LexicalUnitImpl.createFunction(
prev,
funct.substring(0, funct.length() - 1),
params);
} | java | protected LexicalUnit functionInternal(final LexicalUnit prev, final String funct,
final LexicalUnit params) {
if ("counter(".equalsIgnoreCase(funct)) {
return LexicalUnitImpl.createCounter(prev, params);
}
else if ("counters(".equalsIgnoreCase(funct)) {
return LexicalUnitImpl.createCounters(prev, params);
}
else if ("attr(".equalsIgnoreCase(funct)) {
return LexicalUnitImpl.createAttr(prev, params.getStringValue());
}
else if ("rect(".equalsIgnoreCase(funct)) {
return LexicalUnitImpl.createRect(prev, params);
}
else if ("rgb(".equalsIgnoreCase(funct)) {
return LexicalUnitImpl.createRgbColor(prev, params);
}
return LexicalUnitImpl.createFunction(
prev,
funct.substring(0, funct.length() - 1),
params);
} | [
"protected",
"LexicalUnit",
"functionInternal",
"(",
"final",
"LexicalUnit",
"prev",
",",
"final",
"String",
"funct",
",",
"final",
"LexicalUnit",
"params",
")",
"{",
"if",
"(",
"\"counter(\"",
".",
"equalsIgnoreCase",
"(",
"funct",
")",
")",
"{",
"return",
"L... | Process a function decl.
@param prev the previous lexical unit
@param funct the function
@param params the params
@return a lexical unit | [
"Process",
"a",
"function",
"decl",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java#L667-L689 |
137,132 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java | AbstractCSSParser.hexcolorInternal | protected LexicalUnit hexcolorInternal(final LexicalUnit prev, final Token t) {
// Step past the hash at the beginning
final int i = 1;
int r = 0;
int g = 0;
int b = 0;
final int len = t.image.length() - 1;
try {
if (len == 3) {
r = Integer.parseInt(t.image.substring(i + 0, i + 1), 16);
g = Integer.parseInt(t.image.substring(i + 1, i + 2), 16);
b = Integer.parseInt(t.image.substring(i + 2, i + 3), 16);
r = (r << 4) | r;
g = (g << 4) | g;
b = (b << 4) | b;
}
else if (len == 6) {
r = Integer.parseInt(t.image.substring(i + 0, i + 2), 16);
g = Integer.parseInt(t.image.substring(i + 2, i + 4), 16);
b = Integer.parseInt(t.image.substring(i + 4, i + 6), 16);
}
else {
final String pattern = getParserMessage("invalidColor");
throw new CSSParseException(MessageFormat.format(
pattern, new Object[] {t}),
getInputSource().getURI(), t.beginLine,
t.beginColumn);
}
// Turn into an "rgb()"
final LexicalUnit lr = LexicalUnitImpl.createNumber(null, r);
final LexicalUnit lc1 = LexicalUnitImpl.createComma(lr);
final LexicalUnit lg = LexicalUnitImpl.createNumber(lc1, g);
final LexicalUnit lc2 = LexicalUnitImpl.createComma(lg);
LexicalUnitImpl.createNumber(lc2, b);
return LexicalUnitImpl.createRgbColor(prev, lr);
}
catch (final NumberFormatException ex) {
final String pattern = getParserMessage("invalidColor");
throw new CSSParseException(MessageFormat.format(
pattern, new Object[] {t}),
getInputSource().getURI(), t.beginLine,
t.beginColumn, ex);
}
} | java | protected LexicalUnit hexcolorInternal(final LexicalUnit prev, final Token t) {
// Step past the hash at the beginning
final int i = 1;
int r = 0;
int g = 0;
int b = 0;
final int len = t.image.length() - 1;
try {
if (len == 3) {
r = Integer.parseInt(t.image.substring(i + 0, i + 1), 16);
g = Integer.parseInt(t.image.substring(i + 1, i + 2), 16);
b = Integer.parseInt(t.image.substring(i + 2, i + 3), 16);
r = (r << 4) | r;
g = (g << 4) | g;
b = (b << 4) | b;
}
else if (len == 6) {
r = Integer.parseInt(t.image.substring(i + 0, i + 2), 16);
g = Integer.parseInt(t.image.substring(i + 2, i + 4), 16);
b = Integer.parseInt(t.image.substring(i + 4, i + 6), 16);
}
else {
final String pattern = getParserMessage("invalidColor");
throw new CSSParseException(MessageFormat.format(
pattern, new Object[] {t}),
getInputSource().getURI(), t.beginLine,
t.beginColumn);
}
// Turn into an "rgb()"
final LexicalUnit lr = LexicalUnitImpl.createNumber(null, r);
final LexicalUnit lc1 = LexicalUnitImpl.createComma(lr);
final LexicalUnit lg = LexicalUnitImpl.createNumber(lc1, g);
final LexicalUnit lc2 = LexicalUnitImpl.createComma(lg);
LexicalUnitImpl.createNumber(lc2, b);
return LexicalUnitImpl.createRgbColor(prev, lr);
}
catch (final NumberFormatException ex) {
final String pattern = getParserMessage("invalidColor");
throw new CSSParseException(MessageFormat.format(
pattern, new Object[] {t}),
getInputSource().getURI(), t.beginLine,
t.beginColumn, ex);
}
} | [
"protected",
"LexicalUnit",
"hexcolorInternal",
"(",
"final",
"LexicalUnit",
"prev",
",",
"final",
"Token",
"t",
")",
"{",
"// Step past the hash at the beginning",
"final",
"int",
"i",
"=",
"1",
";",
"int",
"r",
"=",
"0",
";",
"int",
"g",
"=",
"0",
";",
"... | Processes a hexadecimal color definition.
@param prev the previous lexical unit
@param t the token
@return a new lexical unit | [
"Processes",
"a",
"hexadecimal",
"color",
"definition",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java#L698-L743 |
137,133 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java | AbstractCSSParser.intValue | protected int intValue(final char op, final String s) {
final int result = Integer.parseInt(s);
if (op == '-') {
return -1 * result;
}
return result;
} | java | protected int intValue(final char op, final String s) {
final int result = Integer.parseInt(s);
if (op == '-') {
return -1 * result;
}
return result;
} | [
"protected",
"int",
"intValue",
"(",
"final",
"char",
"op",
",",
"final",
"String",
"s",
")",
"{",
"final",
"int",
"result",
"=",
"Integer",
".",
"parseInt",
"(",
"s",
")",
";",
"if",
"(",
"op",
"==",
"'",
"'",
")",
"{",
"return",
"-",
"1",
"*",
... | Parses the sting into an integer.
@param op the sign char
@param s the string to parse
@return the int value | [
"Parses",
"the",
"sting",
"into",
"an",
"integer",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java#L752-L758 |
137,134 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java | AbstractCSSParser.doubleValue | protected double doubleValue(final char op, final String s) {
final double result = Double.parseDouble(s);
if (op == '-') {
return -1 * result;
}
return result;
} | java | protected double doubleValue(final char op, final String s) {
final double result = Double.parseDouble(s);
if (op == '-') {
return -1 * result;
}
return result;
} | [
"protected",
"double",
"doubleValue",
"(",
"final",
"char",
"op",
",",
"final",
"String",
"s",
")",
"{",
"final",
"double",
"result",
"=",
"Double",
".",
"parseDouble",
"(",
"s",
")",
";",
"if",
"(",
"op",
"==",
"'",
"'",
")",
"{",
"return",
"-",
"... | Parses the sting into an double.
@param op the sign char
@param s the string to parse
@return the double value | [
"Parses",
"the",
"sting",
"into",
"an",
"double",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java#L767-L773 |
137,135 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java | AbstractCSSParser.getLastNumPos | protected int getLastNumPos(final String s) {
int i = 0;
for ( ; i < s.length(); i++) {
if (NUM_CHARS.indexOf(s.charAt(i)) < 0) {
break;
}
}
return i - 1;
} | java | protected int getLastNumPos(final String s) {
int i = 0;
for ( ; i < s.length(); i++) {
if (NUM_CHARS.indexOf(s.charAt(i)) < 0) {
break;
}
}
return i - 1;
} | [
"protected",
"int",
"getLastNumPos",
"(",
"final",
"String",
"s",
")",
"{",
"int",
"i",
"=",
"0",
";",
"for",
"(",
";",
"i",
"<",
"s",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"if",
"(",
"NUM_CHARS",
".",
"indexOf",
"(",
"s",
".",
"... | Returns the pos of the last numeric char in the given string.
@param s the string to parse
@return the pos | [
"Returns",
"the",
"pos",
"of",
"the",
"last",
"numeric",
"char",
"in",
"the",
"given",
"string",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/AbstractCSSParser.java#L781-L789 |
137,136 | jhades/jhades | jhades/src/main/java/org/jhades/model/ClasspathResources.java | ClasspathResources.sortByNumberOfVersionsDesc | public static void sortByNumberOfVersionsDesc(List<ClasspathResource> resources) {
// sort by number of version occurrences
Comparator<ClasspathResource> sortByNumberOfVersionsDesc = new Comparator<ClasspathResource>() {
@Override
public int compare(ClasspathResource resource1, ClasspathResource resource2) {
return -1 * new Integer(resource1.getResourceFileVersions().size()).compareTo(resource2.getResourceFileVersions().size());
}
};
Collections.sort(resources, sortByNumberOfVersionsDesc);
} | java | public static void sortByNumberOfVersionsDesc(List<ClasspathResource> resources) {
// sort by number of version occurrences
Comparator<ClasspathResource> sortByNumberOfVersionsDesc = new Comparator<ClasspathResource>() {
@Override
public int compare(ClasspathResource resource1, ClasspathResource resource2) {
return -1 * new Integer(resource1.getResourceFileVersions().size()).compareTo(resource2.getResourceFileVersions().size());
}
};
Collections.sort(resources, sortByNumberOfVersionsDesc);
} | [
"public",
"static",
"void",
"sortByNumberOfVersionsDesc",
"(",
"List",
"<",
"ClasspathResource",
">",
"resources",
")",
"{",
"// sort by number of version occurrences",
"Comparator",
"<",
"ClasspathResource",
">",
"sortByNumberOfVersionsDesc",
"=",
"new",
"Comparator",
"<",... | Takes a list of classpath resources and sorts them by the number of classpath versions.
The resources with the biggest number of versions will be first on the list.
@param resources to be sorted | [
"Takes",
"a",
"list",
"of",
"classpath",
"resources",
"and",
"sorts",
"them",
"by",
"the",
"number",
"of",
"classpath",
"versions",
"."
] | 51e20b7d67f51697f947fcab94494c93f6bf1b01 | https://github.com/jhades/jhades/blob/51e20b7d67f51697f947fcab94494c93f6bf1b01/jhades/src/main/java/org/jhades/model/ClasspathResources.java#L53-L62 |
137,137 | jhades/jhades | jhades/src/main/java/org/jhades/model/ClasspathResources.java | ClasspathResources.findResourcesWithDuplicates | public static List<ClasspathResource> findResourcesWithDuplicates(List<ClasspathResource> resourceFiles, boolean excludeSameSizeDups) {
List<ClasspathResource> resourcesWithDuplicates = new ArrayList<>();
// keep only entries with duplicates
for (ClasspathResource resource : resourceFiles) {
if (resource.hasDuplicates(excludeSameSizeDups)) {
resourcesWithDuplicates.add(resource);
}
}
return resourcesWithDuplicates;
} | java | public static List<ClasspathResource> findResourcesWithDuplicates(List<ClasspathResource> resourceFiles, boolean excludeSameSizeDups) {
List<ClasspathResource> resourcesWithDuplicates = new ArrayList<>();
// keep only entries with duplicates
for (ClasspathResource resource : resourceFiles) {
if (resource.hasDuplicates(excludeSameSizeDups)) {
resourcesWithDuplicates.add(resource);
}
}
return resourcesWithDuplicates;
} | [
"public",
"static",
"List",
"<",
"ClasspathResource",
">",
"findResourcesWithDuplicates",
"(",
"List",
"<",
"ClasspathResource",
">",
"resourceFiles",
",",
"boolean",
"excludeSameSizeDups",
")",
"{",
"List",
"<",
"ClasspathResource",
">",
"resourcesWithDuplicates",
"=",... | Inspects a given list of classpath resources, and returns only the resources that contain multiple versions.
@param resourceFiles - the resource files to be inspected
@param excludeSameSizeDups - true to consider only as duplicates files with multiple versions with different file
sizes
@return - the list of resources with duplicates | [
"Inspects",
"a",
"given",
"list",
"of",
"classpath",
"resources",
"and",
"returns",
"only",
"the",
"resources",
"that",
"contain",
"multiple",
"versions",
"."
] | 51e20b7d67f51697f947fcab94494c93f6bf1b01 | https://github.com/jhades/jhades/blob/51e20b7d67f51697f947fcab94494c93f6bf1b01/jhades/src/main/java/org/jhades/model/ClasspathResources.java#L72-L83 |
137,138 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/dom/MediaListImpl.java | MediaListImpl.setMediaText | public void setMediaText(final String mediaText) throws DOMException {
try {
final CSSOMParser parser = new CSSOMParser();
parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE);
final MediaQueryList sml = parser.parseMedia(mediaText);
setMediaList(sml);
}
catch (final CSSParseException e) {
throw new DOMException(DOMException.SYNTAX_ERR, e.getLocalizedMessage());
}
catch (final IOException e) {
throw new DOMException(DOMException.NOT_FOUND_ERR, e.getLocalizedMessage());
}
} | java | public void setMediaText(final String mediaText) throws DOMException {
try {
final CSSOMParser parser = new CSSOMParser();
parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE);
final MediaQueryList sml = parser.parseMedia(mediaText);
setMediaList(sml);
}
catch (final CSSParseException e) {
throw new DOMException(DOMException.SYNTAX_ERR, e.getLocalizedMessage());
}
catch (final IOException e) {
throw new DOMException(DOMException.NOT_FOUND_ERR, e.getLocalizedMessage());
}
} | [
"public",
"void",
"setMediaText",
"(",
"final",
"String",
"mediaText",
")",
"throws",
"DOMException",
"{",
"try",
"{",
"final",
"CSSOMParser",
"parser",
"=",
"new",
"CSSOMParser",
"(",
")",
";",
"parser",
".",
"setErrorHandler",
"(",
"ThrowCssExceptionErrorHandler... | Parses the given media text.
@param mediaText text to be parsed
@throws DOMException in case of error | [
"Parses",
"the",
"given",
"media",
"text",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/dom/MediaListImpl.java#L77-L90 |
137,139 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/dom/MediaListImpl.java | MediaListImpl.setMedia | public void setMedia(final List<String> media) {
mediaQueries_.clear();
for (String medium : media) {
mediaQueries_.add(new MediaQuery(medium));
}
} | java | public void setMedia(final List<String> media) {
mediaQueries_.clear();
for (String medium : media) {
mediaQueries_.add(new MediaQuery(medium));
}
} | [
"public",
"void",
"setMedia",
"(",
"final",
"List",
"<",
"String",
">",
"media",
")",
"{",
"mediaQueries_",
".",
"clear",
"(",
")",
";",
"for",
"(",
"String",
"medium",
":",
"media",
")",
"{",
"mediaQueries_",
".",
"add",
"(",
"new",
"MediaQuery",
"(",... | Resets the list of media queries.
@param media the media queries string to be parsed | [
"Resets",
"the",
"list",
"of",
"media",
"queries",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/dom/MediaListImpl.java#L119-L124 |
137,140 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java | CSSOMParser.parseStyleSheet | public CSSStyleSheetImpl parseStyleSheet(final InputSource source, final String href) throws IOException {
final CSSOMHandler handler = new CSSOMHandler();
handler.setHref(href);
parser_.setDocumentHandler(handler);
parser_.parseStyleSheet(source);
final Object o = handler.getRoot();
if (o instanceof CSSStyleSheetImpl) {
return (CSSStyleSheetImpl) o;
}
return null;
} | java | public CSSStyleSheetImpl parseStyleSheet(final InputSource source, final String href) throws IOException {
final CSSOMHandler handler = new CSSOMHandler();
handler.setHref(href);
parser_.setDocumentHandler(handler);
parser_.parseStyleSheet(source);
final Object o = handler.getRoot();
if (o instanceof CSSStyleSheetImpl) {
return (CSSStyleSheetImpl) o;
}
return null;
} | [
"public",
"CSSStyleSheetImpl",
"parseStyleSheet",
"(",
"final",
"InputSource",
"source",
",",
"final",
"String",
"href",
")",
"throws",
"IOException",
"{",
"final",
"CSSOMHandler",
"handler",
"=",
"new",
"CSSOMHandler",
"(",
")",
";",
"handler",
".",
"setHref",
... | Parses a SAC input source into a CSSOM style sheet.
@param source the SAC input source
@param href the href
@return the CSSOM style sheet
@throws IOException if the underlying SAC parser throws an IOException | [
"Parses",
"a",
"SAC",
"input",
"source",
"into",
"a",
"CSSOM",
"style",
"sheet",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java#L79-L89 |
137,141 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java | CSSOMParser.parsePropertyValue | public CSSValueImpl parsePropertyValue(final String propertyValue) throws IOException {
try (InputSource source = new InputSource(new StringReader(propertyValue))) {
final CSSOMHandler handler = new CSSOMHandler();
parser_.setDocumentHandler(handler);
final LexicalUnit lu = parser_.parsePropertyValue(source);
if (null == lu) {
return null;
}
return new CSSValueImpl(lu);
}
} | java | public CSSValueImpl parsePropertyValue(final String propertyValue) throws IOException {
try (InputSource source = new InputSource(new StringReader(propertyValue))) {
final CSSOMHandler handler = new CSSOMHandler();
parser_.setDocumentHandler(handler);
final LexicalUnit lu = parser_.parsePropertyValue(source);
if (null == lu) {
return null;
}
return new CSSValueImpl(lu);
}
} | [
"public",
"CSSValueImpl",
"parsePropertyValue",
"(",
"final",
"String",
"propertyValue",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputSource",
"source",
"=",
"new",
"InputSource",
"(",
"new",
"StringReader",
"(",
"propertyValue",
")",
")",
")",
"{",
"fin... | Parses a input string into a CSSValue.
@param propertyValue the input string
@return the css value
@throws IOException if the underlying SAC parser throws an IOException | [
"Parses",
"a",
"input",
"string",
"into",
"a",
"CSSValue",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java#L128-L138 |
137,142 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java | CSSOMParser.parseRule | public AbstractCSSRuleImpl parseRule(final String rule) throws IOException {
try (InputSource source = new InputSource(new StringReader(rule))) {
final CSSOMHandler handler = new CSSOMHandler();
parser_.setDocumentHandler(handler);
parser_.parseRule(source);
return (AbstractCSSRuleImpl) handler.getRoot();
}
} | java | public AbstractCSSRuleImpl parseRule(final String rule) throws IOException {
try (InputSource source = new InputSource(new StringReader(rule))) {
final CSSOMHandler handler = new CSSOMHandler();
parser_.setDocumentHandler(handler);
parser_.parseRule(source);
return (AbstractCSSRuleImpl) handler.getRoot();
}
} | [
"public",
"AbstractCSSRuleImpl",
"parseRule",
"(",
"final",
"String",
"rule",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputSource",
"source",
"=",
"new",
"InputSource",
"(",
"new",
"StringReader",
"(",
"rule",
")",
")",
")",
"{",
"final",
"CSSOMHandler... | Parses a string into a CSSRule.
@param rule the input string
@return the css rule
@throws IOException if the underlying SAC parser throws an IOException | [
"Parses",
"a",
"string",
"into",
"a",
"CSSRule",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java#L147-L154 |
137,143 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java | CSSOMParser.parseSelectors | public SelectorList parseSelectors(final String selectors) throws IOException {
try (InputSource source = new InputSource(new StringReader(selectors))) {
final HandlerBase handler = new HandlerBase();
parser_.setDocumentHandler(handler);
return parser_.parseSelectors(source);
}
} | java | public SelectorList parseSelectors(final String selectors) throws IOException {
try (InputSource source = new InputSource(new StringReader(selectors))) {
final HandlerBase handler = new HandlerBase();
parser_.setDocumentHandler(handler);
return parser_.parseSelectors(source);
}
} | [
"public",
"SelectorList",
"parseSelectors",
"(",
"final",
"String",
"selectors",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputSource",
"source",
"=",
"new",
"InputSource",
"(",
"new",
"StringReader",
"(",
"selectors",
")",
")",
")",
"{",
"final",
"Hand... | Parses a string into a CSSSelectorList.
@param selectors the input string
@return the css selector list
@throws IOException if the underlying SAC parser throws an IOException | [
"Parses",
"a",
"string",
"into",
"a",
"CSSSelectorList",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java#L163-L169 |
137,144 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java | CSSOMParser.parseMedia | public MediaQueryList parseMedia(final String media) throws IOException {
try (InputSource source = new InputSource(new StringReader(media))) {
final HandlerBase handler = new HandlerBase();
parser_.setDocumentHandler(handler);
if (parser_ instanceof AbstractCSSParser) {
return ((AbstractCSSParser) parser_).parseMedia(source);
}
return null;
}
} | java | public MediaQueryList parseMedia(final String media) throws IOException {
try (InputSource source = new InputSource(new StringReader(media))) {
final HandlerBase handler = new HandlerBase();
parser_.setDocumentHandler(handler);
if (parser_ instanceof AbstractCSSParser) {
return ((AbstractCSSParser) parser_).parseMedia(source);
}
return null;
}
} | [
"public",
"MediaQueryList",
"parseMedia",
"(",
"final",
"String",
"media",
")",
"throws",
"IOException",
"{",
"try",
"(",
"InputSource",
"source",
"=",
"new",
"InputSource",
"(",
"new",
"StringReader",
"(",
"media",
")",
")",
")",
"{",
"final",
"HandlerBase",
... | Parses a string into a MediaQueryList.
@param media the input string
@return the css media query list
@throws IOException if the underlying SAC parser throws an IOException | [
"Parses",
"a",
"string",
"into",
"a",
"MediaQueryList",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/CSSOMParser.java#L178-L187 |
137,145 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/dom/CSSStyleDeclarationImpl.java | CSSStyleDeclarationImpl.removeProperty | public String removeProperty(final String propertyName) throws DOMException {
if (null == propertyName) {
return "";
}
for (int i = 0; i < properties_.size(); i++) {
final Property p = properties_.get(i);
if (p != null && propertyName.equalsIgnoreCase(p.getName())) {
properties_.remove(i);
if (p.getValue() == null) {
return "";
}
return p.getValue().toString();
}
}
return "";
} | java | public String removeProperty(final String propertyName) throws DOMException {
if (null == propertyName) {
return "";
}
for (int i = 0; i < properties_.size(); i++) {
final Property p = properties_.get(i);
if (p != null && propertyName.equalsIgnoreCase(p.getName())) {
properties_.remove(i);
if (p.getValue() == null) {
return "";
}
return p.getValue().toString();
}
}
return "";
} | [
"public",
"String",
"removeProperty",
"(",
"final",
"String",
"propertyName",
")",
"throws",
"DOMException",
"{",
"if",
"(",
"null",
"==",
"propertyName",
")",
"{",
"return",
"\"\"",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"properties_... | Remove a property.
@param propertyName the property name
@return the removed property
@throws DOMException in case of error | [
"Remove",
"a",
"property",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/dom/CSSStyleDeclarationImpl.java#L119-L134 |
137,146 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/dom/CSSMediaRuleImpl.java | CSSMediaRuleImpl.insertRule | public void insertRule(final String rule, final int index) throws DOMException {
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
try {
final CSSOMParser parser = new CSSOMParser();
parser.setParentStyleSheet(parentStyleSheet);
parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE);
final AbstractCSSRuleImpl r = parser.parseRule(rule);
// Insert the rule into the list of rules
getCssRules().insert(r, index);
}
catch (final IndexOutOfBoundsException e) {
throw new DOMExceptionImpl(
DOMException.INDEX_SIZE_ERR,
DOMExceptionImpl.INDEX_OUT_OF_BOUNDS,
e.getMessage());
}
catch (final CSSException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
catch (final IOException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
} | java | public void insertRule(final String rule, final int index) throws DOMException {
final CSSStyleSheetImpl parentStyleSheet = getParentStyleSheet();
try {
final CSSOMParser parser = new CSSOMParser();
parser.setParentStyleSheet(parentStyleSheet);
parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE);
final AbstractCSSRuleImpl r = parser.parseRule(rule);
// Insert the rule into the list of rules
getCssRules().insert(r, index);
}
catch (final IndexOutOfBoundsException e) {
throw new DOMExceptionImpl(
DOMException.INDEX_SIZE_ERR,
DOMExceptionImpl.INDEX_OUT_OF_BOUNDS,
e.getMessage());
}
catch (final CSSException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
catch (final IOException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
} | [
"public",
"void",
"insertRule",
"(",
"final",
"String",
"rule",
",",
"final",
"int",
"index",
")",
"throws",
"DOMException",
"{",
"final",
"CSSStyleSheetImpl",
"parentStyleSheet",
"=",
"getParentStyleSheet",
"(",
")",
";",
"try",
"{",
"final",
"CSSOMParser",
"pa... | Insert a new rule at the given index.
@param rule the rule to be inserted
@param index the insert pos
@throws DOMException in case of error | [
"Insert",
"a",
"new",
"rule",
"at",
"the",
"given",
"index",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/dom/CSSMediaRuleImpl.java#L126-L157 |
137,147 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/ParserUtils.java | ParserUtils.trimBy | public static String trimBy(final StringBuilder s, final int left, final int right) {
return s.substring(left, s.length() - right);
} | java | public static String trimBy(final StringBuilder s, final int left, final int right) {
return s.substring(left, s.length() - right);
} | [
"public",
"static",
"String",
"trimBy",
"(",
"final",
"StringBuilder",
"s",
",",
"final",
"int",
"left",
",",
"final",
"int",
"right",
")",
"{",
"return",
"s",
".",
"substring",
"(",
"left",
",",
"s",
".",
"length",
"(",
")",
"-",
"right",
")",
";",
... | Remove the given number of chars from start and end.
There is no parameter checking, the caller has to take care of this.
@param s the StringBuilder
@param left no of chars to be removed from start
@param right no of chars to be removed from end
@return the trimmed string | [
"Remove",
"the",
"given",
"number",
"of",
"chars",
"from",
"start",
"and",
"end",
".",
"There",
"is",
"no",
"parameter",
"checking",
"the",
"caller",
"has",
"to",
"take",
"care",
"of",
"this",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/ParserUtils.java#L36-L38 |
137,148 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/CSSException.java | CSSException.getMessage | @Override
public String getMessage() {
if (message_ != null) {
return message_;
}
if (getCause() != null) {
return getCause().getMessage();
}
switch (code_) {
case UNSPECIFIED_ERR:
return "unknown error";
case NOT_SUPPORTED_ERR:
return "not supported";
case SYNTAX_ERR:
return "syntax error";
default:
return null;
}
} | java | @Override
public String getMessage() {
if (message_ != null) {
return message_;
}
if (getCause() != null) {
return getCause().getMessage();
}
switch (code_) {
case UNSPECIFIED_ERR:
return "unknown error";
case NOT_SUPPORTED_ERR:
return "not supported";
case SYNTAX_ERR:
return "syntax error";
default:
return null;
}
} | [
"@",
"Override",
"public",
"String",
"getMessage",
"(",
")",
"{",
"if",
"(",
"message_",
"!=",
"null",
")",
"{",
"return",
"message_",
";",
"}",
"if",
"(",
"getCause",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"getCause",
"(",
")",
".",
"getMessage... | Returns the detail message of this throwable object.
@return the detail message of this Throwable, or null if this Throwable
does not have a detail message. | [
"Returns",
"the",
"detail",
"message",
"of",
"this",
"throwable",
"object",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/CSSException.java#L86-L106 |
137,149 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/parser/selector/ElementSelector.java | ElementSelector.addCondition | public void addCondition(final Condition condition) {
if (conditions_ == null) {
conditions_ = new ArrayList<>();
}
conditions_.add(condition);
} | java | public void addCondition(final Condition condition) {
if (conditions_ == null) {
conditions_ = new ArrayList<>();
}
conditions_.add(condition);
} | [
"public",
"void",
"addCondition",
"(",
"final",
"Condition",
"condition",
")",
"{",
"if",
"(",
"conditions_",
"==",
"null",
")",
"{",
"conditions_",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"conditions_",
".",
"add",
"(",
"condition",
")",
";",... | Add a condition.
@param condition the condition to be added | [
"Add",
"a",
"condition",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/parser/selector/ElementSelector.java#L96-L101 |
137,150 | HtmlUnit/htmlunit-cssparser | src/main/java/com/gargoylesoftware/css/dom/CSSStyleRuleImpl.java | CSSStyleRuleImpl.setSelectorText | public void setSelectorText(final String selectorText) throws DOMException {
try {
final CSSOMParser parser = new CSSOMParser();
selectors_ = parser.parseSelectors(selectorText);
}
catch (final CSSException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
catch (final IOException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
} | java | public void setSelectorText(final String selectorText) throws DOMException {
try {
final CSSOMParser parser = new CSSOMParser();
selectors_ = parser.parseSelectors(selectorText);
}
catch (final CSSException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
catch (final IOException e) {
throw new DOMExceptionImpl(
DOMException.SYNTAX_ERR,
DOMExceptionImpl.SYNTAX_ERROR,
e.getMessage());
}
} | [
"public",
"void",
"setSelectorText",
"(",
"final",
"String",
"selectorText",
")",
"throws",
"DOMException",
"{",
"try",
"{",
"final",
"CSSOMParser",
"parser",
"=",
"new",
"CSSOMParser",
"(",
")",
";",
"selectors_",
"=",
"parser",
".",
"parseSelectors",
"(",
"s... | Sets the selector text.
@param selectorText the new selector text
@throws DOMException in clase of error | [
"Sets",
"the",
"selector",
"text",
"."
] | 384e4170737169b5b4c87c5766495d9b8a6d3866 | https://github.com/HtmlUnit/htmlunit-cssparser/blob/384e4170737169b5b4c87c5766495d9b8a6d3866/src/main/java/com/gargoylesoftware/css/dom/CSSStyleRuleImpl.java#L129-L146 |
137,151 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/PLDebugLog.java | PLDebugLog.setDebugAll | public static void setDebugAll (final boolean bDebug)
{
setDebugText (bDebug);
setDebugFont (bDebug);
setDebugSplit (bDebug);
setDebugPrepare (bDebug);
setDebugRender (bDebug);
} | java | public static void setDebugAll (final boolean bDebug)
{
setDebugText (bDebug);
setDebugFont (bDebug);
setDebugSplit (bDebug);
setDebugPrepare (bDebug);
setDebugRender (bDebug);
} | [
"public",
"static",
"void",
"setDebugAll",
"(",
"final",
"boolean",
"bDebug",
")",
"{",
"setDebugText",
"(",
"bDebug",
")",
";",
"setDebugFont",
"(",
"bDebug",
")",
";",
"setDebugSplit",
"(",
"bDebug",
")",
";",
"setDebugPrepare",
"(",
"bDebug",
")",
";",
... | Shortcut to globally en- or disable debugging
@param bDebug
<code>true</code> to enable debug output | [
"Shortcut",
"to",
"globally",
"en",
"-",
"or",
"disable",
"debugging"
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/PLDebugLog.java#L133-L140 |
137,152 | skuzzle/semantic-version | src/main/java/de/skuzzle/semantic/Version.java | Version.withPreRelease | public Version withPreRelease(String newPreRelease) {
require(newPreRelease != null, "newPreRelease is null");
final String[] newPreReleaseParts = parsePreRelease(newPreRelease);
return new Version(this.major, this.minor, this.patch, newPreReleaseParts,
this.buildMetaDataParts);
} | java | public Version withPreRelease(String newPreRelease) {
require(newPreRelease != null, "newPreRelease is null");
final String[] newPreReleaseParts = parsePreRelease(newPreRelease);
return new Version(this.major, this.minor, this.patch, newPreReleaseParts,
this.buildMetaDataParts);
} | [
"public",
"Version",
"withPreRelease",
"(",
"String",
"newPreRelease",
")",
"{",
"require",
"(",
"newPreRelease",
"!=",
"null",
",",
"\"newPreRelease is null\"",
")",
";",
"final",
"String",
"[",
"]",
"newPreReleaseParts",
"=",
"parsePreRelease",
"(",
"newPreRelease... | Creates a new Version from this one, replacing only the pre-release part with the
given String. All other parts will remain the same as in this Version. You can
remove the pre-release part by passing an empty String.
@param newPreRelease The new pre-release identifier.
@return A new Version.
@throws VersionFormatException If the given String is not a valid pre-release
identifier.
@throws IllegalArgumentException If preRelease is null.
@since 1.1.0 | [
"Creates",
"a",
"new",
"Version",
"from",
"this",
"one",
"replacing",
"only",
"the",
"pre",
"-",
"release",
"part",
"with",
"the",
"given",
"String",
".",
"All",
"other",
"parts",
"will",
"remain",
"the",
"same",
"as",
"in",
"this",
"Version",
".",
"You"... | 2ddb66fb80244cd7f67c77ed5f8072d1132ad933 | https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L577-L582 |
137,153 | skuzzle/semantic-version | src/main/java/de/skuzzle/semantic/Version.java | Version.withBuildMetaData | public Version withBuildMetaData(String newBuildMetaData) {
require(newBuildMetaData != null, "newBuildMetaData is null");
final String[] newBuildMdParts = parseBuildMd(newBuildMetaData);
return new Version(this.major, this.minor, this.patch, this.preReleaseParts,
newBuildMdParts);
} | java | public Version withBuildMetaData(String newBuildMetaData) {
require(newBuildMetaData != null, "newBuildMetaData is null");
final String[] newBuildMdParts = parseBuildMd(newBuildMetaData);
return new Version(this.major, this.minor, this.patch, this.preReleaseParts,
newBuildMdParts);
} | [
"public",
"Version",
"withBuildMetaData",
"(",
"String",
"newBuildMetaData",
")",
"{",
"require",
"(",
"newBuildMetaData",
"!=",
"null",
",",
"\"newBuildMetaData is null\"",
")",
";",
"final",
"String",
"[",
"]",
"newBuildMdParts",
"=",
"parseBuildMd",
"(",
"newBuil... | Creates a new Version from this one, replacing only the build-meta-data part with
the given String. All other parts will remain the same as in this Version. You can
remove the build-meta-data part by passing an empty String.
@param newBuildMetaData The new build meta data identifier.
@return A new Version.
@throws VersionFormatException If the given String is not a valid build-meta-data
identifier.
@throws IllegalArgumentException If newBuildMetaData is null.
@since 1.1.0 | [
"Creates",
"a",
"new",
"Version",
"from",
"this",
"one",
"replacing",
"only",
"the",
"build",
"-",
"meta",
"-",
"data",
"part",
"with",
"the",
"given",
"String",
".",
"All",
"other",
"parts",
"will",
"remain",
"the",
"same",
"as",
"in",
"this",
"Version"... | 2ddb66fb80244cd7f67c77ed5f8072d1132ad933 | https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L630-L635 |
137,154 | skuzzle/semantic-version | src/main/java/de/skuzzle/semantic/Version.java | Version.nextPreRelease | public Version nextPreRelease() {
final String[] newPreReleaseParts = incrementIdentifier(this.preReleaseParts);
return new Version(this.major, this.minor, this.patch, newPreReleaseParts,
EMPTY_ARRAY);
} | java | public Version nextPreRelease() {
final String[] newPreReleaseParts = incrementIdentifier(this.preReleaseParts);
return new Version(this.major, this.minor, this.patch, newPreReleaseParts,
EMPTY_ARRAY);
} | [
"public",
"Version",
"nextPreRelease",
"(",
")",
"{",
"final",
"String",
"[",
"]",
"newPreReleaseParts",
"=",
"incrementIdentifier",
"(",
"this",
".",
"preReleaseParts",
")",
";",
"return",
"new",
"Version",
"(",
"this",
".",
"major",
",",
"this",
".",
"mino... | Derives a new Version instance from this one by only incrementing the pre-release
identifier. The build-meta-data will be dropped, all other fields remain the same.
<p>
The incrementation of the pre-release identifier behaves as follows:
<ul>
<li>In case the identifier is currently empty, it becomes "1" in the result.</li>
<li>If the identifier's last part is numeric, that last part will be incremented in
the result.</li>
<li>If the last part is not numeric, the identifier is interpreted as
{@code identifier.0} which becomes {@code identifier.1} after increment.
</ul>
Examples:
<table summary="Pre-release identifier incrementation behavior">
<tr>
<th>Version</th>
<th>After increment</th>
</tr>
<tr>
<td>1.2.3</td>
<td>1.2.3-1</td>
</tr>
<tr>
<td>1.2.3+build.meta.data</td>
<td>1.2.3-1</td>
</tr>
<tr>
<td>1.2.3-foo</td>
<td>1.2.3-foo.1</td>
</tr>
<tr>
<td>1.2.3-foo.1</td>
<td>1.2.3-foo.2</td>
</tr>
</table>
@return The incremented Version.
@since 1.2.0 | [
"Derives",
"a",
"new",
"Version",
"instance",
"from",
"this",
"one",
"by",
"only",
"incrementing",
"the",
"pre",
"-",
"release",
"identifier",
".",
"The",
"build",
"-",
"meta",
"-",
"data",
"will",
"be",
"dropped",
"all",
"other",
"fields",
"remain",
"the"... | 2ddb66fb80244cd7f67c77ed5f8072d1132ad933 | https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L896-L900 |
137,155 | skuzzle/semantic-version | src/main/java/de/skuzzle/semantic/Version.java | Version.nextBuildMetaData | public Version nextBuildMetaData() {
final String[] newBuildMetaData = incrementIdentifier(this.buildMetaDataParts);
return new Version(this.major, this.minor, this.patch, this.preReleaseParts,
newBuildMetaData);
} | java | public Version nextBuildMetaData() {
final String[] newBuildMetaData = incrementIdentifier(this.buildMetaDataParts);
return new Version(this.major, this.minor, this.patch, this.preReleaseParts,
newBuildMetaData);
} | [
"public",
"Version",
"nextBuildMetaData",
"(",
")",
"{",
"final",
"String",
"[",
"]",
"newBuildMetaData",
"=",
"incrementIdentifier",
"(",
"this",
".",
"buildMetaDataParts",
")",
";",
"return",
"new",
"Version",
"(",
"this",
".",
"major",
",",
"this",
".",
"... | Derives a new Version instance from this one by only incrementing the
build-meta-data identifier. All other fields remain the same.
<p>
The incrementation of the build-meta-data identifier behaves as follows:
<ul>
<li>In case the identifier is currently empty, it becomes "1" in the result.</li>
<li>If the identifier's last part is numeric, that last part will be incremented in
the result. <b>Leading 0's will be removed</b>.</li>
<li>If the last part is not numeric, the identifier is interpreted as
{@code identifier.0} which becomes {@code identifier.1} after increment.
</ul>
Examples:
<table summary="Build meta data incrementation behavior">
<tr>
<th>Version</th>
<th>After increment</th>
</tr>
<tr>
<td>1.2.3</td>
<td>1.2.3+1</td>
</tr>
<tr>
<td>1.2.3-pre.release</td>
<td>1.2.3-pre.release+1</td>
</tr>
<tr>
<td>1.2.3+foo</td>
<td>1.2.3+foo.1</td>
</tr>
<tr>
<td>1.2.3+foo.1</td>
<td>1.2.3+foo.2</td>
</tr>
</table>
@return The incremented Version.
@since 1.2.0 | [
"Derives",
"a",
"new",
"Version",
"instance",
"from",
"this",
"one",
"by",
"only",
"incrementing",
"the",
"build",
"-",
"meta",
"-",
"data",
"identifier",
".",
"All",
"other",
"fields",
"remain",
"the",
"same",
"."
] | 2ddb66fb80244cd7f67c77ed5f8072d1132ad933 | https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L944-L948 |
137,156 | skuzzle/semantic-version | src/main/java/de/skuzzle/semantic/Version.java | Version.isNumeric | private static int isNumeric(String s) {
final char[] chars = s.toCharArray();
int num = 0;
// note: this method does not account for leading zeroes as could occur in build
// meta data parts. Leading zeroes are thus simply ignored when parsing the
// number.
for (int i = 0; i < chars.length; ++i) {
final char c = chars[i];
if (c >= '0' && c <= '9') {
num = num * DECIMAL + Character.digit(c, DECIMAL);
} else {
return -1;
}
}
return num;
} | java | private static int isNumeric(String s) {
final char[] chars = s.toCharArray();
int num = 0;
// note: this method does not account for leading zeroes as could occur in build
// meta data parts. Leading zeroes are thus simply ignored when parsing the
// number.
for (int i = 0; i < chars.length; ++i) {
final char c = chars[i];
if (c >= '0' && c <= '9') {
num = num * DECIMAL + Character.digit(c, DECIMAL);
} else {
return -1;
}
}
return num;
} | [
"private",
"static",
"int",
"isNumeric",
"(",
"String",
"s",
")",
"{",
"final",
"char",
"[",
"]",
"chars",
"=",
"s",
".",
"toCharArray",
"(",
")",
";",
"int",
"num",
"=",
"0",
";",
"// note: this method does not account for leading zeroes as could occur in build",... | Determines whether s is a positive number. If it is, the number is returned,
otherwise the result is -1.
@param s The String to check.
@return The positive number (incl. 0) if s a number, or -1 if it is not. | [
"Determines",
"whether",
"s",
"is",
"a",
"positive",
"number",
".",
"If",
"it",
"is",
"the",
"number",
"is",
"returned",
"otherwise",
"the",
"result",
"is",
"-",
"1",
"."
] | 2ddb66fb80244cd7f67c77ed5f8072d1132ad933 | https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L1245-L1261 |
137,157 | skuzzle/semantic-version | src/main/java/de/skuzzle/semantic/Version.java | Version.getPreReleaseParts | public String[] getPreReleaseParts() {
if (this.preReleaseParts.length == 0) {
return EMPTY_ARRAY;
}
return Arrays.copyOf(this.preReleaseParts, this.preReleaseParts.length);
} | java | public String[] getPreReleaseParts() {
if (this.preReleaseParts.length == 0) {
return EMPTY_ARRAY;
}
return Arrays.copyOf(this.preReleaseParts, this.preReleaseParts.length);
} | [
"public",
"String",
"[",
"]",
"getPreReleaseParts",
"(",
")",
"{",
"if",
"(",
"this",
".",
"preReleaseParts",
".",
"length",
"==",
"0",
")",
"{",
"return",
"EMPTY_ARRAY",
";",
"}",
"return",
"Arrays",
".",
"copyOf",
"(",
"this",
".",
"preReleaseParts",
"... | Gets the pre release identifier parts of this version as array. Modifying the
resulting array will have no influence on the internal state of this object.
@return Pre release version as array. Array is empty if this version has no pre
release part. | [
"Gets",
"the",
"pre",
"release",
"identifier",
"parts",
"of",
"this",
"version",
"as",
"array",
".",
"Modifying",
"the",
"resulting",
"array",
"will",
"have",
"no",
"influence",
"on",
"the",
"internal",
"state",
"of",
"this",
"object",
"."
] | 2ddb66fb80244cd7f67c77ed5f8072d1132ad933 | https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L1469-L1474 |
137,158 | skuzzle/semantic-version | src/main/java/de/skuzzle/semantic/Version.java | Version.getBuildMetaDataParts | public String[] getBuildMetaDataParts() {
if (this.buildMetaDataParts.length == 0) {
return EMPTY_ARRAY;
}
return Arrays.copyOf(this.buildMetaDataParts, this.buildMetaDataParts.length);
} | java | public String[] getBuildMetaDataParts() {
if (this.buildMetaDataParts.length == 0) {
return EMPTY_ARRAY;
}
return Arrays.copyOf(this.buildMetaDataParts, this.buildMetaDataParts.length);
} | [
"public",
"String",
"[",
"]",
"getBuildMetaDataParts",
"(",
")",
"{",
"if",
"(",
"this",
".",
"buildMetaDataParts",
".",
"length",
"==",
"0",
")",
"{",
"return",
"EMPTY_ARRAY",
";",
"}",
"return",
"Arrays",
".",
"copyOf",
"(",
"this",
".",
"buildMetaDataPa... | Gets the build meta data identifier parts of this version as array. Modifying the
resulting array will have no influence on the internal state of this object.
@return Build meta data as array. Array is empty if this version has no build meta
data part. | [
"Gets",
"the",
"build",
"meta",
"data",
"identifier",
"parts",
"of",
"this",
"version",
"as",
"array",
".",
"Modifying",
"the",
"resulting",
"array",
"will",
"have",
"no",
"influence",
"on",
"the",
"internal",
"state",
"of",
"this",
"object",
"."
] | 2ddb66fb80244cd7f67c77ed5f8072d1132ad933 | https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L1530-L1535 |
137,159 | skuzzle/semantic-version | src/main/java/de/skuzzle/semantic/Version.java | Version.toUpperCase | public Version toUpperCase() {
return new Version(this.major, this.minor, this.patch,
copyCase(this.preReleaseParts, true),
copyCase(this.buildMetaDataParts, true));
} | java | public Version toUpperCase() {
return new Version(this.major, this.minor, this.patch,
copyCase(this.preReleaseParts, true),
copyCase(this.buildMetaDataParts, true));
} | [
"public",
"Version",
"toUpperCase",
"(",
")",
"{",
"return",
"new",
"Version",
"(",
"this",
".",
"major",
",",
"this",
".",
"minor",
",",
"this",
".",
"patch",
",",
"copyCase",
"(",
"this",
".",
"preReleaseParts",
",",
"true",
")",
",",
"copyCase",
"("... | Returns a new Version where all identifiers are converted to upper case letters.
@return A new version with upper case identifiers.
@since 1.1.0 | [
"Returns",
"a",
"new",
"Version",
"where",
"all",
"identifiers",
"are",
"converted",
"to",
"upper",
"case",
"letters",
"."
] | 2ddb66fb80244cd7f67c77ed5f8072d1132ad933 | https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L1688-L1692 |
137,160 | skuzzle/semantic-version | src/main/java/de/skuzzle/semantic/Version.java | Version.toLowerCase | public Version toLowerCase() {
return new Version(this.major, this.minor, this.patch,
copyCase(this.preReleaseParts, false),
copyCase(this.buildMetaDataParts, false));
} | java | public Version toLowerCase() {
return new Version(this.major, this.minor, this.patch,
copyCase(this.preReleaseParts, false),
copyCase(this.buildMetaDataParts, false));
} | [
"public",
"Version",
"toLowerCase",
"(",
")",
"{",
"return",
"new",
"Version",
"(",
"this",
".",
"major",
",",
"this",
".",
"minor",
",",
"this",
".",
"patch",
",",
"copyCase",
"(",
"this",
".",
"preReleaseParts",
",",
"false",
")",
",",
"copyCase",
"(... | Returns a new Version where all identifiers are converted to lower case letters.
@return A new version with lower case identifiers.
@since 1.1.0 | [
"Returns",
"a",
"new",
"Version",
"where",
"all",
"identifiers",
"are",
"converted",
"to",
"lower",
"case",
"letters",
"."
] | 2ddb66fb80244cd7f67c77ed5f8072d1132ad933 | https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L1700-L1704 |
137,161 | skuzzle/semantic-version | src/main/java/de/skuzzle/semantic/Version.java | Version.readResolve | private Object readResolve() throws ObjectStreamException {
if (this.preRelease != null || this.buildMetaData != null) {
return createInternal(this.major, this.minor, this.patch,
this.preRelease,
this.buildMetaData);
}
return this;
} | java | private Object readResolve() throws ObjectStreamException {
if (this.preRelease != null || this.buildMetaData != null) {
return createInternal(this.major, this.minor, this.patch,
this.preRelease,
this.buildMetaData);
}
return this;
} | [
"private",
"Object",
"readResolve",
"(",
")",
"throws",
"ObjectStreamException",
"{",
"if",
"(",
"this",
".",
"preRelease",
"!=",
"null",
"||",
"this",
".",
"buildMetaData",
"!=",
"null",
")",
"{",
"return",
"createInternal",
"(",
"this",
".",
"major",
",",
... | Handles proper deserialization of objects serialized with a version prior to 1.1.0
@return the deserialized object.
@throws ObjectStreamException If deserialization fails.
@since 1.1.0 | [
"Handles",
"proper",
"deserialization",
"of",
"objects",
"serialized",
"with",
"a",
"version",
"prior",
"to",
"1",
".",
"1",
".",
"0"
] | 2ddb66fb80244cd7f67c77ed5f8072d1132ad933 | https://github.com/skuzzle/semantic-version/blob/2ddb66fb80244cd7f67c77ed5f8072d1132ad933/src/main/java/de/skuzzle/semantic/Version.java#L1756-L1763 |
137,162 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/element/table/PLTableHelper.java | PLTableHelper.avoidDoubleBorders | public static void avoidDoubleBorders (@Nonnull final PLTable ret)
{
boolean bPreviousRowHasBottomBorder = false;
for (int i = 0; i < ret.getRowCount (); i++)
{
boolean bRowHasBottomBorder = true;
boolean bRowHasTopBorder = true;
final PLTableRow aRow = ret.getRowAtIndex (i);
for (int j = 0; j < aRow.getColumnCount (); j++)
{
final PLTableCell aCell = aRow.getCellAtIndex (j);
if (aCell.getBorderBottomWidth () == 0)
bRowHasBottomBorder = false;
if (aCell.getBorderTopWidth () == 0)
bRowHasTopBorder = false;
}
if (bPreviousRowHasBottomBorder && bRowHasTopBorder)
aRow.setBorderTop (null);
bPreviousRowHasBottomBorder = bRowHasBottomBorder;
}
} | java | public static void avoidDoubleBorders (@Nonnull final PLTable ret)
{
boolean bPreviousRowHasBottomBorder = false;
for (int i = 0; i < ret.getRowCount (); i++)
{
boolean bRowHasBottomBorder = true;
boolean bRowHasTopBorder = true;
final PLTableRow aRow = ret.getRowAtIndex (i);
for (int j = 0; j < aRow.getColumnCount (); j++)
{
final PLTableCell aCell = aRow.getCellAtIndex (j);
if (aCell.getBorderBottomWidth () == 0)
bRowHasBottomBorder = false;
if (aCell.getBorderTopWidth () == 0)
bRowHasTopBorder = false;
}
if (bPreviousRowHasBottomBorder && bRowHasTopBorder)
aRow.setBorderTop (null);
bPreviousRowHasBottomBorder = bRowHasBottomBorder;
}
} | [
"public",
"static",
"void",
"avoidDoubleBorders",
"(",
"@",
"Nonnull",
"final",
"PLTable",
"ret",
")",
"{",
"boolean",
"bPreviousRowHasBottomBorder",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ret",
".",
"getRowCount",
"(",
")",
... | If two joined rows both have borders at their connecting side, the doubles
width has to be removed
@param ret
the PLTable, whose doubled borders are to be removed | [
"If",
"two",
"joined",
"rows",
"both",
"have",
"borders",
"at",
"their",
"connecting",
"side",
"the",
"doubles",
"width",
"has",
"to",
"be",
"removed"
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/element/table/PLTableHelper.java#L40-L61 |
137,163 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/spec/FontSpec.java | FontSpec.getCloneWithDifferentFont | @Nonnull
public FontSpec getCloneWithDifferentFont (@Nonnull final PreloadFont aNewFont)
{
ValueEnforcer.notNull (aNewFont, "NewFont");
if (aNewFont.equals (m_aPreloadFont))
return this;
// Don't copy loaded font!
return new FontSpec (aNewFont, m_fFontSize, m_aColor);
} | java | @Nonnull
public FontSpec getCloneWithDifferentFont (@Nonnull final PreloadFont aNewFont)
{
ValueEnforcer.notNull (aNewFont, "NewFont");
if (aNewFont.equals (m_aPreloadFont))
return this;
// Don't copy loaded font!
return new FontSpec (aNewFont, m_fFontSize, m_aColor);
} | [
"@",
"Nonnull",
"public",
"FontSpec",
"getCloneWithDifferentFont",
"(",
"@",
"Nonnull",
"final",
"PreloadFont",
"aNewFont",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aNewFont",
",",
"\"NewFont\"",
")",
";",
"if",
"(",
"aNewFont",
".",
"equals",
"(",
"m_... | Return a clone of this object but with a different font.
@param aNewFont
The new font to use. Must not be <code>null</code>.
@return this if the fonts are equal - a new object otherwise. | [
"Return",
"a",
"clone",
"of",
"this",
"object",
"but",
"with",
"a",
"different",
"font",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/spec/FontSpec.java#L112-L120 |
137,164 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/spec/FontSpec.java | FontSpec.getCloneWithDifferentFontSize | @Nonnull
public FontSpec getCloneWithDifferentFontSize (final float fNewFontSize)
{
ValueEnforcer.isGT0 (fNewFontSize, "FontSize");
if (EqualsHelper.equals (fNewFontSize, m_fFontSize))
return this;
return new FontSpec (m_aPreloadFont, fNewFontSize, m_aColor);
} | java | @Nonnull
public FontSpec getCloneWithDifferentFontSize (final float fNewFontSize)
{
ValueEnforcer.isGT0 (fNewFontSize, "FontSize");
if (EqualsHelper.equals (fNewFontSize, m_fFontSize))
return this;
return new FontSpec (m_aPreloadFont, fNewFontSize, m_aColor);
} | [
"@",
"Nonnull",
"public",
"FontSpec",
"getCloneWithDifferentFontSize",
"(",
"final",
"float",
"fNewFontSize",
")",
"{",
"ValueEnforcer",
".",
"isGT0",
"(",
"fNewFontSize",
",",
"\"FontSize\"",
")",
";",
"if",
"(",
"EqualsHelper",
".",
"equals",
"(",
"fNewFontSize"... | Return a clone of this object but with a different font size.
@param fNewFontSize
The new font size to use. Must be > 0.
@return this if the font sizes are equal - a new object otherwise. | [
"Return",
"a",
"clone",
"of",
"this",
"object",
"but",
"with",
"a",
"different",
"font",
"size",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/spec/FontSpec.java#L129-L136 |
137,165 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/spec/FontSpec.java | FontSpec.getCloneWithDifferentColor | @Nonnull
public FontSpec getCloneWithDifferentColor (@Nonnull final Color aNewColor)
{
ValueEnforcer.notNull (aNewColor, "NewColor");
if (aNewColor.equals (m_aColor))
return this;
return new FontSpec (m_aPreloadFont, m_fFontSize, aNewColor);
} | java | @Nonnull
public FontSpec getCloneWithDifferentColor (@Nonnull final Color aNewColor)
{
ValueEnforcer.notNull (aNewColor, "NewColor");
if (aNewColor.equals (m_aColor))
return this;
return new FontSpec (m_aPreloadFont, m_fFontSize, aNewColor);
} | [
"@",
"Nonnull",
"public",
"FontSpec",
"getCloneWithDifferentColor",
"(",
"@",
"Nonnull",
"final",
"Color",
"aNewColor",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aNewColor",
",",
"\"NewColor\"",
")",
";",
"if",
"(",
"aNewColor",
".",
"equals",
"(",
"m_a... | Return a clone of this object but with a different color.
@param aNewColor
The new color to use. May not be <code>null</code>.
@return this if the colors are equal - a new object otherwise. | [
"Return",
"a",
"clone",
"of",
"this",
"object",
"but",
"with",
"a",
"different",
"color",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/spec/FontSpec.java#L145-L152 |
137,166 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/spec/HeightSpec.java | HeightSpec.getEffectiveValue | @Nonnegative
public float getEffectiveValue (final float fAvailableHeight)
{
switch (m_eType)
{
case ABSOLUTE:
return Math.min (m_fValue, fAvailableHeight);
case PERCENTAGE:
return fAvailableHeight * m_fValue / 100;
default:
throw new IllegalStateException ("Unsupported: " + m_eType + " - must be calculated outside!");
}
} | java | @Nonnegative
public float getEffectiveValue (final float fAvailableHeight)
{
switch (m_eType)
{
case ABSOLUTE:
return Math.min (m_fValue, fAvailableHeight);
case PERCENTAGE:
return fAvailableHeight * m_fValue / 100;
default:
throw new IllegalStateException ("Unsupported: " + m_eType + " - must be calculated outside!");
}
} | [
"@",
"Nonnegative",
"public",
"float",
"getEffectiveValue",
"(",
"final",
"float",
"fAvailableHeight",
")",
"{",
"switch",
"(",
"m_eType",
")",
"{",
"case",
"ABSOLUTE",
":",
"return",
"Math",
".",
"min",
"(",
"m_fValue",
",",
"fAvailableHeight",
")",
";",
"c... | Get the effective height based on the passed available height. This may not
be called for star or auto height elements.
@param fAvailableHeight
The available height.
@return The effective height to use. | [
"Get",
"the",
"effective",
"height",
"based",
"on",
"the",
"passed",
"available",
"height",
".",
"This",
"may",
"not",
"be",
"called",
"for",
"star",
"or",
"auto",
"height",
"elements",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/spec/HeightSpec.java#L124-L136 |
137,167 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/spec/HeightSpec.java | HeightSpec.abs | @Nonnull
public static HeightSpec abs (@Nonnegative final float fValue)
{
ValueEnforcer.isGT0 (fValue, "Value");
return new HeightSpec (EValueUOMType.ABSOLUTE, fValue);
} | java | @Nonnull
public static HeightSpec abs (@Nonnegative final float fValue)
{
ValueEnforcer.isGT0 (fValue, "Value");
return new HeightSpec (EValueUOMType.ABSOLUTE, fValue);
} | [
"@",
"Nonnull",
"public",
"static",
"HeightSpec",
"abs",
"(",
"@",
"Nonnegative",
"final",
"float",
"fValue",
")",
"{",
"ValueEnforcer",
".",
"isGT0",
"(",
"fValue",
",",
"\"Value\"",
")",
";",
"return",
"new",
"HeightSpec",
"(",
"EValueUOMType",
".",
"ABSOL... | Create a height element with an absolute value.
@param fValue
The height to use. Must be > 0.
@return Never <code>null</code>. | [
"Create",
"a",
"height",
"element",
"with",
"an",
"absolute",
"value",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/spec/HeightSpec.java#L170-L175 |
137,168 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/spec/HeightSpec.java | HeightSpec.perc | @Nonnull
public static HeightSpec perc (@Nonnegative final float fPerc)
{
ValueEnforcer.isGT0 (fPerc, "Perc");
return new HeightSpec (EValueUOMType.PERCENTAGE, fPerc);
} | java | @Nonnull
public static HeightSpec perc (@Nonnegative final float fPerc)
{
ValueEnforcer.isGT0 (fPerc, "Perc");
return new HeightSpec (EValueUOMType.PERCENTAGE, fPerc);
} | [
"@",
"Nonnull",
"public",
"static",
"HeightSpec",
"perc",
"(",
"@",
"Nonnegative",
"final",
"float",
"fPerc",
")",
"{",
"ValueEnforcer",
".",
"isGT0",
"(",
"fPerc",
",",
"\"Perc\"",
")",
";",
"return",
"new",
"HeightSpec",
"(",
"EValueUOMType",
".",
"PERCENT... | Create a height element with an percentage value.
@param fPerc
The height percentage to use. Must be > 0.
@return Never <code>null</code>. | [
"Create",
"a",
"height",
"element",
"with",
"an",
"percentage",
"value",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/spec/HeightSpec.java#L184-L189 |
137,169 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/element/table/PLTable.java | PLTable.createWithPercentage | @Nonnull
@ReturnsMutableCopy
public static PLTable createWithPercentage (@Nonnull @Nonempty final float... aPercentages)
{
ValueEnforcer.notEmpty (aPercentages, "Percentages");
final ICommonsList <WidthSpec> aWidths = new CommonsArrayList <> (aPercentages.length);
for (final float fPercentage : aPercentages)
aWidths.add (WidthSpec.perc (fPercentage));
return new PLTable (aWidths);
} | java | @Nonnull
@ReturnsMutableCopy
public static PLTable createWithPercentage (@Nonnull @Nonempty final float... aPercentages)
{
ValueEnforcer.notEmpty (aPercentages, "Percentages");
final ICommonsList <WidthSpec> aWidths = new CommonsArrayList <> (aPercentages.length);
for (final float fPercentage : aPercentages)
aWidths.add (WidthSpec.perc (fPercentage));
return new PLTable (aWidths);
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"static",
"PLTable",
"createWithPercentage",
"(",
"@",
"Nonnull",
"@",
"Nonempty",
"final",
"float",
"...",
"aPercentages",
")",
"{",
"ValueEnforcer",
".",
"notEmpty",
"(",
"aPercentages",
",",
"\"Percentages\"",
... | Create a new table with the specified percentages.
@param aPercentages
The array to use. The sum of all percentages should be ≤ 100. May
neither be <code>null</code> nor empty.
@return The created {@link PLTable} and never <code>null</code>. | [
"Create",
"a",
"new",
"table",
"with",
"the",
"specified",
"percentages",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/element/table/PLTable.java#L494-L504 |
137,170 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/element/table/PLTable.java | PLTable.createWithEvenlySizedColumns | @Nonnull
@ReturnsMutableCopy
public static PLTable createWithEvenlySizedColumns (@Nonnegative final int nColumnCount)
{
ValueEnforcer.isGT0 (nColumnCount, "ColumnCount");
final ICommonsList <WidthSpec> aWidths = new CommonsArrayList <> (nColumnCount);
for (int i = 0; i < nColumnCount; ++i)
aWidths.add (WidthSpec.star ());
return new PLTable (aWidths);
} | java | @Nonnull
@ReturnsMutableCopy
public static PLTable createWithEvenlySizedColumns (@Nonnegative final int nColumnCount)
{
ValueEnforcer.isGT0 (nColumnCount, "ColumnCount");
final ICommonsList <WidthSpec> aWidths = new CommonsArrayList <> (nColumnCount);
for (int i = 0; i < nColumnCount; ++i)
aWidths.add (WidthSpec.star ());
return new PLTable (aWidths);
} | [
"@",
"Nonnull",
"@",
"ReturnsMutableCopy",
"public",
"static",
"PLTable",
"createWithEvenlySizedColumns",
"(",
"@",
"Nonnegative",
"final",
"int",
"nColumnCount",
")",
"{",
"ValueEnforcer",
".",
"isGT0",
"(",
"nColumnCount",
",",
"\"ColumnCount\"",
")",
";",
"final"... | Create a new table with evenly sized columns.
@param nColumnCount
The number of columns to use. Must be > 0.
@return The created {@link PLTable} and never <code>null</code>. | [
"Create",
"a",
"new",
"table",
"with",
"evenly",
"sized",
"columns",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/element/table/PLTable.java#L513-L523 |
137,171 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/base/AbstractPLRenderableObject.java | AbstractPLRenderableObject._setPreparedSize | private void _setPreparedSize (@Nonnull final SizeSpec aPreparedSize)
{
ValueEnforcer.notNull (aPreparedSize, "PreparedSize");
m_bPrepared = true;
m_aPreparedSize = aPreparedSize;
m_aRenderSize = getRenderSize (aPreparedSize);
if (PLDebugLog.isDebugPrepare ())
{
String sSuffix = "";
if (this instanceof IPLHasMarginBorderPadding <?>)
{
sSuffix = " with " +
PLDebugLog.getXMBP ((IPLHasMarginBorderPadding <?>) this) +
" and " +
PLDebugLog.getYMBP ((IPLHasMarginBorderPadding <?>) this);
}
PLDebugLog.debugPrepare (this,
"Prepared object: " +
PLDebugLog.getWH (aPreparedSize) +
sSuffix +
"; Render size: " +
PLDebugLog.getWH (m_aRenderSize));
}
} | java | private void _setPreparedSize (@Nonnull final SizeSpec aPreparedSize)
{
ValueEnforcer.notNull (aPreparedSize, "PreparedSize");
m_bPrepared = true;
m_aPreparedSize = aPreparedSize;
m_aRenderSize = getRenderSize (aPreparedSize);
if (PLDebugLog.isDebugPrepare ())
{
String sSuffix = "";
if (this instanceof IPLHasMarginBorderPadding <?>)
{
sSuffix = " with " +
PLDebugLog.getXMBP ((IPLHasMarginBorderPadding <?>) this) +
" and " +
PLDebugLog.getYMBP ((IPLHasMarginBorderPadding <?>) this);
}
PLDebugLog.debugPrepare (this,
"Prepared object: " +
PLDebugLog.getWH (aPreparedSize) +
sSuffix +
"; Render size: " +
PLDebugLog.getWH (m_aRenderSize));
}
} | [
"private",
"void",
"_setPreparedSize",
"(",
"@",
"Nonnull",
"final",
"SizeSpec",
"aPreparedSize",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aPreparedSize",
",",
"\"PreparedSize\"",
")",
";",
"m_bPrepared",
"=",
"true",
";",
"m_aPreparedSize",
"=",
"aPrepare... | Set the prepared size of this object. This method also handles min and max
size
@param aPreparedSize
Prepared size without padding and margin. | [
"Set",
"the",
"prepared",
"size",
"of",
"this",
"object",
".",
"This",
"method",
"also",
"handles",
"min",
"and",
"max",
"size"
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/base/AbstractPLRenderableObject.java#L169-L194 |
137,172 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/base/AbstractPLRenderableObject.java | AbstractPLRenderableObject.internalMarkAsPrepared | @Nonnull
protected final IMPLTYPE internalMarkAsPrepared (@Nonnull final SizeSpec aPreparedSize)
{
// Prepare only once!
internalCheckNotPrepared ();
_setPreparedSize (aPreparedSize);
return thisAsT ();
} | java | @Nonnull
protected final IMPLTYPE internalMarkAsPrepared (@Nonnull final SizeSpec aPreparedSize)
{
// Prepare only once!
internalCheckNotPrepared ();
_setPreparedSize (aPreparedSize);
return thisAsT ();
} | [
"@",
"Nonnull",
"protected",
"final",
"IMPLTYPE",
"internalMarkAsPrepared",
"(",
"@",
"Nonnull",
"final",
"SizeSpec",
"aPreparedSize",
")",
"{",
"// Prepare only once!",
"internalCheckNotPrepared",
"(",
")",
";",
"_setPreparedSize",
"(",
"aPreparedSize",
")",
";",
"re... | INTERNAL method. Do not call from outside!
@param aPreparedSize
The new prepared size without margin, border and padding.
@return this | [
"INTERNAL",
"method",
".",
"Do",
"not",
"call",
"from",
"outside!"
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/base/AbstractPLRenderableObject.java#L280-L288 |
137,173 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setFont | public void setFont (final PDFont font, final float fontSize) throws IOException
{
if (fontStack.isEmpty ())
fontStack.add (font);
else
fontStack.set (fontStack.size () - 1, font);
PDDocumentHelper.handleFontSubset (m_aDoc, font);
writeOperand (resources.add (font));
writeOperand (fontSize);
writeOperator ((byte) 'T', (byte) 'f');
} | java | public void setFont (final PDFont font, final float fontSize) throws IOException
{
if (fontStack.isEmpty ())
fontStack.add (font);
else
fontStack.set (fontStack.size () - 1, font);
PDDocumentHelper.handleFontSubset (m_aDoc, font);
writeOperand (resources.add (font));
writeOperand (fontSize);
writeOperator ((byte) 'T', (byte) 'f');
} | [
"public",
"void",
"setFont",
"(",
"final",
"PDFont",
"font",
",",
"final",
"float",
"fontSize",
")",
"throws",
"IOException",
"{",
"if",
"(",
"fontStack",
".",
"isEmpty",
"(",
")",
")",
"fontStack",
".",
"add",
"(",
"font",
")",
";",
"else",
"fontStack",... | Set the font and font size to draw text with.
@param font
The font to use.
@param fontSize
The font size to draw the text.
@throws IOException
If there is an error writing the font information. | [
"Set",
"the",
"font",
"and",
"font",
"size",
"to",
"draw",
"text",
"with",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L332-L344 |
137,174 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.showText | public void showText (final String text) throws IOException
{
if (!inTextMode)
{
throw new IllegalStateException ("Must call beginText() before showText()");
}
if (fontStack.isEmpty ())
{
throw new IllegalStateException ("Must call setFont() before showText()");
}
final PDFont font = fontStack.peek ();
// Unicode code points to keep when subsetting
if (font.willBeSubset ())
{
for (int offset = 0; offset < text.length ();)
{
final int codePoint = text.codePointAt (offset);
font.addToSubset (codePoint);
offset += Character.charCount (codePoint);
}
}
COSWriter.writeString (font.encode (text), m_aOS);
write ((byte) ' ');
writeOperator ((byte) 'T', (byte) 'j');
} | java | public void showText (final String text) throws IOException
{
if (!inTextMode)
{
throw new IllegalStateException ("Must call beginText() before showText()");
}
if (fontStack.isEmpty ())
{
throw new IllegalStateException ("Must call setFont() before showText()");
}
final PDFont font = fontStack.peek ();
// Unicode code points to keep when subsetting
if (font.willBeSubset ())
{
for (int offset = 0; offset < text.length ();)
{
final int codePoint = text.codePointAt (offset);
font.addToSubset (codePoint);
offset += Character.charCount (codePoint);
}
}
COSWriter.writeString (font.encode (text), m_aOS);
write ((byte) ' ');
writeOperator ((byte) 'T', (byte) 'j');
} | [
"public",
"void",
"showText",
"(",
"final",
"String",
"text",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"inTextMode",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Must call beginText() before showText()\"",
")",
";",
"}",
"if",
"(",
"fontS... | Shows the given text at the location specified by the current text matrix.
@param text
The Unicode text to show.
@throws IOException
If an io exception occurs. | [
"Shows",
"the",
"given",
"text",
"at",
"the",
"location",
"specified",
"by",
"the",
"current",
"text",
"matrix",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L370-L398 |
137,175 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setTextMatrix | public void setTextMatrix (final Matrix matrix) throws IOException
{
if (!inTextMode)
{
throw new IllegalStateException ("Error: must call beginText() before setTextMatrix");
}
writeAffineTransform (matrix.createAffineTransform ());
writeOperator ((byte) 'T', (byte) 'm');
} | java | public void setTextMatrix (final Matrix matrix) throws IOException
{
if (!inTextMode)
{
throw new IllegalStateException ("Error: must call beginText() before setTextMatrix");
}
writeAffineTransform (matrix.createAffineTransform ());
writeOperator ((byte) 'T', (byte) 'm');
} | [
"public",
"void",
"setTextMatrix",
"(",
"final",
"Matrix",
"matrix",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"inTextMode",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Error: must call beginText() before setTextMatrix\"",
")",
";",
"}",
"wri... | The Tm operator. Sets the text matrix to the given values. A current text
matrix will be replaced with the new one.
@param matrix
the transformation matrix
@throws IOException
If there is an error writing to the stream.
@throws IllegalStateException
If the method was not allowed to be called at this time. | [
"The",
"Tm",
"operator",
".",
"Sets",
"the",
"text",
"matrix",
"to",
"the",
"given",
"values",
".",
"A",
"current",
"text",
"matrix",
"will",
"be",
"replaced",
"with",
"the",
"new",
"one",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L465-L473 |
137,176 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.drawImage | public void drawImage (final PDImageXObject image, final float x, final float y) throws IOException
{
drawImage (image, x, y, image.getWidth (), image.getHeight ());
} | java | public void drawImage (final PDImageXObject image, final float x, final float y) throws IOException
{
drawImage (image, x, y, image.getWidth (), image.getHeight ());
} | [
"public",
"void",
"drawImage",
"(",
"final",
"PDImageXObject",
"image",
",",
"final",
"float",
"x",
",",
"final",
"float",
"y",
")",
"throws",
"IOException",
"{",
"drawImage",
"(",
"image",
",",
"x",
",",
"y",
",",
"image",
".",
"getWidth",
"(",
")",
"... | Draw an image at the x,y coordinates, with the default size of the image.
@param image
The image to draw.
@param x
The x-coordinate to draw the image.
@param y
The y-coordinate to draw the image.
@throws IOException
If there is an error writing to the stream. | [
"Draw",
"an",
"image",
"at",
"the",
"x",
"y",
"coordinates",
"with",
"the",
"default",
"size",
"of",
"the",
"image",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L487-L490 |
137,177 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.drawImage | public void drawImage (final PDImageXObject image,
final float x,
final float y,
final float width,
final float height) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: drawImage is not allowed within a text block.");
}
saveGraphicsState ();
final AffineTransform transform = new AffineTransform (width, 0, 0, height, x, y);
transform (new Matrix (transform));
writeOperand (resources.add (image));
writeOperator ((byte) 'D', (byte) 'o');
restoreGraphicsState ();
} | java | public void drawImage (final PDImageXObject image,
final float x,
final float y,
final float width,
final float height) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: drawImage is not allowed within a text block.");
}
saveGraphicsState ();
final AffineTransform transform = new AffineTransform (width, 0, 0, height, x, y);
transform (new Matrix (transform));
writeOperand (resources.add (image));
writeOperator ((byte) 'D', (byte) 'o');
restoreGraphicsState ();
} | [
"public",
"void",
"drawImage",
"(",
"final",
"PDImageXObject",
"image",
",",
"final",
"float",
"x",
",",
"final",
"float",
"y",
",",
"final",
"float",
"width",
",",
"final",
"float",
"height",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inTextMode",
")"... | Draw an image at the x,y coordinates, with the given size.
@param image
The image to draw.
@param x
The x-coordinate to draw the image.
@param y
The y-coordinate to draw the image.
@param width
The width to draw the image.
@param height
The height to draw the image.
@throws IOException
If there is an error writing to the stream.
@throws IllegalStateException
If the method was called within a text block. | [
"Draw",
"an",
"image",
"at",
"the",
"x",
"y",
"coordinates",
"with",
"the",
"given",
"size",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L510-L530 |
137,178 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.drawImage | public void drawImage (final PDInlineImage inlineImage, final float x, final float y) throws IOException
{
drawImage (inlineImage, x, y, inlineImage.getWidth (), inlineImage.getHeight ());
} | java | public void drawImage (final PDInlineImage inlineImage, final float x, final float y) throws IOException
{
drawImage (inlineImage, x, y, inlineImage.getWidth (), inlineImage.getHeight ());
} | [
"public",
"void",
"drawImage",
"(",
"final",
"PDInlineImage",
"inlineImage",
",",
"final",
"float",
"x",
",",
"final",
"float",
"y",
")",
"throws",
"IOException",
"{",
"drawImage",
"(",
"inlineImage",
",",
"x",
",",
"y",
",",
"inlineImage",
".",
"getWidth",
... | Draw an inline image at the x,y coordinates, with the default size of the
image.
@param inlineImage
The inline image to draw.
@param x
The x-coordinate to draw the inline image.
@param y
The y-coordinate to draw the inline image.
@throws IOException
If there is an error writing to the stream. | [
"Draw",
"an",
"inline",
"image",
"at",
"the",
"x",
"y",
"coordinates",
"with",
"the",
"default",
"size",
"of",
"the",
"image",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L545-L548 |
137,179 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.drawImage | public void drawImage (final PDInlineImage inlineImage,
final float x,
final float y,
final float width,
final float height) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: drawImage is not allowed within a text block.");
}
saveGraphicsState ();
transform (new Matrix (width, 0, 0, height, x, y));
// create the image dictionary
final StringBuilder sb = new StringBuilder ();
sb.append ("BI");
sb.append ("\n /W ");
sb.append (inlineImage.getWidth ());
sb.append ("\n /H ");
sb.append (inlineImage.getHeight ());
sb.append ("\n /CS ");
sb.append ("/");
sb.append (inlineImage.getColorSpace ().getName ());
if (inlineImage.getDecode () != null && inlineImage.getDecode ().size () > 0)
{
sb.append ("\n /D ");
sb.append ("[");
for (final COSBase base : inlineImage.getDecode ())
{
sb.append (((COSNumber) base).intValue ());
sb.append (" ");
}
sb.append ("]");
}
if (inlineImage.isStencil ())
{
sb.append ("\n /IM true");
}
sb.append ("\n /BPC ");
sb.append (inlineImage.getBitsPerComponent ());
// image dictionary
write (sb.toString ());
writeLine ();
// binary data
writeOperator ((byte) 'I', (byte) 'D');
writeBytes (inlineImage.getData ());
writeLine ();
writeOperator ((byte) 'E', (byte) 'I');
restoreGraphicsState ();
} | java | public void drawImage (final PDInlineImage inlineImage,
final float x,
final float y,
final float width,
final float height) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: drawImage is not allowed within a text block.");
}
saveGraphicsState ();
transform (new Matrix (width, 0, 0, height, x, y));
// create the image dictionary
final StringBuilder sb = new StringBuilder ();
sb.append ("BI");
sb.append ("\n /W ");
sb.append (inlineImage.getWidth ());
sb.append ("\n /H ");
sb.append (inlineImage.getHeight ());
sb.append ("\n /CS ");
sb.append ("/");
sb.append (inlineImage.getColorSpace ().getName ());
if (inlineImage.getDecode () != null && inlineImage.getDecode ().size () > 0)
{
sb.append ("\n /D ");
sb.append ("[");
for (final COSBase base : inlineImage.getDecode ())
{
sb.append (((COSNumber) base).intValue ());
sb.append (" ");
}
sb.append ("]");
}
if (inlineImage.isStencil ())
{
sb.append ("\n /IM true");
}
sb.append ("\n /BPC ");
sb.append (inlineImage.getBitsPerComponent ());
// image dictionary
write (sb.toString ());
writeLine ();
// binary data
writeOperator ((byte) 'I', (byte) 'D');
writeBytes (inlineImage.getData ());
writeLine ();
writeOperator ((byte) 'E', (byte) 'I');
restoreGraphicsState ();
} | [
"public",
"void",
"drawImage",
"(",
"final",
"PDInlineImage",
"inlineImage",
",",
"final",
"float",
"x",
",",
"final",
"float",
"y",
",",
"final",
"float",
"width",
",",
"final",
"float",
"height",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inTextMode",
... | Draw an inline image at the x,y coordinates and a certain width and height.
@param inlineImage
The inline image to draw.
@param x
The x-coordinate to draw the inline image.
@param y
The y-coordinate to draw the inline image.
@param width
The width of the inline image to draw.
@param height
The height of the inline image to draw.
@throws IOException
If there is an error writing to the stream.
@throws IllegalStateException
If the method was called within a text block. | [
"Draw",
"an",
"inline",
"image",
"at",
"the",
"x",
"y",
"coordinates",
"and",
"a",
"certain",
"width",
"and",
"height",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L568-L627 |
137,180 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.drawForm | public void drawForm (final PDFormXObject form) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: drawForm is not allowed within a text block.");
}
writeOperand (resources.add (form));
writeOperator ((byte) 'D', (byte) 'o');
} | java | public void drawForm (final PDFormXObject form) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: drawForm is not allowed within a text block.");
}
writeOperand (resources.add (form));
writeOperator ((byte) 'D', (byte) 'o');
} | [
"public",
"void",
"drawForm",
"(",
"final",
"PDFormXObject",
"form",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inTextMode",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Error: drawForm is not allowed within a text block.\"",
")",
";",
"}",
"writeOpe... | Draws the given Form XObject at the current location.
@param form
Form XObject
@throws IOException
if the content stream could not be written
@throws IllegalStateException
If the method was called within a text block. | [
"Draws",
"the",
"given",
"Form",
"XObject",
"at",
"the",
"current",
"location",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L639-L648 |
137,181 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.saveGraphicsState | public void saveGraphicsState () throws IOException
{
if (!fontStack.isEmpty ())
{
fontStack.push (fontStack.peek ());
}
if (!strokingColorSpaceStack.isEmpty ())
{
strokingColorSpaceStack.push (strokingColorSpaceStack.peek ());
}
if (!nonStrokingColorSpaceStack.isEmpty ())
{
nonStrokingColorSpaceStack.push (nonStrokingColorSpaceStack.peek ());
}
writeOperator ((byte) 'q');
} | java | public void saveGraphicsState () throws IOException
{
if (!fontStack.isEmpty ())
{
fontStack.push (fontStack.peek ());
}
if (!strokingColorSpaceStack.isEmpty ())
{
strokingColorSpaceStack.push (strokingColorSpaceStack.peek ());
}
if (!nonStrokingColorSpaceStack.isEmpty ())
{
nonStrokingColorSpaceStack.push (nonStrokingColorSpaceStack.peek ());
}
writeOperator ((byte) 'q');
} | [
"public",
"void",
"saveGraphicsState",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"fontStack",
".",
"isEmpty",
"(",
")",
")",
"{",
"fontStack",
".",
"push",
"(",
"fontStack",
".",
"peek",
"(",
")",
")",
";",
"}",
"if",
"(",
"!",
"strokin... | q operator. Saves the current graphics state.
@throws IOException
If an error occurs while writing to the stream. | [
"q",
"operator",
".",
"Saves",
"the",
"current",
"graphics",
"state",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L670-L685 |
137,182 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.restoreGraphicsState | public void restoreGraphicsState () throws IOException
{
if (!fontStack.isEmpty ())
{
fontStack.pop ();
}
if (!strokingColorSpaceStack.isEmpty ())
{
strokingColorSpaceStack.pop ();
}
if (!nonStrokingColorSpaceStack.isEmpty ())
{
nonStrokingColorSpaceStack.pop ();
}
writeOperator ((byte) 'Q');
} | java | public void restoreGraphicsState () throws IOException
{
if (!fontStack.isEmpty ())
{
fontStack.pop ();
}
if (!strokingColorSpaceStack.isEmpty ())
{
strokingColorSpaceStack.pop ();
}
if (!nonStrokingColorSpaceStack.isEmpty ())
{
nonStrokingColorSpaceStack.pop ();
}
writeOperator ((byte) 'Q');
} | [
"public",
"void",
"restoreGraphicsState",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"fontStack",
".",
"isEmpty",
"(",
")",
")",
"{",
"fontStack",
".",
"pop",
"(",
")",
";",
"}",
"if",
"(",
"!",
"strokingColorSpaceStack",
".",
"isEmpty",
"("... | Q operator. Restores the current graphics state.
@throws IOException
If an error occurs while writing to the stream. | [
"Q",
"operator",
".",
"Restores",
"the",
"current",
"graphics",
"state",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L693-L708 |
137,183 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setStrokingColor | public void setStrokingColor (final double g) throws IOException
{
if (_isOutsideOneInterval (g))
{
throw new IllegalArgumentException ("Parameter must be within 0..1, but is " + g);
}
writeOperand ((float) g);
writeOperator ((byte) 'G');
} | java | public void setStrokingColor (final double g) throws IOException
{
if (_isOutsideOneInterval (g))
{
throw new IllegalArgumentException ("Parameter must be within 0..1, but is " + g);
}
writeOperand ((float) g);
writeOperator ((byte) 'G');
} | [
"public",
"void",
"setStrokingColor",
"(",
"final",
"double",
"g",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_isOutsideOneInterval",
"(",
"g",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter must be within 0..1, but is \"",
"+",
"g"... | Set the stroking color in the DeviceGray color space. Range is 0..1.
@param g
The gray value.
@throws IOException
If an IO error occurs while writing to the stream.
@throws IllegalArgumentException
If the parameter is invalid. | [
"Set",
"the",
"stroking",
"color",
"in",
"the",
"DeviceGray",
"color",
"space",
".",
"Range",
"is",
"0",
"..",
"1",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L861-L869 |
137,184 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setNonStrokingColor | public void setNonStrokingColor (final PDColor color) throws IOException
{
if (nonStrokingColorSpaceStack.isEmpty () || nonStrokingColorSpaceStack.peek () != color.getColorSpace ())
{
writeOperand (getName (color.getColorSpace ()));
writeOperator ((byte) 'c', (byte) 's');
if (nonStrokingColorSpaceStack.isEmpty ())
{
nonStrokingColorSpaceStack.add (color.getColorSpace ());
}
else
{
nonStrokingColorSpaceStack.set (nonStrokingColorSpaceStack.size () - 1, color.getColorSpace ());
}
}
for (final float value : color.getComponents ())
{
writeOperand (value);
}
if (color.getColorSpace () instanceof PDPattern)
{
writeOperand (color.getPatternName ());
}
if (color.getColorSpace () instanceof PDPattern ||
color.getColorSpace () instanceof PDSeparation ||
color.getColorSpace () instanceof PDDeviceN ||
color.getColorSpace () instanceof PDICCBased)
{
writeOperator ((byte) 's', (byte) 'c', (byte) 'n');
}
else
{
writeOperator ((byte) 's', (byte) 'c');
}
} | java | public void setNonStrokingColor (final PDColor color) throws IOException
{
if (nonStrokingColorSpaceStack.isEmpty () || nonStrokingColorSpaceStack.peek () != color.getColorSpace ())
{
writeOperand (getName (color.getColorSpace ()));
writeOperator ((byte) 'c', (byte) 's');
if (nonStrokingColorSpaceStack.isEmpty ())
{
nonStrokingColorSpaceStack.add (color.getColorSpace ());
}
else
{
nonStrokingColorSpaceStack.set (nonStrokingColorSpaceStack.size () - 1, color.getColorSpace ());
}
}
for (final float value : color.getComponents ())
{
writeOperand (value);
}
if (color.getColorSpace () instanceof PDPattern)
{
writeOperand (color.getPatternName ());
}
if (color.getColorSpace () instanceof PDPattern ||
color.getColorSpace () instanceof PDSeparation ||
color.getColorSpace () instanceof PDDeviceN ||
color.getColorSpace () instanceof PDICCBased)
{
writeOperator ((byte) 's', (byte) 'c', (byte) 'n');
}
else
{
writeOperator ((byte) 's', (byte) 'c');
}
} | [
"public",
"void",
"setNonStrokingColor",
"(",
"final",
"PDColor",
"color",
")",
"throws",
"IOException",
"{",
"if",
"(",
"nonStrokingColorSpaceStack",
".",
"isEmpty",
"(",
")",
"||",
"nonStrokingColorSpaceStack",
".",
"peek",
"(",
")",
"!=",
"color",
".",
"getCo... | Sets the non-stroking color and, if necessary, the non-stroking color
space.
@param color
Color in a specific color space.
@throws IOException
If an IO error occurs while writing to the stream. | [
"Sets",
"the",
"non",
"-",
"stroking",
"color",
"and",
"if",
"necessary",
"the",
"non",
"-",
"stroking",
"color",
"space",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L880-L918 |
137,185 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setNonStrokingColor | public void setNonStrokingColor (final Color color) throws IOException
{
final float [] components = new float [] { color.getRed () / 255f,
color.getGreen () / 255f,
color.getBlue () / 255f };
final PDColor pdColor = new PDColor (components, PDDeviceRGB.INSTANCE);
setNonStrokingColor (pdColor);
} | java | public void setNonStrokingColor (final Color color) throws IOException
{
final float [] components = new float [] { color.getRed () / 255f,
color.getGreen () / 255f,
color.getBlue () / 255f };
final PDColor pdColor = new PDColor (components, PDDeviceRGB.INSTANCE);
setNonStrokingColor (pdColor);
} | [
"public",
"void",
"setNonStrokingColor",
"(",
"final",
"Color",
"color",
")",
"throws",
"IOException",
"{",
"final",
"float",
"[",
"]",
"components",
"=",
"new",
"float",
"[",
"]",
"{",
"color",
".",
"getRed",
"(",
")",
"/",
"255f",
",",
"color",
".",
... | Set the non-stroking color using an AWT color. Conversion uses the default
sRGB color space.
@param color
The color to set.
@throws IOException
If an IO error occurs while writing to the stream. | [
"Set",
"the",
"non",
"-",
"stroking",
"color",
"using",
"an",
"AWT",
"color",
".",
"Conversion",
"uses",
"the",
"default",
"sRGB",
"color",
"space",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L929-L936 |
137,186 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setNonStrokingColor | public void setNonStrokingColor (final int r, final int g, final int b) throws IOException
{
if (_isOutside255Interval (r) || _isOutside255Interval (g) || _isOutside255Interval (b))
{
throw new IllegalArgumentException ("Parameters must be within 0..255, but are (" + r + "," + g + "," + b + ")");
}
writeOperand (r / 255f);
writeOperand (g / 255f);
writeOperand (b / 255f);
writeOperator ((byte) 'r', (byte) 'g');
} | java | public void setNonStrokingColor (final int r, final int g, final int b) throws IOException
{
if (_isOutside255Interval (r) || _isOutside255Interval (g) || _isOutside255Interval (b))
{
throw new IllegalArgumentException ("Parameters must be within 0..255, but are (" + r + "," + g + "," + b + ")");
}
writeOperand (r / 255f);
writeOperand (g / 255f);
writeOperand (b / 255f);
writeOperator ((byte) 'r', (byte) 'g');
} | [
"public",
"void",
"setNonStrokingColor",
"(",
"final",
"int",
"r",
",",
"final",
"int",
"g",
",",
"final",
"int",
"b",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_isOutside255Interval",
"(",
"r",
")",
"||",
"_isOutside255Interval",
"(",
"g",
")",
"||",... | Set the non-stroking color in the DeviceRGB color space. Range is 0..255.
@param r
The red value.
@param g
The green value.
@param b
The blue value.
@throws IOException
If an IO error occurs while writing to the stream.
@throws IllegalArgumentException
If the parameters are invalid. | [
"Set",
"the",
"non",
"-",
"stroking",
"color",
"in",
"the",
"DeviceRGB",
"color",
"space",
".",
"Range",
"is",
"0",
"..",
"255",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L952-L962 |
137,187 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setNonStrokingColor | public void setNonStrokingColor (final int c, final int m, final int y, final int k) throws IOException
{
if (_isOutside255Interval (c) ||
_isOutside255Interval (m) ||
_isOutside255Interval (y) ||
_isOutside255Interval (k))
{
throw new IllegalArgumentException ("Parameters must be within 0..255, but are (" +
c +
"," +
m +
"," +
y +
"," +
k +
")");
}
setNonStrokingColor (c / 255f, m / 255f, y / 255f, k / 255f);
} | java | public void setNonStrokingColor (final int c, final int m, final int y, final int k) throws IOException
{
if (_isOutside255Interval (c) ||
_isOutside255Interval (m) ||
_isOutside255Interval (y) ||
_isOutside255Interval (k))
{
throw new IllegalArgumentException ("Parameters must be within 0..255, but are (" +
c +
"," +
m +
"," +
y +
"," +
k +
")");
}
setNonStrokingColor (c / 255f, m / 255f, y / 255f, k / 255f);
} | [
"public",
"void",
"setNonStrokingColor",
"(",
"final",
"int",
"c",
",",
"final",
"int",
"m",
",",
"final",
"int",
"y",
",",
"final",
"int",
"k",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_isOutside255Interval",
"(",
"c",
")",
"||",
"_isOutside255Inter... | Set the non-stroking color in the DeviceCMYK color space. Range is 0..255.
@param c
The cyan value.
@param m
The magenta value.
@param y
The yellow value.
@param k
The black value.
@throws IOException
If an IO error occurs while writing to the stream.
@throws IllegalArgumentException
If the parameters are invalid. | [
"Set",
"the",
"non",
"-",
"stroking",
"color",
"in",
"the",
"DeviceCMYK",
"color",
"space",
".",
"Range",
"is",
"0",
"..",
"255",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L980-L998 |
137,188 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setNonStrokingColor | public void setNonStrokingColor (final double c, final double m, final double y, final double k) throws IOException
{
if (_isOutsideOneInterval (c) ||
_isOutsideOneInterval (m) ||
_isOutsideOneInterval (y) ||
_isOutsideOneInterval (k))
{
throw new IllegalArgumentException ("Parameters must be within 0..1, but are (" +
c +
"," +
m +
"," +
y +
"," +
k +
")");
}
writeOperand ((float) c);
writeOperand ((float) m);
writeOperand ((float) y);
writeOperand ((float) k);
writeOperator ((byte) 'k');
} | java | public void setNonStrokingColor (final double c, final double m, final double y, final double k) throws IOException
{
if (_isOutsideOneInterval (c) ||
_isOutsideOneInterval (m) ||
_isOutsideOneInterval (y) ||
_isOutsideOneInterval (k))
{
throw new IllegalArgumentException ("Parameters must be within 0..1, but are (" +
c +
"," +
m +
"," +
y +
"," +
k +
")");
}
writeOperand ((float) c);
writeOperand ((float) m);
writeOperand ((float) y);
writeOperand ((float) k);
writeOperator ((byte) 'k');
} | [
"public",
"void",
"setNonStrokingColor",
"(",
"final",
"double",
"c",
",",
"final",
"double",
"m",
",",
"final",
"double",
"y",
",",
"final",
"double",
"k",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_isOutsideOneInterval",
"(",
"c",
")",
"||",
"_isOut... | Set the non-stroking color in the DeviceRGB color space. Range is 0..1.
@param c
The cyan value.
@param m
The magenta value.
@param y
The yellow value.
@param k
The black value.
@throws IOException
If an IO error occurs while writing to the stream. | [
"Set",
"the",
"non",
"-",
"stroking",
"color",
"in",
"the",
"DeviceRGB",
"color",
"space",
".",
"Range",
"is",
"0",
"..",
"1",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1014-L1036 |
137,189 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setNonStrokingColor | public void setNonStrokingColor (final double g) throws IOException
{
if (_isOutsideOneInterval (g))
{
throw new IllegalArgumentException ("Parameter must be within 0..1, but is " + g);
}
writeOperand ((float) g);
writeOperator ((byte) 'g');
} | java | public void setNonStrokingColor (final double g) throws IOException
{
if (_isOutsideOneInterval (g))
{
throw new IllegalArgumentException ("Parameter must be within 0..1, but is " + g);
}
writeOperand ((float) g);
writeOperator ((byte) 'g');
} | [
"public",
"void",
"setNonStrokingColor",
"(",
"final",
"double",
"g",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_isOutsideOneInterval",
"(",
"g",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Parameter must be within 0..1, but is \"",
"+",
... | Set the non-stroking color in the DeviceGray color space. Range is 0..1.
@param g
The gray value.
@throws IOException
If an IO error occurs while writing to the stream.
@throws IllegalArgumentException
If the parameter is invalid. | [
"Set",
"the",
"non",
"-",
"stroking",
"color",
"in",
"the",
"DeviceGray",
"color",
"space",
".",
"Range",
"is",
"0",
"..",
"1",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1067-L1075 |
137,190 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.addRect | public void addRect (final float x, final float y, final float width, final float height) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: addRect is not allowed within a text block.");
}
writeOperand (x);
writeOperand (y);
writeOperand (width);
writeOperand (height);
writeOperator ((byte) 'r', (byte) 'e');
} | java | public void addRect (final float x, final float y, final float width, final float height) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: addRect is not allowed within a text block.");
}
writeOperand (x);
writeOperand (y);
writeOperand (width);
writeOperand (height);
writeOperator ((byte) 'r', (byte) 'e');
} | [
"public",
"void",
"addRect",
"(",
"final",
"float",
"x",
",",
"final",
"float",
"y",
",",
"final",
"float",
"width",
",",
"final",
"float",
"height",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inTextMode",
")",
"{",
"throw",
"new",
"IllegalStateExcepti... | Add a rectangle to the current path.
@param x
The lower left x coordinate.
@param y
The lower left y coordinate.
@param width
The width of the rectangle.
@param height
The height of the rectangle.
@throws IOException
If the content stream could not be written.
@throws IllegalStateException
If the method was called within a text block. | [
"Add",
"a",
"rectangle",
"to",
"the",
"current",
"path",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1093-L1104 |
137,191 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.moveTo | public void moveTo (final float x, final float y) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: moveTo is not allowed within a text block.");
}
writeOperand (x);
writeOperand (y);
writeOperator ((byte) 'm');
} | java | public void moveTo (final float x, final float y) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: moveTo is not allowed within a text block.");
}
writeOperand (x);
writeOperand (y);
writeOperator ((byte) 'm');
} | [
"public",
"void",
"moveTo",
"(",
"final",
"float",
"x",
",",
"final",
"float",
"y",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inTextMode",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Error: moveTo is not allowed within a text block.\"",
")",
";... | Move the current position to the given coordinates.
@param x
The x coordinate.
@param y
The y coordinate.
@throws IOException
If the content stream could not be written.
@throws IllegalStateException
If the method was called within a text block. | [
"Move",
"the",
"current",
"position",
"to",
"the",
"given",
"coordinates",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1222-L1231 |
137,192 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.lineTo | public void lineTo (final float x, final float y) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: lineTo is not allowed within a text block.");
}
writeOperand (x);
writeOperand (y);
writeOperator ((byte) 'l');
} | java | public void lineTo (final float x, final float y) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: lineTo is not allowed within a text block.");
}
writeOperand (x);
writeOperand (y);
writeOperator ((byte) 'l');
} | [
"public",
"void",
"lineTo",
"(",
"final",
"float",
"x",
",",
"final",
"float",
"y",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inTextMode",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Error: lineTo is not allowed within a text block.\"",
")",
";... | Draw a line from the current position to the given coordinates.
@param x
The x coordinate.
@param y
The y coordinate.
@throws IOException
If the content stream could not be written.
@throws IllegalStateException
If the method was called within a text block. | [
"Draw",
"a",
"line",
"from",
"the",
"current",
"position",
"to",
"the",
"given",
"coordinates",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1245-L1254 |
137,193 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.shadingFill | public void shadingFill (final PDShading shading) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: shadingFill is not allowed within a text block.");
}
writeOperand (resources.add (shading));
writeOperator ((byte) 's', (byte) 'h');
} | java | public void shadingFill (final PDShading shading) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: shadingFill is not allowed within a text block.");
}
writeOperand (resources.add (shading));
writeOperator ((byte) 's', (byte) 'h');
} | [
"public",
"void",
"shadingFill",
"(",
"final",
"PDShading",
"shading",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inTextMode",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Error: shadingFill is not allowed within a text block.\"",
")",
";",
"}",
"wri... | Fills the clipping area with the given shading.
@param shading
Shading resource
@throws IOException
If the content stream could not be written
@throws IllegalStateException
If the method was called within a text block. | [
"Fills",
"the",
"clipping",
"area",
"with",
"the",
"given",
"shading",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1334-L1343 |
137,194 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setLineJoinStyle | public void setLineJoinStyle (final int lineJoinStyle) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: setLineJoinStyle is not allowed within a text block.");
}
if (lineJoinStyle >= 0 && lineJoinStyle <= 2)
{
writeOperand (lineJoinStyle);
writeOperator ((byte) 'j');
}
else
{
throw new IllegalArgumentException ("Error: unknown value for line join style");
}
} | java | public void setLineJoinStyle (final int lineJoinStyle) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: setLineJoinStyle is not allowed within a text block.");
}
if (lineJoinStyle >= 0 && lineJoinStyle <= 2)
{
writeOperand (lineJoinStyle);
writeOperator ((byte) 'j');
}
else
{
throw new IllegalArgumentException ("Error: unknown value for line join style");
}
} | [
"public",
"void",
"setLineJoinStyle",
"(",
"final",
"int",
"lineJoinStyle",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inTextMode",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Error: setLineJoinStyle is not allowed within a text block.\"",
")",
";",
"... | Set the line join style.
@param lineJoinStyle
0 for miter join, 1 for round join, and 2 for bevel join.
@throws IOException
If the content stream could not be written.
@throws IllegalStateException
If the method was called within a text block.
@throws IllegalArgumentException
If the parameter is not a valid line join style. | [
"Set",
"the",
"line",
"join",
"style",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1436-L1451 |
137,195 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setLineCapStyle | public void setLineCapStyle (final int lineCapStyle) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: setLineCapStyle is not allowed within a text block.");
}
if (lineCapStyle >= 0 && lineCapStyle <= 2)
{
writeOperand (lineCapStyle);
writeOperator ((byte) 'J');
}
else
{
throw new IllegalArgumentException ("Error: unknown value for line cap style");
}
} | java | public void setLineCapStyle (final int lineCapStyle) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: setLineCapStyle is not allowed within a text block.");
}
if (lineCapStyle >= 0 && lineCapStyle <= 2)
{
writeOperand (lineCapStyle);
writeOperator ((byte) 'J');
}
else
{
throw new IllegalArgumentException ("Error: unknown value for line cap style");
}
} | [
"public",
"void",
"setLineCapStyle",
"(",
"final",
"int",
"lineCapStyle",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inTextMode",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Error: setLineCapStyle is not allowed within a text block.\"",
")",
";",
"}",... | Set the line cap style.
@param lineCapStyle
0 for butt cap, 1 for round cap, and 2 for projecting square cap.
@throws IOException
If the content stream could not be written.
@throws IllegalStateException
If the method was called within a text block.
@throws IllegalArgumentException
If the parameter is not a valid line cap style. | [
"Set",
"the",
"line",
"cap",
"style",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1465-L1480 |
137,196 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.setLineDashPattern | public void setLineDashPattern (final float [] pattern, final float phase) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: setLineDashPattern is not allowed within a text block.");
}
write ((byte) '[');
for (final float value : pattern)
{
writeOperand (value);
}
write ((byte) ']', (byte) ' ');
writeOperand (phase);
writeOperator ((byte) 'd');
} | java | public void setLineDashPattern (final float [] pattern, final float phase) throws IOException
{
if (inTextMode)
{
throw new IllegalStateException ("Error: setLineDashPattern is not allowed within a text block.");
}
write ((byte) '[');
for (final float value : pattern)
{
writeOperand (value);
}
write ((byte) ']', (byte) ' ');
writeOperand (phase);
writeOperator ((byte) 'd');
} | [
"public",
"void",
"setLineDashPattern",
"(",
"final",
"float",
"[",
"]",
"pattern",
",",
"final",
"float",
"phase",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inTextMode",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Error: setLineDashPattern is ... | Set the line dash pattern.
@param pattern
The pattern array
@param phase
The phase of the pattern
@throws IOException
If the content stream could not be written.
@throws IllegalStateException
If the method was called within a text block. | [
"Set",
"the",
"line",
"dash",
"pattern",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1494-L1508 |
137,197 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.beginMarkedContent | public void beginMarkedContent (final COSName tag, final PDPropertyList propertyList) throws IOException
{
writeOperand (tag);
writeOperand (resources.add (propertyList));
writeOperator ((byte) 'B', (byte) 'D', (byte) 'C');
} | java | public void beginMarkedContent (final COSName tag, final PDPropertyList propertyList) throws IOException
{
writeOperand (tag);
writeOperand (resources.add (propertyList));
writeOperator ((byte) 'B', (byte) 'D', (byte) 'C');
} | [
"public",
"void",
"beginMarkedContent",
"(",
"final",
"COSName",
"tag",
",",
"final",
"PDPropertyList",
"propertyList",
")",
"throws",
"IOException",
"{",
"writeOperand",
"(",
"tag",
")",
";",
"writeOperand",
"(",
"resources",
".",
"add",
"(",
"propertyList",
")... | Begin a marked content sequence with a reference to an entry in the page
resources' Properties dictionary.
@param tag
the tag
@param propertyList
property list
@throws IOException
If the content stream could not be written | [
"Begin",
"a",
"marked",
"content",
"sequence",
"with",
"a",
"reference",
"to",
"an",
"entry",
"in",
"the",
"page",
"resources",
"Properties",
"dictionary",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1535-L1540 |
137,198 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.writeOperand | protected void writeOperand (final float real) throws IOException
{
final int byteCount = NumberFormatUtil.formatFloatFast (real,
formatDecimal.getMaximumFractionDigits (),
formatBuffer);
if (byteCount == -1)
{
// Fast formatting failed
write (formatDecimal.format (real));
}
else
{
m_aOS.write (formatBuffer, 0, byteCount);
}
m_aOS.write (' ');
} | java | protected void writeOperand (final float real) throws IOException
{
final int byteCount = NumberFormatUtil.formatFloatFast (real,
formatDecimal.getMaximumFractionDigits (),
formatBuffer);
if (byteCount == -1)
{
// Fast formatting failed
write (formatDecimal.format (real));
}
else
{
m_aOS.write (formatBuffer, 0, byteCount);
}
m_aOS.write (' ');
} | [
"protected",
"void",
"writeOperand",
"(",
"final",
"float",
"real",
")",
"throws",
"IOException",
"{",
"final",
"int",
"byteCount",
"=",
"NumberFormatUtil",
".",
"formatFloatFast",
"(",
"real",
",",
"formatDecimal",
".",
"getMaximumFractionDigits",
"(",
")",
",",
... | Writes a real real to the content stream.
@param real
the value to be written
@throws IOException
In case of IO error | [
"Writes",
"a",
"real",
"real",
"to",
"the",
"content",
"stream",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1575-L1591 |
137,199 | phax/ph-pdf-layout | src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java | PDPageContentStreamExt.writeAffineTransform | private void writeAffineTransform (final AffineTransform transform) throws IOException
{
final double [] values = new double [6];
transform.getMatrix (values);
for (final double v : values)
{
writeOperand ((float) v);
}
} | java | private void writeAffineTransform (final AffineTransform transform) throws IOException
{
final double [] values = new double [6];
transform.getMatrix (values);
for (final double v : values)
{
writeOperand ((float) v);
}
} | [
"private",
"void",
"writeAffineTransform",
"(",
"final",
"AffineTransform",
"transform",
")",
"throws",
"IOException",
"{",
"final",
"double",
"[",
"]",
"values",
"=",
"new",
"double",
"[",
"6",
"]",
";",
"transform",
".",
"getMatrix",
"(",
"values",
")",
";... | Writes an AffineTransform to the content stream as an array.
@param transform
the transform to use
@throws IOException
In case of IO error | [
"Writes",
"an",
"AffineTransform",
"to",
"the",
"content",
"stream",
"as",
"an",
"array",
"."
] | 777d9f3a131cbe8f592c0de1cf554084e541bb54 | https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L1693-L1701 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.