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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
112,500 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/util/ClassGraphUtil.java | ClassGraphUtil.getNonAbstractSubClasses | @SuppressWarnings("all")
synchronized public static <T> Set<Class<? extends T>> getNonAbstractSubClasses(Class<T> parentClass, String... packageNames) {
return getNonAbstractSubClassInfoSet(parentClass, packageNames).stream().map(classInfo -> {
try {
//Here we must use parentClas... | java | @SuppressWarnings("all")
synchronized public static <T> Set<Class<? extends T>> getNonAbstractSubClasses(Class<T> parentClass, String... packageNames) {
return getNonAbstractSubClassInfoSet(parentClass, packageNames).stream().map(classInfo -> {
try {
//Here we must use parentClas... | [
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"synchronized",
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"Class",
"<",
"?",
"extends",
"T",
">",
">",
"getNonAbstractSubClasses",
"(",
"Class",
"<",
"T",
">",
"parentClass",
",",
"String",
"...",
"package... | Scan classpath for all concrete subclasses of specified interface or class
@return all concrete subclasses of specified interface or class | [
"Scan",
"classpath",
"for",
"all",
"concrete",
"subclasses",
"of",
"specified",
"interface",
"or",
"class"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/ClassGraphUtil.java#L50-L63 |
112,501 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/util/ClassGraphUtil.java | ClassGraphUtil.getSubclassInstances | public synchronized static <T> Set<T> getSubclassInstances(Class<T> parentClass, String... packageNames) {
return getNonAbstractSubClasses(parentClass, packageNames).stream()
.filter(subclass -> {
if (Reflection.canInitiate(subclass)) {
return true;
... | java | public synchronized static <T> Set<T> getSubclassInstances(Class<T> parentClass, String... packageNames) {
return getNonAbstractSubClasses(parentClass, packageNames).stream()
.filter(subclass -> {
if (Reflection.canInitiate(subclass)) {
return true;
... | [
"public",
"synchronized",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"getSubclassInstances",
"(",
"Class",
"<",
"T",
">",
"parentClass",
",",
"String",
"...",
"packageNames",
")",
"{",
"return",
"getNonAbstractSubClasses",
"(",
"parentClass",
",",
"package... | search and create new instances of concrete subclasses, 1 for each.
Note that we only initiate subclasses which are with default constructor, those without default constructors
we judge them as canInitiate=false.
@param parentClass parent class
@param packageNames package name prefix
@param <T> class generic... | [
"search",
"and",
"create",
"new",
"instances",
"of",
"concrete",
"subclasses",
"1",
"for",
"each",
".",
"Note",
"that",
"we",
"only",
"initiate",
"subclasses",
"which",
"are",
"with",
"default",
"constructor",
"those",
"without",
"default",
"constructors",
"we",... | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/ClassGraphUtil.java#L102-L120 |
112,502 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/barriers/DistributedDoubleBarrier.java | DistributedDoubleBarrier.enter | public boolean enter(long maxWait, TimeUnit unit) throws Exception
{
long startMs = System.currentTimeMillis();
boolean hasMaxWait = (unit != null);
long maxWaitMs = hasMaxWait ? TimeUnit.MILLISECONDS.convert(maxWait, unit) : Long.MAX_VALUE;
boolean... | java | public boolean enter(long maxWait, TimeUnit unit) throws Exception
{
long startMs = System.currentTimeMillis();
boolean hasMaxWait = (unit != null);
long maxWaitMs = hasMaxWait ? TimeUnit.MILLISECONDS.convert(maxWait, unit) : Long.MAX_VALUE;
boolean... | [
"public",
"boolean",
"enter",
"(",
"long",
"maxWait",
",",
"TimeUnit",
"unit",
")",
"throws",
"Exception",
"{",
"long",
"startMs",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"boolean",
"hasMaxWait",
"=",
"(",
"unit",
"!=",
"null",
")",
";",
... | Enter the barrier and block until all members have entered or the timeout has
elapsed
@param maxWait max time to block
@param unit time unit
@return true if the entry was successful, false if the timeout elapsed first
@throws Exception interruptions, errors, etc. | [
"Enter",
"the",
"barrier",
"and",
"block",
"until",
"all",
"members",
"have",
"entered",
"or",
"the",
"timeout",
"has",
"elapsed"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/barriers/DistributedDoubleBarrier.java#L114-L130 |
112,503 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/barriers/DistributedDoubleBarrier.java | DistributedDoubleBarrier.leave | public synchronized boolean leave(long maxWait, TimeUnit unit) throws Exception
{
long startMs = System.currentTimeMillis();
boolean hasMaxWait = (unit != null);
long maxWaitMs = hasMaxWait ? TimeUnit.MILLISECONDS.convert(maxWait, unit) : Long.MAX_VALUE;
... | java | public synchronized boolean leave(long maxWait, TimeUnit unit) throws Exception
{
long startMs = System.currentTimeMillis();
boolean hasMaxWait = (unit != null);
long maxWaitMs = hasMaxWait ? TimeUnit.MILLISECONDS.convert(maxWait, unit) : Long.MAX_VALUE;
... | [
"public",
"synchronized",
"boolean",
"leave",
"(",
"long",
"maxWait",
",",
"TimeUnit",
"unit",
")",
"throws",
"Exception",
"{",
"long",
"startMs",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"boolean",
"hasMaxWait",
"=",
"(",
"unit",
"!=",
"null"... | Leave the barrier and block until all members have left or the timeout has
elapsed
@param maxWait max time to block
@param unit time unit
@return true if leaving was successful, false if the timeout elapsed first
@throws Exception interruptions, errors, etc. | [
"Leave",
"the",
"barrier",
"and",
"block",
"until",
"all",
"members",
"have",
"left",
"or",
"the",
"timeout",
"has",
"elapsed"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/barriers/DistributedDoubleBarrier.java#L151-L158 |
112,504 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceDiscoveryBuilder.java | ServiceDiscoveryBuilder.builder | public static <T> ServiceDiscoveryBuilder<T> builder(Class<T> payloadClass)
{
return new ServiceDiscoveryBuilder<T>(payloadClass);
} | java | public static <T> ServiceDiscoveryBuilder<T> builder(Class<T> payloadClass)
{
return new ServiceDiscoveryBuilder<T>(payloadClass);
} | [
"public",
"static",
"<",
"T",
">",
"ServiceDiscoveryBuilder",
"<",
"T",
">",
"builder",
"(",
"Class",
"<",
"T",
">",
"payloadClass",
")",
"{",
"return",
"new",
"ServiceDiscoveryBuilder",
"<",
"T",
">",
"(",
"payloadClass",
")",
";",
"}"
] | Return a new builder.
@param payloadClass the class of the payload of your getGroup instance (you can use {@link Void}
if your instances don't need a payload)
@return new builder | [
"Return",
"a",
"new",
"builder",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/ServiceDiscoveryBuilder.java#L41-L44 |
112,505 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/AfterConnectionEstablished.java | AfterConnectionEstablished.execute | public static Future<?> execute(final CuratorFramework client, final Runnable runAfterConnection) throws Exception
{
//Block until connected
final ExecutorService executor = ThreadUtils.newSingleThreadExecutor(ThreadUtils.getProcessName(runAfterConnection.getClass()));
Runnable internalCall ... | java | public static Future<?> execute(final CuratorFramework client, final Runnable runAfterConnection) throws Exception
{
//Block until connected
final ExecutorService executor = ThreadUtils.newSingleThreadExecutor(ThreadUtils.getProcessName(runAfterConnection.getClass()));
Runnable internalCall ... | [
"public",
"static",
"Future",
"<",
"?",
">",
"execute",
"(",
"final",
"CuratorFramework",
"client",
",",
"final",
"Runnable",
"runAfterConnection",
")",
"throws",
"Exception",
"{",
"//Block until connected",
"final",
"ExecutorService",
"executor",
"=",
"ThreadUtils",
... | Spawns a new new background thread that will block until a connection is available and
then execute the 'runAfterConnection' logic
@param client The curator client
@param runAfterConnection The logic to run
@return future of the task so it can be canceled, etc. if needed | [
"Spawns",
"a",
"new",
"new",
"background",
"thread",
"that",
"will",
"block",
"until",
"a",
"connection",
"is",
"available",
"and",
"then",
"execute",
"the",
"runAfterConnection",
"logic"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/AfterConnectionEstablished.java#L44-L70 |
112,506 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/SimpleDistributedQueue.java | SimpleDistributedQueue.element | public byte[] element() throws Exception
{
byte[] bytes = internalElement(false, null);
if ( bytes == null )
{
throw new NoSuchElementException();
}
return bytes;
} | java | public byte[] element() throws Exception
{
byte[] bytes = internalElement(false, null);
if ( bytes == null )
{
throw new NoSuchElementException();
}
return bytes;
} | [
"public",
"byte",
"[",
"]",
"element",
"(",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"internalElement",
"(",
"false",
",",
"null",
")",
";",
"if",
"(",
"bytes",
"==",
"null",
")",
"{",
"throw",
"new",
"NoSuchElementException",
"... | Return the head of the queue without modifying the queue.
@return the data at the head of the queue.
@throws Exception errors
@throws NoSuchElementException if the queue is empty | [
"Return",
"the",
"head",
"of",
"the",
"queue",
"without",
"modifying",
"the",
"queue",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/SimpleDistributedQueue.java#L75-L83 |
112,507 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/SimpleDistributedQueue.java | SimpleDistributedQueue.remove | public byte[] remove() throws Exception
{
byte[] bytes = internalElement(true, null);
if ( bytes == null )
{
throw new NoSuchElementException();
}
return bytes;
} | java | public byte[] remove() throws Exception
{
byte[] bytes = internalElement(true, null);
if ( bytes == null )
{
throw new NoSuchElementException();
}
return bytes;
} | [
"public",
"byte",
"[",
"]",
"remove",
"(",
")",
"throws",
"Exception",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"internalElement",
"(",
"true",
",",
"null",
")",
";",
"if",
"(",
"bytes",
"==",
"null",
")",
"{",
"throw",
"new",
"NoSuchElementException",
"("... | Attempts to remove the head of the queue and return it.
@return The former head of the queue
@throws Exception errors
@throws NoSuchElementException if the queue is empty | [
"Attempts",
"to",
"remove",
"the",
"head",
"of",
"the",
"queue",
"and",
"return",
"it",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/SimpleDistributedQueue.java#L92-L100 |
112,508 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/SimpleDistributedQueue.java | SimpleDistributedQueue.offer | public boolean offer(byte[] data) throws Exception
{
String thisPath = ZKPaths.makePath(path, PREFIX);
client.create().creatingParentContainersIfNeeded().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath(thisPath, data);
return true;
} | java | public boolean offer(byte[] data) throws Exception
{
String thisPath = ZKPaths.makePath(path, PREFIX);
client.create().creatingParentContainersIfNeeded().withMode(CreateMode.PERSISTENT_SEQUENTIAL).forPath(thisPath, data);
return true;
} | [
"public",
"boolean",
"offer",
"(",
"byte",
"[",
"]",
"data",
")",
"throws",
"Exception",
"{",
"String",
"thisPath",
"=",
"ZKPaths",
".",
"makePath",
"(",
"path",
",",
"PREFIX",
")",
";",
"client",
".",
"create",
"(",
")",
".",
"creatingParentContainersIfNe... | Inserts data into queue.
@param data the data
@return true if data was successfully added
@throws Exception errors | [
"Inserts",
"data",
"into",
"queue",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/SimpleDistributedQueue.java#L120-L125 |
112,509 | xiancloud/xian | xian-dao/xian-jdbcdao/src/main/java/info/xiancloud/dao/jdbc/sql/JdbcSqlDriver.java | JdbcSqlDriver.insert | private Single<SingleInsertionResult> insert(String preparedSql, Object[] sqlParams) {
return Single.fromCallable(() -> {
PreparedStatement statement = connection0.prepareStatement(preparedSql, PreparedStatement.RETURN_GENERATED_KEYS);
for (int i = 0; i < sqlParams.length; i++) {
... | java | private Single<SingleInsertionResult> insert(String preparedSql, Object[] sqlParams) {
return Single.fromCallable(() -> {
PreparedStatement statement = connection0.prepareStatement(preparedSql, PreparedStatement.RETURN_GENERATED_KEYS);
for (int i = 0; i < sqlParams.length; i++) {
... | [
"private",
"Single",
"<",
"SingleInsertionResult",
">",
"insert",
"(",
"String",
"preparedSql",
",",
"Object",
"[",
"]",
"sqlParams",
")",
"{",
"return",
"Single",
".",
"fromCallable",
"(",
"(",
")",
"->",
"{",
"PreparedStatement",
"statement",
"=",
"connectio... | Async single record insertion
@return {@link SingleInsertionResult}
如果插入的记录是自动生成主键的,返回结果中会包含自动生成的主键id,否则返回的id属性为null,
同时返回插入条数。 | [
"Async",
"single",
"record",
"insertion"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-dao/xian-jdbcdao/src/main/java/info/xiancloud/dao/jdbc/sql/JdbcSqlDriver.java#L84-L104 |
112,510 | xiancloud/xian | xian-log/xian-gelf-log4j1/src/main/java/org/graylog2/log/GelfConsoleAppender.java | GelfConsoleAppender.setAdditionalFields | public void setAdditionalFields(String additionalFields) {
fields = (Map<String, String>) JSON.parse(additionalFields.replaceAll("'", "\""));
} | java | public void setAdditionalFields(String additionalFields) {
fields = (Map<String, String>) JSON.parse(additionalFields.replaceAll("'", "\""));
} | [
"public",
"void",
"setAdditionalFields",
"(",
"String",
"additionalFields",
")",
"{",
"fields",
"=",
"(",
"Map",
"<",
"String",
",",
"String",
">",
")",
"JSON",
".",
"parse",
"(",
"additionalFields",
".",
"replaceAll",
"(",
"\"'\"",
",",
"\"\\\"\"",
")",
"... | GelfMessageProvider interface. | [
"GelfMessageProvider",
"interface",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-log4j1/src/main/java/org/graylog2/log/GelfConsoleAppender.java#L39-L41 |
112,511 | xiancloud/xian | xian-log/xian-gelf-log4j1/src/main/java/org/graylog2/log/GelfConsoleAppender.java | GelfConsoleAppender.subAppend | @Override
protected void subAppend(LoggingEvent event) {
GelfMessage gelf = GelfMessageFactory.makeMessage(layout, event, this);
this.qw.write(gelf.toJson());
this.qw.write(Layout.LINE_SEP);
if (this.immediateFlush) {
this.qw.flush();
}
} | java | @Override
protected void subAppend(LoggingEvent event) {
GelfMessage gelf = GelfMessageFactory.makeMessage(layout, event, this);
this.qw.write(gelf.toJson());
this.qw.write(Layout.LINE_SEP);
if (this.immediateFlush) {
this.qw.flush();
}
} | [
"@",
"Override",
"protected",
"void",
"subAppend",
"(",
"LoggingEvent",
"event",
")",
"{",
"GelfMessage",
"gelf",
"=",
"GelfMessageFactory",
".",
"makeMessage",
"(",
"layout",
",",
"event",
",",
"this",
")",
";",
"this",
".",
"qw",
".",
"write",
"(",
"gelf... | the important parts. | [
"the",
"important",
"parts",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-log4j1/src/main/java/org/graylog2/log/GelfConsoleAppender.java#L94-L103 |
112,512 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/Input.java | Input.create | public static <Request> Input create(Request requestBean) {
if (requestBean == null)
throw new IllegalArgumentException("request bean should not be null!");
Class requestClass = requestBean.getClass();
return create(requestClass);
} | java | public static <Request> Input create(Request requestBean) {
if (requestBean == null)
throw new IllegalArgumentException("request bean should not be null!");
Class requestClass = requestBean.getClass();
return create(requestClass);
} | [
"public",
"static",
"<",
"Request",
">",
"Input",
"create",
"(",
"Request",
"requestBean",
")",
"{",
"if",
"(",
"requestBean",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"request bean should not be null!\"",
")",
";",
"Class",
"requestCl... | generate an input object from the bean.
@param requestBean the request bean
@param <Request> the request bean type
@return a newly created input definition. | [
"generate",
"an",
"input",
"object",
"from",
"the",
"bean",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/Input.java#L147-L152 |
112,513 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/QueueBuilder.java | QueueBuilder.builder | public static<T> QueueBuilder<T> builder(CuratorFramework client, QueueConsumer<T> consumer, QueueSerializer<T> serializer, String queuePath)
{
return new QueueBuilder<T>(client, consumer, serializer, queuePath);
} | java | public static<T> QueueBuilder<T> builder(CuratorFramework client, QueueConsumer<T> consumer, QueueSerializer<T> serializer, String queuePath)
{
return new QueueBuilder<T>(client, consumer, serializer, queuePath);
} | [
"public",
"static",
"<",
"T",
">",
"QueueBuilder",
"<",
"T",
">",
"builder",
"(",
"CuratorFramework",
"client",
",",
"QueueConsumer",
"<",
"T",
">",
"consumer",
",",
"QueueSerializer",
"<",
"T",
">",
"serializer",
",",
"String",
"queuePath",
")",
"{",
"ret... | Allocate a new builder
@param client the curator client
@param consumer functor to consume messages - NOTE: pass <code>null</code> to make this a producer-only queue
@param serializer serializer to use for items
@param queuePath path to store queue
@return builder | [
"Allocate",
"a",
"new",
"builder"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/QueueBuilder.java#L62-L65 |
112,514 | xiancloud/xian | xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfBuffers.java | GelfBuffers.toUDPBuffers | protected static ByteBuffer[] toUDPBuffers(GelfMessage message, ThreadLocal<ByteBuffer> writeBuffers,
ThreadLocal<ByteBuffer> tempBuffers) {
while (true) {
try {
return message.toUDPBuffers(getBuffer(writeBuffers), getBuffer(tempBuffers));
} catch (BufferOve... | java | protected static ByteBuffer[] toUDPBuffers(GelfMessage message, ThreadLocal<ByteBuffer> writeBuffers,
ThreadLocal<ByteBuffer> tempBuffers) {
while (true) {
try {
return message.toUDPBuffers(getBuffer(writeBuffers), getBuffer(tempBuffers));
} catch (BufferOve... | [
"protected",
"static",
"ByteBuffer",
"[",
"]",
"toUDPBuffers",
"(",
"GelfMessage",
"message",
",",
"ThreadLocal",
"<",
"ByteBuffer",
">",
"writeBuffers",
",",
"ThreadLocal",
"<",
"ByteBuffer",
">",
"tempBuffers",
")",
"{",
"while",
"(",
"true",
")",
"{",
"try"... | Create UDP buffers and apply auto-buffer-enlarging, if necessary.
@param message
@param writeBuffers
@param tempBuffers
@return | [
"Create",
"UDP",
"buffers",
"and",
"apply",
"auto",
"-",
"buffer",
"-",
"enlarging",
"if",
"necessary",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfBuffers.java#L25-L37 |
112,515 | xiancloud/xian | xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfBuffers.java | GelfBuffers.toTCPBuffer | protected static ByteBuffer toTCPBuffer(GelfMessage message, ThreadLocal<ByteBuffer> writeBuffers) {
while (true) {
try {
return message.toTCPBuffer(getBuffer(writeBuffers));
} catch (BufferOverflowException e) {
enlargeBuffer(writeBuffers);
... | java | protected static ByteBuffer toTCPBuffer(GelfMessage message, ThreadLocal<ByteBuffer> writeBuffers) {
while (true) {
try {
return message.toTCPBuffer(getBuffer(writeBuffers));
} catch (BufferOverflowException e) {
enlargeBuffer(writeBuffers);
... | [
"protected",
"static",
"ByteBuffer",
"toTCPBuffer",
"(",
"GelfMessage",
"message",
",",
"ThreadLocal",
"<",
"ByteBuffer",
">",
"writeBuffers",
")",
"{",
"while",
"(",
"true",
")",
"{",
"try",
"{",
"return",
"message",
".",
"toTCPBuffer",
"(",
"getBuffer",
"(",... | Create TCP buffer and apply auto-buffer-enlarging, if necessary.
@param message
@param writeBuffers
@return | [
"Create",
"TCP",
"buffer",
"and",
"apply",
"auto",
"-",
"buffer",
"-",
"enlarging",
"if",
"necessary",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/sender/GelfBuffers.java#L46-L56 |
112,516 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/util/Xmap.java | Xmap.create | public static <K, V> Xmap<K, V> create(Map<K, V> map) {
Xmap<K, V> xmap = new Xmap<>();
xmap.putAll(map);
return xmap;
} | java | public static <K, V> Xmap<K, V> create(Map<K, V> map) {
Xmap<K, V> xmap = new Xmap<>();
xmap.putAll(map);
return xmap;
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"Xmap",
"<",
"K",
",",
"V",
">",
"create",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"map",
")",
"{",
"Xmap",
"<",
"K",
",",
"V",
">",
"xmap",
"=",
"new",
"Xmap",
"<>",
"(",
")",
";",
"xmap",
".",
... | Clone a Xmap with all entries in the parameter 'map'. | [
"Clone",
"a",
"Xmap",
"with",
"all",
"entries",
"in",
"the",
"parameter",
"map",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/Xmap.java#L60-L64 |
112,517 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/support/cos/CloudFile.java | CloudFile.exists | public static Single<Boolean> exists(String path) {
return SingleRxXian.call("cosService", "cosCheckFileExists", new JSONObject() {{
put("path", path);
}}).map(UnitResponse::dataToBoolean);
} | java | public static Single<Boolean> exists(String path) {
return SingleRxXian.call("cosService", "cosCheckFileExists", new JSONObject() {{
put("path", path);
}}).map(UnitResponse::dataToBoolean);
} | [
"public",
"static",
"Single",
"<",
"Boolean",
">",
"exists",
"(",
"String",
"path",
")",
"{",
"return",
"SingleRxXian",
".",
"call",
"(",
"\"cosService\"",
",",
"\"cosCheckFileExists\"",
",",
"new",
"JSONObject",
"(",
")",
"{",
"{",
"put",
"(",
"\"path\"",
... | check whether the cos file exists
@param path the cos path
@return true if exits, false if not exits, error on exception. | [
"check",
"whether",
"the",
"cos",
"file",
"exists"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cos/CloudFile.java#L84-L88 |
112,518 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/LocalUnitsManager.java | LocalUnitsManager.replaceUnit | public static void replaceUnit(/*String group, String unitName, */ Unit newUnit) {
String group = newUnit.getGroup().getName(), unitName = newUnit.getName();
readWriteLock.writeLock().lock();
try {
//unitMap
List<Unit> unitList = unitMap.get(group);
unitList.r... | java | public static void replaceUnit(/*String group, String unitName, */ Unit newUnit) {
String group = newUnit.getGroup().getName(), unitName = newUnit.getName();
readWriteLock.writeLock().lock();
try {
//unitMap
List<Unit> unitList = unitMap.get(group);
unitList.r... | [
"public",
"static",
"void",
"replaceUnit",
"(",
"/*String group, String unitName, */",
"Unit",
"newUnit",
")",
"{",
"String",
"group",
"=",
"newUnit",
".",
"getGroup",
"(",
")",
".",
"getName",
"(",
")",
",",
"unitName",
"=",
"newUnit",
".",
"getName",
"(",
... | Dynamically change the unit collections. Currently we use this for aop. | [
"Dynamically",
"change",
"the",
"unit",
"collections",
".",
"Currently",
"we",
"use",
"this",
"for",
"aop",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/LocalUnitsManager.java#L129-L154 |
112,519 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/LocalUnitsManager.java | LocalUnitsManager.getGroupByUnitClass | public static Group getGroupByUnitClass(Class<? extends Unit> unitClass) {
readWriteLock.readLock().lock();
try {
return searchGroupByUnitClass.get(unitClass);
} finally {
readWriteLock.readLock().unlock();
}
} | java | public static Group getGroupByUnitClass(Class<? extends Unit> unitClass) {
readWriteLock.readLock().lock();
try {
return searchGroupByUnitClass.get(unitClass);
} finally {
readWriteLock.readLock().unlock();
}
} | [
"public",
"static",
"Group",
"getGroupByUnitClass",
"(",
"Class",
"<",
"?",
"extends",
"Unit",
">",
"unitClass",
")",
"{",
"readWriteLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"searchGroupByUnitClass",
".",
"get",
"... | return the cached group singleton of the given unit class. | [
"return",
"the",
"cached",
"group",
"singleton",
"of",
"the",
"given",
"unit",
"class",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/LocalUnitsManager.java#L159-L166 |
112,520 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/LocalUnitsManager.java | LocalUnitsManager.getUnitByUnitClass | public static Unit getUnitByUnitClass(Class<? extends Unit> unitClass) {
readWriteLock.readLock().lock();
try {
return searchUnitByClass.get(unitClass);
} finally {
readWriteLock.readLock().unlock();
}
} | java | public static Unit getUnitByUnitClass(Class<? extends Unit> unitClass) {
readWriteLock.readLock().lock();
try {
return searchUnitByClass.get(unitClass);
} finally {
readWriteLock.readLock().unlock();
}
} | [
"public",
"static",
"Unit",
"getUnitByUnitClass",
"(",
"Class",
"<",
"?",
"extends",
"Unit",
">",
"unitClass",
")",
"{",
"readWriteLock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"searchUnitByClass",
".",
"get",
"(",
"... | return the cached unit singleton of the given unit class. | [
"return",
"the",
"cached",
"unit",
"singleton",
"of",
"the",
"given",
"unit",
"class",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/LocalUnitsManager.java#L171-L178 |
112,521 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/EnsurePath.java | EnsurePath.ensure | public void ensure(CuratorZookeeperClient client) throws Exception
{
Helper localHelper = helper.get();
localHelper.ensure(client, path, makeLastNode);
} | java | public void ensure(CuratorZookeeperClient client) throws Exception
{
Helper localHelper = helper.get();
localHelper.ensure(client, path, makeLastNode);
} | [
"public",
"void",
"ensure",
"(",
"CuratorZookeeperClient",
"client",
")",
"throws",
"Exception",
"{",
"Helper",
"localHelper",
"=",
"helper",
".",
"get",
"(",
")",
";",
"localHelper",
".",
"ensure",
"(",
"client",
",",
"path",
",",
"makeLastNode",
")",
";",
... | First time, synchronizes and makes sure all nodes in the path are created. Subsequent calls
with this instance are NOPs.
@param client ZK client
@throws Exception ZK errors | [
"First",
"time",
"synchronizes",
"and",
"makes",
"sure",
"all",
"nodes",
"in",
"the",
"path",
"are",
"created",
".",
"Subsequent",
"calls",
"with",
"this",
"instance",
"are",
"NOPs",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/EnsurePath.java#L99-L103 |
112,522 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/support/authen/RandomGenerator.java | RandomGenerator.generateDigitsString | public static String generateDigitsString(int length) {
StringBuffer buf = new StringBuffer(length);
SecureRandom rand = new SecureRandom();
for (int i = 0; i < length; i++) {
buf.append(rand.nextInt(digits.length));
}
return buf.toString();
} | java | public static String generateDigitsString(int length) {
StringBuffer buf = new StringBuffer(length);
SecureRandom rand = new SecureRandom();
for (int i = 0; i < length; i++) {
buf.append(rand.nextInt(digits.length));
}
return buf.toString();
} | [
"public",
"static",
"String",
"generateDigitsString",
"(",
"int",
"length",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
"length",
")",
";",
"SecureRandom",
"rand",
"=",
"new",
"SecureRandom",
"(",
")",
";",
"for",
"(",
"int",
"i",
"="... | Generates random string that contains digits only.
@param length the length of the generated string
@return random string | [
"Generates",
"random",
"string",
"that",
"contains",
"digits",
"only",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/authen/RandomGenerator.java#L106-L113 |
112,523 | xiancloud/xian | xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/pool/XianDataSource.java | XianDataSource.getHost | public String getHost() {
String hostAndPort = hostAndPort();
int indexOfMaohao = hostAndPort.indexOf(":");
if (indexOfMaohao == -1) {
return hostAndPort;
} else {
return hostAndPort.substring(0, indexOfMaohao);
}
} | java | public String getHost() {
String hostAndPort = hostAndPort();
int indexOfMaohao = hostAndPort.indexOf(":");
if (indexOfMaohao == -1) {
return hostAndPort;
} else {
return hostAndPort.substring(0, indexOfMaohao);
}
} | [
"public",
"String",
"getHost",
"(",
")",
"{",
"String",
"hostAndPort",
"=",
"hostAndPort",
"(",
")",
";",
"int",
"indexOfMaohao",
"=",
"hostAndPort",
".",
"indexOf",
"(",
"\":\"",
")",
";",
"if",
"(",
"indexOfMaohao",
"==",
"-",
"1",
")",
"{",
"return",
... | parse database url and get the host.
@return the database host | [
"parse",
"database",
"url",
"and",
"get",
"the",
"host",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/pool/XianDataSource.java#L43-L51 |
112,524 | xiancloud/xian | xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/pool/XianDataSource.java | XianDataSource.getPort | public int getPort() {
String hostAndPort = hostAndPort();
int indexOfMaohao = hostAndPort.indexOf(":");
if (indexOfMaohao == -1) {
return 3306;
} else {
return Integer.parseInt(hostAndPort.substring(indexOfMaohao + 1));
}
} | java | public int getPort() {
String hostAndPort = hostAndPort();
int indexOfMaohao = hostAndPort.indexOf(":");
if (indexOfMaohao == -1) {
return 3306;
} else {
return Integer.parseInt(hostAndPort.substring(indexOfMaohao + 1));
}
} | [
"public",
"int",
"getPort",
"(",
")",
"{",
"String",
"hostAndPort",
"=",
"hostAndPort",
"(",
")",
";",
"int",
"indexOfMaohao",
"=",
"hostAndPort",
".",
"indexOf",
"(",
"\":\"",
")",
";",
"if",
"(",
"indexOfMaohao",
"==",
"-",
"1",
")",
"{",
"return",
"... | parse the database url and get the port.
@return the port | [
"parse",
"the",
"database",
"url",
"and",
"get",
"the",
"port",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/pool/XianDataSource.java#L58-L66 |
112,525 | xiancloud/xian | xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/pool/XianDataSource.java | XianDataSource.hostAndPort | private String hostAndPort() {
int start = url.indexOf("://") + 3;
int end = url.indexOf("/", start);
return url.substring(start, end);
} | java | private String hostAndPort() {
int start = url.indexOf("://") + 3;
int end = url.indexOf("/", start);
return url.substring(start, end);
} | [
"private",
"String",
"hostAndPort",
"(",
")",
"{",
"int",
"start",
"=",
"url",
".",
"indexOf",
"(",
"\"://\"",
")",
"+",
"3",
";",
"int",
"end",
"=",
"url",
".",
"indexOf",
"(",
"\"/\"",
",",
"start",
")",
";",
"return",
"url",
".",
"substring",
"(... | parse the url and get the host and port string.
@return the host:port string | [
"parse",
"the",
"url",
"and",
"get",
"the",
"host",
"and",
"port",
"string",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/pool/XianDataSource.java#L73-L77 |
112,526 | xiancloud/xian | xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/pool/XianDataSource.java | XianDataSource.getDatabase | public String getDatabase() {
int indexSlash = url.indexOf("/", url.indexOf("://") + 3);
int questionMarkIndex = url.indexOf("?");
if (questionMarkIndex != -1) {
return url.substring(indexSlash + 1, questionMarkIndex);
} else {
return url.substring(indexSlash + 1)... | java | public String getDatabase() {
int indexSlash = url.indexOf("/", url.indexOf("://") + 3);
int questionMarkIndex = url.indexOf("?");
if (questionMarkIndex != -1) {
return url.substring(indexSlash + 1, questionMarkIndex);
} else {
return url.substring(indexSlash + 1)... | [
"public",
"String",
"getDatabase",
"(",
")",
"{",
"int",
"indexSlash",
"=",
"url",
".",
"indexOf",
"(",
"\"/\"",
",",
"url",
".",
"indexOf",
"(",
"\"://\"",
")",
"+",
"3",
")",
";",
"int",
"questionMarkIndex",
"=",
"url",
".",
"indexOf",
"(",
"\"?\"",
... | parse the databse url and get he database name
@return the database name | [
"parse",
"the",
"databse",
"url",
"and",
"get",
"he",
"database",
"name"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/pool/XianDataSource.java#L84-L92 |
112,527 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/util/thread/MsgIdHolder.java | MsgIdHolder.set | public static boolean set(String value) {
if (StringUtil.isEmpty(value)) {
throw new IllegalArgumentException("Can not set an empty msgId. If you want to clear msgId of current context, use clear() instead.");
}
if (Objects.equals(value, MsgIdHolder.get())) {
//no need ma... | java | public static boolean set(String value) {
if (StringUtil.isEmpty(value)) {
throw new IllegalArgumentException("Can not set an empty msgId. If you want to clear msgId of current context, use clear() instead.");
}
if (Objects.equals(value, MsgIdHolder.get())) {
//no need ma... | [
"public",
"static",
"boolean",
"set",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"value",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Can not set an empty msgId. If you want to clear msgId of current context, u... | Set the msg id of current context
@param value the msg id, can not be null
@return false if old value is the same as new value, true otherwise. | [
"Set",
"the",
"msg",
"id",
"of",
"current",
"context"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/thread/MsgIdHolder.java#L58-L70 |
112,528 | xiancloud/xian | xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/utils/SqlUtils.java | SqlUtils.formatMap | public static Map formatMap(Map conditionMap) {
Map formattedMap = new HashMap();
formattedMap.putAll(conditionMap);
forSpecialValue(formattedMap);
return formattedMap;
} | java | public static Map formatMap(Map conditionMap) {
Map formattedMap = new HashMap();
formattedMap.putAll(conditionMap);
forSpecialValue(formattedMap);
return formattedMap;
} | [
"public",
"static",
"Map",
"formatMap",
"(",
"Map",
"conditionMap",
")",
"{",
"Map",
"formattedMap",
"=",
"new",
"HashMap",
"(",
")",
";",
"formattedMap",
".",
"putAll",
"(",
"conditionMap",
")",
";",
"forSpecialValue",
"(",
"formattedMap",
")",
";",
"return... | format query map
@param conditionMap query condition map
@return a new shallow-cloned map with values formatted | [
"format",
"query",
"map"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-dao/xian-daocore/src/main/java/info/xiancloud/dao/core/utils/SqlUtils.java#L71-L76 |
112,529 | xiancloud/xian | xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/GelfMessageBuilder.java | GelfMessageBuilder.withField | public GelfMessageBuilder withField(String key, String value) {
this.additionalFields.put(key, value);
return this;
} | java | public GelfMessageBuilder withField(String key, String value) {
this.additionalFields.put(key, value);
return this;
} | [
"public",
"GelfMessageBuilder",
"withField",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"this",
".",
"additionalFields",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Add an additional field.
@param key the key
@param value the value
@return GelfMessageBuilder | [
"Add",
"an",
"additional",
"field",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/GelfMessageBuilder.java#L145-L148 |
112,530 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessMutex.java | InterProcessMutex.release | @Override
public void release() throws Exception
{
/*
Note on concurrency: a given lockData instance
can be only acted on by a single thread so locking isn't necessary
*/
Thread currentThread = Thread.currentThread();
LockData lockData = threadData.get(c... | java | @Override
public void release() throws Exception
{
/*
Note on concurrency: a given lockData instance
can be only acted on by a single thread so locking isn't necessary
*/
Thread currentThread = Thread.currentThread();
LockData lockData = threadData.get(c... | [
"@",
"Override",
"public",
"void",
"release",
"(",
")",
"throws",
"Exception",
"{",
"/*\n Note on concurrency: a given lockData instance\n can be only acted on by a single thread so locking isn't necessary\n */",
"Thread",
"currentThread",
"=",
"Thread",
"... | Perform one release of the mutex if the calling thread is the same thread that acquired it. If the
thread had made multiple calls to acquire, the mutex will still be held when this method returns.
@throws Exception ZK errors, interruptions, current thread does not own the lock | [
"Perform",
"one",
"release",
"of",
"the",
"mutex",
"if",
"the",
"calling",
"thread",
"is",
"the",
"same",
"thread",
"that",
"acquired",
"it",
".",
"If",
"the",
"thread",
"had",
"made",
"multiple",
"calls",
"to",
"acquire",
"the",
"mutex",
"will",
"still",
... | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessMutex.java#L128-L160 |
112,531 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessMutex.java | InterProcessMutex.getParticipantNodes | public Collection<String> getParticipantNodes() throws Exception
{
return LockInternals.getParticipantNodes(internals.getClient(), basePath, internals.getLockName(), internals.getDriver());
} | java | public Collection<String> getParticipantNodes() throws Exception
{
return LockInternals.getParticipantNodes(internals.getClient(), basePath, internals.getLockName(), internals.getDriver());
} | [
"public",
"Collection",
"<",
"String",
">",
"getParticipantNodes",
"(",
")",
"throws",
"Exception",
"{",
"return",
"LockInternals",
".",
"getParticipantNodes",
"(",
"internals",
".",
"getClient",
"(",
")",
",",
"basePath",
",",
"internals",
".",
"getLockName",
"... | Return a sorted list of all current nodes participating in the lock
@return list of nodes
@throws Exception ZK errors, interruptions, etc. | [
"Return",
"a",
"sorted",
"list",
"of",
"all",
"current",
"nodes",
"participating",
"in",
"the",
"lock"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessMutex.java#L168-L171 |
112,532 | xiancloud/xian | xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/validator/InputValidator.java | InputValidator.validate | public static <T> T validate(InputStream input, final Class<T> clazz) throws IOException {
return JSON.parseObject(input, clazz);
} | java | public static <T> T validate(InputStream input, final Class<T> clazz) throws IOException {
return JSON.parseObject(input, clazz);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"validate",
"(",
"InputStream",
"input",
",",
"final",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"IOException",
"{",
"return",
"JSON",
".",
"parseObject",
"(",
"input",
",",
"clazz",
")",
";",
"}"
] | Validates an input and returns an instance of a given class constructed from the input.
@param input the input to be validated
@param clazz the class to be used to create an instance from the input
@return an instance created from the input
@throws IOException ioException | [
"Validates",
"an",
"input",
"and",
"returns",
"an",
"instance",
"of",
"a",
"given",
"class",
"constructed",
"from",
"the",
"input",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-oauth20/xian-apifestOauth20/src/main/java/com/apifest/oauth20/validator/InputValidator.java#L38-L40 |
112,533 | xiancloud/xian | xian-monitor/src/main/java/info/xiancloud/plugin/monitor/common/StaticNodeIdManager.java | StaticNodeIdManager.getStaticNodeId | public static String getStaticNodeId(String nodeId) {
String application = NodeIdBean.parse(nodeId).getApplication();
if (nodeId_to_StaticFinalId_map.get(nodeId) == null) {
Instance<NodeStatus> instance = ApplicationDiscovery.singleton.instance(nodeId);
if (instance != null) {
... | java | public static String getStaticNodeId(String nodeId) {
String application = NodeIdBean.parse(nodeId).getApplication();
if (nodeId_to_StaticFinalId_map.get(nodeId) == null) {
Instance<NodeStatus> instance = ApplicationDiscovery.singleton.instance(nodeId);
if (instance != null) {
... | [
"public",
"static",
"String",
"getStaticNodeId",
"(",
"String",
"nodeId",
")",
"{",
"String",
"application",
"=",
"NodeIdBean",
".",
"parse",
"(",
"nodeId",
")",
".",
"getApplication",
"(",
")",
";",
"if",
"(",
"nodeId_to_StaticFinalId_map",
".",
"get",
"(",
... | Lasy-create staticNodeId for the given node id.
@param nodeId the node id generated by the node itself.
@return the staticNodeId eg. payment---0 | [
"Lasy",
"-",
"create",
"staticNodeId",
"for",
"the",
"given",
"node",
"id",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-monitor/src/main/java/info/xiancloud/plugin/monitor/common/StaticNodeIdManager.java#L47-L61 |
112,534 | xiancloud/xian | xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/PoolingGelfMessageBuilder.java | PoolingGelfMessageBuilder.build | public GelfMessage build() {
GelfMessage gelfMessage = new PoolingGelfMessage(shortMessage, fullMessage, javaTimestamp, level, poolHolder);
gelfMessage.addFields(additionalFields);
gelfMessage.setMaximumMessageSize(maximumMessageSize);
gelfMessage.setVersion(version);
gelfMessag... | java | public GelfMessage build() {
GelfMessage gelfMessage = new PoolingGelfMessage(shortMessage, fullMessage, javaTimestamp, level, poolHolder);
gelfMessage.addFields(additionalFields);
gelfMessage.setMaximumMessageSize(maximumMessageSize);
gelfMessage.setVersion(version);
gelfMessag... | [
"public",
"GelfMessage",
"build",
"(",
")",
"{",
"GelfMessage",
"gelfMessage",
"=",
"new",
"PoolingGelfMessage",
"(",
"shortMessage",
",",
"fullMessage",
",",
"javaTimestamp",
",",
"level",
",",
"poolHolder",
")",
";",
"gelfMessage",
".",
"addFields",
"(",
"addi... | Build a new Gelf message based on the builder settings.
@return GelfMessage | [
"Build",
"a",
"new",
"Gelf",
"message",
"based",
"on",
"the",
"builder",
"settings",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-log/xian-gelf-common/src/main/java/biz/paluch/logging/gelf/intern/PoolingGelfMessageBuilder.java#L74-L86 |
112,535 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/util/Reflection.java | Reflection.getNonAbstractSubclasses | public static <T> Set<Class<? extends T>> getNonAbstractSubclasses(Class<T> clazz) {
return ClassGraphUtil/*TraverseClasspath*/.getNonAbstractSubClasses(clazz);
} | java | public static <T> Set<Class<? extends T>> getNonAbstractSubclasses(Class<T> clazz) {
return ClassGraphUtil/*TraverseClasspath*/.getNonAbstractSubClasses(clazz);
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"Class",
"<",
"?",
"extends",
"T",
">",
">",
"getNonAbstractSubclasses",
"(",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"return",
"ClassGraphUtil",
"/*TraverseClasspath*/",
".",
"getNonAbstractSubClasses",
"(",
... | scan and get the concrete subclasses.
Note
1. we only scan for the default package.
2. This method is too expensive, it is advised to cache the result.
@param clazz parent class
@param <T> parent class generic type
@return a set of concret subclasses. | [
"scan",
"and",
"get",
"the",
"concrete",
"subclasses",
".",
"Note",
"1",
".",
"we",
"only",
"scan",
"for",
"the",
"default",
"package",
".",
"2",
".",
"This",
"method",
"is",
"too",
"expensive",
"it",
"is",
"advised",
"to",
"cache",
"the",
"result",
".... | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/Reflection.java#L64-L66 |
112,536 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/util/Reflection.java | Reflection.getWithAnnotatedClass | public static <T> List<T> getWithAnnotatedClass(Class annotationClass, String packages) {
return new ArrayList<T>() {{
addAll(ClassGraphUtil.getWithAnnotatedClass(annotationClass, packages));
}};
} | java | public static <T> List<T> getWithAnnotatedClass(Class annotationClass, String packages) {
return new ArrayList<T>() {{
addAll(ClassGraphUtil.getWithAnnotatedClass(annotationClass, packages));
}};
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"getWithAnnotatedClass",
"(",
"Class",
"annotationClass",
",",
"String",
"packages",
")",
"{",
"return",
"new",
"ArrayList",
"<",
"T",
">",
"(",
")",
"{",
"{",
"addAll",
"(",
"ClassGraphUtil",
"."... | Scan and get classes under certain annotation, and initiate them.
Note that we only scan for the default package. | [
"Scan",
"and",
"get",
"classes",
"under",
"certain",
"annotation",
"and",
"initiate",
"them",
".",
"Note",
"that",
"we",
"only",
"scan",
"for",
"the",
"default",
"package",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/Reflection.java#L72-L76 |
112,537 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/util/Reflection.java | Reflection.getPrimitiveType | public static Class getPrimitiveType(Class type) {
if (type == int.class || type == Integer.class) {
return int.class;
} else if (type == long.class || type == Long.class) {
return long.class;
} else if (type == short.class || type == Short.class) {
return sho... | java | public static Class getPrimitiveType(Class type) {
if (type == int.class || type == Integer.class) {
return int.class;
} else if (type == long.class || type == Long.class) {
return long.class;
} else if (type == short.class || type == Short.class) {
return sho... | [
"public",
"static",
"Class",
"getPrimitiveType",
"(",
"Class",
"type",
")",
"{",
"if",
"(",
"type",
"==",
"int",
".",
"class",
"||",
"type",
"==",
"Integer",
".",
"class",
")",
"{",
"return",
"int",
".",
"class",
";",
"}",
"else",
"if",
"(",
"type",
... | getPrimitiveType of the given class
@param type the given class.
@return the primitive of the given class, eg. Integer/int to int, Double/double to double etc...
@throws IllegalArgumentException if the given class can not be unpacked to primitive type. | [
"getPrimitiveType",
"of",
"the",
"given",
"class"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/Reflection.java#L165-L184 |
112,538 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/util/Reflection.java | Reflection.cast | @SuppressWarnings("unchecked")
private static <T> T cast(Object obj, Class<T> clazz) {
if (obj == null) {
return null;
}
if (clazz == null) {
throw new IllegalArgumentException("parameter 'Class<T> clazz' is not allowed to be null.");
}
if (clazz.isEnu... | java | @SuppressWarnings("unchecked")
private static <T> T cast(Object obj, Class<T> clazz) {
if (obj == null) {
return null;
}
if (clazz == null) {
throw new IllegalArgumentException("parameter 'Class<T> clazz' is not allowed to be null.");
}
if (clazz.isEnu... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"<",
"T",
">",
"T",
"cast",
"(",
"Object",
"obj",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
... | make a forced class casting.
@param obj the object you want to cast from.
@param clazz the class your want to cast to.
@return The casted object. | [
"make",
"a",
"forced",
"class",
"casting",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/Reflection.java#L193-L225 |
112,539 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/util/Reflection.java | Reflection.toTypedSet | @SuppressWarnings("all")
public static <T> Set<T> toTypedSet(Object data, Class<T> type) {
Set<T> setResult = new HashSet<>();
if (data == null) {
return setResult;
}
if (data instanceof Collection) {
Collection collection = (Collection) data;
for ... | java | @SuppressWarnings("all")
public static <T> Set<T> toTypedSet(Object data, Class<T> type) {
Set<T> setResult = new HashSet<>();
if (data == null) {
return setResult;
}
if (data instanceof Collection) {
Collection collection = (Collection) data;
for ... | [
"@",
"SuppressWarnings",
"(",
"\"all\"",
")",
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"toTypedSet",
"(",
"Object",
"data",
",",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"Set",
"<",
"T",
">",
"setResult",
"=",
"new",
"HashSet",
"<>... | Adapt the data object to the given typed hash set, it is safe to make a cast even if the given data is not a set,
or the element is not the given type.
@param data the guessed data object
@param type the element type
@param <T> the generic type
@return a newly created hash set contains all the data | [
"Adapt",
"the",
"data",
"object",
"to",
"the",
"given",
"typed",
"hash",
"set",
"it",
"is",
"safe",
"to",
"make",
"a",
"cast",
"even",
"if",
"the",
"given",
"data",
"is",
"not",
"a",
"set",
"or",
"the",
"element",
"is",
"not",
"the",
"given",
"type",... | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/Reflection.java#L266-L287 |
112,540 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/util/Reflection.java | Reflection.getAllFieldsRec | private static List<Field> getAllFieldsRec(Class clazz, List<Field> fieldList) {
Class superClazz = clazz.getSuperclass();
if (superClazz != null) {
getAllFieldsRec(superClazz, fieldList);
}
fieldList.addAll(ArrayUtil.toList(clazz.getDeclaredFields(), Field.class));
r... | java | private static List<Field> getAllFieldsRec(Class clazz, List<Field> fieldList) {
Class superClazz = clazz.getSuperclass();
if (superClazz != null) {
getAllFieldsRec(superClazz, fieldList);
}
fieldList.addAll(ArrayUtil.toList(clazz.getDeclaredFields(), Field.class));
r... | [
"private",
"static",
"List",
"<",
"Field",
">",
"getAllFieldsRec",
"(",
"Class",
"clazz",
",",
"List",
"<",
"Field",
">",
"fieldList",
")",
"{",
"Class",
"superClazz",
"=",
"clazz",
".",
"getSuperclass",
"(",
")",
";",
"if",
"(",
"superClazz",
"!=",
"nul... | recursive method. | [
"recursive",
"method",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/Reflection.java#L743-L750 |
112,541 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java | ConnectionStateManager.start | public void start()
{
Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Cannot be started more than once");
service.submit
(
new Callable<Object>()
{
@Override
public Object call() throws E... | java | public void start()
{
Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Cannot be started more than once");
service.submit
(
new Callable<Object>()
{
@Override
public Object call() throws E... | [
"public",
"void",
"start",
"(",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"state",
".",
"compareAndSet",
"(",
"State",
".",
"LATENT",
",",
"State",
".",
"STARTED",
")",
",",
"\"Cannot be started more than once\"",
")",
";",
"service",
".",
"submit",
... | Start the manager | [
"Start",
"the",
"manager"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java#L100-L116 |
112,542 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java | ConnectionStateManager.addStateChange | public synchronized boolean addStateChange(ConnectionState newConnectionState)
{
if ( state.get() != State.STARTED )
{
return false;
}
ConnectionState previousState = currentConnectionState;
if ( previousState == newConnectionState )
{
return ... | java | public synchronized boolean addStateChange(ConnectionState newConnectionState)
{
if ( state.get() != State.STARTED )
{
return false;
}
ConnectionState previousState = currentConnectionState;
if ( previousState == newConnectionState )
{
return ... | [
"public",
"synchronized",
"boolean",
"addStateChange",
"(",
"ConnectionState",
"newConnectionState",
")",
"{",
"if",
"(",
"state",
".",
"get",
"(",
")",
"!=",
"State",
".",
"STARTED",
")",
"{",
"return",
"false",
";",
"}",
"ConnectionState",
"previousState",
"... | Post a state change. If the manager is already in that state the change
is ignored. Otherwise the change is queued for listeners.
@param newConnectionState new state
@return true if the state actually changed, false if it was already at that state | [
"Post",
"a",
"state",
"change",
".",
"If",
"the",
"manager",
"is",
"already",
"in",
"that",
"state",
"the",
"change",
"is",
"ignored",
".",
"Otherwise",
"the",
"change",
"is",
"queued",
"for",
"listeners",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/state/ConnectionStateManager.java#L168-L192 |
112,543 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/ConnectionState.java | ConnectionState.getSessionId | public long getSessionId() {
long sessionId = 0;
try {
ZooKeeper zk = zooKeeper.getZooKeeper();
if (zk != null) {
sessionId = zk.getSessionId();
}
} catch (Exception e) {
// Ignore the exception
}
return sessionId;
... | java | public long getSessionId() {
long sessionId = 0;
try {
ZooKeeper zk = zooKeeper.getZooKeeper();
if (zk != null) {
sessionId = zk.getSessionId();
}
} catch (Exception e) {
// Ignore the exception
}
return sessionId;
... | [
"public",
"long",
"getSessionId",
"(",
")",
"{",
"long",
"sessionId",
"=",
"0",
";",
"try",
"{",
"ZooKeeper",
"zk",
"=",
"zooKeeper",
".",
"getZooKeeper",
"(",
")",
";",
"if",
"(",
"zk",
"!=",
"null",
")",
"{",
"sessionId",
"=",
"zk",
".",
"getSessio... | Return the current session id | [
"Return",
"the",
"current",
"session",
"id"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/ConnectionState.java#L240-L251 |
112,544 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/message/UnitRequest.java | UnitRequest.get | public <T> T get(String key, Class<T> clazz, T defaultValue) {
Object obj = argMap.get(key);
if (obj == null) {
return defaultValue;
}
return Reflection.toType(obj, clazz);
} | java | public <T> T get(String key, Class<T> clazz, T defaultValue) {
Object obj = argMap.get(key);
if (obj == null) {
return defaultValue;
}
return Reflection.toType(obj, clazz);
} | [
"public",
"<",
"T",
">",
"T",
"get",
"(",
"String",
"key",
",",
"Class",
"<",
"T",
">",
"clazz",
",",
"T",
"defaultValue",
")",
"{",
"Object",
"obj",
"=",
"argMap",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"... | Get the specified key's value from the unit input, anc cast it into the type you want.
@return read value from the argMap, if the key doesn't exist or the key's value is null,then the defaultValue is returned. | [
"Get",
"the",
"specified",
"key",
"s",
"value",
"from",
"the",
"unit",
"input",
"anc",
"cast",
"it",
"into",
"the",
"type",
"you",
"want",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitRequest.java#L84-L90 |
112,545 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/message/UnitRequest.java | UnitRequest.getSet | @SuppressWarnings("unchecked")
public <T> Set<T> getSet(String key) {
return Reflection.toType(get(key), Set.class);
} | java | @SuppressWarnings("unchecked")
public <T> Set<T> getSet(String key) {
return Reflection.toType(get(key), Set.class);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"getSet",
"(",
"String",
"key",
")",
"{",
"return",
"Reflection",
".",
"toType",
"(",
"get",
"(",
"key",
")",
",",
"Set",
".",
"class",
")",
";",
"}"... | Get the set. Note you must be sure with the generic type, or a class cast exception will be thrown.
@param key the argument name
@param <T> the generic type
@return the set representing the argument. | [
"Get",
"the",
"set",
".",
"Note",
"you",
"must",
"be",
"sure",
"with",
"the",
"generic",
"type",
"or",
"a",
"class",
"cast",
"exception",
"will",
"be",
"thrown",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitRequest.java#L166-L169 |
112,546 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/message/UnitRequest.java | UnitRequest.getArgBean | public <T> T getArgBean(Class<? extends T> beanClass) {
return Reflection.toType(argMap, beanClass);
} | java | public <T> T getArgBean(Class<? extends T> beanClass) {
return Reflection.toType(argMap, beanClass);
} | [
"public",
"<",
"T",
">",
"T",
"getArgBean",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"beanClass",
")",
"{",
"return",
"Reflection",
".",
"toType",
"(",
"argMap",
",",
"beanClass",
")",
";",
"}"
] | Convert this unit request's argument map into java bean.
@param beanClass the bean type that you want to
@return the casted java bean object. | [
"Convert",
"this",
"unit",
"request",
"s",
"argument",
"map",
"into",
"java",
"bean",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitRequest.java#L177-L179 |
112,547 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/message/UnitRequest.java | UnitRequest.create | public static UnitRequest create(String group, String unit) {
return new UnitRequest().setContext(RequestContext.create().setGroup(group).setUnit(unit));
} | java | public static UnitRequest create(String group, String unit) {
return new UnitRequest().setContext(RequestContext.create().setGroup(group).setUnit(unit));
} | [
"public",
"static",
"UnitRequest",
"create",
"(",
"String",
"group",
",",
"String",
"unit",
")",
"{",
"return",
"new",
"UnitRequest",
"(",
")",
".",
"setContext",
"(",
"RequestContext",
".",
"create",
"(",
")",
".",
"setGroup",
"(",
"group",
")",
".",
"s... | Create a new UnitRequest instance with the group and unit name. | [
"Create",
"a",
"new",
"UnitRequest",
"instance",
"with",
"the",
"group",
"and",
"unit",
"name",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitRequest.java#L193-L195 |
112,548 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/message/UnitRequest.java | UnitRequest.create | public static UnitRequest create(Class<? extends Unit> unitClass) {
Unit unit = LocalUnitsManager.getUnitByUnitClass(unitClass);
return create(unit.getGroup().getName(), unit.getName());
} | java | public static UnitRequest create(Class<? extends Unit> unitClass) {
Unit unit = LocalUnitsManager.getUnitByUnitClass(unitClass);
return create(unit.getGroup().getName(), unit.getName());
} | [
"public",
"static",
"UnitRequest",
"create",
"(",
"Class",
"<",
"?",
"extends",
"Unit",
">",
"unitClass",
")",
"{",
"Unit",
"unit",
"=",
"LocalUnitsManager",
".",
"getUnitByUnitClass",
"(",
"unitClass",
")",
";",
"return",
"create",
"(",
"unit",
".",
"getGro... | Create a new UnitRequest instance by the Unit class. | [
"Create",
"a",
"new",
"UnitRequest",
"instance",
"by",
"the",
"Unit",
"class",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/message/UnitRequest.java#L200-L203 |
112,549 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderLatch.java | LeaderLatch.start | public void start() throws Exception
{
Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Cannot be started more than once");
startTask.set(AfterConnectionEstablished.execute(client, new Runnable()
{
@Override
public v... | java | public void start() throws Exception
{
Preconditions.checkState(state.compareAndSet(State.LATENT, State.STARTED), "Cannot be started more than once");
startTask.set(AfterConnectionEstablished.execute(client, new Runnable()
{
@Override
public v... | [
"public",
"void",
"start",
"(",
")",
"throws",
"Exception",
"{",
"Preconditions",
".",
"checkState",
"(",
"state",
".",
"compareAndSet",
"(",
"State",
".",
"LATENT",
",",
"State",
".",
"STARTED",
")",
",",
"\"Cannot be started more than once\"",
")",
";",
"sta... | Add this instance to the leadership election and attempt to acquire leadership.
@throws Exception errors | [
"Add",
"this",
"instance",
"to",
"the",
"leadership",
"election",
"and",
"attempt",
"to",
"acquire",
"leadership",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderLatch.java#L158-L177 |
112,550 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java | DistributedQueue.start | @Override
public void start() throws Exception
{
if ( !state.compareAndSet(State.LATENT, State.STARTED) )
{
throw new IllegalStateException();
}
try
{
client.create().creatingParentContainersIfNeeded().forPath(queuePath);
}
cat... | java | @Override
public void start() throws Exception
{
if ( !state.compareAndSet(State.LATENT, State.STARTED) )
{
throw new IllegalStateException();
}
try
{
client.create().creatingParentContainersIfNeeded().forPath(queuePath);
}
cat... | [
"@",
"Override",
"public",
"void",
"start",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"!",
"state",
".",
"compareAndSet",
"(",
"State",
".",
"LATENT",
",",
"State",
".",
"STARTED",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
")",
... | Start the queue. No other methods work until this is called
@throws Exception startup errors | [
"Start",
"the",
"queue",
".",
"No",
"other",
"methods",
"work",
"until",
"this",
"is",
"called"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java#L157-L205 |
112,551 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java | DistributedQueue.flushPuts | @Override
public boolean flushPuts(long waitTime, TimeUnit timeUnit) throws InterruptedException
{
long msWaitRemaining = TimeUnit.MILLISECONDS.convert(waitTime, timeUnit);
synchronized(putCount)
{
while ( putCount.get() > 0 )
{
if ( msWaitRemai... | java | @Override
public boolean flushPuts(long waitTime, TimeUnit timeUnit) throws InterruptedException
{
long msWaitRemaining = TimeUnit.MILLISECONDS.convert(waitTime, timeUnit);
synchronized(putCount)
{
while ( putCount.get() > 0 )
{
if ( msWaitRemai... | [
"@",
"Override",
"public",
"boolean",
"flushPuts",
"(",
"long",
"waitTime",
",",
"TimeUnit",
"timeUnit",
")",
"throws",
"InterruptedException",
"{",
"long",
"msWaitRemaining",
"=",
"TimeUnit",
".",
"MILLISECONDS",
".",
"convert",
"(",
"waitTime",
",",
"timeUnit",
... | Wait until any pending puts are committed
@param waitTime max wait time
@param timeUnit time unit
@return true if the flush was successful, false if it timed out first
@throws InterruptedException if thread was interrupted | [
"Wait",
"until",
"any",
"pending",
"puts",
"are",
"committed"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedQueue.java#L268-L290 |
112,552 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedIdQueue.java | DistributedIdQueue.remove | public int remove(String id) throws Exception
{
id = Preconditions.checkNotNull(id, "id cannot be null");
queue.checkState();
int count = 0;
for ( String name : queue.getChildren() )
{
if ( parseId(name).id.equals(id) )
{
if ( que... | java | public int remove(String id) throws Exception
{
id = Preconditions.checkNotNull(id, "id cannot be null");
queue.checkState();
int count = 0;
for ( String name : queue.getChildren() )
{
if ( parseId(name).id.equals(id) )
{
if ( que... | [
"public",
"int",
"remove",
"(",
"String",
"id",
")",
"throws",
"Exception",
"{",
"id",
"=",
"Preconditions",
".",
"checkNotNull",
"(",
"id",
",",
"\"id cannot be null\"",
")",
";",
"queue",
".",
"checkState",
"(",
")",
";",
"int",
"count",
"=",
"0",
";",... | Remove any items with the given Id
@param id item Id to remove
@return number of items removed
@throws Exception errors | [
"Remove",
"any",
"items",
"with",
"the",
"given",
"Id"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-recipes/src/main/java/org/apache/curator/framework/recipes/queue/DistributedIdQueue.java#L172-L191 |
112,553 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/conf/plugin/PluginConfig.java | PluginConfig.extendedKey | private static String extendedKey(Properties properties, String key) {
String extendedKey = extendedKey(key);
return properties.containsKey(extendedKey) ? extendedKey : key;
} | java | private static String extendedKey(Properties properties, String key) {
String extendedKey = extendedKey(key);
return properties.containsKey(extendedKey) ? extendedKey : key;
} | [
"private",
"static",
"String",
"extendedKey",
"(",
"Properties",
"properties",
",",
"String",
"key",
")",
"{",
"String",
"extendedKey",
"=",
"extendedKey",
"(",
"key",
")",
";",
"return",
"properties",
".",
"containsKey",
"(",
"extendedKey",
")",
"?",
"extende... | For internal use only, please do not rely on this method.
@return the environment specific configuration key. The original key will be returned if no prefixed configuration is specified for the current env. | [
"For",
"internal",
"use",
"only",
"please",
"do",
"not",
"rely",
"on",
"this",
"method",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/conf/plugin/PluginConfig.java#L144-L147 |
112,554 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/SessionFailRetryLoop.java | SessionFailRetryLoop.start | public void start()
{
Preconditions.checkState(Thread.currentThread().equals(ourThread), "Not in the correct thread");
client.addParentWatcher(watcher);
} | java | public void start()
{
Preconditions.checkState(Thread.currentThread().equals(ourThread), "Not in the correct thread");
client.addParentWatcher(watcher);
} | [
"public",
"void",
"start",
"(",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"Thread",
".",
"currentThread",
"(",
")",
".",
"equals",
"(",
"ourThread",
")",
",",
"\"Not in the correct thread\"",
")",
";",
"client",
".",
"addParentWatcher",
"(",
"watcher"... | SessionFailRetryLoop must be started | [
"SessionFailRetryLoop",
"must",
"be",
"started"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/SessionFailRetryLoop.java#L190-L195 |
112,555 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/SessionFailRetryLoop.java | SessionFailRetryLoop.close | @Override
public void close()
{
Preconditions.checkState(Thread.currentThread().equals(ourThread), "Not in the correct thread");
failedSessionThreads.remove(ourThread);
client.removeParentWatcher(watcher);
} | java | @Override
public void close()
{
Preconditions.checkState(Thread.currentThread().equals(ourThread), "Not in the correct thread");
failedSessionThreads.remove(ourThread);
client.removeParentWatcher(watcher);
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"Preconditions",
".",
"checkState",
"(",
"Thread",
".",
"currentThread",
"(",
")",
".",
"equals",
"(",
"ourThread",
")",
",",
"\"Not in the correct thread\"",
")",
";",
"failedSessionThreads",
".",
"re... | Must be called in a finally handler when done with the loop | [
"Must",
"be",
"called",
"in",
"a",
"finally",
"handler",
"when",
"done",
"with",
"the",
"loop"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/SessionFailRetryLoop.java#L211-L218 |
112,556 | xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/util/EnvUtil.java | EnvUtil.verifyEnvironment | public static boolean verifyEnvironment() {
if (!PRODUCTION.equals(getEnv())) {
return true;
} else {
File tokenFile = new File("/etc/xian/xian_runtime_production.token");
if (tokenFile.exists() && tokenFile.isFile()) {
String token = PlainFileUtil.rea... | java | public static boolean verifyEnvironment() {
if (!PRODUCTION.equals(getEnv())) {
return true;
} else {
File tokenFile = new File("/etc/xian/xian_runtime_production.token");
if (tokenFile.exists() && tokenFile.isFile()) {
String token = PlainFileUtil.rea... | [
"public",
"static",
"boolean",
"verifyEnvironment",
"(",
")",
"{",
"if",
"(",
"!",
"PRODUCTION",
".",
"equals",
"(",
"getEnv",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"File",
"tokenFile",
"=",
"new",
"File",
"(",
"\"/etc/xian/... | Production safety check. Protection for production env. | [
"Production",
"safety",
"check",
".",
"Protection",
"for",
"production",
"env",
"."
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/util/EnvUtil.java#L198-L209 |
112,557 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java | CuratorFrameworkFactory.newClient | public static CuratorFramework newClient(String connectString, RetryPolicy retryPolicy)
{
return newClient(connectString, DEFAULT_SESSION_TIMEOUT_MS, DEFAULT_CONNECTION_TIMEOUT_MS, retryPolicy);
} | java | public static CuratorFramework newClient(String connectString, RetryPolicy retryPolicy)
{
return newClient(connectString, DEFAULT_SESSION_TIMEOUT_MS, DEFAULT_CONNECTION_TIMEOUT_MS, retryPolicy);
} | [
"public",
"static",
"CuratorFramework",
"newClient",
"(",
"String",
"connectString",
",",
"RetryPolicy",
"retryPolicy",
")",
"{",
"return",
"newClient",
"(",
"connectString",
",",
"DEFAULT_SESSION_TIMEOUT_MS",
",",
"DEFAULT_CONNECTION_TIMEOUT_MS",
",",
"retryPolicy",
")",... | Create a new client with default session timeout and default connection timeout
@param connectString list of servers to connect to
@param retryPolicy retry policy to use
@return client | [
"Create",
"a",
"new",
"client",
"with",
"default",
"session",
"timeout",
"and",
"default",
"connection",
"timeout"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java#L79-L82 |
112,558 | xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java | CuratorFrameworkFactory.newClient | public static CuratorFramework newClient(String connectString, int sessionTimeoutMs, int connectionTimeoutMs, RetryPolicy retryPolicy)
{
return builder().
connectString(connectString).
sessionTimeoutMs(sessionTimeoutMs).
connectionTimeoutMs(connectionTimeoutMs).
... | java | public static CuratorFramework newClient(String connectString, int sessionTimeoutMs, int connectionTimeoutMs, RetryPolicy retryPolicy)
{
return builder().
connectString(connectString).
sessionTimeoutMs(sessionTimeoutMs).
connectionTimeoutMs(connectionTimeoutMs).
... | [
"public",
"static",
"CuratorFramework",
"newClient",
"(",
"String",
"connectString",
",",
"int",
"sessionTimeoutMs",
",",
"int",
"connectionTimeoutMs",
",",
"RetryPolicy",
"retryPolicy",
")",
"{",
"return",
"builder",
"(",
")",
".",
"connectString",
"(",
"connectStr... | Create a new client
@param connectString list of servers to connect to
@param sessionTimeoutMs session timeout
@param connectionTimeoutMs connection timeout
@param retryPolicy retry policy to use
@return client | [
"Create",
"a",
"new",
"client"
] | 1948e088545553d2745b2c86d8b5a64988bb850e | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-framework/src/main/java/org/apache/curator/framework/CuratorFrameworkFactory.java#L93-L101 |
112,559 | rampatra/jbot | jbot-example/src/main/java/example/jbot/slack/SlackWebhooks.java | SlackWebhooks.invokeSlackWebhook | @PostConstruct
public void invokeSlackWebhook() {
RestTemplate restTemplate = new RestTemplate();
RichMessage richMessage = new RichMessage("Just to test Slack's incoming webhooks.");
// set attachments
Attachment[] attachments = new Attachment[1];
attachments[0] = new Attach... | java | @PostConstruct
public void invokeSlackWebhook() {
RestTemplate restTemplate = new RestTemplate();
RichMessage richMessage = new RichMessage("Just to test Slack's incoming webhooks.");
// set attachments
Attachment[] attachments = new Attachment[1];
attachments[0] = new Attach... | [
"@",
"PostConstruct",
"public",
"void",
"invokeSlackWebhook",
"(",
")",
"{",
"RestTemplate",
"restTemplate",
"=",
"new",
"RestTemplate",
"(",
")",
";",
"RichMessage",
"richMessage",
"=",
"new",
"RichMessage",
"(",
"\"Just to test Slack's incoming webhooks.\"",
")",
";... | Make a POST call to the incoming webhook url. | [
"Make",
"a",
"POST",
"call",
"to",
"the",
"incoming",
"webhook",
"url",
"."
] | 0f42e1a6ec4dcbc5d1257e1307704903e771f7b5 | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot-example/src/main/java/example/jbot/slack/SlackWebhooks.java#L44-L67 |
112,560 | rampatra/jbot | jbot/src/main/java/me/ramswaroop/jbot/core/slack/Bot.java | Bot.afterConnectionClosed | public void afterConnectionClosed(WebSocketSession session, CloseStatus status) {
logger.debug("WebSocket closed: {}, Close Status: {}", session, status.toString());
} | java | public void afterConnectionClosed(WebSocketSession session, CloseStatus status) {
logger.debug("WebSocket closed: {}, Close Status: {}", session, status.toString());
} | [
"public",
"void",
"afterConnectionClosed",
"(",
"WebSocketSession",
"session",
",",
"CloseStatus",
"status",
")",
"{",
"logger",
".",
"debug",
"(",
"\"WebSocket closed: {}, Close Status: {}\"",
",",
"session",
",",
"status",
".",
"toString",
"(",
")",
")",
";",
"}... | Invoked after the web socket connection is closed.
You can override this method in the child classes.
@param session websocket session between bot and slack
@param status websocket close status
@see WebSocketHandler#afterConnectionClosed | [
"Invoked",
"after",
"the",
"web",
"socket",
"connection",
"is",
"closed",
".",
"You",
"can",
"override",
"this",
"method",
"in",
"the",
"child",
"classes",
"."
] | 0f42e1a6ec4dcbc5d1257e1307704903e771f7b5 | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot/src/main/java/me/ramswaroop/jbot/core/slack/Bot.java#L104-L106 |
112,561 | rampatra/jbot | jbot/src/main/java/me/ramswaroop/jbot/core/slack/Bot.java | Bot.startRTMAndWebSocketConnection | @PostConstruct
protected void startRTMAndWebSocketConnection() {
slackService.connectRTM(getSlackToken());
if (slackService.getWebSocketUrl() != null) {
webSocketManager = new WebSocketConnectionManager(client(), handler(), slackService.getWebSocketUrl());
webSocketManager.st... | java | @PostConstruct
protected void startRTMAndWebSocketConnection() {
slackService.connectRTM(getSlackToken());
if (slackService.getWebSocketUrl() != null) {
webSocketManager = new WebSocketConnectionManager(client(), handler(), slackService.getWebSocketUrl());
webSocketManager.st... | [
"@",
"PostConstruct",
"protected",
"void",
"startRTMAndWebSocketConnection",
"(",
")",
"{",
"slackService",
".",
"connectRTM",
"(",
"getSlackToken",
"(",
")",
")",
";",
"if",
"(",
"slackService",
".",
"getWebSocketUrl",
"(",
")",
"!=",
"null",
")",
"{",
"webSo... | Entry point where the web socket connection starts
and after which your bot becomes live. | [
"Entry",
"point",
"where",
"the",
"web",
"socket",
"connection",
"starts",
"and",
"after",
"which",
"your",
"bot",
"becomes",
"live",
"."
] | 0f42e1a6ec4dcbc5d1257e1307704903e771f7b5 | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot/src/main/java/me/ramswaroop/jbot/core/slack/Bot.java#L311-L320 |
112,562 | rampatra/jbot | jbot-example/src/main/java/example/jbot/facebook/FbBot.java | FbBot.onReceiveQuickReply | @Controller(events = EventType.QUICK_REPLY, pattern = "(yes|no)")
public void onReceiveQuickReply(Event event) {
if ("yes".equals(event.getMessage().getQuickReply().getPayload())) {
reply(event, "Cool! You can type: \n 1) Show Buttons \n 2) Show List \n 3) Setup meeting");
} else {
... | java | @Controller(events = EventType.QUICK_REPLY, pattern = "(yes|no)")
public void onReceiveQuickReply(Event event) {
if ("yes".equals(event.getMessage().getQuickReply().getPayload())) {
reply(event, "Cool! You can type: \n 1) Show Buttons \n 2) Show List \n 3) Setup meeting");
} else {
... | [
"@",
"Controller",
"(",
"events",
"=",
"EventType",
".",
"QUICK_REPLY",
",",
"pattern",
"=",
"\"(yes|no)\"",
")",
"public",
"void",
"onReceiveQuickReply",
"(",
"Event",
"event",
")",
"{",
"if",
"(",
"\"yes\"",
".",
"equals",
"(",
"event",
".",
"getMessage",
... | This method gets invoked when the user clicks on a quick reply button whose payload is either "yes" or "no".
@param event | [
"This",
"method",
"gets",
"invoked",
"when",
"the",
"user",
"clicks",
"on",
"a",
"quick",
"reply",
"button",
"whose",
"payload",
"is",
"either",
"yes",
"or",
"no",
"."
] | 0f42e1a6ec4dcbc5d1257e1307704903e771f7b5 | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot-example/src/main/java/example/jbot/facebook/FbBot.java#L80-L87 |
112,563 | rampatra/jbot | jbot-example/src/main/java/example/jbot/facebook/FbBot.java | FbBot.showGithubLink | @Controller(events = EventType.MESSAGE, pattern = "(?i)(bye|tata|ttyl|cya|see you)")
public void showGithubLink(Event event) {
reply(event, new Message().setAttachment(new Attachment().setType("template").setPayload(new Payload()
.setTemplateType("button").setText("Bye. Happy coding!").setBu... | java | @Controller(events = EventType.MESSAGE, pattern = "(?i)(bye|tata|ttyl|cya|see you)")
public void showGithubLink(Event event) {
reply(event, new Message().setAttachment(new Attachment().setType("template").setPayload(new Payload()
.setTemplateType("button").setText("Bye. Happy coding!").setBu... | [
"@",
"Controller",
"(",
"events",
"=",
"EventType",
".",
"MESSAGE",
",",
"pattern",
"=",
"\"(?i)(bye|tata|ttyl|cya|see you)\"",
")",
"public",
"void",
"showGithubLink",
"(",
"Event",
"event",
")",
"{",
"reply",
"(",
"event",
",",
"new",
"Message",
"(",
")",
... | Show the github project url when the user says bye.
@param event | [
"Show",
"the",
"github",
"project",
"url",
"when",
"the",
"user",
"says",
"bye",
"."
] | 0f42e1a6ec4dcbc5d1257e1307704903e771f7b5 | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot-example/src/main/java/example/jbot/facebook/FbBot.java#L136-L141 |
112,564 | rampatra/jbot | jbot-example/src/main/java/example/jbot/slack/SlackBot.java | SlackBot.onPinAdded | @Controller(events = EventType.PIN_ADDED)
public void onPinAdded(WebSocketSession session, Event event) {
reply(session, event, "Thanks for the pin! You can find all pinned items under channel details.");
} | java | @Controller(events = EventType.PIN_ADDED)
public void onPinAdded(WebSocketSession session, Event event) {
reply(session, event, "Thanks for the pin! You can find all pinned items under channel details.");
} | [
"@",
"Controller",
"(",
"events",
"=",
"EventType",
".",
"PIN_ADDED",
")",
"public",
"void",
"onPinAdded",
"(",
"WebSocketSession",
"session",
",",
"Event",
"event",
")",
"{",
"reply",
"(",
"session",
",",
"event",
",",
"\"Thanks for the pin! You can find all pinn... | Invoked when an item is pinned in the channel.
@param session
@param event | [
"Invoked",
"when",
"an",
"item",
"is",
"pinned",
"in",
"the",
"channel",
"."
] | 0f42e1a6ec4dcbc5d1257e1307704903e771f7b5 | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot-example/src/main/java/example/jbot/slack/SlackBot.java#L83-L86 |
112,565 | rampatra/jbot | jbot/src/main/java/me/ramswaroop/jbot/core/slack/SlackService.java | SlackService.connectRTM | public void connectRTM(String slackToken) {
RTM rtm = restTemplate.getForEntity(slackApiEndpoints.getRtmConnectApi(), RTM.class, slackToken).getBody();
currentUser = rtm.getSelf();
webSocketUrl = rtm.getUrl();
getImChannels(slackToken, 200,"");
} | java | public void connectRTM(String slackToken) {
RTM rtm = restTemplate.getForEntity(slackApiEndpoints.getRtmConnectApi(), RTM.class, slackToken).getBody();
currentUser = rtm.getSelf();
webSocketUrl = rtm.getUrl();
getImChannels(slackToken, 200,"");
} | [
"public",
"void",
"connectRTM",
"(",
"String",
"slackToken",
")",
"{",
"RTM",
"rtm",
"=",
"restTemplate",
".",
"getForEntity",
"(",
"slackApiEndpoints",
".",
"getRtmConnectApi",
"(",
")",
",",
"RTM",
".",
"class",
",",
"slackToken",
")",
".",
"getBody",
"(",... | Start a RTM connection. Fetch the web socket url to connect to, current user details
and list of channel ids where the current user has had conversation.
@param slackToken slack token which you get from slack for the integration you create | [
"Start",
"a",
"RTM",
"connection",
".",
"Fetch",
"the",
"web",
"socket",
"url",
"to",
"connect",
"to",
"current",
"user",
"details",
"and",
"list",
"of",
"channel",
"ids",
"where",
"the",
"current",
"user",
"has",
"had",
"conversation",
"."
] | 0f42e1a6ec4dcbc5d1257e1307704903e771f7b5 | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot/src/main/java/me/ramswaroop/jbot/core/slack/SlackService.java#L48-L53 |
112,566 | rampatra/jbot | jbot/src/main/java/me/ramswaroop/jbot/core/slack/SlackService.java | SlackService.getImChannels | private void getImChannels(String slackToken, int limit, String nextCursor) {
try {
Event event = restTemplate.getForEntity(slackApiEndpoints.getImListApi(), Event.class,
slackToken, limit, nextCursor).getBody();
imChannelIds.addAll(Arrays.stream(event.getIms()).map(C... | java | private void getImChannels(String slackToken, int limit, String nextCursor) {
try {
Event event = restTemplate.getForEntity(slackApiEndpoints.getImListApi(), Event.class,
slackToken, limit, nextCursor).getBody();
imChannelIds.addAll(Arrays.stream(event.getIms()).map(C... | [
"private",
"void",
"getImChannels",
"(",
"String",
"slackToken",
",",
"int",
"limit",
",",
"String",
"nextCursor",
")",
"{",
"try",
"{",
"Event",
"event",
"=",
"restTemplate",
".",
"getForEntity",
"(",
"slackApiEndpoints",
".",
"getImListApi",
"(",
")",
",",
... | Fetch all im channels to determine direct message to the bot.
@param slackToken slack token which you get from slack for the integration you create
@param limit number of channels to fetch in one call
@param nextCursor cursor for the next call | [
"Fetch",
"all",
"im",
"channels",
"to",
"determine",
"direct",
"message",
"to",
"the",
"bot",
"."
] | 0f42e1a6ec4dcbc5d1257e1307704903e771f7b5 | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot/src/main/java/me/ramswaroop/jbot/core/slack/SlackService.java#L62-L75 |
112,567 | rampatra/jbot | jbot/src/main/java/me/ramswaroop/jbot/core/facebook/Bot.java | Bot.startConversation | protected final void startConversation(Event event, String methodName) {
startConversation(event.getSender().getId(), methodName);
} | java | protected final void startConversation(Event event, String methodName) {
startConversation(event.getSender().getId(), methodName);
} | [
"protected",
"final",
"void",
"startConversation",
"(",
"Event",
"event",
",",
"String",
"methodName",
")",
"{",
"startConversation",
"(",
"event",
".",
"getSender",
"(",
")",
".",
"getId",
"(",
")",
",",
"methodName",
")",
";",
"}"
] | Call this method to start a conversation.
@param event received from facebook | [
"Call",
"this",
"method",
"to",
"start",
"a",
"conversation",
"."
] | 0f42e1a6ec4dcbc5d1257e1307704903e771f7b5 | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot/src/main/java/me/ramswaroop/jbot/core/facebook/Bot.java#L229-L231 |
112,568 | rampatra/jbot | jbot/src/main/java/me/ramswaroop/jbot/core/facebook/Bot.java | Bot.invokeChainedMethod | private void invokeChainedMethod(Event event) {
Queue<MethodWrapper> queue = conversationQueueMap.get(event.getSender().getId());
if (queue != null && !queue.isEmpty()) {
MethodWrapper methodWrapper = queue.peek();
try {
EventType[] eventTypes = methodWrapper.ge... | java | private void invokeChainedMethod(Event event) {
Queue<MethodWrapper> queue = conversationQueueMap.get(event.getSender().getId());
if (queue != null && !queue.isEmpty()) {
MethodWrapper methodWrapper = queue.peek();
try {
EventType[] eventTypes = methodWrapper.ge... | [
"private",
"void",
"invokeChainedMethod",
"(",
"Event",
"event",
")",
"{",
"Queue",
"<",
"MethodWrapper",
">",
"queue",
"=",
"conversationQueueMap",
".",
"get",
"(",
"event",
".",
"getSender",
"(",
")",
".",
"getId",
"(",
")",
")",
";",
"if",
"(",
"queue... | Invoke the appropriate method in a conversation.
@param event received from facebook | [
"Invoke",
"the",
"appropriate",
"method",
"in",
"a",
"conversation",
"."
] | 0f42e1a6ec4dcbc5d1257e1307704903e771f7b5 | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot/src/main/java/me/ramswaroop/jbot/core/facebook/Bot.java#L298-L316 |
112,569 | rampatra/jbot | jbot/src/main/java/me/ramswaroop/jbot/core/facebook/Bot.java | Bot.getPatternFromEventType | private String getPatternFromEventType(Event event) {
switch (event.getType()) {
case MESSAGE:
return event.getMessage().getText();
case QUICK_REPLY:
return event.getMessage().getQuickReply().getPayload();
case POSTBACK:
return ... | java | private String getPatternFromEventType(Event event) {
switch (event.getType()) {
case MESSAGE:
return event.getMessage().getText();
case QUICK_REPLY:
return event.getMessage().getQuickReply().getPayload();
case POSTBACK:
return ... | [
"private",
"String",
"getPatternFromEventType",
"(",
"Event",
"event",
")",
"{",
"switch",
"(",
"event",
".",
"getType",
"(",
")",
")",
"{",
"case",
"MESSAGE",
":",
"return",
"event",
".",
"getMessage",
"(",
")",
".",
"getText",
"(",
")",
";",
"case",
... | Match the pattern with different attributes based on the event type.
@param event received from facebook
@return the pattern string | [
"Match",
"the",
"pattern",
"with",
"different",
"attributes",
"based",
"on",
"the",
"event",
"type",
"."
] | 0f42e1a6ec4dcbc5d1257e1307704903e771f7b5 | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot/src/main/java/me/ramswaroop/jbot/core/facebook/Bot.java#L324-L335 |
112,570 | rampatra/jbot | jbot/src/main/java/me/ramswaroop/jbot/core/common/BaseBot.java | BaseBot.formConversationQueue | private Queue<MethodWrapper> formConversationQueue(Queue<MethodWrapper> queue, String methodName) {
MethodWrapper methodWrapper = methodNameMap.get(methodName);
queue.add(methodWrapper);
if (StringUtils.isEmpty(methodName)) {
return queue;
} else {
return formConv... | java | private Queue<MethodWrapper> formConversationQueue(Queue<MethodWrapper> queue, String methodName) {
MethodWrapper methodWrapper = methodNameMap.get(methodName);
queue.add(methodWrapper);
if (StringUtils.isEmpty(methodName)) {
return queue;
} else {
return formConv... | [
"private",
"Queue",
"<",
"MethodWrapper",
">",
"formConversationQueue",
"(",
"Queue",
"<",
"MethodWrapper",
">",
"queue",
",",
"String",
"methodName",
")",
"{",
"MethodWrapper",
"methodWrapper",
"=",
"methodNameMap",
".",
"get",
"(",
"methodName",
")",
";",
"que... | Form a Queue with all the methods responsible for a particular conversation.
@param queue
@param methodName
@return | [
"Form",
"a",
"Queue",
"with",
"all",
"the",
"methods",
"responsible",
"for",
"a",
"particular",
"conversation",
"."
] | 0f42e1a6ec4dcbc5d1257e1307704903e771f7b5 | https://github.com/rampatra/jbot/blob/0f42e1a6ec4dcbc5d1257e1307704903e771f7b5/jbot/src/main/java/me/ramswaroop/jbot/core/common/BaseBot.java#L145-L153 |
112,571 | twitter/finatra | kafka-streams/kafka-streams-queryable-thrift-client/src/main/java/com/twitter/finatra/streams/queryable/thrift/client/partitioning/utils/KafkaUtils.java | KafkaUtils.murmur2 | @SuppressWarnings("fallthrough")
public static int murmur2(final byte[] data) {
int length = data.length;
int seed = 0x9747b28c;
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
final int m = 0x5bd1e995;
final int r = 24;
... | java | @SuppressWarnings("fallthrough")
public static int murmur2(final byte[] data) {
int length = data.length;
int seed = 0x9747b28c;
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
final int m = 0x5bd1e995;
final int r = 24;
... | [
"@",
"SuppressWarnings",
"(",
"\"fallthrough\"",
")",
"public",
"static",
"int",
"murmur2",
"(",
"final",
"byte",
"[",
"]",
"data",
")",
"{",
"int",
"length",
"=",
"data",
".",
"length",
";",
"int",
"seed",
"=",
"0x9747b28c",
";",
"// 'm' and 'r' are mixing ... | Generates 32 bit murmur2 hash from byte array
@param data byte array to hash
@return 32 bit hash of the given array | [
"Generates",
"32",
"bit",
"murmur2",
"hash",
"from",
"byte",
"array"
] | 0f92823927cedf4f843cc7e65d59e8665ad40f4c | https://github.com/twitter/finatra/blob/0f92823927cedf4f843cc7e65d59e8665ad40f4c/kafka-streams/kafka-streams-queryable-thrift-client/src/main/java/com/twitter/finatra/streams/queryable/thrift/client/partitioning/utils/KafkaUtils.java#L33-L77 |
112,572 | twitter/finatra | kafka-streams/kafka-streams-static-partitioning/src/main/java/org/apache/kafka/streams/processor/internals/OverridableStreamsPartitionAssignor.java | OverridableStreamsPartitionAssignor.prepareTopic | private void prepareTopic(final Map<String, InternalTopicMetadata> topicPartitions) {
log.debug("Starting to validate internal topics {} in partition assignor.", topicPartitions);
// first construct the topics to make ready
final Map<String, InternalTopicConfig> topicsToMakeReady = new HashMap<>();
fo... | java | private void prepareTopic(final Map<String, InternalTopicMetadata> topicPartitions) {
log.debug("Starting to validate internal topics {} in partition assignor.", topicPartitions);
// first construct the topics to make ready
final Map<String, InternalTopicConfig> topicsToMakeReady = new HashMap<>();
fo... | [
"private",
"void",
"prepareTopic",
"(",
"final",
"Map",
"<",
"String",
",",
"InternalTopicMetadata",
">",
"topicPartitions",
")",
"{",
"log",
".",
"debug",
"(",
"\"Starting to validate internal topics {} in partition assignor.\"",
",",
"topicPartitions",
")",
";",
"// f... | Internal helper function that creates a Kafka topic
@param topicPartitions Map that contains the topic names to be created with the number of partitions | [
"Internal",
"helper",
"function",
"that",
"creates",
"a",
"Kafka",
"topic"
] | 0f92823927cedf4f843cc7e65d59e8665ad40f4c | https://github.com/twitter/finatra/blob/0f92823927cedf4f843cc7e65d59e8665ad40f4c/kafka-streams/kafka-streams-static-partitioning/src/main/java/org/apache/kafka/streams/processor/internals/OverridableStreamsPartitionAssignor.java#L973-L996 |
112,573 | validator/validator | src/nu/validator/checker/table/ColumnRange.java | ColumnRange.removeColumn | ColumnRange removeColumn(int column) {
// first, let's see if this is a 1-column range that should
// be destroyed
if (isSingleCol()) {
return null;
} else if (column == left) {
left++;
return this;
} else if (column + 1 == right) {
... | java | ColumnRange removeColumn(int column) {
// first, let's see if this is a 1-column range that should
// be destroyed
if (isSingleCol()) {
return null;
} else if (column == left) {
left++;
return this;
} else if (column + 1 == right) {
... | [
"ColumnRange",
"removeColumn",
"(",
"int",
"column",
")",
"{",
"// first, let's see if this is a 1-column range that should ",
"// be destroyed",
"if",
"(",
"isSingleCol",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"if",
"(",
"column",
"==",
"left",
"... | Removes a column from the range possibly asking it to be destroyed or
splitting it.
@param column a column index
@return <code>null</code> if this range gets destroyed,
<code>this</code> if the range gets resized and
the new right half range if the range gets split | [
"Removes",
"a",
"column",
"from",
"the",
"range",
"possibly",
"asking",
"it",
"to",
"be",
"destroyed",
"or",
"splitting",
"it",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/checker/table/ColumnRange.java#L122-L141 |
112,574 | validator/validator | src/nu/validator/datatype/SvgPathData.java | SvgPathData.checkh | private State checkh(State state) throws DatatypeException, IOException {
if (state.context.length() == 0) {
state = appendToContext(state);
}
state.current = state.reader.read();
state = appendToContext(state);
state = skipSpaces(state);
boolean expectNumber ... | java | private State checkh(State state) throws DatatypeException, IOException {
if (state.context.length() == 0) {
state = appendToContext(state);
}
state.current = state.reader.read();
state = appendToContext(state);
state = skipSpaces(state);
boolean expectNumber ... | [
"private",
"State",
"checkh",
"(",
"State",
"state",
")",
"throws",
"DatatypeException",
",",
"IOException",
"{",
"if",
"(",
"state",
".",
"context",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"state",
"=",
"appendToContext",
"(",
"state",
")",
";",
... | Checks an 'h' command. | [
"Checks",
"an",
"h",
"command",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/datatype/SvgPathData.java#L334-L370 |
112,575 | validator/validator | src/nu/validator/datatype/SvgPathData.java | SvgPathData.skipSubPath | private State skipSubPath(State state) throws IOException {
for (;;) {
switch (state.current) {
case -1:
case 'm':
case 'M':
return state;
default:
break;
}
state.current =... | java | private State skipSubPath(State state) throws IOException {
for (;;) {
switch (state.current) {
case -1:
case 'm':
case 'M':
return state;
default:
break;
}
state.current =... | [
"private",
"State",
"skipSubPath",
"(",
"State",
"state",
")",
"throws",
"IOException",
"{",
"for",
"(",
";",
";",
")",
"{",
"switch",
"(",
"state",
".",
"current",
")",
"{",
"case",
"-",
"1",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"r... | Skips a sub-path. | [
"Skips",
"a",
"sub",
"-",
"path",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/datatype/SvgPathData.java#L1327-L1340 |
112,576 | validator/validator | src/nu/validator/datatype/SvgPathData.java | SvgPathData.skipSpaces | private State skipSpaces(State state) throws IOException {
for (;;) {
switch (state.current) {
default:
return state;
case 0x20:
case 0x09:
case 0x0D:
case 0x0A:
}
state.curren... | java | private State skipSpaces(State state) throws IOException {
for (;;) {
switch (state.current) {
default:
return state;
case 0x20:
case 0x09:
case 0x0D:
case 0x0A:
}
state.curren... | [
"private",
"State",
"skipSpaces",
"(",
"State",
"state",
")",
"throws",
"IOException",
"{",
"for",
"(",
";",
";",
")",
"{",
"switch",
"(",
"state",
".",
"current",
")",
"{",
"default",
":",
"return",
"state",
";",
"case",
"0x20",
":",
"case",
"0x09",
... | Skips the whitespaces in the current reader. | [
"Skips",
"the",
"whitespaces",
"in",
"the",
"current",
"reader",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/datatype/SvgPathData.java#L1345-L1358 |
112,577 | validator/validator | src/nu/validator/checker/table/Table.java | Table.appendColumnRange | private void appendColumnRange(ColumnRange colRange) {
if (last == null) {
first = colRange;
last = colRange;
} else {
last.setNext(colRange);
last = colRange;
}
} | java | private void appendColumnRange(ColumnRange colRange) {
if (last == null) {
first = colRange;
last = colRange;
} else {
last.setNext(colRange);
last = colRange;
}
} | [
"private",
"void",
"appendColumnRange",
"(",
"ColumnRange",
"colRange",
")",
"{",
"if",
"(",
"last",
"==",
"null",
")",
"{",
"first",
"=",
"colRange",
";",
"last",
"=",
"colRange",
";",
"}",
"else",
"{",
"last",
".",
"setNext",
"(",
"colRange",
")",
";... | Appends a column range to the linked list of column ranges.
@param colRange the range to append | [
"Appends",
"a",
"column",
"range",
"to",
"the",
"linked",
"list",
"of",
"column",
"ranges",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/checker/table/Table.java#L433-L441 |
112,578 | validator/validator | src/nu/validator/xml/HtmlSerializer.java | HtmlSerializer.characters | @Override
public void characters(char[] ch, int start, int length)
throws SAXException {
try {
for (int j = 0; j < length; j++) {
char c = ch[start + j];
switch (c) {
case '<':
this.writer.write("<");
... | java | @Override
public void characters(char[] ch, int start, int length)
throws SAXException {
try {
for (int j = 0; j < length; j++) {
char c = ch[start + j];
switch (c) {
case '<':
this.writer.write("<");
... | [
"@",
"Override",
"public",
"void",
"characters",
"(",
"char",
"[",
"]",
"ch",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"SAXException",
"{",
"try",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"length",
";",
"j",
"++",
")... | Writes out characters.
@param ch
the source array
@param start
the index of the first character to be written
@param length
the number of characters to write
@throws SAXException
if there are IO problems | [
"Writes",
"out",
"characters",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/xml/HtmlSerializer.java#L151-L174 |
112,579 | validator/validator | src/nu/validator/xml/HtmlSerializer.java | HtmlSerializer.endDocument | @Override
public void endDocument() throws SAXException {
try {
this.writer.close();
} catch (IOException ioe) {
throw (SAXException)new SAXException(ioe).initCause(ioe);
}
} | java | @Override
public void endDocument() throws SAXException {
try {
this.writer.close();
} catch (IOException ioe) {
throw (SAXException)new SAXException(ioe).initCause(ioe);
}
} | [
"@",
"Override",
"public",
"void",
"endDocument",
"(",
")",
"throws",
"SAXException",
"{",
"try",
"{",
"this",
".",
"writer",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"throw",
"(",
"SAXException",
")",
"new",
"SAX... | Must be called in the end.
@throws SAXException
if there are IO problems | [
"Must",
"be",
"called",
"in",
"the",
"end",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/xml/HtmlSerializer.java#L182-L189 |
112,580 | validator/validator | src/nu/validator/xml/HtmlSerializer.java | HtmlSerializer.endElement | @Override
public void endElement(String namespaceURI, String localName, String qName)
throws SAXException {
try {
if (XHTML_NS.equals(namespaceURI)
&& Arrays.binarySearch(emptyElements, localName) < 0) {
this.writer.write("</");
thi... | java | @Override
public void endElement(String namespaceURI, String localName, String qName)
throws SAXException {
try {
if (XHTML_NS.equals(namespaceURI)
&& Arrays.binarySearch(emptyElements, localName) < 0) {
this.writer.write("</");
thi... | [
"@",
"Override",
"public",
"void",
"endElement",
"(",
"String",
"namespaceURI",
",",
"String",
"localName",
",",
"String",
"qName",
")",
"throws",
"SAXException",
"{",
"try",
"{",
"if",
"(",
"XHTML_NS",
".",
"equals",
"(",
"namespaceURI",
")",
"&&",
"Arrays"... | Writes an end tag if the element is an XHTML element and is not an empty
element in HTML 4.01 Strict.
@param namespaceURI
the XML namespace
@param localName
the element name in the namespace
@param qName
ignored
@throws SAXException
if there are IO problems | [
"Writes",
"an",
"end",
"tag",
"if",
"the",
"element",
"is",
"an",
"XHTML",
"element",
"and",
"is",
"not",
"an",
"empty",
"element",
"in",
"HTML",
"4",
".",
"01",
"Strict",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/xml/HtmlSerializer.java#L205-L218 |
112,581 | validator/validator | src/nu/validator/xml/HtmlSerializer.java | HtmlSerializer.startDocument | @Override
public void startDocument() throws SAXException {
try {
switch (doctype) {
case NO_DOCTYPE:
return;
case DOCTYPE_HTML5:
writer.write("<!DOCTYPE html>\n");
return;
case DOCTYPE_HT... | java | @Override
public void startDocument() throws SAXException {
try {
switch (doctype) {
case NO_DOCTYPE:
return;
case DOCTYPE_HTML5:
writer.write("<!DOCTYPE html>\n");
return;
case DOCTYPE_HT... | [
"@",
"Override",
"public",
"void",
"startDocument",
"(",
")",
"throws",
"SAXException",
"{",
"try",
"{",
"switch",
"(",
"doctype",
")",
"{",
"case",
"NO_DOCTYPE",
":",
"return",
";",
"case",
"DOCTYPE_HTML5",
":",
"writer",
".",
"write",
"(",
"\"<!DOCTYPE htm... | Must be called first. | [
"Must",
"be",
"called",
"first",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/xml/HtmlSerializer.java#L223-L242 |
112,582 | validator/validator | src/nu/validator/xml/HtmlSerializer.java | HtmlSerializer.startElement | @Override
public void startElement(String namespaceURI, String localName,
String qName, Attributes atts) throws SAXException {
try {
if (XHTML_NS.equals(namespaceURI)) {
if ("meta".equals(localName)
&& ((atts.getIndex("", "http-equiv") != -1) ... | java | @Override
public void startElement(String namespaceURI, String localName,
String qName, Attributes atts) throws SAXException {
try {
if (XHTML_NS.equals(namespaceURI)) {
if ("meta".equals(localName)
&& ((atts.getIndex("", "http-equiv") != -1) ... | [
"@",
"Override",
"public",
"void",
"startElement",
"(",
"String",
"namespaceURI",
",",
"String",
"localName",
",",
"String",
"qName",
",",
"Attributes",
"atts",
")",
"throws",
"SAXException",
"{",
"try",
"{",
"if",
"(",
"XHTML_NS",
".",
"equals",
"(",
"names... | Writes a start tag if the element is an XHTML element.
@param namespaceURI
the XML namespace
@param localName
the element name in the namespace
@param qName
ignored
@param atts
the attribute list
@throws SAXException
if there are IO problems | [
"Writes",
"a",
"start",
"tag",
"if",
"the",
"element",
"is",
"an",
"XHTML",
"element",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/xml/HtmlSerializer.java#L259-L333 |
112,583 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.fatal | private void fatal(String message, char textFound, String textExpected)
throws SAXException {
fatal(message, Character.valueOf(textFound).toString(), textExpected);
} | java | private void fatal(String message, char textFound, String textExpected)
throws SAXException {
fatal(message, Character.valueOf(textFound).toString(), textExpected);
} | [
"private",
"void",
"fatal",
"(",
"String",
"message",
",",
"char",
"textFound",
",",
"String",
"textExpected",
")",
"throws",
"SAXException",
"{",
"fatal",
"(",
"message",
",",
"Character",
".",
"valueOf",
"(",
"textFound",
")",
".",
"toString",
"(",
")",
... | Report a serious error.
@param message
The error message.
@param textFound
The text that caused the error (or null). | [
"Report",
"a",
"serious",
"error",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L578-L581 |
112,584 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parseComment | private void parseComment() throws Exception {
boolean saved = expandPE;
expandPE = false;
parseUntil(endDelimComment);
require('>');
expandPE = saved;
handler.comment(dataBuffer, 0, dataBufferPos);
dataBufferPos = 0;
} | java | private void parseComment() throws Exception {
boolean saved = expandPE;
expandPE = false;
parseUntil(endDelimComment);
require('>');
expandPE = saved;
handler.comment(dataBuffer, 0, dataBufferPos);
dataBufferPos = 0;
} | [
"private",
"void",
"parseComment",
"(",
")",
"throws",
"Exception",
"{",
"boolean",
"saved",
"=",
"expandPE",
";",
"expandPE",
"=",
"false",
";",
"parseUntil",
"(",
"endDelimComment",
")",
";",
"require",
"(",
"'",
"'",
")",
";",
"expandPE",
"=",
"saved",
... | Skip a comment.
<pre>
[15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* "-->"
</pre>
<p>
(The <code><!--</code> has already been read.) | [
"Skip",
"a",
"comment",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L651-L660 |
112,585 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parsePI | private void parsePI() throws SAXException, IOException {
String name;
boolean saved = expandPE;
expandPE = false;
name = readNmtoken(true);
// NE08
if (name.indexOf(':') >= 0) {
fatal("Illegal character(':') in processing instruction name ",
... | java | private void parsePI() throws SAXException, IOException {
String name;
boolean saved = expandPE;
expandPE = false;
name = readNmtoken(true);
// NE08
if (name.indexOf(':') >= 0) {
fatal("Illegal character(':') in processing instruction name ",
... | [
"private",
"void",
"parsePI",
"(",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"String",
"name",
";",
"boolean",
"saved",
"=",
"expandPE",
";",
"expandPE",
"=",
"false",
";",
"name",
"=",
"readNmtoken",
"(",
"true",
")",
";",
"// NE08",
"if",
... | Parse a processing instruction and do a call-back.
<pre>
[16] PI ::= '<?' PITarget
(S (Char* - (Char* '?>' Char*)))?
'?>'
[17] PITarget ::= Name - ( ('X'|'x') ('M'|m') ('L'|l') )
</pre>
<p>
(The <code><?</code> has already been read.) | [
"Parse",
"a",
"processing",
"instruction",
"and",
"do",
"a",
"call",
"-",
"back",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L679-L699 |
112,586 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parseXMLDecl | private String parseXMLDecl(String encoding) throws SAXException,
IOException {
String version;
String encodingName = null;
String standalone = null;
int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF;
// Read the version.
require("version");
... | java | private String parseXMLDecl(String encoding) throws SAXException,
IOException {
String version;
String encodingName = null;
String standalone = null;
int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF;
// Read the version.
require("version");
... | [
"private",
"String",
"parseXMLDecl",
"(",
"String",
"encoding",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"String",
"version",
";",
"String",
"encodingName",
"=",
"null",
";",
"String",
"standalone",
"=",
"null",
";",
"int",
"flags",
"=",
"LIT_DI... | Parse the XML declaration.
<pre>
[23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
[24] VersionInfo ::= S 'version' Eq
("'" VersionNum "'" | '"' VersionNum '"' )
[26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')*
[32] SDDecl ::= S 'standalone' Eq
( "'"" ('ye... | [
"Parse",
"the",
"XML",
"declaration",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L794-L860 |
112,587 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.checkEncodingLiteral | private void checkEncodingLiteral(String encodingName) throws SAXException {
if (encodingName == null) {
return;
}
if (encodingName.length() == 0) {
fatal("The empty string does not a legal encoding name.");
}
char c = encodingName.charAt(0);
if (!... | java | private void checkEncodingLiteral(String encodingName) throws SAXException {
if (encodingName == null) {
return;
}
if (encodingName.length() == 0) {
fatal("The empty string does not a legal encoding name.");
}
char c = encodingName.charAt(0);
if (!... | [
"private",
"void",
"checkEncodingLiteral",
"(",
"String",
"encodingName",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"encodingName",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"encodingName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
... | hsivonen 2006-04-28 | [
"hsivonen",
"2006",
"-",
"04",
"-",
"28"
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L863-L882 |
112,588 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parseTextDecl | private String parseTextDecl(String encoding) throws SAXException,
IOException {
String encodingName = null;
int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF;
// Read an optional version.
if (tryRead("version")) {
String version;
parse... | java | private String parseTextDecl(String encoding) throws SAXException,
IOException {
String encodingName = null;
int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF;
// Read an optional version.
if (tryRead("version")) {
String version;
parse... | [
"private",
"String",
"parseTextDecl",
"(",
"String",
"encoding",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"String",
"encodingName",
"=",
"null",
";",
"int",
"flags",
"=",
"LIT_DISABLE_CREF",
"|",
"LIT_DISABLE_PE",
"|",
"LIT_DISABLE_EREF",
";",
"// R... | Parse a text declaration.
<pre>
[79] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>'
[80] EncodingDecl ::= S 'encoding' Eq
( '"' EncName '"' | "'" EncName "'" )
[81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
</pre>
<p>
(The <code><?xml</code>' and whitespace have alread... | [
"Parse",
"a",
"text",
"declaration",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L901-L938 |
112,589 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parseMisc | private void parseMisc() throws Exception {
while (true) {
skipWhitespace();
if (tryRead(startDelimPI)) {
parsePI();
} else if (tryRead(startDelimComment)) {
parseComment();
} else {
return;
}
}
... | java | private void parseMisc() throws Exception {
while (true) {
skipWhitespace();
if (tryRead(startDelimPI)) {
parsePI();
} else if (tryRead(startDelimComment)) {
parseComment();
} else {
return;
}
}
... | [
"private",
"void",
"parseMisc",
"(",
")",
"throws",
"Exception",
"{",
"while",
"(",
"true",
")",
"{",
"skipWhitespace",
"(",
")",
";",
"if",
"(",
"tryRead",
"(",
"startDelimPI",
")",
")",
"{",
"parsePI",
"(",
")",
";",
"}",
"else",
"if",
"(",
"tryRea... | Parse miscellaneous markup outside the document element and DOCTYPE
declaration.
<pre>
[27] Misc ::= Comment | PI | S
</pre> | [
"Parse",
"miscellaneous",
"markup",
"outside",
"the",
"document",
"element",
"and",
"DOCTYPE",
"declaration",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L1035-L1046 |
112,590 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parseDoctypedecl | private void parseDoctypedecl() throws Exception {
String rootName;
ExternalIdentifiers ids;
// Read the document type name.
requireWhitespace();
rootName = readNmtoken(true);
// Read the External subset's IDs
skipWhitespace();
ids = readExternalIds(fals... | java | private void parseDoctypedecl() throws Exception {
String rootName;
ExternalIdentifiers ids;
// Read the document type name.
requireWhitespace();
rootName = readNmtoken(true);
// Read the External subset's IDs
skipWhitespace();
ids = readExternalIds(fals... | [
"private",
"void",
"parseDoctypedecl",
"(",
")",
"throws",
"Exception",
"{",
"String",
"rootName",
";",
"ExternalIdentifiers",
"ids",
";",
"// Read the document type name.",
"requireWhitespace",
"(",
")",
";",
"rootName",
"=",
"readNmtoken",
"(",
"true",
")",
";",
... | Parse a document type declaration.
<pre>
[28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S?
('[' (markupdecl | PEReference | S)* ']' S?)? '>'
</pre>
<p>
(The <code><!DOCTYPE</code> has already been read.) | [
"Parse",
"a",
"document",
"type",
"declaration",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L1059-L1143 |
112,591 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parseMarkupdecl | private void parseMarkupdecl() throws Exception {
char[] saved = null;
boolean savedPE = expandPE;
// prevent "<%foo;" and ensures saved entity is right
require('<');
unread('<');
expandPE = false;
if (tryRead("<!ELEMENT")) {
saved = readBuffer;
... | java | private void parseMarkupdecl() throws Exception {
char[] saved = null;
boolean savedPE = expandPE;
// prevent "<%foo;" and ensures saved entity is right
require('<');
unread('<');
expandPE = false;
if (tryRead("<!ELEMENT")) {
saved = readBuffer;
... | [
"private",
"void",
"parseMarkupdecl",
"(",
")",
"throws",
"Exception",
"{",
"char",
"[",
"]",
"saved",
"=",
"null",
";",
"boolean",
"savedPE",
"=",
"expandPE",
";",
"// prevent \"<%foo;\" and ensures saved entity is right",
"require",
"(",
"'",
"'",
")",
";",
"u... | Parse a markup declaration in the internal or external DTD subset.
<pre>
[29] markupdecl ::= elementdecl | Attlistdecl | EntityDecl
| NotationDecl | PI | Comment
[30] extSubsetDecl ::= (markupdecl | conditionalSect
| PEReference | S) *
</pre>
<p>
Reading toplevel PE references is handled as a lexical issue by the
cal... | [
"Parse",
"a",
"markup",
"declaration",
"in",
"the",
"internal",
"or",
"external",
"DTD",
"subset",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L1159-L1208 |
112,592 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parseElement | private void parseElement(boolean maybeGetSubset) throws Exception {
String gi;
char c;
int oldElementContent = currentElementContent;
String oldElement = currentElement;
ElementDecl element;
// This is the (global) counter for the
// array of specified attribute... | java | private void parseElement(boolean maybeGetSubset) throws Exception {
String gi;
char c;
int oldElementContent = currentElementContent;
String oldElement = currentElement;
ElementDecl element;
// This is the (global) counter for the
// array of specified attribute... | [
"private",
"void",
"parseElement",
"(",
"boolean",
"maybeGetSubset",
")",
"throws",
"Exception",
"{",
"String",
"gi",
";",
"char",
"c",
";",
"int",
"oldElementContent",
"=",
"currentElementContent",
";",
"String",
"oldElement",
"=",
"currentElement",
";",
"Element... | Parse an element, with its tags.
<pre>
[39] element ::= EmptyElementTag | STag content ETag
[40] STag ::= '<' Name (S Attribute)* S? '>'
[44] EmptyElementTag ::= '<' Name (S Attribute)* S? '/>'
</pre>
<p>
(The '<' has already been read.)
<p>
NOTE: this method actually chains onto parseContent (), if ne... | [
"Parse",
"an",
"element",
"with",
"its",
"tags",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L1225-L1340 |
112,593 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parseAttribute | private void parseAttribute(String name) throws Exception {
String aname;
String type;
String value;
int flags = LIT_ATTRIBUTE | LIT_ENTITY_REF;
// Read the attribute name.
aname = readNmtoken(true);
type = getAttributeType(name, aname);
// Parse '='
... | java | private void parseAttribute(String name) throws Exception {
String aname;
String type;
String value;
int flags = LIT_ATTRIBUTE | LIT_ENTITY_REF;
// Read the attribute name.
aname = readNmtoken(true);
type = getAttributeType(name, aname);
// Parse '='
... | [
"private",
"void",
"parseAttribute",
"(",
"String",
"name",
")",
"throws",
"Exception",
"{",
"String",
"aname",
";",
"String",
"type",
";",
"String",
"value",
";",
"int",
"flags",
"=",
"LIT_ATTRIBUTE",
"|",
"LIT_ENTITY_REF",
";",
"// Read the attribute name.",
"... | Parse an attribute assignment.
<pre>
[41] Attribute ::= Name Eq AttValue
</pre>
@param name
The name of the attribute's element.
@see SAXDriver#attribute | [
"Parse",
"an",
"attribute",
"assignment",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L1353-L1402 |
112,594 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parseContent | private void parseContent() throws Exception {
char c;
while (true) {
// consume characters (or ignorable whitspace) until delimiter
parseCharData();
// Handle delimiters
c = readCh();
switch (c) {
case '&': // Found "&"
... | java | private void parseContent() throws Exception {
char c;
while (true) {
// consume characters (or ignorable whitspace) until delimiter
parseCharData();
// Handle delimiters
c = readCh();
switch (c) {
case '&': // Found "&"
... | [
"private",
"void",
"parseContent",
"(",
")",
"throws",
"Exception",
"{",
"char",
"c",
";",
"while",
"(",
"true",
")",
"{",
"// consume characters (or ignorable whitspace) until delimiter",
"parseCharData",
"(",
")",
";",
"// Handle delimiters",
"c",
"=",
"readCh",
"... | Parse the content of an element.
<pre>
[43] content ::= (element | CharData | Reference
| CDSect | PI | Comment)*
[67] Reference ::= EntityRef | CharRef
</pre>
<p>
NOTE: consumes ETtag. | [
"Parse",
"the",
"content",
"of",
"an",
"element",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L1448-L1515 |
112,595 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parseElementDecl | private void parseElementDecl() throws Exception {
String name;
requireWhitespace();
// Read the element type name.
name = readNmtoken(true);
requireWhitespace();
// Read the content model.
parseContentspec(name);
skipWhitespace();
require('>');... | java | private void parseElementDecl() throws Exception {
String name;
requireWhitespace();
// Read the element type name.
name = readNmtoken(true);
requireWhitespace();
// Read the content model.
parseContentspec(name);
skipWhitespace();
require('>');... | [
"private",
"void",
"parseElementDecl",
"(",
")",
"throws",
"Exception",
"{",
"String",
"name",
";",
"requireWhitespace",
"(",
")",
";",
"// Read the element type name.",
"name",
"=",
"readNmtoken",
"(",
"true",
")",
";",
"requireWhitespace",
"(",
")",
";",
"// R... | Parse an element type declaration.
<pre>
[45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>'
</pre>
<p>
NOTE: the '<!ELEMENT' has already been read. | [
"Parse",
"an",
"element",
"type",
"declaration",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L1527-L1540 |
112,596 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parseContentspec | private void parseContentspec(String name) throws Exception {
// FIXME: move elementDecl() into setElement(), pass EMTPY/ANY ...
if (tryRead("EMPTY")) {
setElement(name, CONTENT_EMPTY, null, null);
if (!skippedPE) {
handler.getDeclHandler().elementDecl(name, "EMPT... | java | private void parseContentspec(String name) throws Exception {
// FIXME: move elementDecl() into setElement(), pass EMTPY/ANY ...
if (tryRead("EMPTY")) {
setElement(name, CONTENT_EMPTY, null, null);
if (!skippedPE) {
handler.getDeclHandler().elementDecl(name, "EMPT... | [
"private",
"void",
"parseContentspec",
"(",
"String",
"name",
")",
"throws",
"Exception",
"{",
"// FIXME: move elementDecl() into setElement(), pass EMTPY/ANY ...",
"if",
"(",
"tryRead",
"(",
"\"EMPTY\"",
")",
")",
"{",
"setElement",
"(",
"name",
",",
"CONTENT_EMPTY",
... | Content specification.
<pre>
[46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | elements
</pre> | [
"Content",
"specification",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L1549-L1585 |
112,597 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parseElements | private void parseElements(char[] saved) throws Exception {
char c;
char sep;
// Parse the first content particle
skipWhitespace();
parseCp();
// Check for end or for a separator.
skipWhitespace();
c = readCh();
switch (c) {
case ')':... | java | private void parseElements(char[] saved) throws Exception {
char c;
char sep;
// Parse the first content particle
skipWhitespace();
parseCp();
// Check for end or for a separator.
skipWhitespace();
c = readCh();
switch (c) {
case ')':... | [
"private",
"void",
"parseElements",
"(",
"char",
"[",
"]",
"saved",
")",
"throws",
"Exception",
"{",
"char",
"c",
";",
"char",
"sep",
";",
"// Parse the first content particle",
"skipWhitespace",
"(",
")",
";",
"parseCp",
"(",
")",
";",
"// Check for end or for ... | Parse an element-content model.
<pre>
[47] elements ::= (choice | seq) ('?' | '*' | '+')?
[49] choice ::= '(' S? cp (S? '|' S? cp)+ S? ')'
[50] seq ::= '(' S? cp (S? ',' S? cp)* S? ')'
</pre>
<p>
NOTE: the opening '(' and S have already been read.
@param saved
Buffer for entity that should have the terminal ')' | [
"Parse",
"an",
"element",
"-",
"content",
"model",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L1602-L1676 |
112,598 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parseCp | private void parseCp() throws Exception {
if (tryRead('(')) {
dataBufferAppend('(');
parseElements(readBuffer);
} else {
dataBufferAppend(readNmtoken(true));
char c = readCh();
switch (c) {
case '?':
case '*':
... | java | private void parseCp() throws Exception {
if (tryRead('(')) {
dataBufferAppend('(');
parseElements(readBuffer);
} else {
dataBufferAppend(readNmtoken(true));
char c = readCh();
switch (c) {
case '?':
case '*':
... | [
"private",
"void",
"parseCp",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"tryRead",
"(",
"'",
"'",
")",
")",
"{",
"dataBufferAppend",
"(",
"'",
"'",
")",
";",
"parseElements",
"(",
"readBuffer",
")",
";",
"}",
"else",
"{",
"dataBufferAppend",
"("... | Parse a content particle.
<pre>
[48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?
</pre> | [
"Parse",
"a",
"content",
"particle",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L1685-L1703 |
112,599 | validator/validator | src/nu/validator/gnu/xml/aelfred2/XmlParser.java | XmlParser.parseMixed | private void parseMixed(char[] saved) throws Exception {
// Check for PCDATA alone.
skipWhitespace();
if (tryRead(')')) {
// VC: Proper Group/PE Nesting
if (readBuffer != saved) {
handler.verror("Illegal Group/PE nesting");
}
dataB... | java | private void parseMixed(char[] saved) throws Exception {
// Check for PCDATA alone.
skipWhitespace();
if (tryRead(')')) {
// VC: Proper Group/PE Nesting
if (readBuffer != saved) {
handler.verror("Illegal Group/PE nesting");
}
dataB... | [
"private",
"void",
"parseMixed",
"(",
"char",
"[",
"]",
"saved",
")",
"throws",
"Exception",
"{",
"// Check for PCDATA alone.",
"skipWhitespace",
"(",
")",
";",
"if",
"(",
"tryRead",
"(",
"'",
"'",
")",
")",
"{",
"// VC: Proper Group/PE Nesting",
"if",
"(",
... | Parse mixed content.
<pre>
[51] Mixed ::= '(' S? ( '#PCDATA' (S? '|' S? Name)*) S? ')*'
| '(' S? ('#PCDATA') S? ')'
</pre>
@param saved
Buffer for entity that should have the terminal ')' | [
"Parse",
"mixed",
"content",
"."
] | c7b7f85b3a364df7d9944753fb5b2cd0ce642889 | https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/gnu/xml/aelfred2/XmlParser.java#L1716-L1747 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.