repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.invokeCallbackMethod
private JsonNode invokeCallbackMethod(final InvokeRequest req, final String cookie) { Object obj = this.getObject(req.getObjref()); Method method = this.findCallbackMethod(obj.getClass(), cookie); final Class<?>[] argTypes = method.getParameterTypes(); final Object[] args = new Object[a...
java
private JsonNode invokeCallbackMethod(final InvokeRequest req, final String cookie) { Object obj = this.getObject(req.getObjref()); Method method = this.findCallbackMethod(obj.getClass(), cookie); final Class<?>[] argTypes = method.getParameterTypes(); final Object[] args = new Object[a...
[ "private", "JsonNode", "invokeCallbackMethod", "(", "final", "InvokeRequest", "req", ",", "final", "String", "cookie", ")", "{", "Object", "obj", "=", "this", ".", "getObject", "(", "req", ".", "getObjref", "(", ")", ")", ";", "Method", "method", "=", "thi...
Invokes an override for a method. @param req The request @param cookie The cookie @return The method's return value
[ "Invokes", "an", "override", "for", "a", "method", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L361-L372
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.invokeMethod
private Object invokeMethod(final Object obj, final Method method, final Object... args) { // turn method to accessible. otherwise, we won't be able to callback to methods // on non-public classes. boolean accessibility = method.isAccessible(); method.setAccessible(true); try { ...
java
private Object invokeMethod(final Object obj, final Method method, final Object... args) { // turn method to accessible. otherwise, we won't be able to callback to methods // on non-public classes. boolean accessibility = method.isAccessible(); method.setAccessible(true); try { ...
[ "private", "Object", "invokeMethod", "(", "final", "Object", "obj", ",", "final", "Method", "method", ",", "final", "Object", "...", "args", ")", "{", "// turn method to accessible. otherwise, we won't be able to callback to methods", "// on non-public classes.", "boolean", ...
Invokes a Java method, even if the method is protected. @param obj The object @param method The method @param args Method arguments @return The return value
[ "Invokes", "a", "Java", "method", "even", "if", "the", "method", "is", "protected", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L381-L402
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.processCallback
private void processCallback(final Callback callback) { try { JsonNode result = handleCallback(callback); this.getClient().completeCallback(callback, null, result); } catch (JsiiException e) { this.getClient().completeCallback(callback, e.getMessage(), null); ...
java
private void processCallback(final Callback callback) { try { JsonNode result = handleCallback(callback); this.getClient().completeCallback(callback, null, result); } catch (JsiiException e) { this.getClient().completeCallback(callback, e.getMessage(), null); ...
[ "private", "void", "processCallback", "(", "final", "Callback", "callback", ")", "{", "try", "{", "JsonNode", "result", "=", "handleCallback", "(", "callback", ")", ";", "this", ".", "getClient", "(", ")", ".", "completeCallback", "(", "callback", ",", "null...
Process a single callback by invoking the native method it refers to. @param callback The callback to process.
[ "Process", "a", "single", "callback", "by", "invoking", "the", "native", "method", "it", "refers", "to", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L408-L415
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.findCallbackMethod
private Method findCallbackMethod(final Class<?> klass, final String signature) { for (Method method : klass.getMethods()) { if (method.toString().equals(signature)) { // found! return method; } } throw new JsiiException("Unable to find c...
java
private Method findCallbackMethod(final Class<?> klass, final String signature) { for (Method method : klass.getMethods()) { if (method.toString().equals(signature)) { // found! return method; } } throw new JsiiException("Unable to find c...
[ "private", "Method", "findCallbackMethod", "(", "final", "Class", "<", "?", ">", "klass", ",", "final", "String", "signature", ")", "{", "for", "(", "Method", "method", ":", "klass", ".", "getMethods", "(", ")", ")", "{", "if", "(", "method", ".", "toS...
Finds the Java method that implements a callback. @param klass The java class. @param signature Method signature @return a {@link Method}.
[ "Finds", "the", "Java", "method", "that", "implements", "a", "callback", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L423-L433
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.discoverOverrides
private static Collection<JsiiOverride> discoverOverrides(final Class<?> classToInspect) { Map<String, JsiiOverride> overrides = new HashMap<>(); Class<?> klass = classToInspect; // if we reached a generated jsii class or Object, we should stop collecting those overrides since // all t...
java
private static Collection<JsiiOverride> discoverOverrides(final Class<?> classToInspect) { Map<String, JsiiOverride> overrides = new HashMap<>(); Class<?> klass = classToInspect; // if we reached a generated jsii class or Object, we should stop collecting those overrides since // all t...
[ "private", "static", "Collection", "<", "JsiiOverride", ">", "discoverOverrides", "(", "final", "Class", "<", "?", ">", "classToInspect", ")", "{", "Map", "<", "String", ",", "JsiiOverride", ">", "overrides", "=", "new", "HashMap", "<>", "(", ")", ";", "Cl...
Prepare a list of methods which are overridden by Java classes. @param classToInspect The java class to inspect for @return A list of method names that should be overridden.
[ "Prepare", "a", "list", "of", "methods", "which", "are", "overridden", "by", "Java", "classes", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L469-L520
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.tryGetJsiiAnnotation
static Jsii tryGetJsiiAnnotation(final Class<?> type, final boolean inherited) { Jsii[] ann; if (inherited) { ann = (Jsii[]) type.getAnnotationsByType(Jsii.class); } else { ann = (Jsii[]) type.getDeclaredAnnotationsByType(Jsii.class); } if (ann.length ==...
java
static Jsii tryGetJsiiAnnotation(final Class<?> type, final boolean inherited) { Jsii[] ann; if (inherited) { ann = (Jsii[]) type.getAnnotationsByType(Jsii.class); } else { ann = (Jsii[]) type.getDeclaredAnnotationsByType(Jsii.class); } if (ann.length ==...
[ "static", "Jsii", "tryGetJsiiAnnotation", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "boolean", "inherited", ")", "{", "Jsii", "[", "]", "ann", ";", "if", "(", "inherited", ")", "{", "ann", "=", "(", "Jsii", "[", "]", ")", "type", ...
Attempts to find the @Jsii annotation from a type. @param type The type. @param inherited If 'true' will look for the annotation up the class hierarchy. @return The annotation or null.
[ "Attempts", "to", "find", "the" ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L532-L546
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.loadModuleForClass
String loadModuleForClass(Class<?> nativeClass) { final Jsii jsii = tryGetJsiiAnnotation(nativeClass, true); if (jsii == null) { throw new JsiiException("Unable to find @Jsii annotation for class"); } this.loadModule(jsii.module()); return jsii.fqn(); }
java
String loadModuleForClass(Class<?> nativeClass) { final Jsii jsii = tryGetJsiiAnnotation(nativeClass, true); if (jsii == null) { throw new JsiiException("Unable to find @Jsii annotation for class"); } this.loadModule(jsii.module()); return jsii.fqn(); }
[ "String", "loadModuleForClass", "(", "Class", "<", "?", ">", "nativeClass", ")", "{", "final", "Jsii", "jsii", "=", "tryGetJsiiAnnotation", "(", "nativeClass", ",", "true", ")", ";", "if", "(", "jsii", "==", "null", ")", "{", "throw", "new", "JsiiException...
Given a java class that extends a Jsii proxy, loads the corresponding jsii module and returns the FQN of the jsii type. @param nativeClass The java class. @return The FQN.
[ "Given", "a", "java", "class", "that", "extends", "a", "Jsii", "proxy", "loads", "the", "corresponding", "jsii", "module", "and", "returns", "the", "FQN", "of", "the", "jsii", "type", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L554-L562
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Util.java
Util.readString
static String readString(final InputStream is) { try (final Scanner s = new Scanner(is, "UTF-8")) { s.useDelimiter("\\A"); if (s.hasNext()) { return s.next(); } else { return ""; } } }
java
static String readString(final InputStream is) { try (final Scanner s = new Scanner(is, "UTF-8")) { s.useDelimiter("\\A"); if (s.hasNext()) { return s.next(); } else { return ""; } } }
[ "static", "String", "readString", "(", "final", "InputStream", "is", ")", "{", "try", "(", "final", "Scanner", "s", "=", "new", "Scanner", "(", "is", ",", "\"UTF-8\"", ")", ")", "{", "s", ".", "useDelimiter", "(", "\"\\\\A\"", ")", ";", "if", "(", "s...
Reads a string from an input stream. @param is The input stream., @return A string.
[ "Reads", "a", "string", "from", "an", "input", "stream", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Util.java#L32-L41
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Util.java
Util.extractResource
static String extractResource(final Class<?> klass, final String resourceName, final String outputDirectory) throws IOException { String directory = outputDirectory; if (directory == null) { directory = Files.createTempDirectory("jsii-java-runtime-resource").toString(); } Pa...
java
static String extractResource(final Class<?> klass, final String resourceName, final String outputDirectory) throws IOException { String directory = outputDirectory; if (directory == null) { directory = Files.createTempDirectory("jsii-java-runtime-resource").toString(); } Pa...
[ "static", "String", "extractResource", "(", "final", "Class", "<", "?", ">", "klass", ",", "final", "String", "resourceName", ",", "final", "String", "outputDirectory", ")", "throws", "IOException", "{", "String", "directory", "=", "outputDirectory", ";", "if", ...
Extracts a resource file from the .jar and saves it into an output directory. @param url The URL of the resource @param outputDirectory The output directory (optional) @return The full path of the saved resource @throws IOException If there was an I/O error
[ "Extracts", "a", "resource", "file", "from", "the", ".", "jar", "and", "saves", "it", "into", "an", "output", "directory", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/Util.java#L102-L118
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiCall
@Nullable protected final <T> T jsiiCall(final String method, final Class<T> returnType, @Nullable final Object... args) { return JsiiObjectMapper.treeToValue(JsiiObject.engine.getClient() .callMethod(this.objRef, ...
java
@Nullable protected final <T> T jsiiCall(final String method, final Class<T> returnType, @Nullable final Object... args) { return JsiiObjectMapper.treeToValue(JsiiObject.engine.getClient() .callMethod(this.objRef, ...
[ "@", "Nullable", "protected", "final", "<", "T", ">", "T", "jsiiCall", "(", "final", "String", "method", ",", "final", "Class", "<", "T", ">", "returnType", ",", "@", "Nullable", "final", "Object", "...", "args", ")", "{", "return", "JsiiObjectMapper", "...
Calls a JavaScript method on the object. @param method The name of the method. @param returnType The return type. @param args Method arguments. @param <T> Java type for the return value. @return A return value.
[ "Calls", "a", "JavaScript", "method", "on", "the", "object", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L54-L61
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiStaticCall
@Nullable protected static <T> T jsiiStaticCall(final Class<?> nativeClass, final String method, final Class<T> returnType, @Nullable final Object... args) { String fqn = engine.loadModuleForClass(nativeClass); return JsiiObjectMapper.treeToValue(engine.getClient() ...
java
@Nullable protected static <T> T jsiiStaticCall(final Class<?> nativeClass, final String method, final Class<T> returnType, @Nullable final Object... args) { String fqn = engine.loadModuleForClass(nativeClass); return JsiiObjectMapper.treeToValue(engine.getClient() ...
[ "@", "Nullable", "protected", "static", "<", "T", ">", "T", "jsiiStaticCall", "(", "final", "Class", "<", "?", ">", "nativeClass", ",", "final", "String", "method", ",", "final", "Class", "<", "T", ">", "returnType", ",", "@", "Nullable", "final", "Objec...
Calls a static method. @param nativeClass The java class. @param method The method to call. @param returnType The return type. @param args The method arguments. @param <T> Return type. @return Return value.
[ "Calls", "a", "static", "method", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L72-L78
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiAsyncCall
@Nullable protected final <T> T jsiiAsyncCall(final String method, final Class<T> returnType, @Nullable final Object... args) { JsiiClient client = engine.getClient(); JsiiPromise promise = client.beginAsyncMethod(this.objRef, method, JsiiObjectMapper.valueToTree(args)); engine.processAllPe...
java
@Nullable protected final <T> T jsiiAsyncCall(final String method, final Class<T> returnType, @Nullable final Object... args) { JsiiClient client = engine.getClient(); JsiiPromise promise = client.beginAsyncMethod(this.objRef, method, JsiiObjectMapper.valueToTree(args)); engine.processAllPe...
[ "@", "Nullable", "protected", "final", "<", "T", ">", "T", "jsiiAsyncCall", "(", "final", "String", "method", ",", "final", "Class", "<", "T", ">", "returnType", ",", "@", "Nullable", "final", "Object", "...", "args", ")", "{", "JsiiClient", "client", "=...
Calls an async method on the object. @param method The name of the method. @param returnType The return type. @param args Method arguments. @param <T> Java type for the return value. @return A ereturn value.
[ "Calls", "an", "async", "method", "on", "the", "object", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L88-L96
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiGet
@Nullable protected final <T> T jsiiGet(final String property, final Class<T> type) { return JsiiObjectMapper.treeToValue(engine.getClient().getPropertyValue(this.objRef, property), type); }
java
@Nullable protected final <T> T jsiiGet(final String property, final Class<T> type) { return JsiiObjectMapper.treeToValue(engine.getClient().getPropertyValue(this.objRef, property), type); }
[ "@", "Nullable", "protected", "final", "<", "T", ">", "T", "jsiiGet", "(", "final", "String", "property", ",", "final", "Class", "<", "T", ">", "type", ")", "{", "return", "JsiiObjectMapper", ".", "treeToValue", "(", "engine", ".", "getClient", "(", ")",...
Gets a property value from the object. @param property The property name. @param type The Java type of the property. @param <T> The Java type of the property. @return The property value.
[ "Gets", "a", "property", "value", "from", "the", "object", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L105-L108
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiStaticGet
@Nullable protected static <T> T jsiiStaticGet(final Class<?> nativeClass, final String property, final Class<T> type) { String fqn = engine.loadModuleForClass(nativeClass); return JsiiObjectMapper.treeToValue(engine.getClient().getStaticPropertyValue(fqn, property), type); }
java
@Nullable protected static <T> T jsiiStaticGet(final Class<?> nativeClass, final String property, final Class<T> type) { String fqn = engine.loadModuleForClass(nativeClass); return JsiiObjectMapper.treeToValue(engine.getClient().getStaticPropertyValue(fqn, property), type); }
[ "@", "Nullable", "protected", "static", "<", "T", ">", "T", "jsiiStaticGet", "(", "final", "Class", "<", "?", ">", "nativeClass", ",", "final", "String", "property", ",", "final", "Class", "<", "T", ">", "type", ")", "{", "String", "fqn", "=", "engine"...
Returns the value of a static property. @param nativeClass The java class. @param property The name of the property. @param type The expected java return type. @param <T> Return type @return Return value
[ "Returns", "the", "value", "of", "a", "static", "property", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L118-L122
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiSet
protected final void jsiiSet(final String property, @Nullable final Object value) { engine.getClient().setPropertyValue(this.objRef, property, JsiiObjectMapper.valueToTree(value)); }
java
protected final void jsiiSet(final String property, @Nullable final Object value) { engine.getClient().setPropertyValue(this.objRef, property, JsiiObjectMapper.valueToTree(value)); }
[ "protected", "final", "void", "jsiiSet", "(", "final", "String", "property", ",", "@", "Nullable", "final", "Object", "value", ")", "{", "engine", ".", "getClient", "(", ")", ".", "setPropertyValue", "(", "this", ".", "objRef", ",", "property", ",", "JsiiO...
Sets a property value of an object. @param property The name of the property. @param value The property value.
[ "Sets", "a", "property", "value", "of", "an", "object", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L129-L131
train
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java
JsiiObject.jsiiStaticSet
protected static void jsiiStaticSet(final Class<?> nativeClass, final String property, @Nullable final Object value) { String fqn = engine.loadModuleForClass(nativeClass); engine.getClient().setStaticPropertyValue(fqn, property, JsiiObjectMapper.valueToTree(value)); }
java
protected static void jsiiStaticSet(final Class<?> nativeClass, final String property, @Nullable final Object value) { String fqn = engine.loadModuleForClass(nativeClass); engine.getClient().setStaticPropertyValue(fqn, property, JsiiObjectMapper.valueToTree(value)); }
[ "protected", "static", "void", "jsiiStaticSet", "(", "final", "Class", "<", "?", ">", "nativeClass", ",", "final", "String", "property", ",", "@", "Nullable", "final", "Object", "value", ")", "{", "String", "fqn", "=", "engine", ".", "loadModuleForClass", "(...
Sets a value for a static property. @param nativeClass The java class. @param property The name of the property @param value The value
[ "Sets", "a", "value", "for", "a", "static", "property", "." ]
6bbf743f5f65e98e5199ad31c93961533ffc40e5
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObject.java#L139-L142
train
NordicSemiconductor/Android-Scanner-Compat-Library
scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/BluetoothLeUtils.java
BluetoothLeUtils.checkAdapterStateOn
@RequiresPermission(Manifest.permission.BLUETOOTH) static void checkAdapterStateOn(@Nullable final BluetoothAdapter adapter) { if (adapter == null || adapter.getState() != BluetoothAdapter.STATE_ON) { throw new IllegalStateException("BT Adapter is not turned ON"); } }
java
@RequiresPermission(Manifest.permission.BLUETOOTH) static void checkAdapterStateOn(@Nullable final BluetoothAdapter adapter) { if (adapter == null || adapter.getState() != BluetoothAdapter.STATE_ON) { throw new IllegalStateException("BT Adapter is not turned ON"); } }
[ "@", "RequiresPermission", "(", "Manifest", ".", "permission", ".", "BLUETOOTH", ")", "static", "void", "checkAdapterStateOn", "(", "@", "Nullable", "final", "BluetoothAdapter", "adapter", ")", "{", "if", "(", "adapter", "==", "null", "||", "adapter", ".", "ge...
Ensure Bluetooth is turned on. @throws IllegalStateException If {@code adapter} is null or Bluetooth state is not {@link BluetoothAdapter#STATE_ON}.
[ "Ensure", "Bluetooth", "is", "turned", "on", "." ]
569982877c77c005649f728809d3199faf2080af
https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/blob/569982877c77c005649f728809d3199faf2080af/scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/BluetoothLeUtils.java#L137-L142
train
NordicSemiconductor/Android-Scanner-Compat-Library
scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/ScanFilter.java
ScanFilter.matchesServiceUuid
private static boolean matchesServiceUuid(@NonNull final UUID uuid, @Nullable final UUID mask, @NonNull final UUID data) { if (mask == null) { return uuid.equals(data); } if ((uuid.getLeastSignificantBits() & mask.getLeastSignificantBits()) != (data.getLeastSignificantBits() & m...
java
private static boolean matchesServiceUuid(@NonNull final UUID uuid, @Nullable final UUID mask, @NonNull final UUID data) { if (mask == null) { return uuid.equals(data); } if ((uuid.getLeastSignificantBits() & mask.getLeastSignificantBits()) != (data.getLeastSignificantBits() & m...
[ "private", "static", "boolean", "matchesServiceUuid", "(", "@", "NonNull", "final", "UUID", "uuid", ",", "@", "Nullable", "final", "UUID", "mask", ",", "@", "NonNull", "final", "UUID", "data", ")", "{", "if", "(", "mask", "==", "null", ")", "{", "return"...
Check if the uuid pattern matches the particular service uuid.
[ "Check", "if", "the", "uuid", "pattern", "matches", "the", "particular", "service", "uuid", "." ]
569982877c77c005649f728809d3199faf2080af
https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/blob/569982877c77c005649f728809d3199faf2080af/scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/ScanFilter.java#L350-L362
train
NordicSemiconductor/Android-Scanner-Compat-Library
scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/ScanFilter.java
ScanFilter.matchesPartialData
@SuppressWarnings("BooleanMethodIsAlwaysInverted") private boolean matchesPartialData(@Nullable final byte[] data, @Nullable final byte[] dataMask, @Nullable final byte[] parsedData) { if (data == null) { // If filter data is null it means it doesn't matter. // We return true if any dat...
java
@SuppressWarnings("BooleanMethodIsAlwaysInverted") private boolean matchesPartialData(@Nullable final byte[] data, @Nullable final byte[] dataMask, @Nullable final byte[] parsedData) { if (data == null) { // If filter data is null it means it doesn't matter. // We return true if any dat...
[ "@", "SuppressWarnings", "(", "\"BooleanMethodIsAlwaysInverted\"", ")", "private", "boolean", "matchesPartialData", "(", "@", "Nullable", "final", "byte", "[", "]", "data", ",", "@", "Nullable", "final", "byte", "[", "]", "dataMask", ",", "@", "Nullable", "final...
Check whether the data pattern matches the parsed data.
[ "Check", "whether", "the", "data", "pattern", "matches", "the", "parsed", "data", "." ]
569982877c77c005649f728809d3199faf2080af
https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/blob/569982877c77c005649f728809d3199faf2080af/scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/ScanFilter.java#L365-L391
train
NordicSemiconductor/Android-Scanner-Compat-Library
scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/BluetoothLeScannerCompat.java
BluetoothLeScannerCompat.getScanner
@NonNull public synchronized static BluetoothLeScannerCompat getScanner() { if (instance != null) return instance; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) return instance = new BluetoothLeScannerImplOreo(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) return instance = new BluetoothLe...
java
@NonNull public synchronized static BluetoothLeScannerCompat getScanner() { if (instance != null) return instance; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) return instance = new BluetoothLeScannerImplOreo(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) return instance = new BluetoothLe...
[ "@", "NonNull", "public", "synchronized", "static", "BluetoothLeScannerCompat", "getScanner", "(", ")", "{", "if", "(", "instance", "!=", "null", ")", "return", "instance", ";", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION...
Returns the scanner compat object @return scanner implementation
[ "Returns", "the", "scanner", "compat", "object" ]
569982877c77c005649f728809d3199faf2080af
https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/blob/569982877c77c005649f728809d3199faf2080af/scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/BluetoothLeScannerCompat.java#L96-L107
train
NordicSemiconductor/Android-Scanner-Compat-Library
scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/BluetoothLeScannerImplJB.java
BluetoothLeScannerImplJB.setPowerSaveSettings
private void setPowerSaveSettings() { long minRest = Long.MAX_VALUE, minScan = Long.MAX_VALUE; synchronized (wrappers) { for (final ScanCallbackWrapper wrapper : wrappers.values()) { final ScanSettings settings = wrapper.scanSettings; if (settings.hasPowerSaveMode()) { if (minRest > settings.getPowe...
java
private void setPowerSaveSettings() { long minRest = Long.MAX_VALUE, minScan = Long.MAX_VALUE; synchronized (wrappers) { for (final ScanCallbackWrapper wrapper : wrappers.values()) { final ScanSettings settings = wrapper.scanSettings; if (settings.hasPowerSaveMode()) { if (minRest > settings.getPowe...
[ "private", "void", "setPowerSaveSettings", "(", ")", "{", "long", "minRest", "=", "Long", ".", "MAX_VALUE", ",", "minScan", "=", "Long", ".", "MAX_VALUE", ";", "synchronized", "(", "wrappers", ")", "{", "for", "(", "final", "ScanCallbackWrapper", "wrapper", ...
This method goes through registered callbacks and sets the power rest and scan intervals to next lowest value.
[ "This", "method", "goes", "through", "registered", "callbacks", "and", "sets", "the", "power", "rest", "and", "scan", "intervals", "to", "next", "lowest", "value", "." ]
569982877c77c005649f728809d3199faf2080af
https://github.com/NordicSemiconductor/Android-Scanner-Compat-Library/blob/569982877c77c005649f728809d3199faf2080af/scanner/src/main/java/no/nordicsemi/android/support/v18/scanner/BluetoothLeScannerImplJB.java#L213-L243
train
alibaba/Virtualview-Android
virtualview/src/main/java/com/tmall/wireless/vaf/expr/engine/CodeReader.java
CodeReader.setCode
public void setCode(ExprCode code) { mCode = code; mStartPos = mCode.mStartPos; mCurIndex = mStartPos; }
java
public void setCode(ExprCode code) { mCode = code; mStartPos = mCode.mStartPos; mCurIndex = mStartPos; }
[ "public", "void", "setCode", "(", "ExprCode", "code", ")", "{", "mCode", "=", "code", ";", "mStartPos", "=", "mCode", ".", "mStartPos", ";", "mCurIndex", "=", "mStartPos", ";", "}" ]
private int mCount;
[ "private", "int", "mCount", ";" ]
30c65791f34458ec840e00d2b84ab2912ea102f0
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/virtualview/src/main/java/com/tmall/wireless/vaf/expr/engine/CodeReader.java#L39-L44
train
alibaba/Virtualview-Android
virtualview/src/main/java/com/tmall/wireless/vaf/virtualview/Helper/RtlHelper.java
RtlHelper.isRtl
public static boolean isRtl() { if (sEnable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return View.LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()); } return false; }
java
public static boolean isRtl() { if (sEnable && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return View.LAYOUT_DIRECTION_RTL == TextUtils.getLayoutDirectionFromLocale(Locale.getDefault()); } return false; }
[ "public", "static", "boolean", "isRtl", "(", ")", "{", "if", "(", "sEnable", "&&", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "JELLY_BEAN_MR1", ")", "{", "return", "View", ".", "LAYOUT_DIRECTION_RTL", "==", "TextUtils"...
In Rtl env or not. @return true if in Rtl env.
[ "In", "Rtl", "env", "or", "not", "." ]
30c65791f34458ec840e00d2b84ab2912ea102f0
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/virtualview/src/main/java/com/tmall/wireless/vaf/virtualview/Helper/RtlHelper.java#L33-L39
train
alibaba/Virtualview-Android
virtualview/src/main/java/com/tmall/wireless/vaf/virtualview/Helper/RtlHelper.java
RtlHelper.getRealLeft
public static int getRealLeft(boolean isRtl, int parentLeft, int parentWidth, int left, int width) { if (isRtl) { // 1, trim the parent's left. left -= parentLeft; // 2, calculate the RTL left. left = parentWidth - width - left; // 3, add the parent's ...
java
public static int getRealLeft(boolean isRtl, int parentLeft, int parentWidth, int left, int width) { if (isRtl) { // 1, trim the parent's left. left -= parentLeft; // 2, calculate the RTL left. left = parentWidth - width - left; // 3, add the parent's ...
[ "public", "static", "int", "getRealLeft", "(", "boolean", "isRtl", ",", "int", "parentLeft", ",", "int", "parentWidth", ",", "int", "left", ",", "int", "width", ")", "{", "if", "(", "isRtl", ")", "{", "// 1, trim the parent's left.", "left", "-=", "parentLef...
Convert left to RTL left if need. @param parentLeft parent's left @param parentWidth parent's width @param left self's left @param width self's width @return
[ "Convert", "left", "to", "RTL", "left", "if", "need", "." ]
30c65791f34458ec840e00d2b84ab2912ea102f0
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/virtualview/src/main/java/com/tmall/wireless/vaf/virtualview/Helper/RtlHelper.java#L49-L59
train
alibaba/Virtualview-Android
app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java
ViewServer.get
public static ViewServer get(Context context) { ApplicationInfo info = context.getApplicationInfo(); if (BUILD_TYPE_USER.equals(Build.TYPE) && (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { if (sServer == null) { sServer = new ViewServer(ViewServer.VIE...
java
public static ViewServer get(Context context) { ApplicationInfo info = context.getApplicationInfo(); if (BUILD_TYPE_USER.equals(Build.TYPE) && (info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { if (sServer == null) { sServer = new ViewServer(ViewServer.VIE...
[ "public", "static", "ViewServer", "get", "(", "Context", "context", ")", "{", "ApplicationInfo", "info", "=", "context", ".", "getApplicationInfo", "(", ")", ";", "if", "(", "BUILD_TYPE_USER", ".", "equals", "(", "Build", ".", "TYPE", ")", "&&", "(", "info...
Returns a unique instance of the ViewServer. This method should only be called from the main thread of your application. The server will have the same lifetime as your process. If your application does not have the <code>android:debuggable</code> flag set in its manifest, the server returned by this method will be a d...
[ "Returns", "a", "unique", "instance", "of", "the", "ViewServer", ".", "This", "method", "should", "only", "be", "called", "from", "the", "main", "thread", "of", "your", "application", ".", "The", "server", "will", "have", "the", "same", "lifetime", "as", "...
30c65791f34458ec840e00d2b84ab2912ea102f0
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java#L173-L193
train
alibaba/Virtualview-Android
app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java
ViewServer.removeWindow
public void removeWindow(View view) { mWindowsLock.writeLock().lock(); try { mWindows.remove(view.getRootView()); } finally { mWindowsLock.writeLock().unlock(); } fireWindowsChangedEvent(); }
java
public void removeWindow(View view) { mWindowsLock.writeLock().lock(); try { mWindows.remove(view.getRootView()); } finally { mWindowsLock.writeLock().unlock(); } fireWindowsChangedEvent(); }
[ "public", "void", "removeWindow", "(", "View", "view", ")", "{", "mWindowsLock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "mWindows", ".", "remove", "(", "view", ".", "getRootView", "(", ")", ")", ";", "}", "finally", "{", ...
Invoke this method to unregister a view hierarchy. @param view A view that belongs to the view hierarchy/window to unregister @see #addWindow(View, String)
[ "Invoke", "this", "method", "to", "unregister", "a", "view", "hierarchy", "." ]
30c65791f34458ec840e00d2b84ab2912ea102f0
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java#L353-L361
train
alibaba/Virtualview-Android
app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java
ViewServer.setFocusedWindow
public void setFocusedWindow(View view) { mFocusLock.writeLock().lock(); try { mFocusedWindow = view == null ? null : view.getRootView(); } finally { mFocusLock.writeLock().unlock(); } fireFocusChangedEvent(); }
java
public void setFocusedWindow(View view) { mFocusLock.writeLock().lock(); try { mFocusedWindow = view == null ? null : view.getRootView(); } finally { mFocusLock.writeLock().unlock(); } fireFocusChangedEvent(); }
[ "public", "void", "setFocusedWindow", "(", "View", "view", ")", "{", "mFocusLock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "mFocusedWindow", "=", "view", "==", "null", "?", "null", ":", "view", ".", "getRootView", "(", ")", ...
Invoke this method to change the currently focused window. @param view A view that belongs to the view hierarchy/window that has focus, or null to remove focus
[ "Invoke", "this", "method", "to", "change", "the", "currently", "focused", "window", "." ]
30c65791f34458ec840e00d2b84ab2912ea102f0
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java#L379-L387
train
alibaba/Virtualview-Android
app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java
ViewServer.run
public void run() { try { mServer = new ServerSocket(mPort, VIEW_SERVER_MAX_CONNECTIONS, InetAddress.getLocalHost()); } catch (Exception e) { Log.w(LOG_TAG, "Starting ServerSocket error: ", e); } while (mServer != null && Thread.currentThread() == mThread) { ...
java
public void run() { try { mServer = new ServerSocket(mPort, VIEW_SERVER_MAX_CONNECTIONS, InetAddress.getLocalHost()); } catch (Exception e) { Log.w(LOG_TAG, "Starting ServerSocket error: ", e); } while (mServer != null && Thread.currentThread() == mThread) { ...
[ "public", "void", "run", "(", ")", "{", "try", "{", "mServer", "=", "new", "ServerSocket", "(", "mPort", ",", "VIEW_SERVER_MAX_CONNECTIONS", ",", "InetAddress", ".", "getLocalHost", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "Log"...
Main server loop.
[ "Main", "server", "loop", "." ]
30c65791f34458ec840e00d2b84ab2912ea102f0
https://github.com/alibaba/Virtualview-Android/blob/30c65791f34458ec840e00d2b84ab2912ea102f0/app/src/main/java/com/tmall/wireless/virtualviewdemo/ViewServer.java#L392-L416
train
restfb/restfb
src/main/java/com/restfb/util/UrlUtils.java
UrlUtils.removeQueryParameter
public static String removeQueryParameter(String url, String key) { String[] urlParts = url.split("\\?"); if (urlParts.length == 2) { Map<String, List<String>> paramMap = extractParametersFromQueryString(urlParts[1]); if (paramMap.containsKey(key)) { String queryValue = paramMap.get(key).ge...
java
public static String removeQueryParameter(String url, String key) { String[] urlParts = url.split("\\?"); if (urlParts.length == 2) { Map<String, List<String>> paramMap = extractParametersFromQueryString(urlParts[1]); if (paramMap.containsKey(key)) { String queryValue = paramMap.get(key).ge...
[ "public", "static", "String", "removeQueryParameter", "(", "String", "url", ",", "String", "key", ")", "{", "String", "[", "]", "urlParts", "=", "url", ".", "split", "(", "\"\\\\?\"", ")", ";", "if", "(", "urlParts", ".", "length", "==", "2", ")", "{",...
Remove the given key from the url query string and return the new URL as String. @param url The URL from which parameters are extracted. @param key the key, that should be removed @return the modified URL as String
[ "Remove", "the", "given", "key", "from", "the", "url", "query", "string", "and", "return", "the", "new", "URL", "as", "String", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/UrlUtils.java#L204-L223
train
restfb/restfb
src/main/java/com/restfb/BaseFacebookClient.java
BaseFacebookClient.verifyParameterLegality
protected void verifyParameterLegality(Parameter... parameters) { for (Parameter parameter : parameters) if (illegalParamNames.contains(parameter.name)) { throw new IllegalArgumentException( "Parameter '" + parameter.name + "' is reserved for RestFB use - you cannot specify it yourself...
java
protected void verifyParameterLegality(Parameter... parameters) { for (Parameter parameter : parameters) if (illegalParamNames.contains(parameter.name)) { throw new IllegalArgumentException( "Parameter '" + parameter.name + "' is reserved for RestFB use - you cannot specify it yourself...
[ "protected", "void", "verifyParameterLegality", "(", "Parameter", "...", "parameters", ")", "{", "for", "(", "Parameter", "parameter", ":", "parameters", ")", "if", "(", "illegalParamNames", ".", "contains", "(", "parameter", ".", "name", ")", ")", "{", "throw...
Verifies that the provided parameter names don't collide with the ones we internally pass along to Facebook. @param parameters The parameters to check. @throws IllegalArgumentException If there's a parameter name collision.
[ "Verifies", "that", "the", "provided", "parameter", "names", "don", "t", "collide", "with", "the", "ones", "we", "internally", "pass", "along", "to", "Facebook", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/BaseFacebookClient.java#L136-L142
train
restfb/restfb
src/main/lombok/com/restfb/types/webhook/messaging/NlpResult.java
NlpResult.getEntities
public <T extends BaseNlpEntity> List<T> getEntities(Class<T> clazz) { List<BaseNlpEntity> resultList = new ArrayList<>(); for (BaseNlpEntity item : getEntities()) { if (item.getClass().equals(clazz)) { resultList.add(item); } } return (List<T>) resultList; }
java
public <T extends BaseNlpEntity> List<T> getEntities(Class<T> clazz) { List<BaseNlpEntity> resultList = new ArrayList<>(); for (BaseNlpEntity item : getEntities()) { if (item.getClass().equals(clazz)) { resultList.add(item); } } return (List<T>) resultList; }
[ "public", "<", "T", "extends", "BaseNlpEntity", ">", "List", "<", "T", ">", "getEntities", "(", "Class", "<", "T", ">", "clazz", ")", "{", "List", "<", "BaseNlpEntity", ">", "resultList", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Bas...
returns a subset of the found entities. Only entities that are of type <code>T</code> are returned. T needs to extend the {@link BaseNlpEntity}. @param clazz the filter class @return List of entites, only the filtered elements are returned.
[ "returns", "a", "subset", "of", "the", "found", "entities", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/lombok/com/restfb/types/webhook/messaging/NlpResult.java#L138-L146
train
restfb/restfb
src/main/lombok/com/restfb/types/Comments.java
Comments.fillOrder
private void fillOrder(JsonObject summary) { if (summary != null) { order = summary.getString("order", order); } if (order == null && openGraphCommentOrder != null) { order = openGraphCommentOrder; } }
java
private void fillOrder(JsonObject summary) { if (summary != null) { order = summary.getString("order", order); } if (order == null && openGraphCommentOrder != null) { order = openGraphCommentOrder; } }
[ "private", "void", "fillOrder", "(", "JsonObject", "summary", ")", "{", "if", "(", "summary", "!=", "null", ")", "{", "order", "=", "summary", ".", "getString", "(", "\"order\"", ",", "order", ")", ";", "}", "if", "(", "order", "==", "null", "&&", "o...
set the order the comments are sorted
[ "set", "the", "order", "the", "comments", "are", "sorted" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/lombok/com/restfb/types/Comments.java#L157-L165
train
restfb/restfb
src/main/lombok/com/restfb/types/Comments.java
Comments.fillCanComment
private void fillCanComment(JsonObject summary) { if (summary != null && summary.get("can_comment") != null) { canComment = summary.get("can_comment").asBoolean(); } if (canComment == null && openGraphCanComment != null) { canComment = openGraphCanComment; } }
java
private void fillCanComment(JsonObject summary) { if (summary != null && summary.get("can_comment") != null) { canComment = summary.get("can_comment").asBoolean(); } if (canComment == null && openGraphCanComment != null) { canComment = openGraphCanComment; } }
[ "private", "void", "fillCanComment", "(", "JsonObject", "summary", ")", "{", "if", "(", "summary", "!=", "null", "&&", "summary", ".", "get", "(", "\"can_comment\"", ")", "!=", "null", ")", "{", "canComment", "=", "summary", ".", "get", "(", "\"can_comment...
set the can_comment
[ "set", "the", "can_comment" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/lombok/com/restfb/types/Comments.java#L170-L178
train
restfb/restfb
src/main/java/com/restfb/util/EncodingUtils.java
EncodingUtils.decodeBase64
public static byte[] decodeBase64(String base64) { if (base64 == null) throw new NullPointerException("Parameter 'base64' cannot be null."); String fixedBase64 = padBase64(base64); return Base64.getDecoder().decode(fixedBase64); }
java
public static byte[] decodeBase64(String base64) { if (base64 == null) throw new NullPointerException("Parameter 'base64' cannot be null."); String fixedBase64 = padBase64(base64); return Base64.getDecoder().decode(fixedBase64); }
[ "public", "static", "byte", "[", "]", "decodeBase64", "(", "String", "base64", ")", "{", "if", "(", "base64", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"Parameter 'base64' cannot be null.\"", ")", ";", "String", "fixedBase64", "=", "padBa...
Decodes a base64-encoded string, padding out if necessary. @param base64 The base64-encoded string to decode. @return A decoded version of {@code base64}. @throws NullPointerException If {@code base64} is {@code null}.
[ "Decodes", "a", "base64", "-", "encoded", "string", "padding", "out", "if", "necessary", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/EncodingUtils.java#L53-L59
train
restfb/restfb
src/main/java/com/restfb/util/EncodingUtils.java
EncodingUtils.encodeAppSecretProof
public static String encodeAppSecretProof(String appSecret, String accessToken) { try { byte[] key = appSecret.getBytes(StandardCharsets.UTF_8); SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA256"); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(signingKey); byte[] raw = ...
java
public static String encodeAppSecretProof(String appSecret, String accessToken) { try { byte[] key = appSecret.getBytes(StandardCharsets.UTF_8); SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA256"); Mac mac = Mac.getInstance("HmacSHA256"); mac.init(signingKey); byte[] raw = ...
[ "public", "static", "String", "encodeAppSecretProof", "(", "String", "appSecret", ",", "String", "accessToken", ")", "{", "try", "{", "byte", "[", "]", "key", "=", "appSecret", ".", "getBytes", "(", "StandardCharsets", ".", "UTF_8", ")", ";", "SecretKeySpec", ...
Generates an appsecret_proof for facebook. See https://developers.facebook.com/docs/graph-api/securing-requests for more info @param appSecret The facebook application secret @param accessToken The facebook access token @return A Hex encoded SHA256 Hash as a String
[ "Generates", "an", "appsecret_proof", "for", "facebook", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/EncodingUtils.java#L112-L124
train
restfb/restfb
src/main/java/com/restfb/json/JsonObject.java
JsonObject.remove
public JsonObject remove(String name) { if (name == null) { throw new NullPointerException(NAME_IS_NULL); } int index = indexOf(name); if (index != -1) { table.remove(index); names.remove(index); values.remove(index); } return this; }
java
public JsonObject remove(String name) { if (name == null) { throw new NullPointerException(NAME_IS_NULL); } int index = indexOf(name); if (index != -1) { table.remove(index); names.remove(index); values.remove(index); } return this; }
[ "public", "JsonObject", "remove", "(", "String", "name", ")", "{", "if", "(", "name", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "NAME_IS_NULL", ")", ";", "}", "int", "index", "=", "indexOf", "(", "name", ")", ";", "if", "(", ...
Removes a member with the specified name from this object. If this object contains multiple members with the given name, only the last one is removed. If this object does not contain a member with the specified name, the object is not modified. @param name the name of the member to remove @return the object itself, to...
[ "Removes", "a", "member", "with", "the", "specified", "name", "from", "this", "object", ".", "If", "this", "object", "contains", "multiple", "members", "with", "the", "given", "name", "only", "the", "last", "one", "is", "removed", ".", "If", "this", "objec...
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/json/JsonObject.java#L501-L512
train
restfb/restfb
src/main/java/com/restfb/json/JsonObject.java
JsonObject.merge
public JsonObject merge(JsonObject object) { if (object == null) { throw new NullPointerException(OBJECT_IS_NULL); } for (Member member : object) { this.set(member.name, member.value); } return this; }
java
public JsonObject merge(JsonObject object) { if (object == null) { throw new NullPointerException(OBJECT_IS_NULL); } for (Member member : object) { this.set(member.name, member.value); } return this; }
[ "public", "JsonObject", "merge", "(", "JsonObject", "object", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "OBJECT_IS_NULL", ")", ";", "}", "for", "(", "Member", "member", ":", "object", ")", "{", "t...
Copies all members of the specified object into this object. When the specified object contains members with names that also exist in this object, the existing values in this object will be replaced by the corresponding values in the specified object. @param object the object to merge @return the object itself, to ena...
[ "Copies", "all", "members", "of", "the", "specified", "object", "into", "this", "object", ".", "When", "the", "specified", "object", "contains", "members", "with", "names", "that", "also", "exist", "in", "this", "object", "the", "existing", "values", "in", "...
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/json/JsonObject.java#L536-L544
train
restfb/restfb
src/main/java/com/restfb/DefaultFacebookClient.java
DefaultFacebookClient.urlDecodeSignedRequestToken
protected String urlDecodeSignedRequestToken(String signedRequestToken) { verifyParameterPresence("signedRequestToken", signedRequestToken); return signedRequestToken.replace("-", "+").replace("_", "/").trim(); }
java
protected String urlDecodeSignedRequestToken(String signedRequestToken) { verifyParameterPresence("signedRequestToken", signedRequestToken); return signedRequestToken.replace("-", "+").replace("_", "/").trim(); }
[ "protected", "String", "urlDecodeSignedRequestToken", "(", "String", "signedRequestToken", ")", "{", "verifyParameterPresence", "(", "\"signedRequestToken\"", ",", "signedRequestToken", ")", ";", "return", "signedRequestToken", ".", "replace", "(", "\"-\"", ",", "\"+\"", ...
Decodes a component of a signed request received from Facebook using FB's special URL-encoding strategy. @param signedRequestToken Token to decode. @return The decoded token.
[ "Decodes", "a", "component", "of", "a", "signed", "request", "received", "from", "Facebook", "using", "FB", "s", "special", "URL", "-", "encoding", "strategy", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/DefaultFacebookClient.java#L619-L622
train
restfb/restfb
src/main/java/com/restfb/DefaultFacebookClient.java
DefaultFacebookClient.verifySignedRequest
protected boolean verifySignedRequest(String appSecret, String algorithm, String encodedPayload, byte[] signature) { verifyParameterPresence("appSecret", appSecret); verifyParameterPresence("algorithm", algorithm); verifyParameterPresence("encodedPayload", encodedPayload); verifyParameterPresence("signa...
java
protected boolean verifySignedRequest(String appSecret, String algorithm, String encodedPayload, byte[] signature) { verifyParameterPresence("appSecret", appSecret); verifyParameterPresence("algorithm", algorithm); verifyParameterPresence("encodedPayload", encodedPayload); verifyParameterPresence("signa...
[ "protected", "boolean", "verifySignedRequest", "(", "String", "appSecret", ",", "String", "algorithm", ",", "String", "encodedPayload", ",", "byte", "[", "]", "signature", ")", "{", "verifyParameterPresence", "(", "\"appSecret\"", ",", "appSecret", ")", ";", "veri...
Verifies that the signed request is really from Facebook. @param appSecret The secret for the app that can verify this signed request. @param algorithm Signature algorithm specified by FB in the decoded payload. @param encodedPayload The encoded payload used to generate a signature for comparison against the provided ...
[ "Verifies", "that", "the", "signed", "request", "is", "really", "from", "Facebook", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/DefaultFacebookClient.java#L657-L676
train
restfb/restfb
src/main/java/com/restfb/DefaultFacebookClient.java
DefaultFacebookClient.toParameterString
protected String toParameterString(boolean withJsonParameter, Parameter... parameters) { if (!isBlank(accessToken)) { parameters = parametersWithAdditionalParameter(Parameter.with(ACCESS_TOKEN_PARAM_NAME, accessToken), parameters); } if (!isBlank(accessToken) && !isBlank(appSecret)) { parameter...
java
protected String toParameterString(boolean withJsonParameter, Parameter... parameters) { if (!isBlank(accessToken)) { parameters = parametersWithAdditionalParameter(Parameter.with(ACCESS_TOKEN_PARAM_NAME, accessToken), parameters); } if (!isBlank(accessToken) && !isBlank(appSecret)) { parameter...
[ "protected", "String", "toParameterString", "(", "boolean", "withJsonParameter", ",", "Parameter", "...", "parameters", ")", "{", "if", "(", "!", "isBlank", "(", "accessToken", ")", ")", "{", "parameters", "=", "parametersWithAdditionalParameter", "(", "Parameter", ...
Generate the parameter string to be included in the Facebook API request. @param withJsonParameter add additional parameter format with type json @param parameters Arbitrary number of extra parameters to include in the request. @return The parameter string to include in the Facebook API request. @throws FacebookJsonMa...
[ "Generate", "the", "parameter", "string", "to", "be", "included", "in", "the", "Facebook", "API", "request", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/DefaultFacebookClient.java#L875-L905
train
restfb/restfb
src/main/java/com/restfb/DefaultFacebookClient.java
DefaultFacebookClient.getFacebookGraphEndpointUrl
protected String getFacebookGraphEndpointUrl() { if (apiVersion.isUrlElementRequired()) { return getFacebookEndpointUrls().getGraphEndpoint() + '/' + apiVersion.getUrlElement(); } else { return getFacebookEndpointUrls().getGraphEndpoint(); } }
java
protected String getFacebookGraphEndpointUrl() { if (apiVersion.isUrlElementRequired()) { return getFacebookEndpointUrls().getGraphEndpoint() + '/' + apiVersion.getUrlElement(); } else { return getFacebookEndpointUrls().getGraphEndpoint(); } }
[ "protected", "String", "getFacebookGraphEndpointUrl", "(", ")", "{", "if", "(", "apiVersion", ".", "isUrlElementRequired", "(", ")", ")", "{", "return", "getFacebookEndpointUrls", "(", ")", ".", "getGraphEndpoint", "(", ")", "+", "'", "'", "+", "apiVersion", "...
Returns the base endpoint URL for the Graph API. @return The base endpoint URL for the Graph API.
[ "Returns", "the", "base", "endpoint", "URL", "for", "the", "Graph", "API", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/DefaultFacebookClient.java#L931-L937
train
restfb/restfb
src/main/java/com/restfb/DefaultFacebookClient.java
DefaultFacebookClient.getFacebookGraphVideoEndpointUrl
protected String getFacebookGraphVideoEndpointUrl() { if (apiVersion.isUrlElementRequired()) { return getFacebookEndpointUrls().getGraphVideoEndpoint() + '/' + apiVersion.getUrlElement(); } else { return getFacebookEndpointUrls().getGraphVideoEndpoint(); } }
java
protected String getFacebookGraphVideoEndpointUrl() { if (apiVersion.isUrlElementRequired()) { return getFacebookEndpointUrls().getGraphVideoEndpoint() + '/' + apiVersion.getUrlElement(); } else { return getFacebookEndpointUrls().getGraphVideoEndpoint(); } }
[ "protected", "String", "getFacebookGraphVideoEndpointUrl", "(", ")", "{", "if", "(", "apiVersion", ".", "isUrlElementRequired", "(", ")", ")", "{", "return", "getFacebookEndpointUrls", "(", ")", ".", "getGraphVideoEndpoint", "(", ")", "+", "'", "'", "+", "apiVer...
Returns the base endpoint URL for the Graph API's video upload functionality. @return The base endpoint URL for the Graph API's video upload functionality. @since 1.6.5
[ "Returns", "the", "base", "endpoint", "URL", "for", "the", "Graph", "API", "s", "video", "upload", "functionality", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/DefaultFacebookClient.java#L945-L951
train
restfb/restfb
src/main/java/com/restfb/JsonHelper.java
JsonHelper.getDoubleFrom
public Double getDoubleFrom(JsonValue json) { if (json.isNumber()) { return json.asDouble(); } else { return Double.valueOf(json.asString()); } }
java
public Double getDoubleFrom(JsonValue json) { if (json.isNumber()) { return json.asDouble(); } else { return Double.valueOf(json.asString()); } }
[ "public", "Double", "getDoubleFrom", "(", "JsonValue", "json", ")", "{", "if", "(", "json", ".", "isNumber", "(", ")", ")", "{", "return", "json", ".", "asDouble", "(", ")", ";", "}", "else", "{", "return", "Double", ".", "valueOf", "(", "json", ".",...
convert jsonvalue to a Double @param json @return
[ "convert", "jsonvalue", "to", "a", "Double" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/JsonHelper.java#L78-L84
train
restfb/restfb
src/main/java/com/restfb/JsonHelper.java
JsonHelper.getIntegerFrom
public Integer getIntegerFrom(JsonValue json) { if (json.isNumber()) { return json.asInt(); } else { return Integer.valueOf(json.asString()); } }
java
public Integer getIntegerFrom(JsonValue json) { if (json.isNumber()) { return json.asInt(); } else { return Integer.valueOf(json.asString()); } }
[ "public", "Integer", "getIntegerFrom", "(", "JsonValue", "json", ")", "{", "if", "(", "json", ".", "isNumber", "(", ")", ")", "{", "return", "json", ".", "asInt", "(", ")", ";", "}", "else", "{", "return", "Integer", ".", "valueOf", "(", "json", ".",...
convert jsonvalue to a Integer @param json @return
[ "convert", "jsonvalue", "to", "a", "Integer" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/JsonHelper.java#L92-L98
train
restfb/restfb
src/main/java/com/restfb/JsonHelper.java
JsonHelper.getStringFrom
public String getStringFrom(JsonValue json) { if (json.isString()) { return json.asString(); } else { return json.toString(); } }
java
public String getStringFrom(JsonValue json) { if (json.isString()) { return json.asString(); } else { return json.toString(); } }
[ "public", "String", "getStringFrom", "(", "JsonValue", "json", ")", "{", "if", "(", "json", ".", "isString", "(", ")", ")", "{", "return", "json", ".", "asString", "(", ")", ";", "}", "else", "{", "return", "json", ".", "toString", "(", ")", ";", "...
convert jsonvalue to a String @param json @return
[ "convert", "jsonvalue", "to", "a", "String" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/JsonHelper.java#L106-L112
train
restfb/restfb
src/main/java/com/restfb/JsonHelper.java
JsonHelper.getFloatFrom
public Float getFloatFrom(JsonValue json) { if (json.isNumber()) { return json.asFloat(); } else { return new BigDecimal(json.asString()).floatValue(); } }
java
public Float getFloatFrom(JsonValue json) { if (json.isNumber()) { return json.asFloat(); } else { return new BigDecimal(json.asString()).floatValue(); } }
[ "public", "Float", "getFloatFrom", "(", "JsonValue", "json", ")", "{", "if", "(", "json", ".", "isNumber", "(", ")", ")", "{", "return", "json", ".", "asFloat", "(", ")", ";", "}", "else", "{", "return", "new", "BigDecimal", "(", "json", ".", "asStri...
convert jsonvalue to a Float @param json @return
[ "convert", "jsonvalue", "to", "a", "Float" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/JsonHelper.java#L120-L126
train
restfb/restfb
src/main/java/com/restfb/JsonHelper.java
JsonHelper.getBigIntegerFrom
public BigInteger getBigIntegerFrom(JsonValue json) { if (json.isString()) { return new BigInteger(json.asString()); } else { return new BigInteger(json.toString()); } }
java
public BigInteger getBigIntegerFrom(JsonValue json) { if (json.isString()) { return new BigInteger(json.asString()); } else { return new BigInteger(json.toString()); } }
[ "public", "BigInteger", "getBigIntegerFrom", "(", "JsonValue", "json", ")", "{", "if", "(", "json", ".", "isString", "(", ")", ")", "{", "return", "new", "BigInteger", "(", "json", ".", "asString", "(", ")", ")", ";", "}", "else", "{", "return", "new",...
convert jsonvalue to a BigInteger @param json @return
[ "convert", "jsonvalue", "to", "a", "BigInteger" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/JsonHelper.java#L134-L140
train
restfb/restfb
src/main/java/com/restfb/JsonHelper.java
JsonHelper.getLongFrom
public Long getLongFrom(JsonValue json) { if (json.isNumber()) { return json.asLong(); } else { return Long.valueOf(json.asString()); } }
java
public Long getLongFrom(JsonValue json) { if (json.isNumber()) { return json.asLong(); } else { return Long.valueOf(json.asString()); } }
[ "public", "Long", "getLongFrom", "(", "JsonValue", "json", ")", "{", "if", "(", "json", ".", "isNumber", "(", ")", ")", "{", "return", "json", ".", "asLong", "(", ")", ";", "}", "else", "{", "return", "Long", ".", "valueOf", "(", "json", ".", "asSt...
convert jsonvalue to a Long @param json @return
[ "convert", "jsonvalue", "to", "a", "Long" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/JsonHelper.java#L148-L154
train
restfb/restfb
src/main/java/com/restfb/JsonHelper.java
JsonHelper.getBigDecimalFrom
public BigDecimal getBigDecimalFrom(JsonValue json) { if (json.isString()) { return new BigDecimal(json.asString()); } else { return new BigDecimal(json.toString()); } }
java
public BigDecimal getBigDecimalFrom(JsonValue json) { if (json.isString()) { return new BigDecimal(json.asString()); } else { return new BigDecimal(json.toString()); } }
[ "public", "BigDecimal", "getBigDecimalFrom", "(", "JsonValue", "json", ")", "{", "if", "(", "json", ".", "isString", "(", ")", ")", "{", "return", "new", "BigDecimal", "(", "json", ".", "asString", "(", ")", ")", ";", "}", "else", "{", "return", "new",...
convert jsonvalue to a BigDecimal @param json @return
[ "convert", "jsonvalue", "to", "a", "BigDecimal" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/JsonHelper.java#L162-L168
train
restfb/restfb
src/main/lombok/com/restfb/types/Reactions.java
Reactions.fillTotalCount
private void fillTotalCount(JsonObject summary) { if (totalCount == 0 && summary != null && summary.get("total_count") != null) { totalCount = summary.getLong("total_count", totalCount); } }
java
private void fillTotalCount(JsonObject summary) { if (totalCount == 0 && summary != null && summary.get("total_count") != null) { totalCount = summary.getLong("total_count", totalCount); } }
[ "private", "void", "fillTotalCount", "(", "JsonObject", "summary", ")", "{", "if", "(", "totalCount", "==", "0", "&&", "summary", "!=", "null", "&&", "summary", ".", "get", "(", "\"total_count\"", ")", "!=", "null", ")", "{", "totalCount", "=", "summary", ...
add change count value, if summary is set and count is empty
[ "add", "change", "count", "value", "if", "summary", "is", "set", "and", "count", "is", "empty" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/lombok/com/restfb/types/Reactions.java#L106-L110
train
restfb/restfb
src/main/java/com/restfb/DefaultWebRequestor.java
DefaultWebRequestor.createFormFieldName
protected String createFormFieldName(BinaryAttachment binaryAttachment) { if (binaryAttachment.getFieldName() != null) { return binaryAttachment.getFieldName(); } String name = binaryAttachment.getFilename(); int fileExtensionIndex = name.lastIndexOf('.'); return fileExtensionIndex > 0 ? name...
java
protected String createFormFieldName(BinaryAttachment binaryAttachment) { if (binaryAttachment.getFieldName() != null) { return binaryAttachment.getFieldName(); } String name = binaryAttachment.getFilename(); int fileExtensionIndex = name.lastIndexOf('.'); return fileExtensionIndex > 0 ? name...
[ "protected", "String", "createFormFieldName", "(", "BinaryAttachment", "binaryAttachment", ")", "{", "if", "(", "binaryAttachment", ".", "getFieldName", "(", ")", "!=", "null", ")", "{", "return", "binaryAttachment", ".", "getFieldName", "(", ")", ";", "}", "Str...
Creates the form field name for the binary attachment filename by stripping off the file extension - for example, the filename "test.png" would return "test". @param binaryAttachment The binary attachment for which to create the form field name. @return The form field name for the given binary attachment.
[ "Creates", "the", "form", "field", "name", "for", "the", "binary", "attachment", "filename", "by", "stripping", "off", "the", "file", "extension", "-", "for", "example", "the", "filename", "test", ".", "png", "would", "return", "test", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/DefaultWebRequestor.java#L281-L289
train
restfb/restfb
src/main/lombok/com/restfb/types/webhook/messaging/MessagingItem.java
MessagingItem.getItem
public InnerMessagingItem getItem() { if (optin != null) { return optin; } if (postback != null) { return postback; } if (delivery != null) { return delivery; } if (read != null) { return read; } if (accountLinking != null) { return accountLinking; ...
java
public InnerMessagingItem getItem() { if (optin != null) { return optin; } if (postback != null) { return postback; } if (delivery != null) { return delivery; } if (read != null) { return read; } if (accountLinking != null) { return accountLinking; ...
[ "public", "InnerMessagingItem", "getItem", "(", ")", "{", "if", "(", "optin", "!=", "null", ")", "{", "return", "optin", ";", "}", "if", "(", "postback", "!=", "null", ")", "{", "return", "postback", ";", "}", "if", "(", "delivery", "!=", "null", ")"...
generic access to the inner item. depending on the inner elements the corresponding element is returned. So you can get an {@link OptinItem}, {@link PostbackItem}, {@link DeliveryItem}, {@link AccountLinkingItem} or {@link MessageItem} @return the inner item.
[ "generic", "access", "to", "the", "inner", "item", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/lombok/com/restfb/types/webhook/messaging/MessagingItem.java#L137-L195
train
restfb/restfb
src/main/lombok/com/restfb/types/webhook/messaging/AppRoles.java
AppRoles.getRoles
public List<String> getRoles(String appId) { if (roles.containsKey(appId)) { return Collections.unmodifiableList(roles.get(appId)); } else { return null; } }
java
public List<String> getRoles(String appId) { if (roles.containsKey(appId)) { return Collections.unmodifiableList(roles.get(appId)); } else { return null; } }
[ "public", "List", "<", "String", ">", "getRoles", "(", "String", "appId", ")", "{", "if", "(", "roles", ".", "containsKey", "(", "appId", ")", ")", "{", "return", "Collections", ".", "unmodifiableList", "(", "roles", ".", "get", "(", "appId", ")", ")",...
get the roles to the given app id @param appId @return List of app roles
[ "get", "the", "roles", "to", "the", "given", "app", "id" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/lombok/com/restfb/types/webhook/messaging/AppRoles.java#L50-L56
train
restfb/restfb
src/main/java/com/restfb/exception/generator/DefaultFacebookExceptionGenerator.java
DefaultFacebookExceptionGenerator.skipResponseStatusExceptionParsing
protected void skipResponseStatusExceptionParsing(String json) throws ResponseErrorJsonParsingException { // If this is not an object, it's not an error response. if (!json.startsWith("{")) { throw new ResponseErrorJsonParsingException(); } int subStrEnd = Math.min(50, json.length()); if (!js...
java
protected void skipResponseStatusExceptionParsing(String json) throws ResponseErrorJsonParsingException { // If this is not an object, it's not an error response. if (!json.startsWith("{")) { throw new ResponseErrorJsonParsingException(); } int subStrEnd = Math.min(50, json.length()); if (!js...
[ "protected", "void", "skipResponseStatusExceptionParsing", "(", "String", "json", ")", "throws", "ResponseErrorJsonParsingException", "{", "// If this is not an object, it's not an error response.", "if", "(", "!", "json", ".", "startsWith", "(", "\"{\"", ")", ")", "{", "...
checks if a string may be a json and contains a error string somewhere, this is used for speedup the error parsing @param json
[ "checks", "if", "a", "string", "may", "be", "a", "json", "and", "contains", "a", "error", "string", "somewhere", "this", "is", "used", "for", "speedup", "the", "error", "parsing" ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/exception/generator/DefaultFacebookExceptionGenerator.java#L124-L134
train
restfb/restfb
src/main/lombok/com/restfb/BinaryAttachment.java
BinaryAttachment.getData
public InputStream getData() { if (data != null) { return new ByteArrayInputStream(data); } else if (dataStream != null) { return dataStream; } else { throw new IllegalStateException("Either the byte[] or the stream mustn't be null at this point."); } }
java
public InputStream getData() { if (data != null) { return new ByteArrayInputStream(data); } else if (dataStream != null) { return dataStream; } else { throw new IllegalStateException("Either the byte[] or the stream mustn't be null at this point."); } }
[ "public", "InputStream", "getData", "(", ")", "{", "if", "(", "data", "!=", "null", ")", "{", "return", "new", "ByteArrayInputStream", "(", "data", ")", ";", "}", "else", "if", "(", "dataStream", "!=", "null", ")", "{", "return", "dataStream", ";", "}"...
The attachment's data. @return The attachment's data.
[ "The", "attachment", "s", "data", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/lombok/com/restfb/BinaryAttachment.java#L398-L406
train
restfb/restfb
src/main/lombok/com/restfb/BinaryAttachment.java
BinaryAttachment.getContentType
public String getContentType() { if (contentType != null) { return contentType; } if (dataStream != null) { try { contentType = URLConnection.guessContentTypeFromStream(dataStream); } catch (IOException ioe) { // ignore exception } } if (data != null) { ...
java
public String getContentType() { if (contentType != null) { return contentType; } if (dataStream != null) { try { contentType = URLConnection.guessContentTypeFromStream(dataStream); } catch (IOException ioe) { // ignore exception } } if (data != null) { ...
[ "public", "String", "getContentType", "(", ")", "{", "if", "(", "contentType", "!=", "null", ")", "{", "return", "contentType", ";", "}", "if", "(", "dataStream", "!=", "null", ")", "{", "try", "{", "contentType", "=", "URLConnection", ".", "guessContentTy...
return the given content type or try to guess from stream or file name. Depending of the available data. @return the content type
[ "return", "the", "given", "content", "type", "or", "try", "to", "guess", "from", "stream", "or", "file", "name", ".", "Depending", "of", "the", "available", "data", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/lombok/com/restfb/BinaryAttachment.java#L413-L436
train
restfb/restfb
src/main/java/com/restfb/DefaultJsonMapper.java
DefaultJsonMapper.logMultipleMappingFailedForField
protected void logMultipleMappingFailedForField(String facebookFieldName, FieldWithAnnotation<Facebook> fieldWithAnnotation, String json) { if (!MAPPER_LOGGER.isTraceEnabled()) { return; } Field field = fieldWithAnnotation.getField(); MAPPER_LOGGER.trace( "Could not map '{}' to {}. {...
java
protected void logMultipleMappingFailedForField(String facebookFieldName, FieldWithAnnotation<Facebook> fieldWithAnnotation, String json) { if (!MAPPER_LOGGER.isTraceEnabled()) { return; } Field field = fieldWithAnnotation.getField(); MAPPER_LOGGER.trace( "Could not map '{}' to {}. {...
[ "protected", "void", "logMultipleMappingFailedForField", "(", "String", "facebookFieldName", ",", "FieldWithAnnotation", "<", "Facebook", ">", "fieldWithAnnotation", ",", "String", "json", ")", "{", "if", "(", "!", "MAPPER_LOGGER", ".", "isTraceEnabled", "(", ")", "...
Dumps out a log message when one of a multiple-mapped Facebook field name JSON-to-Java mapping operation fails. @param facebookFieldName The Facebook field name. @param fieldWithAnnotation The Java field to map to and its annotation. @param json The JSON that failed to map to the Java field.
[ "Dumps", "out", "a", "log", "message", "when", "one", "of", "a", "multiple", "-", "mapped", "Facebook", "field", "name", "JSON", "-", "to", "-", "Java", "mapping", "operation", "fails", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/DefaultJsonMapper.java#L297-L310
train
restfb/restfb
src/main/java/com/restfb/DefaultJsonMapper.java
DefaultJsonMapper.facebookFieldNamesWithMultipleMappings
protected Set<String> facebookFieldNamesWithMultipleMappings( List<FieldWithAnnotation<Facebook>> fieldsWithAnnotation) { Map<String, Integer> facebookFieldsNamesWithOccurrenceCount = new HashMap<>(); Set<String> facebookFieldNamesWithMultipleMappings = new HashSet<>(); // Get a count of Facebook fie...
java
protected Set<String> facebookFieldNamesWithMultipleMappings( List<FieldWithAnnotation<Facebook>> fieldsWithAnnotation) { Map<String, Integer> facebookFieldsNamesWithOccurrenceCount = new HashMap<>(); Set<String> facebookFieldNamesWithMultipleMappings = new HashSet<>(); // Get a count of Facebook fie...
[ "protected", "Set", "<", "String", ">", "facebookFieldNamesWithMultipleMappings", "(", "List", "<", "FieldWithAnnotation", "<", "Facebook", ">", ">", "fieldsWithAnnotation", ")", "{", "Map", "<", "String", ",", "Integer", ">", "facebookFieldsNamesWithOccurrenceCount", ...
Finds any Facebook JSON fields that are mapped to more than 1 Java field. @param fieldsWithAnnotation Java fields annotated with the {@code Facebook} annotation. @return Any Facebook JSON fields that are mapped to more than 1 Java field.
[ "Finds", "any", "Facebook", "JSON", "fields", "that", "are", "mapped", "to", "more", "than", "1", "Java", "field", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/DefaultJsonMapper.java#L343-L366
train
restfb/restfb
src/main/java/com/restfb/util/ObjectUtil.java
ObjectUtil.isEmptyCollectionOrMap
public static boolean isEmptyCollectionOrMap(Object obj) { if (obj instanceof Collection) { return ((Collection) obj).isEmpty(); } return (obj instanceof Map && ((Map) obj).isEmpty()); }
java
public static boolean isEmptyCollectionOrMap(Object obj) { if (obj instanceof Collection) { return ((Collection) obj).isEmpty(); } return (obj instanceof Map && ((Map) obj).isEmpty()); }
[ "public", "static", "boolean", "isEmptyCollectionOrMap", "(", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "Collection", ")", "{", "return", "(", "(", "Collection", ")", "obj", ")", ".", "isEmpty", "(", ")", ";", "}", "return", "(", "obj", ...
Checks is the object is a empty 'collection' or 'map'. @param obj the object that is checked @return {@code true} if the given object is a empty collection or an empty map, {@code false} otherwise
[ "Checks", "is", "the", "object", "is", "a", "empty", "collection", "or", "map", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/util/ObjectUtil.java#L59-L65
train
restfb/restfb
src/main/java/com/restfb/logging/RestFBLogger.java
RestFBLogger.getLoggerInstance
public static RestFBLogger getLoggerInstance(String logCategory) { Object obj; Class[] ctrTypes = new Class[] { String.class }; Object[] ctrArgs = new Object[] { logCategory }; try { Constructor loggerClassConstructor = usedLoggerClass.getConstructor(ctrTypes); obj = loggerClassConstructor.n...
java
public static RestFBLogger getLoggerInstance(String logCategory) { Object obj; Class[] ctrTypes = new Class[] { String.class }; Object[] ctrArgs = new Object[] { logCategory }; try { Constructor loggerClassConstructor = usedLoggerClass.getConstructor(ctrTypes); obj = loggerClassConstructor.n...
[ "public", "static", "RestFBLogger", "getLoggerInstance", "(", "String", "logCategory", ")", "{", "Object", "obj", ";", "Class", "[", "]", "ctrTypes", "=", "new", "Class", "[", "]", "{", "String", ".", "class", "}", ";", "Object", "[", "]", "ctrArgs", "="...
returns the instance of the logger that belongs to the category. @param logCategory the category of the logger @return a instance of the logger
[ "returns", "the", "instance", "of", "the", "logger", "that", "belongs", "to", "the", "category", "." ]
fb77ba5486d1339e7deb81b9830670fa209b1047
https://github.com/restfb/restfb/blob/fb77ba5486d1339e7deb81b9830670fa209b1047/src/main/java/com/restfb/logging/RestFBLogger.java#L88-L100
train
jpmml/jpmml-evaluator
pmml-evaluator/src/main/java/org/jpmml/evaluator/LevenshteinDistanceUtil.java
LevenshteinDistanceUtil.limitedCompare
static int limitedCompare(CharSequence left, CharSequence right, final boolean caseSensitive, final int threshold) { // NOPMD if (left == null || right == null) { throw new IllegalArgumentException("Strings must not be null"); } if (threshold < 0) { throw new IllegalArgumentException("Threshold must not be ...
java
static int limitedCompare(CharSequence left, CharSequence right, final boolean caseSensitive, final int threshold) { // NOPMD if (left == null || right == null) { throw new IllegalArgumentException("Strings must not be null"); } if (threshold < 0) { throw new IllegalArgumentException("Threshold must not be ...
[ "static", "int", "limitedCompare", "(", "CharSequence", "left", ",", "CharSequence", "right", ",", "final", "boolean", "caseSensitive", ",", "final", "int", "threshold", ")", "{", "// NOPMD", "if", "(", "left", "==", "null", "||", "right", "==", "null", ")",...
Find the Levenshtein distance between two CharSequences if it's less than or equal to a given threshold. <p> This implementation follows from Algorithms on Strings, Trees and Sequences by Dan Gusfield and Chas Emerick's implementation of the Levenshtein distance algorithm from <a href="http://www.merriampark.com/ld.ht...
[ "Find", "the", "Levenshtein", "distance", "between", "two", "CharSequences", "if", "it", "s", "less", "than", "or", "equal", "to", "a", "given", "threshold", "." ]
ac8a48775877b6fa9dbc5f259871f3278489cc61
https://github.com/jpmml/jpmml-evaluator/blob/ac8a48775877b6fa9dbc5f259871f3278489cc61/pmml-evaluator/src/main/java/org/jpmml/evaluator/LevenshteinDistanceUtil.java#L57-L197
train
dita-ot/dita-ot
src/main/java/org/dita/dost/writer/ConrefPushParser.java
ConrefPushParser.updateList
private void updateList(final File filename) { try { final URI reletivePath = toURI(filename.getAbsolutePath().substring(new File(normalize(tempDir.toString())).getPath().length() + 1)); final FileInfo f = job.getOrCreateFileInfo(reletivePath); if (hasConref) { ...
java
private void updateList(final File filename) { try { final URI reletivePath = toURI(filename.getAbsolutePath().substring(new File(normalize(tempDir.toString())).getPath().length() + 1)); final FileInfo f = job.getOrCreateFileInfo(reletivePath); if (hasConref) { ...
[ "private", "void", "updateList", "(", "final", "File", "filename", ")", "{", "try", "{", "final", "URI", "reletivePath", "=", "toURI", "(", "filename", ".", "getAbsolutePath", "(", ")", ".", "substring", "(", "new", "File", "(", "normalize", "(", "tempDir"...
Update conref list in job configuration and in conref list file. @param filename filename
[ "Update", "conref", "list", "in", "job", "configuration", "and", "in", "conref", "list", "file", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/writer/ConrefPushParser.java#L171-L187
train
dita-ot/dita-ot
src/main/java/org/dita/dost/platform/PluginRequirement.java
PluginRequirement.addPlugins
public void addPlugins(final String s) { final StringTokenizer t = new StringTokenizer(s, REQUIREMENT_SEPARATOR); while (t.hasMoreTokens()) { plugins.add(t.nextToken()); } }
java
public void addPlugins(final String s) { final StringTokenizer t = new StringTokenizer(s, REQUIREMENT_SEPARATOR); while (t.hasMoreTokens()) { plugins.add(t.nextToken()); } }
[ "public", "void", "addPlugins", "(", "final", "String", "s", ")", "{", "final", "StringTokenizer", "t", "=", "new", "StringTokenizer", "(", "s", ",", "REQUIREMENT_SEPARATOR", ")", ";", "while", "(", "t", ".", "hasMoreTokens", "(", ")", ")", "{", "plugins",...
Add plugins. @param s plugins name
[ "Add", "plugins", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/platform/PluginRequirement.java#L34-L39
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/DitaValReader.java
DitaValReader.refineAction
private void refineAction(final Action action, final FilterKey key) { if (key.value != null && bindingMap != null && !bindingMap.isEmpty()) { final Map<String, Set<Element>> schemeMap = bindingMap.get(key.attribute); if (schemeMap != null && !schemeMap.isEmpty()) { for (f...
java
private void refineAction(final Action action, final FilterKey key) { if (key.value != null && bindingMap != null && !bindingMap.isEmpty()) { final Map<String, Set<Element>> schemeMap = bindingMap.get(key.attribute); if (schemeMap != null && !schemeMap.isEmpty()) { for (f...
[ "private", "void", "refineAction", "(", "final", "Action", "action", ",", "final", "FilterKey", "key", ")", "{", "if", "(", "key", ".", "value", "!=", "null", "&&", "bindingMap", "!=", "null", "&&", "!", "bindingMap", ".", "isEmpty", "(", ")", ")", "{"...
Refine action key with information from subject schemes.
[ "Refine", "action", "key", "with", "information", "from", "subject", "schemes", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/DitaValReader.java#L295-L309
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/DitaValReader.java
DitaValReader.insertAction
private void insertAction(final Element subTree, final QName attName, final Action action) { if (subTree == null || action == null) { return; } final LinkedList<Element> queue = new LinkedList<>(); // Skip the sub-tree root because it has been added already. NodeLis...
java
private void insertAction(final Element subTree, final QName attName, final Action action) { if (subTree == null || action == null) { return; } final LinkedList<Element> queue = new LinkedList<>(); // Skip the sub-tree root because it has been added already. NodeLis...
[ "private", "void", "insertAction", "(", "final", "Element", "subTree", ",", "final", "QName", "attName", ",", "final", "Action", "action", ")", "{", "if", "(", "subTree", "==", "null", "||", "action", "==", "null", ")", "{", "return", ";", "}", "final", ...
Insert subject scheme based action into filetermap if key not present in the map @param subTree subject scheme definition element @param attName attribute name @param action action to insert
[ "Insert", "subject", "scheme", "based", "action", "into", "filetermap", "if", "key", "not", "present", "in", "the", "map" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/DitaValReader.java#L318-L351
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/DitaValReader.java
DitaValReader.searchForKey
private Element searchForKey(final Element root, final String keyValue) { if (root == null || keyValue == null) { return null; } final LinkedList<Element> queue = new LinkedList<>(); queue.add(root); while (!queue.isEmpty()) { final Element node = queue.re...
java
private Element searchForKey(final Element root, final String keyValue) { if (root == null || keyValue == null) { return null; } final LinkedList<Element> queue = new LinkedList<>(); queue.add(root); while (!queue.isEmpty()) { final Element node = queue.re...
[ "private", "Element", "searchForKey", "(", "final", "Element", "root", ",", "final", "String", "keyValue", ")", "{", "if", "(", "root", "==", "null", "||", "keyValue", "==", "null", ")", "{", "return", "null", ";", "}", "final", "LinkedList", "<", "Eleme...
Search subject scheme elements for a given key @param root subject scheme element tree to search through @param keyValue key to locate @return element that matches the key, otherwise {@code null}
[ "Search", "subject", "scheme", "elements", "for", "a", "given", "key" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/DitaValReader.java#L359-L381
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/DitaValReader.java
DitaValReader.insertAction
private void insertAction(final Action action, final FilterKey key) { if (filterMap.get(key) == null) { filterMap.put(key, action); } else { logger.info(MessageUtils.getMessage("DOTJ007I", key.toString()).toString()); } }
java
private void insertAction(final Action action, final FilterKey key) { if (filterMap.get(key) == null) { filterMap.put(key, action); } else { logger.info(MessageUtils.getMessage("DOTJ007I", key.toString()).toString()); } }
[ "private", "void", "insertAction", "(", "final", "Action", "action", ",", "final", "FilterKey", "key", ")", "{", "if", "(", "filterMap", ".", "get", "(", "key", ")", "==", "null", ")", "{", "filterMap", ".", "put", "(", "key", ",", "action", ")", ";"...
Insert action into filetermap if key not present in the map
[ "Insert", "action", "into", "filetermap", "if", "key", "not", "present", "in", "the", "map" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/DitaValReader.java#L387-L393
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/DebugAndFilterModule.java
DebugAndFilterModule.outputSubjectScheme
private void outputSubjectScheme() throws DITAOTException { try { final Map<URI, Set<URI>> graph = SubjectSchemeReader.readMapFromXML(new File(job.tempDir, FILE_NAME_SUBJECT_RELATION)); final Queue<URI> queue = new LinkedList<>(graph.keySet()); final Set<URI> visitedSet = ne...
java
private void outputSubjectScheme() throws DITAOTException { try { final Map<URI, Set<URI>> graph = SubjectSchemeReader.readMapFromXML(new File(job.tempDir, FILE_NAME_SUBJECT_RELATION)); final Queue<URI> queue = new LinkedList<>(graph.keySet()); final Set<URI> visitedSet = ne...
[ "private", "void", "outputSubjectScheme", "(", ")", "throws", "DITAOTException", "{", "try", "{", "final", "Map", "<", "URI", ",", "Set", "<", "URI", ">", ">", "graph", "=", "SubjectSchemeReader", ".", "readMapFromXML", "(", "new", "File", "(", "job", ".",...
Output subject schema file. @throws DITAOTException if generation files
[ "Output", "subject", "schema", "file", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/DebugAndFilterModule.java#L318-L365
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/DebugAndFilterModule.java
DebugAndFilterModule.generateScheme
private void generateScheme(final File filename, final Document root) throws DITAOTException { final File p = filename.getParentFile(); if (!p.exists() && !p.mkdirs()) { throw new DITAOTException("Failed to make directory " + p.getAbsolutePath()); } Result res = null; ...
java
private void generateScheme(final File filename, final Document root) throws DITAOTException { final File p = filename.getParentFile(); if (!p.exists() && !p.mkdirs()) { throw new DITAOTException("Failed to make directory " + p.getAbsolutePath()); } Result res = null; ...
[ "private", "void", "generateScheme", "(", "final", "File", "filename", ",", "final", "Document", "root", ")", "throws", "DITAOTException", "{", "final", "File", "p", "=", "filename", ".", "getParentFile", "(", ")", ";", "if", "(", "!", "p", ".", "exists", ...
Serialize subject scheme file. @param filename output filepath @param root subject scheme document @throws DITAOTException if generation fails
[ "Serialize", "subject", "scheme", "file", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/DebugAndFilterModule.java#L477-L501
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/DebugAndFilterModule.java
DebugAndFilterModule.getPathtoProject
public static File getPathtoProject(final File filename, final File traceFilename, final File inputMap, final Job job) { if (job.getGeneratecopyouter() != Job.Generate.OLDSOLUTION) { if (isOutFile(traceFilename, inputMap)) { return toFile(getRelativePathFromOut(traceFilename.getAbsol...
java
public static File getPathtoProject(final File filename, final File traceFilename, final File inputMap, final Job job) { if (job.getGeneratecopyouter() != Job.Generate.OLDSOLUTION) { if (isOutFile(traceFilename, inputMap)) { return toFile(getRelativePathFromOut(traceFilename.getAbsol...
[ "public", "static", "File", "getPathtoProject", "(", "final", "File", "filename", ",", "final", "File", "traceFilename", ",", "final", "File", "inputMap", ",", "final", "Job", "job", ")", "{", "if", "(", "job", ".", "getGeneratecopyouter", "(", ")", "!=", ...
Get path to base directory @param filename relative input file path from base directory @param traceFilename absolute input file @param inputMap absolute path to start file @return path to base directory, {@code null} if not available
[ "Get", "path", "to", "base", "directory" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/DebugAndFilterModule.java#L511-L521
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/DebugAndFilterModule.java
DebugAndFilterModule.getRelativePathFromOut
private static String getRelativePathFromOut(final File overflowingFile, final Job job) { final URI relativePath = URLUtils.getRelativePath(job.getInputFile(), overflowingFile.toURI()); final File outputDir = job.getOutputDir().getAbsoluteFile(); final File outputPathName = new File(outputDir, "...
java
private static String getRelativePathFromOut(final File overflowingFile, final Job job) { final URI relativePath = URLUtils.getRelativePath(job.getInputFile(), overflowingFile.toURI()); final File outputDir = job.getOutputDir().getAbsoluteFile(); final File outputPathName = new File(outputDir, "...
[ "private", "static", "String", "getRelativePathFromOut", "(", "final", "File", "overflowingFile", ",", "final", "Job", "job", ")", "{", "final", "URI", "relativePath", "=", "URLUtils", ".", "getRelativePath", "(", "job", ".", "getInputFile", "(", ")", ",", "ov...
Just for the overflowing files. @param overflowingFile overflowingFile @return relative system path to out which ends in {@link java.io.File#separator File.separator}
[ "Just", "for", "the", "overflowing", "files", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/DebugAndFilterModule.java#L527-L538
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/MoveMetaModule.java
MoveMetaModule.execute
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException { final Collection<FileInfo> fis = job.getFileInfo(fi -> fi.isInput); if (!fis.isEmpty()) { final Map<URI, Map<String, Element>> mapSet = getMapMetadata(fis); pushMetadat...
java
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException { final Collection<FileInfo> fis = job.getFileInfo(fi -> fi.isInput); if (!fis.isEmpty()) { final Map<URI, Map<String, Element>> mapSet = getMapMetadata(fis); pushMetadat...
[ "@", "Override", "public", "AbstractPipelineOutput", "execute", "(", "final", "AbstractPipelineInput", "input", ")", "throws", "DITAOTException", "{", "final", "Collection", "<", "FileInfo", ">", "fis", "=", "job", ".", "getFileInfo", "(", "fi", "->", "fi", ".",...
Entry point of MoveMetaModule. @param input Input parameters and resources. @return null @throws DITAOTException exception
[ "Entry", "point", "of", "MoveMetaModule", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/MoveMetaModule.java#L59-L69
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/MoveMetaModule.java
MoveMetaModule.pushMetadata
private void pushMetadata(final Map<URI, Map<String, Element>> mapSet) { if (!mapSet.isEmpty()) { //process map first final DitaMapMetaWriter mapInserter = new DitaMapMetaWriter(); mapInserter.setLogger(logger); mapInserter.setJob(job); for (final Entr...
java
private void pushMetadata(final Map<URI, Map<String, Element>> mapSet) { if (!mapSet.isEmpty()) { //process map first final DitaMapMetaWriter mapInserter = new DitaMapMetaWriter(); mapInserter.setLogger(logger); mapInserter.setJob(job); for (final Entr...
[ "private", "void", "pushMetadata", "(", "final", "Map", "<", "URI", ",", "Map", "<", "String", ",", "Element", ">", ">", "mapSet", ")", "{", "if", "(", "!", "mapSet", ".", "isEmpty", "(", ")", ")", "{", "//process map first", "final", "DitaMapMetaWriter"...
Push information from topicmeta in the map into the corresponding topics and maps.
[ "Push", "information", "from", "topicmeta", "in", "the", "map", "into", "the", "corresponding", "topics", "and", "maps", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/MoveMetaModule.java#L146-L198
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/MoveMetaModule.java
MoveMetaModule.getMapMetadata
private Map<URI, Map<String, Element>> getMapMetadata(final Collection<FileInfo> fis) { final MapMetaReader metaReader = new MapMetaReader(); metaReader.setLogger(logger); metaReader.setJob(job); for (final FileInfo f : fis) { final File mapFile = new File(job.tempDir, f.file...
java
private Map<URI, Map<String, Element>> getMapMetadata(final Collection<FileInfo> fis) { final MapMetaReader metaReader = new MapMetaReader(); metaReader.setLogger(logger); metaReader.setJob(job); for (final FileInfo f : fis) { final File mapFile = new File(job.tempDir, f.file...
[ "private", "Map", "<", "URI", ",", "Map", "<", "String", ",", "Element", ">", ">", "getMapMetadata", "(", "final", "Collection", "<", "FileInfo", ">", "fis", ")", "{", "final", "MapMetaReader", "metaReader", "=", "new", "MapMetaReader", "(", ")", ";", "m...
Read metadata from topicmeta elements in maps.
[ "Read", "metadata", "from", "topicmeta", "elements", "in", "maps", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/MoveMetaModule.java#L203-L213
train
dita-ot/dita-ot
src/main/java/org/dita/dost/writer/ConkeyrefFilter.java
ConkeyrefFilter.getRelativePath
private URI getRelativePath(final URI href) { final URI keyValue; final URI inputMap = job.getFileInfo(fi -> fi.isInput).stream() .map(fi -> fi.uri) .findFirst() .orElse(null); if (inputMap != null) { final URI tmpMap = job.tempDirURI.r...
java
private URI getRelativePath(final URI href) { final URI keyValue; final URI inputMap = job.getFileInfo(fi -> fi.isInput).stream() .map(fi -> fi.uri) .findFirst() .orElse(null); if (inputMap != null) { final URI tmpMap = job.tempDirURI.r...
[ "private", "URI", "getRelativePath", "(", "final", "URI", "href", ")", "{", "final", "URI", "keyValue", ";", "final", "URI", "inputMap", "=", "job", ".", "getFileInfo", "(", "fi", "->", "fi", ".", "isInput", ")", ".", "stream", "(", ")", ".", "map", ...
Update href URI. @param href href URI @return updated href URI
[ "Update", "href", "URI", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/writer/ConkeyrefFilter.java#L92-L105
train
dita-ot/dita-ot
src/main/plugins/org.dita.htmlhelp/src/main/java/org/dita/dost/ant/CheckLang.java
CheckLang.setActiveProjectProperty
private void setActiveProjectProperty(final String propertyName, final String propertyValue) { final Project activeProject = getProject(); if (activeProject != null) { activeProject.setProperty(propertyName, propertyValue); } }
java
private void setActiveProjectProperty(final String propertyName, final String propertyValue) { final Project activeProject = getProject(); if (activeProject != null) { activeProject.setProperty(propertyName, propertyValue); } }
[ "private", "void", "setActiveProjectProperty", "(", "final", "String", "propertyName", ",", "final", "String", "propertyValue", ")", "{", "final", "Project", "activeProject", "=", "getProject", "(", ")", ";", "if", "(", "activeProject", "!=", "null", ")", "{", ...
Sets property in active ant project with name specified inpropertyName, and value specified in propertyValue parameter
[ "Sets", "property", "in", "active", "ant", "project", "with", "name", "specified", "inpropertyName", "and", "value", "specified", "in", "propertyValue", "parameter" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/plugins/org.dita.htmlhelp/src/main/java/org/dita/dost/ant/CheckLang.java#L123-L128
train
dita-ot/dita-ot
src/main/java/org/dita/dost/ant/DITAOTEchoTask.java
DITAOTEchoTask.readParamValues
private String[] readParamValues() throws BuildException { final ArrayList<String> prop = new ArrayList<>(); for (final ParamElem p : params) { if (!p.isValid()) { throw new BuildException("Incomplete parameter"); } if (isValid(getProject(), getLocatio...
java
private String[] readParamValues() throws BuildException { final ArrayList<String> prop = new ArrayList<>(); for (final ParamElem p : params) { if (!p.isValid()) { throw new BuildException("Incomplete parameter"); } if (isValid(getProject(), getLocatio...
[ "private", "String", "[", "]", "readParamValues", "(", ")", "throws", "BuildException", "{", "final", "ArrayList", "<", "String", ">", "prop", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "final", "ParamElem", "p", ":", "params", ")", "{", ...
Read parameter values to an array. @return parameter values where array index corresponds to parameter name
[ "Read", "parameter", "values", "to", "an", "array", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/ant/DITAOTEchoTask.java#L87-L105
train
dita-ot/dita-ot
src/main/plugins/org.dita.eclipsehelp/src/main/java/org/dita/dost/writer/EclipseIndexWriter.java
EclipseIndexWriter.getIndexFileName
@Override public String getIndexFileName(final String outputFileRoot) { final File indexDir = new File(outputFileRoot).getParentFile(); setFilePath(indexDir.getAbsolutePath()); return new File(indexDir, "index.xml").getAbsolutePath(); }
java
@Override public String getIndexFileName(final String outputFileRoot) { final File indexDir = new File(outputFileRoot).getParentFile(); setFilePath(indexDir.getAbsolutePath()); return new File(indexDir, "index.xml").getAbsolutePath(); }
[ "@", "Override", "public", "String", "getIndexFileName", "(", "final", "String", "outputFileRoot", ")", "{", "final", "File", "indexDir", "=", "new", "File", "(", "outputFileRoot", ")", ".", "getParentFile", "(", ")", ";", "setFilePath", "(", "indexDir", ".", ...
Get index file name. @param outputFileRoot root path @return index file name
[ "Get", "index", "file", "name", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/plugins/org.dita.eclipsehelp/src/main/java/org/dita/dost/writer/EclipseIndexWriter.java#L162-L167
train
dita-ot/dita-ot
src/main/java/org/dita/dost/ant/IntegratorTask.java
IntegratorTask.setDitadir
@Deprecated public void setDitadir(final File ditaDir) { if (!ditaDir.isAbsolute()) { throw new IllegalArgumentException("ditadir attribute value must be an absolute path: " + ditaDir); } this.ditaDir = ditaDir; }
java
@Deprecated public void setDitadir(final File ditaDir) { if (!ditaDir.isAbsolute()) { throw new IllegalArgumentException("ditadir attribute value must be an absolute path: " + ditaDir); } this.ditaDir = ditaDir; }
[ "@", "Deprecated", "public", "void", "setDitadir", "(", "final", "File", "ditaDir", ")", "{", "if", "(", "!", "ditaDir", ".", "isAbsolute", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"ditadir attribute value must be an absolute path: \"",...
Set the ditaDir. @param ditaDir ditaDir
[ "Set", "the", "ditaDir", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/ant/IntegratorTask.java#L48-L54
train
dita-ot/dita-ot
src/main/java/org/dita/dost/writer/SeparateChunkTopicParser.java
SeparateChunkTopicParser.getTopicDoc
private Element getTopicDoc(final URI absolutePathToFile) { final DocumentBuilder builder = getDocumentBuilder(); try { final Document doc = builder.parse(absolutePathToFile.toString()); return doc.getDocumentElement(); } catch (final SAXException | IOException e) { ...
java
private Element getTopicDoc(final URI absolutePathToFile) { final DocumentBuilder builder = getDocumentBuilder(); try { final Document doc = builder.parse(absolutePathToFile.toString()); return doc.getDocumentElement(); } catch (final SAXException | IOException e) { ...
[ "private", "Element", "getTopicDoc", "(", "final", "URI", "absolutePathToFile", ")", "{", "final", "DocumentBuilder", "builder", "=", "getDocumentBuilder", "(", ")", ";", "try", "{", "final", "Document", "doc", "=", "builder", ".", "parse", "(", "absolutePathToF...
get the document node of a topic file. @param absolutePathToFile topic file @return element.
[ "get", "the", "document", "node", "of", "a", "topic", "file", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/writer/SeparateChunkTopicParser.java#L260-L269
train
dita-ot/dita-ot
src/main/java/org/dita/dost/index/IndexTerm.java
IndexTerm.addSubTerm
public void addSubTerm(final IndexTerm term) { int i = 0; final int subTermNum = subTerms.size(); if (IndexTermPrefix.SEE != term.getTermPrefix() && IndexTermPrefix.SEE_ALSO != term.getTermPrefix()) { //if the term is not "index-see" or "index-see-also" leaf = false; ...
java
public void addSubTerm(final IndexTerm term) { int i = 0; final int subTermNum = subTerms.size(); if (IndexTermPrefix.SEE != term.getTermPrefix() && IndexTermPrefix.SEE_ALSO != term.getTermPrefix()) { //if the term is not "index-see" or "index-see-also" leaf = false; ...
[ "public", "void", "addSubTerm", "(", "final", "IndexTerm", "term", ")", "{", "int", "i", "=", "0", ";", "final", "int", "subTermNum", "=", "subTerms", ".", "size", "(", ")", ";", "if", "(", "IndexTermPrefix", ".", "SEE", "!=", "term", ".", "getTermPref...
Add a sub term into the sub term list. @param term index term to be added
[ "Add", "a", "sub", "term", "into", "the", "sub", "term", "list", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/index/IndexTerm.java#L183-L211
train
dita-ot/dita-ot
src/main/java/org/dita/dost/index/IndexTerm.java
IndexTerm.addSubTerms
public void addSubTerms(final List<IndexTerm> terms) { int subTermsNum; if (terms == null) { return; } subTermsNum = terms.size(); for (int i = 0; i < subTermsNum; i++) { addSubTerm(terms.get(i)); } }
java
public void addSubTerms(final List<IndexTerm> terms) { int subTermsNum; if (terms == null) { return; } subTermsNum = terms.size(); for (int i = 0; i < subTermsNum; i++) { addSubTerm(terms.get(i)); } }
[ "public", "void", "addSubTerms", "(", "final", "List", "<", "IndexTerm", ">", "terms", ")", "{", "int", "subTermsNum", ";", "if", "(", "terms", "==", "null", ")", "{", "return", ";", "}", "subTermsNum", "=", "terms", ".", "size", "(", ")", ";", "for"...
Add all the sub terms in the list. @param terms terms list
[ "Add", "all", "the", "sub", "terms", "in", "the", "list", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/index/IndexTerm.java#L218-L228
train
dita-ot/dita-ot
src/main/java/org/dita/dost/index/IndexTerm.java
IndexTerm.sortSubTerms
public void sortSubTerms() { final int subTermNum = subTerms.size(); if (subTerms != null && subTermNum > 0) { Collections.sort(subTerms); for (final IndexTerm subTerm : subTerms) { subTerm.sortSubTerms(); } } }
java
public void sortSubTerms() { final int subTermNum = subTerms.size(); if (subTerms != null && subTermNum > 0) { Collections.sort(subTerms); for (final IndexTerm subTerm : subTerms) { subTerm.sortSubTerms(); } } }
[ "public", "void", "sortSubTerms", "(", ")", "{", "final", "int", "subTermNum", "=", "subTerms", ".", "size", "(", ")", ";", "if", "(", "subTerms", "!=", "null", "&&", "subTermNum", ">", "0", ")", "{", "Collections", ".", "sort", "(", "subTerms", ")", ...
Sort all the subterms iteratively.
[ "Sort", "all", "the", "subterms", "iteratively", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/index/IndexTerm.java#L278-L287
train
dita-ot/dita-ot
src/main/java/org/dita/dost/index/IndexTerm.java
IndexTerm.compareTo
@Override public int compareTo(final IndexTerm obj) { return DITAOTCollator.getInstance(termLocale).compare(termKey, obj.getTermKey()); }
java
@Override public int compareTo(final IndexTerm obj) { return DITAOTCollator.getInstance(termLocale).compare(termKey, obj.getTermKey()); }
[ "@", "Override", "public", "int", "compareTo", "(", "final", "IndexTerm", "obj", ")", "{", "return", "DITAOTCollator", ".", "getInstance", "(", "termLocale", ")", ".", "compare", "(", "termKey", ",", "obj", ".", "getTermKey", "(", ")", ")", ";", "}" ]
Compare the given indexterm with current term. @param obj object to compare with @return int
[ "Compare", "the", "given", "indexterm", "with", "current", "term", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/index/IndexTerm.java#L295-L298
train
dita-ot/dita-ot
src/main/java/org/dita/dost/index/IndexTerm.java
IndexTerm.addTargets
public void addTargets(final List<IndexTermTarget> targets) { int targetNum; if (targets == null) { return; } targetNum = targets.size(); for (int i = 0; i < targetNum; i++) { addTarget(targets.get(i)); } }
java
public void addTargets(final List<IndexTermTarget> targets) { int targetNum; if (targets == null) { return; } targetNum = targets.size(); for (int i = 0; i < targetNum; i++) { addTarget(targets.get(i)); } }
[ "public", "void", "addTargets", "(", "final", "List", "<", "IndexTermTarget", ">", "targets", ")", "{", "int", "targetNum", ";", "if", "(", "targets", "==", "null", ")", "{", "return", ";", "}", "targetNum", "=", "targets", ".", "size", "(", ")", ";", ...
Add all the indexterm targets in the list. @param targets list of targets
[ "Add", "all", "the", "indexterm", "targets", "in", "the", "list", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/index/IndexTerm.java#L325-L336
train
dita-ot/dita-ot
src/main/java/org/dita/dost/index/IndexTerm.java
IndexTerm.getTermFullName
public String getTermFullName() { if (termPrefix == null) { return termName; } else { if (termLocale == null) { return termPrefix.message + STRING_BLANK + termName; } else { final String key = "IndexTerm." + termPrefix.message.toLowerCa...
java
public String getTermFullName() { if (termPrefix == null) { return termName; } else { if (termLocale == null) { return termPrefix.message + STRING_BLANK + termName; } else { final String key = "IndexTerm." + termPrefix.message.toLowerCa...
[ "public", "String", "getTermFullName", "(", ")", "{", "if", "(", "termPrefix", "==", "null", ")", "{", "return", "termName", ";", "}", "else", "{", "if", "(", "termLocale", "==", "null", ")", "{", "return", "termPrefix", ".", "message", "+", "STRING_BLAN...
Get the full term, with any prefix. @return full term with prefix
[ "Get", "the", "full", "term", "with", "any", "prefix", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/index/IndexTerm.java#L377-L393
train
dita-ot/dita-ot
src/main/java/org/dita/dost/index/IndexTerm.java
IndexTerm.updateSubTerm
public void updateSubTerm() { if (subTerms.size() == 1) { // if there is only one subterm, it is necessary to update final IndexTerm term = subTerms.get(0); // get the only subterm if (term.getTermPrefix() == IndexTermPrefix.SEE) { //if the only subterm is ind...
java
public void updateSubTerm() { if (subTerms.size() == 1) { // if there is only one subterm, it is necessary to update final IndexTerm term = subTerms.get(0); // get the only subterm if (term.getTermPrefix() == IndexTermPrefix.SEE) { //if the only subterm is ind...
[ "public", "void", "updateSubTerm", "(", ")", "{", "if", "(", "subTerms", ".", "size", "(", ")", "==", "1", ")", "{", "// if there is only one subterm, it is necessary to update", "final", "IndexTerm", "term", "=", "subTerms", ".", "get", "(", "0", ")", ";", ...
Update the sub-term prefix from "See also" to "See" if there is only one sub-term.
[ "Update", "the", "sub", "-", "term", "prefix", "from", "See", "also", "to", "See", "if", "there", "is", "only", "one", "sub", "-", "term", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/index/IndexTerm.java#L398-L408
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/KeyrefReader.java
KeyrefReader.read
public void read(final URI filename, final Document doc) { currentFile = filename; rootScope = null; // TODO: use KeyScope implementation that retains order KeyScope keyScope = readScopes(doc); keyScope = cascadeChildKeys(keyScope); // TODO: determine effective key defini...
java
public void read(final URI filename, final Document doc) { currentFile = filename; rootScope = null; // TODO: use KeyScope implementation that retains order KeyScope keyScope = readScopes(doc); keyScope = cascadeChildKeys(keyScope); // TODO: determine effective key defini...
[ "public", "void", "read", "(", "final", "URI", "filename", ",", "final", "Document", "doc", ")", "{", "currentFile", "=", "filename", ";", "rootScope", "=", "null", ";", "// TODO: use KeyScope implementation that retains order", "KeyScope", "keyScope", "=", "readSco...
Read key definitions @param filename absolute URI to DITA map with key definitions @param doc key definition DITA map
[ "Read", "key", "definitions" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/KeyrefReader.java#L100-L109
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/KeyrefReader.java
KeyrefReader.readScopes
private KeyScope readScopes(final Document doc) { final List<KeyScope> scopes = readScopes(doc.getDocumentElement()); if (scopes.size() == 1 && scopes.get(0).name == null) { return scopes.get(0); } else { return new KeyScope("#root", null, Collections.emptyMap(), scopes);...
java
private KeyScope readScopes(final Document doc) { final List<KeyScope> scopes = readScopes(doc.getDocumentElement()); if (scopes.size() == 1 && scopes.get(0).name == null) { return scopes.get(0); } else { return new KeyScope("#root", null, Collections.emptyMap(), scopes);...
[ "private", "KeyScope", "readScopes", "(", "final", "Document", "doc", ")", "{", "final", "List", "<", "KeyScope", ">", "scopes", "=", "readScopes", "(", "doc", ".", "getDocumentElement", "(", ")", ")", ";", "if", "(", "scopes", ".", "size", "(", ")", "...
Read keys scopes in map.
[ "Read", "keys", "scopes", "in", "map", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/KeyrefReader.java#L112-L119
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/KeyrefReader.java
KeyrefReader.readScope
private void readScope(final Element scope, final Map<String, KeyDef> keyDefs) { final List<Element> maps = new ArrayList<>(); maps.add(scope); for (final Element child: getChildElements(scope)) { collectMaps(child, maps); } for (final Element map: maps) { ...
java
private void readScope(final Element scope, final Map<String, KeyDef> keyDefs) { final List<Element> maps = new ArrayList<>(); maps.add(scope); for (final Element child: getChildElements(scope)) { collectMaps(child, maps); } for (final Element map: maps) { ...
[ "private", "void", "readScope", "(", "final", "Element", "scope", ",", "final", "Map", "<", "String", ",", "KeyDef", ">", "keyDefs", ")", "{", "final", "List", "<", "Element", ">", "maps", "=", "new", "ArrayList", "<>", "(", ")", ";", "maps", ".", "a...
Read key definitions from a key scope.
[ "Read", "key", "definitions", "from", "a", "key", "scope", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/KeyrefReader.java#L170-L179
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/KeyrefReader.java
KeyrefReader.readMap
private void readMap(final Element map, final Map<String, KeyDef> keyDefs) { readKeyDefinition(map, keyDefs); for (final Element elem: getChildElements(map)) { if (!(SUBMAP.matches(elem) || elem.getAttributeNode(ATTRIBUTE_NAME_KEYSCOPE) != null)) { readMap(elem, keyDefs); ...
java
private void readMap(final Element map, final Map<String, KeyDef> keyDefs) { readKeyDefinition(map, keyDefs); for (final Element elem: getChildElements(map)) { if (!(SUBMAP.matches(elem) || elem.getAttributeNode(ATTRIBUTE_NAME_KEYSCOPE) != null)) { readMap(elem, keyDefs); ...
[ "private", "void", "readMap", "(", "final", "Element", "map", ",", "final", "Map", "<", "String", ",", "KeyDef", ">", "keyDefs", ")", "{", "readKeyDefinition", "(", "map", ",", "keyDefs", ")", ";", "for", "(", "final", "Element", "elem", ":", "getChildEl...
Recursively read key definitions from a single map fragment.
[ "Recursively", "read", "key", "definitions", "from", "a", "single", "map", "fragment", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/KeyrefReader.java#L195-L202
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/KeyrefReader.java
KeyrefReader.cascadeChildKeys
private KeyScope cascadeChildKeys(final KeyScope rootScope) { final Map<String, KeyDef> res = new HashMap<>(rootScope.keyDefinition); cascadeChildKeys(rootScope, res, ""); return new KeyScope(rootScope.id, rootScope.name, res, new ArrayList<>(rootScope.childScopes)); }
java
private KeyScope cascadeChildKeys(final KeyScope rootScope) { final Map<String, KeyDef> res = new HashMap<>(rootScope.keyDefinition); cascadeChildKeys(rootScope, res, ""); return new KeyScope(rootScope.id, rootScope.name, res, new ArrayList<>(rootScope.childScopes)); }
[ "private", "KeyScope", "cascadeChildKeys", "(", "final", "KeyScope", "rootScope", ")", "{", "final", "Map", "<", "String", ",", "KeyDef", ">", "res", "=", "new", "HashMap", "<>", "(", "rootScope", ".", "keyDefinition", ")", ";", "cascadeChildKeys", "(", "roo...
Cascade child keys with prefixes to parent key scopes.
[ "Cascade", "child", "keys", "with", "prefixes", "to", "parent", "key", "scopes", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/KeyrefReader.java#L226-L230
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/KeyrefReader.java
KeyrefReader.resolveIntermediate
private KeyScope resolveIntermediate(final KeyScope scope) { final Map<String, KeyDef> keys = new HashMap<>(scope.keyDefinition); for (final Map.Entry<String, KeyDef> e: scope.keyDefinition.entrySet()) { final KeyDef res = resolveIntermediate(scope, e.getValue(), Collections.singletonList(e....
java
private KeyScope resolveIntermediate(final KeyScope scope) { final Map<String, KeyDef> keys = new HashMap<>(scope.keyDefinition); for (final Map.Entry<String, KeyDef> e: scope.keyDefinition.entrySet()) { final KeyDef res = resolveIntermediate(scope, e.getValue(), Collections.singletonList(e....
[ "private", "KeyScope", "resolveIntermediate", "(", "final", "KeyScope", "scope", ")", "{", "final", "Map", "<", "String", ",", "KeyDef", ">", "keys", "=", "new", "HashMap", "<>", "(", "scope", ".", "keyDefinition", ")", ";", "for", "(", "final", "Map", "...
Resolve intermediate key references.
[ "Resolve", "intermediate", "key", "references", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/KeyrefReader.java#L271-L283
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/ConrefPushReader.java
ConrefPushReader.replaceContent
private DocumentFragment replaceContent(final DocumentFragment pushcontent) { final NodeList children = pushcontent.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { final Node child = children.item(i); switch (child.getNodeType()) { case Node.ELEMENT_...
java
private DocumentFragment replaceContent(final DocumentFragment pushcontent) { final NodeList children = pushcontent.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { final Node child = children.item(i); switch (child.getNodeType()) { case Node.ELEMENT_...
[ "private", "DocumentFragment", "replaceContent", "(", "final", "DocumentFragment", "pushcontent", ")", "{", "final", "NodeList", "children", "=", "pushcontent", ".", "getChildNodes", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "children", ...
Rewrite link attributes.
[ "Rewrite", "link", "attributes", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/ConrefPushReader.java#L224-L240
train
dita-ot/dita-ot
src/main/java/org/dita/dost/reader/DitamapIndexTermReader.java
DitamapIndexTermReader.needPushTerm
private boolean needPushTerm() { if (elementStack.empty()) { return false; } if (elementStack.peek() instanceof TopicrefElement) { // for dita files the indexterm has been moved to its <prolog> // therefore we don't need to collect these terms again. ...
java
private boolean needPushTerm() { if (elementStack.empty()) { return false; } if (elementStack.peek() instanceof TopicrefElement) { // for dita files the indexterm has been moved to its <prolog> // therefore we don't need to collect these terms again. ...
[ "private", "boolean", "needPushTerm", "(", ")", "{", "if", "(", "elementStack", ".", "empty", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "elementStack", ".", "peek", "(", ")", "instanceof", "TopicrefElement", ")", "{", "// for dita files t...
Check element stack for the root topicref or indexterm element.
[ "Check", "element", "stack", "for", "the", "root", "topicref", "or", "indexterm", "element", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/reader/DitamapIndexTermReader.java#L338-L353
train
dita-ot/dita-ot
src/main/java/org/dita/dost/util/DitaClass.java
DitaClass.matches
public boolean matches(final Node node) { if (node.getNodeType() == Node.ELEMENT_NODE) { return matches(((Element) node).getAttribute(ATTRIBUTE_NAME_CLASS)); } return false; }
java
public boolean matches(final Node node) { if (node.getNodeType() == Node.ELEMENT_NODE) { return matches(((Element) node).getAttribute(ATTRIBUTE_NAME_CLASS)); } return false; }
[ "public", "boolean", "matches", "(", "final", "Node", "node", ")", "{", "if", "(", "node", ".", "getNodeType", "(", ")", "==", "Node", ".", "ELEMENT_NODE", ")", "{", "return", "matches", "(", "(", "(", "Element", ")", "node", ")", ".", "getAttribute", ...
Test if given DITA class string matches this DITA class. @param node DOM DITA element @return {@code true} if given node is an Element and its class matches this class, otherwise {@code false}
[ "Test", "if", "given", "DITA", "class", "string", "matches", "this", "DITA", "class", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/DitaClass.java#L175-L180
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/KeyrefModule.java
KeyrefModule.execute
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException { if (fileInfoFilter == null) { fileInfoFilter = f -> f.format == null || f.format.equals(ATTR_FORMAT_VALUE_DITA) || f.format.equals(ATTR_FORMAT_VALUE_DITAMAP); } ...
java
@Override public AbstractPipelineOutput execute(final AbstractPipelineInput input) throws DITAOTException { if (fileInfoFilter == null) { fileInfoFilter = f -> f.format == null || f.format.equals(ATTR_FORMAT_VALUE_DITA) || f.format.equals(ATTR_FORMAT_VALUE_DITAMAP); } ...
[ "@", "Override", "public", "AbstractPipelineOutput", "execute", "(", "final", "AbstractPipelineInput", "input", ")", "throws", "DITAOTException", "{", "if", "(", "fileInfoFilter", "==", "null", ")", "{", "fileInfoFilter", "=", "f", "->", "f", ".", "format", "=="...
Entry point of KeyrefModule. @param input Input parameters and resources. @return null @throws DITAOTException exception
[ "Entry", "point", "of", "KeyrefModule", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/KeyrefModule.java#L85-L148
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/KeyrefModule.java
KeyrefModule.collectProcessingTopics
private List<ResolveTask> collectProcessingTopics(final Collection<FileInfo> fis, final KeyScope rootScope, final Document doc) { final List<ResolveTask> res = new ArrayList<>(); final FileInfo input = job.getFileInfo(fi -> fi.isInput).iterator().next(); res.add(new ResolveTask(rootScope, input,...
java
private List<ResolveTask> collectProcessingTopics(final Collection<FileInfo> fis, final KeyScope rootScope, final Document doc) { final List<ResolveTask> res = new ArrayList<>(); final FileInfo input = job.getFileInfo(fi -> fi.isInput).iterator().next(); res.add(new ResolveTask(rootScope, input,...
[ "private", "List", "<", "ResolveTask", ">", "collectProcessingTopics", "(", "final", "Collection", "<", "FileInfo", ">", "fis", ",", "final", "KeyScope", "rootScope", ",", "final", "Document", "doc", ")", "{", "final", "List", "<", "ResolveTask", ">", "res", ...
Collect topics for key reference processing and modify map to reflect new file names.
[ "Collect", "topics", "for", "key", "reference", "processing", "and", "modify", "map", "to", "reflect", "new", "file", "names", "." ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/KeyrefModule.java#L155-L176
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/KeyrefModule.java
KeyrefModule.removeDuplicateResolveTargets
private List<ResolveTask> removeDuplicateResolveTargets(List<ResolveTask> renames) { return renames.stream() .collect(Collectors.groupingBy( rt -> rt.scope, Collectors.toMap( rt -> rt.in.uri, ...
java
private List<ResolveTask> removeDuplicateResolveTargets(List<ResolveTask> renames) { return renames.stream() .collect(Collectors.groupingBy( rt -> rt.scope, Collectors.toMap( rt -> rt.in.uri, ...
[ "private", "List", "<", "ResolveTask", ">", "removeDuplicateResolveTargets", "(", "List", "<", "ResolveTask", ">", "renames", ")", "{", "return", "renames", ".", "stream", "(", ")", ".", "collect", "(", "Collectors", ".", "groupingBy", "(", "rt", "->", "rt",...
Remove duplicate sources within the same scope
[ "Remove", "duplicate", "sources", "within", "the", "same", "scope" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/KeyrefModule.java#L179-L191
train
dita-ot/dita-ot
src/main/java/org/dita/dost/module/KeyrefModule.java
KeyrefModule.adjustResourceRenames
List<ResolveTask> adjustResourceRenames(final List<ResolveTask> renames) { final Map<KeyScope, List<ResolveTask>> scopes = renames.stream().collect(Collectors.groupingBy(rt -> rt.scope)); final List<ResolveTask> res = new ArrayList<>(); for (final Map.Entry<KeyScope, List<ResolveTask>> group : ...
java
List<ResolveTask> adjustResourceRenames(final List<ResolveTask> renames) { final Map<KeyScope, List<ResolveTask>> scopes = renames.stream().collect(Collectors.groupingBy(rt -> rt.scope)); final List<ResolveTask> res = new ArrayList<>(); for (final Map.Entry<KeyScope, List<ResolveTask>> group : ...
[ "List", "<", "ResolveTask", ">", "adjustResourceRenames", "(", "final", "List", "<", "ResolveTask", ">", "renames", ")", "{", "final", "Map", "<", "KeyScope", ",", "List", "<", "ResolveTask", ">", ">", "scopes", "=", "renames", ".", "stream", "(", ")", "...
Adjust key targets per rewrites
[ "Adjust", "key", "targets", "per", "rewrites" ]
ea776b3c60c03d9f033b6f7ea072349e49dbcdd2
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/module/KeyrefModule.java#L194-L213
train