method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
list | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
list | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
|---|---|---|---|---|---|---|---|---|---|---|---|
public static NormalizedNode<?, ?> createDocumentOne(
SchemaContext schemaContext) {
return ImmutableContainerNodeBuilder
.create()
.withNodeIdentifier(
new YangInstanceIdentifier.NodeIdentifier(schemaContext.getQName()))
.withChild(createTestContainer()).build();
}
|
static NormalizedNode<?, ?> function( SchemaContext schemaContext) { return ImmutableContainerNodeBuilder .create() .withNodeIdentifier( new YangInstanceIdentifier.NodeIdentifier(schemaContext.getQName())) .withChild(createTestContainer()).build(); }
|
/**
* Returns a test document
*
* <pre>
* test
* outer-list
* id 1
* outer-list
* id 2
* inner-list
* name "one"
* inner-list
* name "two"
*
* </pre>
*
* @return
*/
|
Returns a test document <code> test outer-list id 1 outer-list id 2 inner-list name "one" inner-list name "two" </code>
|
createDocumentOne
|
{
"repo_name": "qqbbyq/controller",
"path": "opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CompositeModel.java",
"license": "epl-1.0",
"size": 16936
}
|
[
"org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier",
"org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode",
"org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder",
"org.opendaylight.yangtools.yang.model.api.SchemaContext"
] |
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder; import org.opendaylight.yangtools.yang.model.api.SchemaContext;
|
import org.opendaylight.yangtools.yang.data.api.*; import org.opendaylight.yangtools.yang.data.api.schema.*; import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.*; import org.opendaylight.yangtools.yang.model.api.*;
|
[
"org.opendaylight.yangtools"
] |
org.opendaylight.yangtools;
| 2,189,242
|
public static MozuClient deleteSynonymDefinitionClient(Integer synonymId) throws Exception
{
MozuUrl url = com.mozu.api.urls.commerce.catalog.admin.SearchUrl.deleteSynonymDefinitionUrl(synonymId);
String verb = "DELETE";
MozuClient mozuClient = (MozuClient) MozuClientFactory.getInstance();
mozuClient.setVerb(verb);
mozuClient.setResourceUrl(url);
return mozuClient;
}
|
static MozuClient function(Integer synonymId) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.catalog.admin.SearchUrl.deleteSynonymDefinitionUrl(synonymId); String verb = STR; MozuClient mozuClient = (MozuClient) MozuClientFactory.getInstance(); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); return mozuClient; }
|
/**
*
* <p><pre><code>
* MozuClient mozuClient=DeleteSynonymDefinitionClient( synonymId);
* client.setBaseAddress(url);
* client.executeRequest();
* </code></pre></p>
* @param synonymId The unique identifier of the synonym definition.
* @return Mozu.Api.MozuClient
*/
|
<code><code> MozuClient mozuClient=DeleteSynonymDefinitionClient( synonymId); client.setBaseAddress(url); client.executeRequest(); </code></code>
|
deleteSynonymDefinitionClient
|
{
"repo_name": "Mozu/mozu-java",
"path": "mozu-javaasync-core/src/main/java/com/mozu/api/clients/commerce/catalog/admin/SearchClient.java",
"license": "mit",
"size": 40771
}
|
[
"com.mozu.api.MozuClient",
"com.mozu.api.MozuClientFactory",
"com.mozu.api.MozuUrl"
] |
import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl;
|
import com.mozu.api.*;
|
[
"com.mozu.api"
] |
com.mozu.api;
| 443,338
|
private void requestLocationPermission() {
ActivityCompat.requestPermissions(this,
PermissionUtil.getLocationPermissions(),
Constants.PermissionRequestType.LOCATION.ordinal());
}
|
void function() { ActivityCompat.requestPermissions(this, PermissionUtil.getLocationPermissions(), Constants.PermissionRequestType.LOCATION.ordinal()); }
|
/**
* Permission check and request functions
*/
|
Permission check and request functions
|
requestLocationPermission
|
{
"repo_name": "syncthing/syncthing-android",
"path": "app/src/main/java/com/nutomic/syncthingandroid/activities/FirstStartActivity.java",
"license": "mpl-2.0",
"size": 17317
}
|
[
"androidx.core.app.ActivityCompat",
"com.nutomic.syncthingandroid.service.Constants",
"com.nutomic.syncthingandroid.util.PermissionUtil"
] |
import androidx.core.app.ActivityCompat; import com.nutomic.syncthingandroid.service.Constants; import com.nutomic.syncthingandroid.util.PermissionUtil;
|
import androidx.core.app.*; import com.nutomic.syncthingandroid.service.*; import com.nutomic.syncthingandroid.util.*;
|
[
"androidx.core",
"com.nutomic.syncthingandroid"
] |
androidx.core; com.nutomic.syncthingandroid;
| 1,817,528
|
@Override
public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_)
{
if (p_149727_1_.isRemote)
{
return true;
}
else
{
TileEntityHopper tileentityhopper = func_149920_e(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_);
if (tileentityhopper != null)
{
p_149727_5_.func_146093_a(tileentityhopper);
}
return true;
}
}
|
boolean function(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { if (p_149727_1_.isRemote) { return true; } else { TileEntityHopper tileentityhopper = func_149920_e(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_); if (tileentityhopper != null) { p_149727_5_.func_146093_a(tileentityhopper); } return true; } }
|
/**
* Called upon block activation (right click on the block.)
*/
|
Called upon block activation (right click on the block.)
|
onBlockActivated
|
{
"repo_name": "mookie1097/NightfallMod",
"path": "src/main/java/mooklabs/nightfall/blocks/BlockHopper.java",
"license": "mit",
"size": 10907
}
|
[
"net.minecraft.entity.player.EntityPlayer",
"net.minecraft.tileentity.TileEntityHopper",
"net.minecraft.world.World"
] |
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntityHopper; import net.minecraft.world.World;
|
import net.minecraft.entity.player.*; import net.minecraft.tileentity.*; import net.minecraft.world.*;
|
[
"net.minecraft.entity",
"net.minecraft.tileentity",
"net.minecraft.world"
] |
net.minecraft.entity; net.minecraft.tileentity; net.minecraft.world;
| 568,681
|
public void configure(Renderer renderer) {
throw new UnsupportedOperationException();
}
|
void function(Renderer renderer) { throw new UnsupportedOperationException(); }
|
/**
* Throws an UnsupportedOperationException.
*
* @param renderer not used
*/
|
Throws an UnsupportedOperationException
|
configure
|
{
"repo_name": "spepping/fop-cs",
"path": "src/java/org/apache/fop/render/pdf/PDFRendererConfigurator.java",
"license": "apache-2.0",
"size": 10052
}
|
[
"org.apache.fop.render.Renderer"
] |
import org.apache.fop.render.Renderer;
|
import org.apache.fop.render.*;
|
[
"org.apache.fop"
] |
org.apache.fop;
| 2,774,033
|
protected void initialize() throws IOException {
keyConverter.initialize(null);
valueConverter.initialize(null);
}
|
void function() throws IOException { keyConverter.initialize(null); valueConverter.initialize(null); }
|
/**
* Initializes key, value WritableConverters.
*
* @throws IOException
*/
|
Initializes key, value WritableConverters
|
initialize
|
{
"repo_name": "ketralnis/elephant-bird",
"path": "src/java/com/twitter/elephantbird/pig/load/SequenceFileLoader.java",
"license": "apache-2.0",
"size": 16786
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,313,873
|
public int count(Predicate<T> predicate) throws Exception {
int rs = 0;
Iterator<T> iterator = this.iterator();
while (iterator.hasNext()) {
T item = iterator.next();
if (predicate.evaluate(item)) {
rs++;
}
}
return rs;
}
|
int function(Predicate<T> predicate) throws Exception { int rs = 0; Iterator<T> iterator = this.iterator(); while (iterator.hasNext()) { T item = iterator.next(); if (predicate.evaluate(item)) { rs++; } } return rs; }
|
/**
* Returns a number that represents how many elements in the sequence
* satisfy a condition.
*
* @param predicate A {@code Predicate<T>} to test each element for a condition.
* @return A number that represents how many elements in the sequence
* satisfy the condition in the predicate.
* @throws Exception the exception
*/
|
Returns a number that represents how many elements in the sequence satisfy a condition
|
count
|
{
"repo_name": "ziaagikian/linq4android",
"path": "core/src/org/linq4android/collections/LinqQuery.java",
"license": "apache-2.0",
"size": 95061
}
|
[
"java.util.Iterator"
] |
import java.util.Iterator;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,785,669
|
public static Context getCurrentContext(Config config) {
String contextName = config.getCurrentContext();
if (contextName != null) {
List<NamedContext> contexts = config.getContexts();
if (contexts != null) {
for (NamedContext context : contexts) {
if (contextName.equals(context.getName())) {
return context.getContext();
}
}
}
}
return null;
}
|
static Context function(Config config) { String contextName = config.getCurrentContext(); if (contextName != null) { List<NamedContext> contexts = config.getContexts(); if (contexts != null) { for (NamedContext context : contexts) { if (contextName.equals(context.getName())) { return context.getContext(); } } } } return null; }
|
/**
* Returns the current context in the given config
*/
|
Returns the current context in the given config
|
getCurrentContext
|
{
"repo_name": "KurtStam/kubernetes-client",
"path": "kubernetes-client/src/main/java/io/fabric8/kubernetes/client/internal/KubeConfigUtils.java",
"license": "apache-2.0",
"size": 3886
}
|
[
"io.fabric8.kubernetes.api.model.Config",
"io.fabric8.kubernetes.api.model.Context",
"io.fabric8.kubernetes.api.model.NamedContext",
"java.util.List"
] |
import io.fabric8.kubernetes.api.model.Config; import io.fabric8.kubernetes.api.model.Context; import io.fabric8.kubernetes.api.model.NamedContext; import java.util.List;
|
import io.fabric8.kubernetes.api.model.*; import java.util.*;
|
[
"io.fabric8.kubernetes",
"java.util"
] |
io.fabric8.kubernetes; java.util;
| 131,891
|
public final boolean renameTo(String path) throws IOException
{
return renameTo(lookup(path));
}
|
final boolean function(String path) throws IOException { return renameTo(lookup(path)); }
|
/**
* Renames the file or directory to the name given by the path.
* @return true if successful
*/
|
Renames the file or directory to the name given by the path
|
renameTo
|
{
"repo_name": "gruppo4/quercus-upstream",
"path": "modules/kernel/src/com/caucho/vfs/Path.java",
"license": "gpl-2.0",
"size": 36959
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,682,940
|
public static void main(final String[] args) throws Exception {
int res = ToolRunner.run(new Configuration(), new ExampleJob(), args);
if (res != 0) {
System.err.println("something bad happened !");
} else {
System.out.println("ExampleJob is done !");
}
System.exit(res);
}
public static final String JSON = "{\n" + " \"colorsArray\":[{\n" + " \"colorName\":\"red\",\n"
+ " \"hexValue\":\"#f00\"\n" + " },\n" + " {\n"
+ " \"colorName\":\"green\",\n" + " \"hexValue\":\"#0f0\"\n" + " },\n"
+ " {\n" + " \"colorName\":\"blue\",\n" + " \"hexValue\":\"#00f\"\n"
+ " },\n" + " {\n" + " \"colorName\":\"cyan\",\n"
+ " \"hexValue\":\"#0ff\"\n" + " },\n" + " {\n"
+ " \"colorName\":\"magenta\",\n" + " \"hexValue\":\"#f0f\"\n" + " },\n"
+ " {\n" + " \"colorName\":\"yellow\",\n" + " \"hexValue\":\"#ff0\"\n"
+ " },\n" + " {\n" + " \"colorName\":\"black\",\n"
+ " \"hexValue\":\"#000\"\n" + " }\n" + " ]\n" + "}";
|
static void function(final String[] args) throws Exception { int res = ToolRunner.run(new Configuration(), new ExampleJob(), args); if (res != 0) { System.err.println(STR); } else { System.out.println(STR); } System.exit(res); } public static final String JSON = "{\n" + STRcolorsArray\":[{\n" + STRcolorName\":\"red\",\n" + STRhexValue\":\"#f00\"\n" + STR + STR + STRcolorName\":\"green\",\n" + STRhexValue\":\"#0f0\"\n" + STR + STR + STRcolorName\":\"blue\",\n" + STRhexValue\":\"#00f\"\n" + STR + STR + STRcolorName\":\"cyan\",\n" + STRhexValue\":\"#0ff\"\n" + STR + STR + STRcolorName\":\"magenta\",\n" + STRhexValue\":\"#f0f\"\n" + STR + STR + STRcolorName\":\"yellow\",\n" + STRhexValue\":\"#ff0\"\n" + STR + STR + STRcolorName\":\"black\",\n" + STRhexValue\":\"#000\"\n" + STR + STR + "}";
|
/**
* Main entry point for the example.
*
* @param args
* arguments
* @throws Exception
* when something goes wrong
*/
|
Main entry point for the example
|
main
|
{
"repo_name": "fanlehai/CodePractice",
"path": "hadoop/src/main/java/com/fanlehai/hadoop/serialize/json/multiline/ExampleJob.java",
"license": "apache-2.0",
"size": 5623
}
|
[
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.util.ToolRunner"
] |
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.util.ToolRunner;
|
import org.apache.hadoop.conf.*; import org.apache.hadoop.util.*;
|
[
"org.apache.hadoop"
] |
org.apache.hadoop;
| 1,758,234
|
private void removeChildren(int index) throws Exception {
prepareChildren();
for (PropertyInfo child : m_children) {
// skip if should not display raw Property
if (!rawProperties_shouldShow(child.m_property)) {
continue;
}
// hide presentation
{
PropertyEditorPresentation presentation =
child.getProperty().getEditor().getPresentation();
if (presentation != null) {
presentation.hide(PropertyTable.this, child.getProperty());
}
}
// remove child
m_properties.remove(index);
// remove children of current child
if (child.isExpanded()) {
child.removeChildren(index);
}
}
}
|
void function(int index) throws Exception { prepareChildren(); for (PropertyInfo child : m_children) { if (!rawProperties_shouldShow(child.m_property)) { continue; } { PropertyEditorPresentation presentation = child.getProperty().getEditor().getPresentation(); if (presentation != null) { presentation.hide(PropertyTable.this, child.getProperty()); } } m_properties.remove(index); if (child.isExpanded()) { child.removeChildren(index); } } }
|
/**
* Removes children properties.
*/
|
Removes children properties
|
removeChildren
|
{
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "external/eclipse-windowbuilder/propertysheet/src/org/eclipse/wb/internal/core/model/property/table/PropertyTable.java",
"license": "gpl-3.0",
"size": 51611
}
|
[
"org.eclipse.wb.internal.core.model.property.editor.presentation.PropertyEditorPresentation"
] |
import org.eclipse.wb.internal.core.model.property.editor.presentation.PropertyEditorPresentation;
|
import org.eclipse.wb.internal.core.model.property.editor.presentation.*;
|
[
"org.eclipse.wb"
] |
org.eclipse.wb;
| 2,587,847
|
public Ip4Address endIp() {
String ip = get(END_IP, null);
return ip != null ? Ip4Address.valueOf(ip) : null;
}
|
Ip4Address function() { String ip = get(END_IP, null); return ip != null ? Ip4Address.valueOf(ip) : null; }
|
/**
* Returns the end IP for the available IP Range.
*
* @return end IP or null if not set
*/
|
Returns the end IP for the available IP Range
|
endIp
|
{
"repo_name": "sonu283304/onos",
"path": "apps/dhcp/app/src/main/java/org/onosproject/dhcp/impl/DhcpConfig.java",
"license": "apache-2.0",
"size": 9788
}
|
[
"org.onlab.packet.Ip4Address"
] |
import org.onlab.packet.Ip4Address;
|
import org.onlab.packet.*;
|
[
"org.onlab.packet"
] |
org.onlab.packet;
| 1,391,320
|
//////////////////THE EVENT HANDLING CODE//////////////
//Needed so an annotation can listen to its features//
//and update correctly the database//////////////////
private transient Vector mapListeners;
public synchronized void removeFeatureMapListener(FeatureMapListener l) {
if (mapListeners != null && mapListeners.contains(l)) {
Vector v = (Vector) mapListeners.clone();
v.removeElement(l);
mapListeners = v;
}
|
transient Vector mapListeners; public synchronized void function(FeatureMapListener l) { if (mapListeners != null && mapListeners.contains(l)) { Vector v = (Vector) mapListeners.clone(); v.removeElement(l); mapListeners = v; }
|
/**
* Removes a gate listener
*/
|
Removes a gate listener
|
removeFeatureMapListener
|
{
"repo_name": "liuhongchao/GATE_Developer_7.0",
"path": "src/gate/util/SimpleFeatureMapImpl.java",
"license": "lgpl-3.0",
"size": 15356
}
|
[
"java.util.Vector"
] |
import java.util.Vector;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,762,374
|
public void setEmptyContainerElement(Element emptyContainerElement) {
m_emptyContainerElement = emptyContainerElement;
}
|
void function(Element emptyContainerElement) { m_emptyContainerElement = emptyContainerElement; }
|
/**
* Sets the empty container element.<p>
*
* @param emptyContainerElement the empty container element
*/
|
Sets the empty container element
|
setEmptyContainerElement
|
{
"repo_name": "gallardo/opencms-core",
"path": "src-gwt/org/opencms/ade/containerpage/client/ui/CmsContainerPageContainer.java",
"license": "lgpl-2.1",
"size": 29939
}
|
[
"com.google.gwt.dom.client.Element"
] |
import com.google.gwt.dom.client.Element;
|
import com.google.gwt.dom.client.*;
|
[
"com.google.gwt"
] |
com.google.gwt;
| 2,751,466
|
public Counter getCounter(String name) {
Iterator i = shares.iterator();
while ( i.hasNext() ) {
Counter s = (Counter) i.next();
if (name.equals(s.getName())) return s;
}
return null;
}
|
Counter function(String name) { Iterator i = shares.iterator(); while ( i.hasNext() ) { Counter s = (Counter) i.next(); if (name.equals(s.getName())) return s; } return null; }
|
/**
* Search for the counter with the specified string name and return it if it is registered.
*/
|
Search for the counter with the specified string name and return it if it is registered
|
getCounter
|
{
"repo_name": "aurelf/avrora",
"path": "src/cck/stat/Proportion.java",
"license": "bsd-3-clause",
"size": 4294
}
|
[
"java.util.Iterator"
] |
import java.util.Iterator;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 356,890
|
public void registerComponent(Object bean, ObjectName oname, String type)
throws Exception
{
if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() ) {
CoyoteLogger.MODELER_LOGGER.debug( "Managed= "+ oname);
}
if( bean ==null ) {
CoyoteLogger.MODELER_LOGGER.nullComponent(oname);
return;
}
try {
if( type==null ) {
type=bean.getClass().getName();
}
ManagedBean managed = findManagedBean(bean.getClass(), type);
// The real mbean is created and registered
DynamicMBean mbean = managed.createMBean(bean);
if( getMBeanServer().isRegistered( oname )) {
if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled()) {
CoyoteLogger.MODELER_LOGGER.debug("Unregistering existing component " + oname );
}
getMBeanServer().unregisterMBean( oname );
}
getMBeanServer().registerMBean( mbean, oname);
} catch( Exception ex) {
CoyoteLogger.MODELER_LOGGER.errorRegisteringMbean(oname, ex);
throw ex;
}
}
|
void function(Object bean, ObjectName oname, String type) throws Exception { if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled() ) { CoyoteLogger.MODELER_LOGGER.debug( STR+ oname); } if( bean ==null ) { CoyoteLogger.MODELER_LOGGER.nullComponent(oname); return; } try { if( type==null ) { type=bean.getClass().getName(); } ManagedBean managed = findManagedBean(bean.getClass(), type); DynamicMBean mbean = managed.createMBean(bean); if( getMBeanServer().isRegistered( oname )) { if( CoyoteLogger.MODELER_LOGGER.isDebugEnabled()) { CoyoteLogger.MODELER_LOGGER.debug(STR + oname ); } getMBeanServer().unregisterMBean( oname ); } getMBeanServer().registerMBean( mbean, oname); } catch( Exception ex) { CoyoteLogger.MODELER_LOGGER.errorRegisteringMbean(oname, ex); throw ex; } }
|
/** Register a component
* XXX make it private
*
* @param bean
* @param oname
* @param type
* @throws Exception
*/
|
Register a component XXX make it private
|
registerComponent
|
{
"repo_name": "whitingjr/JbossWeb_7_2_0",
"path": "src/main/java/org/apache/tomcat/util/modeler/Registry.java",
"license": "apache-2.0",
"size": 33058
}
|
[
"javax.management.DynamicMBean",
"javax.management.ObjectName",
"org.jboss.web.CoyoteLogger"
] |
import javax.management.DynamicMBean; import javax.management.ObjectName; import org.jboss.web.CoyoteLogger;
|
import javax.management.*; import org.jboss.web.*;
|
[
"javax.management",
"org.jboss.web"
] |
javax.management; org.jboss.web;
| 1,821,484
|
@Field(3)
public Pointer<Byte > extensions() {
return this.io.getPointerField(this, 3);
}
|
@Field(3) Pointer<Byte > function() { return this.io.getPointerField(this, 3); }
|
/**
* < comma-separated filename extensions<br>
* C type : const char*
*/
|
C type : const char
|
extensions
|
{
"repo_name": "mutars/java_libav",
"path": "wrapper/src/main/java/com/mutar/libav/bridge/avformat/AVOutputFormat.java",
"license": "gpl-2.0",
"size": 16998
}
|
[
"org.bridj.Pointer",
"org.bridj.ann.Field"
] |
import org.bridj.Pointer; import org.bridj.ann.Field;
|
import org.bridj.*; import org.bridj.ann.*;
|
[
"org.bridj",
"org.bridj.ann"
] |
org.bridj; org.bridj.ann;
| 2,125,143
|
public boolean removeChild(View child) {
return IMPL.removeChild(mInfo, child);
}
|
boolean function(View child) { return IMPL.removeChild(mInfo, child); }
|
/**
* Removes a child. If the child was not previously added to the node,
* calling this method has no effect.
* <p>
* <strong>Note:</strong> Cannot be called from an
* {@link android.accessibilityservice.AccessibilityService}.
* This class is made immutable before being delivered to an AccessibilityService.
* </p>
*
* @param child The child.
* @return true if the child was present
* @throws IllegalStateException If called from an AccessibilityService.
*/
|
Removes a child. If the child was not previously added to the node, calling this method has no effect. Note: Cannot be called from an <code>android.accessibilityservice.AccessibilityService</code>. This class is made immutable before being delivered to an AccessibilityService.
|
removeChild
|
{
"repo_name": "BruceHurrican/studydemo",
"path": "libs_src/v4src/java/android/support/v4/view/accessibility/AccessibilityNodeInfoCompat.java",
"license": "apache-2.0",
"size": 134224
}
|
[
"android.view.View"
] |
import android.view.View;
|
import android.view.*;
|
[
"android.view"
] |
android.view;
| 1,715,613
|
@Test
public void normalRangeSmokeTest() {
final int log2m = 11;
final int m = (1 << log2m);
final int regwidth = 5;
// regwidth = 5, so hash space is
// log2m + (2^5 - 1 - 1), so L = log2m + 30
final int l = log2m + 30;
// all registers at 'medium' value
{
final HLL hll = new HLL(log2m, regwidth, 128, m, HLLType.SPARSE);
final int registerValue = 7;
for(int i=0; i<m; i++) {
hll.addRaw(ProbabilisticTestUtil.constructHLLValue(log2m, i, registerValue));
}
final long cardinality = hll.cardinality();
// Simplified estimator when all registers take same value: alpha / (m/2^val)
final double estimator = HLLUtil.alphaMSquared(m)/((double)m/Math.pow(2, registerValue));
// Assert conditions for uncorrected range
assertTrue(estimator <= Math.pow(2,l)/30);
assertTrue(estimator > (5 * m /(double)2));
final long expected = (long)Math.ceil(estimator);
assertEquals(cardinality, expected);
}
}
|
void function() { final int log2m = 11; final int m = (1 << log2m); final int regwidth = 5; final int l = log2m + 30; { final HLL hll = new HLL(log2m, regwidth, 128, m, HLLType.SPARSE); final int registerValue = 7; for(int i=0; i<m; i++) { hll.addRaw(ProbabilisticTestUtil.constructHLLValue(log2m, i, registerValue)); } final long cardinality = hll.cardinality(); final double estimator = HLLUtil.alphaMSquared(m)/((double)m/Math.pow(2, registerValue)); assertTrue(estimator <= Math.pow(2,l)/30); assertTrue(estimator > (5 * m /(double)2)); final long expected = (long)Math.ceil(estimator); assertEquals(cardinality, expected); } }
|
/**
* Smoke test for {@link HLL#cardinality()} and the proper use of the
* uncorrected estimator.
*/
|
Smoke test for <code>HLL#cardinality()</code> and the proper use of the uncorrected estimator
|
normalRangeSmokeTest
|
{
"repo_name": "stephenmcd/java-hll",
"path": "src/test/java/net/agkn/hll/SparseHLLTest.java",
"license": "apache-2.0",
"size": 20073
}
|
[
"net.agkn.hll.util.HLLUtil",
"org.testng.Assert"
] |
import net.agkn.hll.util.HLLUtil; import org.testng.Assert;
|
import net.agkn.hll.util.*; import org.testng.*;
|
[
"net.agkn.hll",
"org.testng"
] |
net.agkn.hll; org.testng;
| 1,964,401
|
public static File findFile(String imgName, File dir, String extension) {
try {
List<Path> candidateFiles = Files
.list(Paths.get(dir.getAbsolutePath()))
.filter(p -> StringUtils.containsIgnoreCase(p.toString(), imgName)).collect(Collectors.toList());
logger.trace("candidateFiles = "+candidateFiles);
if (!CoreUtils.isEmpty(candidateFiles)) {
Path exactMatch = candidateFiles.stream()
.filter(p -> StringUtils.equalsIgnoreCase(imgName+"."+extension, p.toFile().getName()))
.findFirst().orElse(null);
File f = exactMatch!=null ? exactMatch.toFile() : candidateFiles.get(0).toFile();
if (f.canRead()) {
logger.debug("found {} for image {} in {}", f, imgName, dir);
return f;
}
}
} catch (IOException e) {
logger.warn("error while searching file for image {} in {}, msg = {} ", imgName, dir, e.getMessage());
}
logger.warn("no match file for image {} in {} ", imgName, dir);
return null;
}
|
static File function(String imgName, File dir, String extension) { try { List<Path> candidateFiles = Files .list(Paths.get(dir.getAbsolutePath())) .filter(p -> StringUtils.containsIgnoreCase(p.toString(), imgName)).collect(Collectors.toList()); logger.trace(STR+candidateFiles); if (!CoreUtils.isEmpty(candidateFiles)) { Path exactMatch = candidateFiles.stream() .filter(p -> StringUtils.equalsIgnoreCase(imgName+"."+extension, p.toFile().getName())) .findFirst().orElse(null); File f = exactMatch!=null ? exactMatch.toFile() : candidateFiles.get(0).toFile(); if (f.canRead()) { logger.debug(STR, f, imgName, dir); return f; } } } catch (IOException e) { logger.warn(STR, imgName, dir, e.getMessage()); } logger.warn(STR, imgName, dir); return null; }
|
/**
*
* Find first file if filename just contains image name
*
* @param imgName
* @param dir
* @param extension
* @return
*/
|
Find first file if filename just contains image name
|
findFile
|
{
"repo_name": "Transkribus/TranskribusCore",
"path": "src/main/java/eu/transkribus/core/io/LocalDocReader.java",
"license": "gpl-3.0",
"size": 59987
}
|
[
"eu.transkribus.core.util.CoreUtils",
"java.io.File",
"java.io.IOException",
"java.nio.file.Files",
"java.nio.file.Path",
"java.nio.file.Paths",
"java.util.List",
"java.util.stream.Collectors",
"org.apache.commons.lang3.StringUtils"
] |
import eu.transkribus.core.util.CoreUtils; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils;
|
import eu.transkribus.core.util.*; import java.io.*; import java.nio.file.*; import java.util.*; import java.util.stream.*; import org.apache.commons.lang3.*;
|
[
"eu.transkribus.core",
"java.io",
"java.nio",
"java.util",
"org.apache.commons"
] |
eu.transkribus.core; java.io; java.nio; java.util; org.apache.commons;
| 1,575,786
|
private AdGroupCriterion[] createKeywords(
AdWordsServicesInterface adWordsServices,
AdWordsSession session,
AdGroup adGroup,
List<String> keywordsToAdd)
throws RemoteException, UnsupportedEncodingException {
// Gets the AdGroupCriterionService.
AdGroupCriterionServiceInterface adGroupCriterionService =
adWordsServices.get(session, AdGroupCriterionServiceInterface.class);
List<AdGroupCriterionOperation> operations = new ArrayList<>();
for (String keywordToAdd : keywordsToAdd) {
// Creates the keyword.
Keyword keyword = new Keyword();
keyword.setText(keywordToAdd);
keyword.setMatchType(KeywordMatchType.EXACT);
// Creates biddable ad group criterion.
BiddableAdGroupCriterion keywordBiddableAdGroupCriterion = new BiddableAdGroupCriterion();
keywordBiddableAdGroupCriterion.setAdGroupId(adGroup.getId());
keywordBiddableAdGroupCriterion.setCriterion(keyword);
// You can optionally provide these field(s).
keywordBiddableAdGroupCriterion.setUserStatus(UserStatus.PAUSED);
String encodedFinalUrl =
String.format(
"http://example.com/mars/cruise/?kw=%s",
URLEncoder.encode(keyword.getText(), UTF_8.name()));
keywordBiddableAdGroupCriterion.setFinalUrls(new UrlList(new String[] {encodedFinalUrl}));
// Creates the operation.
AdGroupCriterionOperation keywordAdGroupCriterionOperation = new AdGroupCriterionOperation();
keywordAdGroupCriterionOperation.setOperand(keywordBiddableAdGroupCriterion);
keywordAdGroupCriterionOperation.setOperator(Operator.ADD);
operations.add(keywordAdGroupCriterionOperation);
}
// Adds the keywords.
AdGroupCriterionReturnValue result =
adGroupCriterionService.mutate(operations.toArray(new AdGroupCriterionOperation[0]));
// Displays the results.
for (AdGroupCriterion adGroupCriterionResult : result.getValue()) {
System.out.printf(
"Keyword ad group criterion with ad group ID %d, criterion ID %d, "
+ "text '%s', and match type '%s' was added.%n",
adGroupCriterionResult.getAdGroupId(),
adGroupCriterionResult.getCriterion().getId(),
((Keyword) adGroupCriterionResult.getCriterion()).getText(),
((Keyword) adGroupCriterionResult.getCriterion()).getMatchType());
}
return result.getValue();
}
|
AdGroupCriterion[] function( AdWordsServicesInterface adWordsServices, AdWordsSession session, AdGroup adGroup, List<String> keywordsToAdd) throws RemoteException, UnsupportedEncodingException { AdGroupCriterionServiceInterface adGroupCriterionService = adWordsServices.get(session, AdGroupCriterionServiceInterface.class); List<AdGroupCriterionOperation> operations = new ArrayList<>(); for (String keywordToAdd : keywordsToAdd) { Keyword keyword = new Keyword(); keyword.setText(keywordToAdd); keyword.setMatchType(KeywordMatchType.EXACT); BiddableAdGroupCriterion keywordBiddableAdGroupCriterion = new BiddableAdGroupCriterion(); keywordBiddableAdGroupCriterion.setAdGroupId(adGroup.getId()); keywordBiddableAdGroupCriterion.setCriterion(keyword); keywordBiddableAdGroupCriterion.setUserStatus(UserStatus.PAUSED); String encodedFinalUrl = String.format( STRKeyword ad group criterion with ad group ID %d, criterion ID %d, STRtext '%s', and match type '%s' was added.%n", adGroupCriterionResult.getAdGroupId(), adGroupCriterionResult.getCriterion().getId(), ((Keyword) adGroupCriterionResult.getCriterion()).getText(), ((Keyword) adGroupCriterionResult.getCriterion()).getMatchType()); } return result.getValue(); }
|
/**
* Creates keywords ad group criteria.
*
* @param adWordsServices the Google AdWords services interface.
* @param session the client session.
* @param adGroup the ad group for the new criteria.
* @param keywordsToAdd the keywords to add to the text ads.
* @throws RemoteException if the API request failed due to other errors.
* @throws UnsupportedEncodingException if encoding the final URL failed.
*/
|
Creates keywords ad group criteria
|
createKeywords
|
{
"repo_name": "googleads/google-ads-java",
"path": "google-ads-migration-examples/src/main/java/com/google/ads/googleads/migration/campaignmanagement/CreateCompleteCampaignBothApisPhase3.java",
"license": "apache-2.0",
"size": 25031
}
|
[
"com.google.ads.googleads.v10.resources.AdGroup",
"com.google.api.ads.adwords.axis.v201809.cm.AdGroupCriterion",
"com.google.api.ads.adwords.axis.v201809.cm.AdGroupCriterionOperation",
"com.google.api.ads.adwords.axis.v201809.cm.AdGroupCriterionServiceInterface",
"com.google.api.ads.adwords.axis.v201809.cm.BiddableAdGroupCriterion",
"com.google.api.ads.adwords.axis.v201809.cm.Keyword",
"com.google.api.ads.adwords.axis.v201809.cm.KeywordMatchType",
"com.google.api.ads.adwords.axis.v201809.cm.UserStatus",
"com.google.api.ads.adwords.lib.client.AdWordsSession",
"com.google.api.ads.adwords.lib.factory.AdWordsServicesInterface",
"java.io.UnsupportedEncodingException",
"java.rmi.RemoteException",
"java.util.ArrayList",
"java.util.List"
] |
import com.google.ads.googleads.v10.resources.AdGroup; import com.google.api.ads.adwords.axis.v201809.cm.AdGroupCriterion; import com.google.api.ads.adwords.axis.v201809.cm.AdGroupCriterionOperation; import com.google.api.ads.adwords.axis.v201809.cm.AdGroupCriterionServiceInterface; import com.google.api.ads.adwords.axis.v201809.cm.BiddableAdGroupCriterion; import com.google.api.ads.adwords.axis.v201809.cm.Keyword; import com.google.api.ads.adwords.axis.v201809.cm.KeywordMatchType; import com.google.api.ads.adwords.axis.v201809.cm.UserStatus; import com.google.api.ads.adwords.lib.client.AdWordsSession; import com.google.api.ads.adwords.lib.factory.AdWordsServicesInterface; import java.io.UnsupportedEncodingException; import java.rmi.RemoteException; import java.util.ArrayList; import java.util.List;
|
import com.google.ads.googleads.v10.resources.*; import com.google.api.ads.adwords.axis.v201809.cm.*; import com.google.api.ads.adwords.lib.client.*; import com.google.api.ads.adwords.lib.factory.*; import java.io.*; import java.rmi.*; import java.util.*;
|
[
"com.google.ads",
"com.google.api",
"java.io",
"java.rmi",
"java.util"
] |
com.google.ads; com.google.api; java.io; java.rmi; java.util;
| 1,198,542
|
private PathPoint getSafePoint(Entity entityIn, int x, int y, int z, int p_176171_5_)
{
PathPoint pathpoint = null;
int i = this.getVerticalOffset(entityIn, x, y, z);
if (i == 2)
{
return this.openPoint(x, y, z);
}
else
{
if (i == 1)
{
pathpoint = this.openPoint(x, y, z);
}
if (pathpoint == null && p_176171_5_ > 0 && i != -3 && i != -4 && this.getVerticalOffset(entityIn, x, y + p_176171_5_, z) == 1)
{
pathpoint = this.openPoint(x, y + p_176171_5_, z);
y += p_176171_5_;
}
if (pathpoint != null)
{
int j = 0;
int k;
for (k = 0; y > 0; pathpoint = this.openPoint(x, y, z))
{
k = this.getVerticalOffset(entityIn, x, y - 1, z);
if (this.avoidsWater && k == -1)
{
return null;
}
if (k != 1)
{
break;
}
if (j++ >= entityIn.getMaxFallHeight())
{
return null;
}
--y;
if (y <= 0)
{
return null;
}
}
if (k == -2)
{
return null;
}
}
return pathpoint;
}
}
|
PathPoint function(Entity entityIn, int x, int y, int z, int p_176171_5_) { PathPoint pathpoint = null; int i = this.getVerticalOffset(entityIn, x, y, z); if (i == 2) { return this.openPoint(x, y, z); } else { if (i == 1) { pathpoint = this.openPoint(x, y, z); } if (pathpoint == null && p_176171_5_ > 0 && i != -3 && i != -4 && this.getVerticalOffset(entityIn, x, y + p_176171_5_, z) == 1) { pathpoint = this.openPoint(x, y + p_176171_5_, z); y += p_176171_5_; } if (pathpoint != null) { int j = 0; int k; for (k = 0; y > 0; pathpoint = this.openPoint(x, y, z)) { k = this.getVerticalOffset(entityIn, x, y - 1, z); if (this.avoidsWater && k == -1) { return null; } if (k != 1) { break; } if (j++ >= entityIn.getMaxFallHeight()) { return null; } --y; if (y <= 0) { return null; } } if (k == -2) { return null; } } return pathpoint; } }
|
/**
* Returns a point that the entity can safely move to
*/
|
Returns a point that the entity can safely move to
|
getSafePoint
|
{
"repo_name": "TorchPowered/CraftBloom",
"path": "src/net/minecraft/world/pathfinder/WalkNodeProcessor.java",
"license": "mit",
"size": 10823
}
|
[
"net.minecraft.entity.Entity",
"net.minecraft.pathfinding.PathPoint"
] |
import net.minecraft.entity.Entity; import net.minecraft.pathfinding.PathPoint;
|
import net.minecraft.entity.*; import net.minecraft.pathfinding.*;
|
[
"net.minecraft.entity",
"net.minecraft.pathfinding"
] |
net.minecraft.entity; net.minecraft.pathfinding;
| 2,218,362
|
public int createPlatform(String[] args) {
ReturnCode rc = ReturnCode.OK;
Map<String, String> initProps = new HashMap<String, String>(20);
initProps.put(BootstrapConstants.LAUNCH_TIME, Long.toString(launchTime));
initProps.put("org.apache.aries.blueprint.preemptiveShutdown", Boolean.toString(false));
BootstrapConfig bootProps = createBootstrapConfig();
try {
// process and consume Launcher-specific command line arguments
// (bottom) bootstrap.properties file <- command line args <- system properties (top)
LaunchArguments launchArgs = createLaunchArguments(args, initProps);
rc = launchArgs.getRc(); // Pay attention that rc is not modified before calling handleActions().
// Figure out log locations, etc.
findLocations(bootProps, launchArgs.getProcessName());
if (rc.logName != null) {
// If the server doesn't exist (and won't be created), then
// create the log in the common .logs dir. We always put
// create.log in the common .logs dir because we don't want to
// create the server directory before verifying it.
if (rc == ReturnCode.CREATE_ACTION || (!bootProps.getConfigFile(null).exists() && !rc.getVerifyServer().willCreate())) {
Debug.open(bootProps.getUserOutputFile(".logs"), rc.logName);
} else {
Debug.open(bootProps.getLogDirectory(), rc.logName);
}
}
// Test/create required directories if this is a new server that should be created (--create)
bootProps.verifyProcess(rc.getVerifyServer(), launchArgs);
// Initialize bootstrap configuration: bootstrap properties, etc.
if (rc.readInitialConfig()) {
// Read/merge bootstrap properties and System.properties into initProps
bootProps.configure(initProps);
// Set system properties based on configuration result..
bootProps.setSystemProperties();
}
bootProps.setCmdArgs(launchArgs.getExtraArguments());
if (launchArgs.getProcessName() == null && launchArgs.getRc().defaultServerNameMessage()) {
System.out.println(MessageFormat.format(BootstrapConstants.messages.getString(getDefaultProcessNameMessageKey()),
getDefaultProcessName()));
}
// Now perform appropriate processing based on the current return code
rc = handleActions(bootProps, launchArgs);
} catch (LocationException e) {
System.out.println(BootstrapConstants.messages.getString("error.unableToLaunch"));
System.out.println(e.getTranslatedMessage());
if (Debug.isOpen()) {
Debug.printStackTrace(e);
Debug.println(bootProps.printLocations(true));
}
if (e.getCause() != null) {
e.printStackTrace();
}
if (e.getCause() != null || bootProps.isConfigured()) {
System.out.println(bootProps.printLocations(true));
}
rc = ReturnCode.LOCATION_EXCEPTION;
} catch (ClientRunnerException e) {
System.out.println(e.getTranslatedMessage());
if (Debug.isOpen()) {
Debug.printStackTrace(e);
}
if (e.getCause() != null) {
e.printStackTrace();
}
rc = e.getReturnCode();
} catch (LaunchException e) {
System.out.println(BootstrapConstants.messages.getString("error.unableToLaunch"));
System.out.println(e.getTranslatedMessage());
if (Debug.isOpen()) {
Debug.printStackTrace(e);
}
if (e.getCause() != null) {
e.printStackTrace();
}
rc = e.getReturnCode();
} catch (RuntimeException e) {
Throwable t = e.getCause();
if (t == null)
t = e;
System.out.println(BootstrapConstants.messages.getString("error.unableToLaunch"));
System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("error.unknownException"), t.toString()));
if (Debug.isOpen()) {
Debug.printStackTrace(e);
}
e.printStackTrace();
rc = ReturnCode.RUNTIME_EXCEPTION;
} catch (Throwable e) {
System.out.println(BootstrapConstants.messages.getString("error.unableToLaunch"));
System.out.println(MessageFormat.format(BootstrapConstants.messages.getString("error.unknownException"), e.toString()));
if (Debug.isOpen()) {
Debug.printStackTrace(e);
}
e.printStackTrace();
rc = ReturnCode.UNKNOWN_EXCEPTION;
} finally {
System.out.flush();
if (!Debug.isOpen()) {
System.err.flush();
} else {
boolean delete = rc == ReturnCode.OK;
if (!delete) {
Debug.println();
for (int i = 0; i < args.length; i++) {
Debug.println("arg" + i + "=" + args[i]);
}
Debug.println("exit=" + rc.val);
Debug.println();
Debug.println(bootProps.printLocations(true));
}
Debug.close(delete);
}
}
return rc.val;
}
|
int function(String[] args) { ReturnCode rc = ReturnCode.OK; Map<String, String> initProps = new HashMap<String, String>(20); initProps.put(BootstrapConstants.LAUNCH_TIME, Long.toString(launchTime)); initProps.put(STR, Boolean.toString(false)); BootstrapConfig bootProps = createBootstrapConfig(); try { LaunchArguments launchArgs = createLaunchArguments(args, initProps); rc = launchArgs.getRc(); findLocations(bootProps, launchArgs.getProcessName()); if (rc.logName != null) { if (rc == ReturnCode.CREATE_ACTION (!bootProps.getConfigFile(null).exists() && !rc.getVerifyServer().willCreate())) { Debug.open(bootProps.getUserOutputFile(".logs"), rc.logName); } else { Debug.open(bootProps.getLogDirectory(), rc.logName); } } bootProps.verifyProcess(rc.getVerifyServer(), launchArgs); if (rc.readInitialConfig()) { bootProps.configure(initProps); bootProps.setSystemProperties(); } bootProps.setCmdArgs(launchArgs.getExtraArguments()); if (launchArgs.getProcessName() == null && launchArgs.getRc().defaultServerNameMessage()) { System.out.println(MessageFormat.format(BootstrapConstants.messages.getString(getDefaultProcessNameMessageKey()), getDefaultProcessName())); } rc = handleActions(bootProps, launchArgs); } catch (LocationException e) { System.out.println(BootstrapConstants.messages.getString(STR)); System.out.println(e.getTranslatedMessage()); if (Debug.isOpen()) { Debug.printStackTrace(e); Debug.println(bootProps.printLocations(true)); } if (e.getCause() != null) { e.printStackTrace(); } if (e.getCause() != null bootProps.isConfigured()) { System.out.println(bootProps.printLocations(true)); } rc = ReturnCode.LOCATION_EXCEPTION; } catch (ClientRunnerException e) { System.out.println(e.getTranslatedMessage()); if (Debug.isOpen()) { Debug.printStackTrace(e); } if (e.getCause() != null) { e.printStackTrace(); } rc = e.getReturnCode(); } catch (LaunchException e) { System.out.println(BootstrapConstants.messages.getString(STR)); System.out.println(e.getTranslatedMessage()); if (Debug.isOpen()) { Debug.printStackTrace(e); } if (e.getCause() != null) { e.printStackTrace(); } rc = e.getReturnCode(); } catch (RuntimeException e) { Throwable t = e.getCause(); if (t == null) t = e; System.out.println(BootstrapConstants.messages.getString(STR)); System.out.println(MessageFormat.format(BootstrapConstants.messages.getString(STR), t.toString())); if (Debug.isOpen()) { Debug.printStackTrace(e); } e.printStackTrace(); rc = ReturnCode.RUNTIME_EXCEPTION; } catch (Throwable e) { System.out.println(BootstrapConstants.messages.getString(STR)); System.out.println(MessageFormat.format(BootstrapConstants.messages.getString(STR), e.toString())); if (Debug.isOpen()) { Debug.printStackTrace(e); } e.printStackTrace(); rc = ReturnCode.UNKNOWN_EXCEPTION; } finally { System.out.flush(); if (!Debug.isOpen()) { System.err.flush(); } else { boolean delete = rc == ReturnCode.OK; if (!delete) { Debug.println(); for (int i = 0; i < args.length; i++) { Debug.println("arg" + i + "=" + args[i]); } Debug.println("exit=" + rc.val); Debug.println(); Debug.println(bootProps.printLocations(true)); } Debug.close(delete); } } return rc.val; }
|
/**
* Launch the platform-- this method will not return until the
* framework exits. Subsequent calls to this method (while the platform is
* running) will immediately return.
*
* @param args
* Command line arguments
*
* @return 0 if platform was launched and shut down successfully, > 20 if
* an exception or unexpected condition occurred during
* platform/framework startup or shutdown.
*/
|
Launch the platform-- this method will not return until the framework exits. Subsequent calls to this method (while the platform is running) will immediately return
|
createPlatform
|
{
"repo_name": "kgibm/open-liberty",
"path": "dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/Launcher.java",
"license": "epl-1.0",
"size": 18227
}
|
[
"com.ibm.ws.kernel.boot.internal.BootstrapConstants",
"java.text.MessageFormat",
"java.util.HashMap",
"java.util.Map"
] |
import com.ibm.ws.kernel.boot.internal.BootstrapConstants; import java.text.MessageFormat; import java.util.HashMap; import java.util.Map;
|
import com.ibm.ws.kernel.boot.internal.*; import java.text.*; import java.util.*;
|
[
"com.ibm.ws",
"java.text",
"java.util"
] |
com.ibm.ws; java.text; java.util;
| 1,700,906
|
// private boolean gameOver = false;
@Override
public void start()
{
super.start();
final PlayerID winner = checkForWinner();
if (winner != null)
{
// CountDownLatch waitToLeaveGame = new CountDownLatch(1);
signalGameOver(winner.getName() + " wins!");// , waitToLeaveGame);
// gameOver = true;
// while(true){}
}
}
|
void function() { super.start(); final PlayerID winner = checkForWinner(); if (winner != null) { signalGameOver(winner.getName() + STR); } }
|
/**
* Called before the delegate will run.
*/
|
Called before the delegate will run
|
start
|
{
"repo_name": "tea-dragon/triplea",
"path": "src/main/java/games/strategy/grid/kingstable/delegate/EndTurnDelegate.java",
"license": "gpl-2.0",
"size": 5261
}
|
[
"games.strategy.engine.data.PlayerID"
] |
import games.strategy.engine.data.PlayerID;
|
import games.strategy.engine.data.*;
|
[
"games.strategy.engine"
] |
games.strategy.engine;
| 2,675,131
|
public static final String getTestScratchPath() {
String filePath = DEFAULT_TEMP_DIR;
File scratch = new File(filePath);
if (!scratch.exists() && !scratch.mkdirs()) {
filePath = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$
if (filePath == null) {
filePath = "."; //$NON-NLS-1$
}
}
File scratchDirectory = new File(filePath);
if(!scratchDirectory.exists()) {
scratchDirectory.mkdir();
}
return filePath;
}
|
static final String function() { String filePath = DEFAULT_TEMP_DIR; File scratch = new File(filePath); if (!scratch.exists() && !scratch.mkdirs()) { filePath = System.getProperty(STR); if (filePath == null) { filePath = "."; } } File scratchDirectory = new File(filePath); if(!scratchDirectory.exists()) { scratchDirectory.mkdir(); } return filePath; }
|
/**
* Obtain the file path to a scratch area where files may be created during testing.
*
* @return File path, never null
*/
|
Obtain the file path to a scratch area where files may be created during testing
|
getTestScratchPath
|
{
"repo_name": "jagazee/teiid-8.7",
"path": "common-core/src/test/java/org/teiid/core/util/UnitTestUtil.java",
"license": "lgpl-2.1",
"size": 21572
}
|
[
"java.io.File"
] |
import java.io.File;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 280,720
|
protected boolean synthesizedElement(Element elem) {
if (matchNameAttribute(elem.getAttributes(), HTML.Tag.IMPLIED)) {
return true;
}
return false;
}
|
boolean function(Element elem) { if (matchNameAttribute(elem.getAttributes(), HTML.Tag.IMPLIED)) { return true; } return false; }
|
/**
* Returns true if the element is a
* synthesized element. Currently we are only testing
* for the p-implied tag.
*/
|
Returns true if the element is a synthesized element. Currently we are only testing for the p-implied tag
|
synthesizedElement
|
{
"repo_name": "cst316/spring16project-Team-Boston",
"path": "src/net/sf/memoranda/ui/htmleditor/AltHTMLWriter.java",
"license": "gpl-2.0",
"size": 82104
}
|
[
"javax.swing.text.Element"
] |
import javax.swing.text.Element;
|
import javax.swing.text.*;
|
[
"javax.swing"
] |
javax.swing;
| 555,346
|
public static final AccountBudgetProposalServiceClient create(
AccountBudgetProposalServiceSettings settings) throws IOException {
return new AccountBudgetProposalServiceClient(settings);
}
|
static final AccountBudgetProposalServiceClient function( AccountBudgetProposalServiceSettings settings) throws IOException { return new AccountBudgetProposalServiceClient(settings); }
|
/**
* Constructs an instance of AccountBudgetProposalServiceClient, using the given settings. The
* channels are created based on the settings passed in, or defaults for any settings that are not
* set.
*/
|
Constructs an instance of AccountBudgetProposalServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set
|
create
|
{
"repo_name": "googleads/google-ads-java",
"path": "google-ads-stubs-v9/src/main/java/com/google/ads/googleads/v9/services/AccountBudgetProposalServiceClient.java",
"license": "apache-2.0",
"size": 17303
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 992,446
|
void setDefaultTracer(InterceptStrategy tracer);
|
void setDefaultTracer(InterceptStrategy tracer);
|
/**
* Sets a custom tracer to be used as the default tracer.
* <p/>
* <b>Note:</b> This must be set before any routes are created,
* changing the default tracer for existing routes is not supported.
*
* @param tracer the custom tracer to use as default tracer
*/
|
Sets a custom tracer to be used as the default tracer. Note: This must be set before any routes are created, changing the default tracer for existing routes is not supported
|
setDefaultTracer
|
{
"repo_name": "jonmcewen/camel",
"path": "camel-core/src/main/java/org/apache/camel/CamelContext.java",
"license": "apache-2.0",
"size": 79068
}
|
[
"org.apache.camel.spi.InterceptStrategy"
] |
import org.apache.camel.spi.InterceptStrategy;
|
import org.apache.camel.spi.*;
|
[
"org.apache.camel"
] |
org.apache.camel;
| 1,031,380
|
void readEncodedColumns(int stripeIx, StripeInformation stripe,
OrcProto.RowIndex[] index, List<OrcProto.ColumnEncoding> encodings,
List<OrcProto.Stream> streams, boolean[] physicalFileIncludes, boolean[] rgs,
Consumer<OrcEncodedColumnBatch> consumer) throws IOException;
|
void readEncodedColumns(int stripeIx, StripeInformation stripe, OrcProto.RowIndex[] index, List<OrcProto.ColumnEncoding> encodings, List<OrcProto.Stream> streams, boolean[] physicalFileIncludes, boolean[] rgs, Consumer<OrcEncodedColumnBatch> consumer) throws IOException;
|
/**
* Reads encoded data from ORC file.
* @param stripeIx Index of the stripe to read.
* @param stripe Externally provided metadata (from metadata reader or external cache).
* @param index Externally provided metadata (from metadata reader or external cache).
* @param encodings Externally provided metadata (from metadata reader or external cache).
* @param streams Externally provided metadata (from metadata reader or external cache).
* @param physicalFileIncludes The array of booleans indicating whether each column should be read.
* @param rgs Arrays of rgs, per column set to true in included, that are to be read.
* null in each respective position means all rgs for this column need to be read.
* @param consumer The sink for data that has been read.
*/
|
Reads encoded data from ORC file
|
readEncodedColumns
|
{
"repo_name": "sankarh/hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/io/orc/encoded/EncodedReader.java",
"license": "apache-2.0",
"size": 3632
}
|
[
"java.io.IOException",
"java.util.List",
"org.apache.hadoop.hive.ql.io.orc.encoded.Reader",
"org.apache.orc.OrcProto",
"org.apache.orc.StripeInformation"
] |
import java.io.IOException; import java.util.List; import org.apache.hadoop.hive.ql.io.orc.encoded.Reader; import org.apache.orc.OrcProto; import org.apache.orc.StripeInformation;
|
import java.io.*; import java.util.*; import org.apache.hadoop.hive.ql.io.orc.encoded.*; import org.apache.orc.*;
|
[
"java.io",
"java.util",
"org.apache.hadoop",
"org.apache.orc"
] |
java.io; java.util; org.apache.hadoop; org.apache.orc;
| 1,459,578
|
public void setCheckBoxesFromMenuItemList() {
for (int index = 0; index < _grammarMenu.getItemCount(); index++) {
JMenuItem menuItem = null;
try {
// Gets the menu item from the file menu
menuItem = _grammarMenu.getItem(index);
// If it is not a separator
if (menuItem != null) {
// Updates the menu item check box state with the menu
// configuration
_components.get(menuItem.getName()).setSelected(
AcideMenuConfiguration.getInstance()
.getIsDisplayed(menuItem.getName()));
}
} catch (ClassCastException exception) {
// If the file JMenu has a menu instead of a JMenuItem
// Gets the menu from the file menu
JMenu menu = (JMenu) _grammarMenu.getMenuComponent(index);
// If it is not a separator
if (menu != null) {
// Updates the menu check box state with the menu
// configuration
_components.get(menu.getName()).setSelected(
AcideMenuConfiguration.getInstance()
.getIsDisplayed(menu.getName()));
}
}
}
}
|
void function() { for (int index = 0; index < _grammarMenu.getItemCount(); index++) { JMenuItem menuItem = null; try { menuItem = _grammarMenu.getItem(index); if (menuItem != null) { _components.get(menuItem.getName()).setSelected( AcideMenuConfiguration.getInstance() .getIsDisplayed(menuItem.getName())); } } catch (ClassCastException exception) { JMenu menu = (JMenu) _grammarMenu.getMenuComponent(index); if (menu != null) { _components.get(menu.getName()).setSelected( AcideMenuConfiguration.getInstance() .getIsDisplayed(menu.getName())); } } } }
|
/**
* Sets the check box values from the menu item list of the menu
* configuration.
*/
|
Sets the check box values from the menu item list of the menu configuration
|
setCheckBoxesFromMenuItemList
|
{
"repo_name": "salcedonia/acide-0-8-release-2010-2011",
"path": "acide/src/acide/gui/menuBar/configurationMenu/menuMenu/gui/configurationPanel/grammarPanel/AcideGrammarMenuPanel.java",
"license": "gpl-3.0",
"size": 8018
}
|
[
"javax.swing.JMenu",
"javax.swing.JMenuItem"
] |
import javax.swing.JMenu; import javax.swing.JMenuItem;
|
import javax.swing.*;
|
[
"javax.swing"
] |
javax.swing;
| 2,750,497
|
public OffsetDateTime date() {
if (this.date == null) {
return null;
}
return this.date.dateTime();
}
|
OffsetDateTime function() { if (this.date == null) { return null; } return this.date.dateTime(); }
|
/**
* Get the date value.
*
* @return the date value.
*/
|
Get the date value
|
date
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/models/BlobGetAccountInfoHeaders.java",
"license": "mit",
"size": 4260
}
|
[
"java.time.OffsetDateTime"
] |
import java.time.OffsetDateTime;
|
import java.time.*;
|
[
"java.time"
] |
java.time;
| 2,449,857
|
public Appointment createAppointment(PersonalAppointment personalAppointment) throws IOException {
String data = gson.toJson(personalAppointment);
BufferedReader reader = new BufferedReader(HttpUtil.httpPostRaw(magister.school.url + "/api/personen/" + magister.profile.id + "/afspraken", data));
StringBuilder responseBuilder = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
responseBuilder.append(line);
}
responseBuilder.toString();
//String url = GsonUtil.getFromJson(responseBuilder.toString(), "Url").getAsString();
return null;
}
|
Appointment function(PersonalAppointment personalAppointment) throws IOException { String data = gson.toJson(personalAppointment); BufferedReader reader = new BufferedReader(HttpUtil.httpPostRaw(magister.school.url + STR + magister.profile.id + STR, data)); StringBuilder responseBuilder = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { responseBuilder.append(line); } responseBuilder.toString(); return null; }
|
/**
* Adds an appointment to magister. It wil return the Url of this Appointment, if it fails null will be
* returned
*
* @param personalAppointment the personal appointment instance.
* @return the appointment instance with more info.
* @throws IOException if there is no active internet connection.
* @throws PrivilegeException if the profile doesn't have the privilege to perform this action.
*/
|
Adds an appointment to magister. It wil return the Url of this Appointment, if it fails null will be returned
|
createAppointment
|
{
"repo_name": "Z3r0byte/Magis",
"path": "app/src/main/java/net/ilexiconn/magister/handler/AppointmentHandler.java",
"license": "apache-2.0",
"size": 7719
}
|
[
"java.io.BufferedReader",
"java.io.IOException",
"net.ilexiconn.magister.container.Appointment",
"net.ilexiconn.magister.container.PersonalAppointment",
"net.ilexiconn.magister.util.HttpUtil"
] |
import java.io.BufferedReader; import java.io.IOException; import net.ilexiconn.magister.container.Appointment; import net.ilexiconn.magister.container.PersonalAppointment; import net.ilexiconn.magister.util.HttpUtil;
|
import java.io.*; import net.ilexiconn.magister.container.*; import net.ilexiconn.magister.util.*;
|
[
"java.io",
"net.ilexiconn.magister"
] |
java.io; net.ilexiconn.magister;
| 406,100
|
@Override
protected AmazonDLM build(AwsSyncClientParams params) {
return new AmazonDLMClient(params);
}
|
AmazonDLM function(AwsSyncClientParams params) { return new AmazonDLMClient(params); }
|
/**
* Construct a synchronous implementation of AmazonDLM using the current builder configuration.
*
* @param params
* Current builder configuration represented as a parameter object.
* @return Fully configured implementation of AmazonDLM.
*/
|
Construct a synchronous implementation of AmazonDLM using the current builder configuration
|
build
|
{
"repo_name": "jentfoo/aws-sdk-java",
"path": "aws-java-sdk-dlm/src/main/java/com/amazonaws/services/dlm/AmazonDLMClientBuilder.java",
"license": "apache-2.0",
"size": 2284
}
|
[
"com.amazonaws.client.AwsSyncClientParams"
] |
import com.amazonaws.client.AwsSyncClientParams;
|
import com.amazonaws.client.*;
|
[
"com.amazonaws.client"
] |
com.amazonaws.client;
| 2,760,322
|
boolean isBlockPowered(Vector3i position);
|
boolean isBlockPowered(Vector3i position);
|
/**
* Test whether the object is powered.
*
* @param position The position of the block
* @return Whether powered
*/
|
Test whether the object is powered
|
isBlockPowered
|
{
"repo_name": "caseif/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/world/extent/Extent.java",
"license": "mit",
"size": 33478
}
|
[
"com.flowpowered.math.vector.Vector3i"
] |
import com.flowpowered.math.vector.Vector3i;
|
import com.flowpowered.math.vector.*;
|
[
"com.flowpowered.math"
] |
com.flowpowered.math;
| 1,601,442
|
public DTMIterator asIterator(XPathContext xctxt, int contextNode)
throws javax.xml.transform.TransformerException
{
try
{
xctxt.pushCurrentNodeAndExpression(contextNode, contextNode);
return execute(xctxt).iter();
}
finally
{
xctxt.popCurrentNodeAndExpression();
}
}
|
DTMIterator function(XPathContext xctxt, int contextNode) throws javax.xml.transform.TransformerException { try { xctxt.pushCurrentNodeAndExpression(contextNode, contextNode); return execute(xctxt).iter(); } finally { xctxt.popCurrentNodeAndExpression(); } }
|
/**
* Given an select expression and a context, evaluate the XPath
* and return the resulting iterator.
*
* @param xctxt The execution context.
* @param contextNode The node that "." expresses.
*
*
* @return A valid DTMIterator.
* @throws TransformerException thrown if the active ProblemListener decides
* the error condition is severe enough to halt processing.
*
* @throws javax.xml.transform.TransformerException
* @xsl.usage experimental
*/
|
Given an select expression and a context, evaluate the XPath and return the resulting iterator
|
asIterator
|
{
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jaxp/src/com/sun/org/apache/xpath/internal/Expression.java",
"license": "mit",
"size": 18185
}
|
[
"com.sun.org.apache.xml.internal.dtm.DTMIterator",
"javax.xml.transform.TransformerException"
] |
import com.sun.org.apache.xml.internal.dtm.DTMIterator; import javax.xml.transform.TransformerException;
|
import com.sun.org.apache.xml.internal.dtm.*; import javax.xml.transform.*;
|
[
"com.sun.org",
"javax.xml"
] |
com.sun.org; javax.xml;
| 686,751
|
public void fatal(String key, boolean asString, Object[] args) {
logMessage(Level.FATAL, key, asString, args, null);
}
|
void function(String key, boolean asString, Object[] args) { logMessage(Level.FATAL, key, asString, args, null); }
|
/**
* Log statements with level FATAL
*
* @param key
* Key present in the resource bundle. If asString parameter is
* false then this is treated as the string to be displayed
* @param asString
* Boolean value which decides if the parameter "key" should be
* treated as a key in the resource bundle or as a string
* @param args
* List of parameters which can be used to replace placeholders
* in a message.
*/
|
Log statements with level FATAL
|
fatal
|
{
"repo_name": "mifos/1.5.x",
"path": "application/src/main/java/org/mifos/framework/components/logger/MifosLogger.java",
"license": "apache-2.0",
"size": 10918
}
|
[
"org.apache.log4j.Level"
] |
import org.apache.log4j.Level;
|
import org.apache.log4j.*;
|
[
"org.apache.log4j"
] |
org.apache.log4j;
| 218,881
|
public void removeAllChildren()
{
TreePath treePath = tree.getSelectionPath();
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)treePath.getLastPathComponent();
java.util.Enumeration enumeration = selectedNode.children();
while (enumeration.hasMoreElements())
{
DefaultMutableTreeNode n = (DefaultMutableTreeNode)enumeration.nextElement();
treeModel.removeNodeFromParent(n);
}
}
} //end class DynamicTree
} //end class RawExplorer
class FileTableModel extends AbstractTableModel
{
private RawExplorer RawExplorer;
protected final String[] columnNames = {"Name", "Size", "Type", "Last Modificated", "Created"};
protected Vector rowData = new Vector();
class RowNode
{
String name;
long size;
String type;
DirectoryDate lastModificationDate;
DirectoryTime lastModificationTime;
DirectoryDate creationDate;
DirectoryTime creationTime;
|
void function() { TreePath treePath = tree.getSelectionPath(); DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode)treePath.getLastPathComponent(); java.util.Enumeration enumeration = selectedNode.children(); while (enumeration.hasMoreElements()) { DefaultMutableTreeNode n = (DefaultMutableTreeNode)enumeration.nextElement(); treeModel.removeNodeFromParent(n); } } } } class FileTableModel extends AbstractTableModel { private RawExplorer RawExplorer; protected final String[] columnNames = {"Name", "Size", "Type", STR, STR}; protected Vector rowData = new Vector(); class RowNode { String name; long size; String type; DirectoryDate lastModificationDate; DirectoryTime lastModificationTime; DirectoryDate creationDate; DirectoryTime creationTime;
|
/**
* Removes all children from the selected path.
*/
|
Removes all children from the selected path
|
removeAllChildren
|
{
"repo_name": "umr-dbs/xxl-usecases",
"path": "src/xxl/core/io/RawExplorer.java",
"license": "lgpl-3.0",
"size": 82149
}
|
[
"java.util.Enumeration",
"java.util.Vector",
"javax.swing.table.AbstractTableModel",
"javax.swing.tree.DefaultMutableTreeNode",
"javax.swing.tree.TreePath",
"xxl.core.io.fat.DirectoryDate",
"xxl.core.io.fat.DirectoryTime"
] |
import java.util.Enumeration; import java.util.Vector; import javax.swing.table.AbstractTableModel; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; import xxl.core.io.fat.DirectoryDate; import xxl.core.io.fat.DirectoryTime;
|
import java.util.*; import javax.swing.table.*; import javax.swing.tree.*; import xxl.core.io.fat.*;
|
[
"java.util",
"javax.swing",
"xxl.core.io"
] |
java.util; javax.swing; xxl.core.io;
| 173,424
|
public DataForm getFilledForm() {
// Now submit all information
Iterator<String> valueIter = valueMap.keySet().iterator();
FillableForm answerForm = new FillableForm(searchForm);
while (valueIter.hasNext()) {
String answer = valueIter.next();
Object o = valueMap.get(answer);
if (o instanceof JCheckBox) {
boolean isSelected = ((JCheckBox)o).isSelected();
answerForm.setAnswer(answer, isSelected);
}
else if (o instanceof JTextArea) {
List<String> list = new ArrayList<>();
String value = ((JTextArea)o).getText();
StringTokenizer tokenizer = new StringTokenizer(value, ", ", false);
while (tokenizer.hasMoreTokens()) {
list.add(tokenizer.nextToken());
}
if (list.size() > 0) {
answerForm.setAnswer(answer, list);
}
}
else if (o instanceof JTextField) {
String value = ((JTextField)o).getText();
if (ModelUtil.hasLength(value)) {
answerForm.setAnswer(answer, value);
}
}
else if (o instanceof JComboBox) {
Object v = ((JComboBox<?>)o).getSelectedItem();
String value;
if (v instanceof FormField.Option) {
value = ((FormField.Option)v).getValueString();
}
else {
value = (String)v;
}
List<String> list = new ArrayList<>();
list.add(value);
if (list.size() > 0) {
answerForm.setAnswer(answer, list);
}
}
else if (o instanceof CheckBoxList) {
List<String> list = ((CheckBoxList)o).getSelectedValues();
if (list.size() > 0) {
answerForm.setAnswer(answer, list);
}
}
}
return answerForm.getDataFormToSubmit();
}
|
DataForm function() { Iterator<String> valueIter = valueMap.keySet().iterator(); FillableForm answerForm = new FillableForm(searchForm); while (valueIter.hasNext()) { String answer = valueIter.next(); Object o = valueMap.get(answer); if (o instanceof JCheckBox) { boolean isSelected = ((JCheckBox)o).isSelected(); answerForm.setAnswer(answer, isSelected); } else if (o instanceof JTextArea) { List<String> list = new ArrayList<>(); String value = ((JTextArea)o).getText(); StringTokenizer tokenizer = new StringTokenizer(value, STR, false); while (tokenizer.hasMoreTokens()) { list.add(tokenizer.nextToken()); } if (list.size() > 0) { answerForm.setAnswer(answer, list); } } else if (o instanceof JTextField) { String value = ((JTextField)o).getText(); if (ModelUtil.hasLength(value)) { answerForm.setAnswer(answer, value); } } else if (o instanceof JComboBox) { Object v = ((JComboBox<?>)o).getSelectedItem(); String value; if (v instanceof FormField.Option) { value = ((FormField.Option)v).getValueString(); } else { value = (String)v; } List<String> list = new ArrayList<>(); list.add(value); if (list.size() > 0) { answerForm.setAnswer(answer, list); } } else if (o instanceof CheckBoxList) { List<String> list = ((CheckBoxList)o).getSelectedValues(); if (list.size() > 0) { answerForm.setAnswer(answer, list); } } } return answerForm.getDataFormToSubmit(); }
|
/**
* Returns the answered DataForm.
*
* @return the answered DataForm.
*/
|
Returns the answered DataForm
|
getFilledForm
|
{
"repo_name": "igniterealtime/Spark",
"path": "core/src/main/java/org/jivesoftware/spark/ui/DataFormUI.java",
"license": "apache-2.0",
"size": 8901
}
|
[
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List",
"java.util.StringTokenizer",
"javax.swing.JCheckBox",
"javax.swing.JComboBox",
"javax.swing.JTextArea",
"javax.swing.JTextField",
"org.jivesoftware.smackx.xdata.FormField",
"org.jivesoftware.smackx.xdata.form.FillableForm",
"org.jivesoftware.smackx.xdata.packet.DataForm",
"org.jivesoftware.spark.component.CheckBoxList",
"org.jivesoftware.spark.util.ModelUtil"
] |
import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JTextArea; import javax.swing.JTextField; import org.jivesoftware.smackx.xdata.FormField; import org.jivesoftware.smackx.xdata.form.FillableForm; import org.jivesoftware.smackx.xdata.packet.DataForm; import org.jivesoftware.spark.component.CheckBoxList; import org.jivesoftware.spark.util.ModelUtil;
|
import java.util.*; import javax.swing.*; import org.jivesoftware.smackx.xdata.*; import org.jivesoftware.smackx.xdata.form.*; import org.jivesoftware.smackx.xdata.packet.*; import org.jivesoftware.spark.component.*; import org.jivesoftware.spark.util.*;
|
[
"java.util",
"javax.swing",
"org.jivesoftware.smackx",
"org.jivesoftware.spark"
] |
java.util; javax.swing; org.jivesoftware.smackx; org.jivesoftware.spark;
| 1,165,932
|
public Instance getMachine(String workspaceId, String machineId) throws NotFoundException {
EnvironmentHolder environment;
try (@SuppressWarnings("unused") Unlocker u = stripedLocks.readLock(workspaceId)) {
environment = environments.get(workspaceId);
}
if (environment == null) {
throw new EnvironmentNotRunningException("Environment with ID '" + workspaceId + "' is not found");
}
return environment.machines.stream()
.filter(instance -> instance.getId().equals(machineId))
.findAny()
.orElseThrow(() -> new NotFoundException(
format("Machine with ID '%s' is not found in the environment of workspace '%s'",
machineId, workspaceId)));
}
|
Instance function(String workspaceId, String machineId) throws NotFoundException { EnvironmentHolder environment; try (@SuppressWarnings(STR) Unlocker u = stripedLocks.readLock(workspaceId)) { environment = environments.get(workspaceId); } if (environment == null) { throw new EnvironmentNotRunningException(STR + workspaceId + STR); } return environment.machines.stream() .filter(instance -> instance.getId().equals(machineId)) .findAny() .orElseThrow(() -> new NotFoundException( format(STR, machineId, workspaceId))); }
|
/**
* Returns specific machine from environment of specific workspace.
*
* @param workspaceId
* ID of workspace that owns environment machines
* @param machineId
* ID of requested machine
* @return requested machine
* @throws EnvironmentNotRunningException
* if environment is not running
* @throws NotFoundException
* if machine is not found in the environment
*/
|
Returns specific machine from environment of specific workspace
|
getMachine
|
{
"repo_name": "cdietrich/che",
"path": "wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/environment/server/CheEnvironmentEngine.java",
"license": "epl-1.0",
"size": 67725
}
|
[
"java.lang.String",
"org.eclipse.che.api.core.NotFoundException",
"org.eclipse.che.api.environment.server.exception.EnvironmentNotRunningException",
"org.eclipse.che.api.machine.server.spi.Instance",
"org.eclipse.che.commons.lang.concurrent.Unlocker"
] |
import java.lang.String; import org.eclipse.che.api.core.NotFoundException; import org.eclipse.che.api.environment.server.exception.EnvironmentNotRunningException; import org.eclipse.che.api.machine.server.spi.Instance; import org.eclipse.che.commons.lang.concurrent.Unlocker;
|
import java.lang.*; import org.eclipse.che.api.core.*; import org.eclipse.che.api.environment.server.exception.*; import org.eclipse.che.api.machine.server.spi.*; import org.eclipse.che.commons.lang.concurrent.*;
|
[
"java.lang",
"org.eclipse.che"
] |
java.lang; org.eclipse.che;
| 763,637
|
public boolean isRightArrow() {
return getNativeKeyCode() == KeyCodes.KEY_RIGHT;
}
|
boolean function() { return getNativeKeyCode() == KeyCodes.KEY_RIGHT; }
|
/**
* Is this a right arrow?
*
* @return whether this is a right arrow key event
*/
|
Is this a right arrow
|
isRightArrow
|
{
"repo_name": "Darsstar/framework",
"path": "client/src/main/java/com/vaadin/client/widget/grid/events/GridKeyUpEvent.java",
"license": "apache-2.0",
"size": 3942
}
|
[
"com.google.gwt.event.dom.client.KeyCodes"
] |
import com.google.gwt.event.dom.client.KeyCodes;
|
import com.google.gwt.event.dom.client.*;
|
[
"com.google.gwt"
] |
com.google.gwt;
| 2,599,903
|
protected XMLEventReader initializeXmlReader(InputStream stream)
throws XMLStreamException, Exception {
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD,false);
//inputFactory.setProperty(XMLInputFactory.RESOLVER, null);
return inputFactory.createXMLEventReader(stream);
}
|
XMLEventReader function(InputStream stream) throws XMLStreamException, Exception { XMLInputFactory inputFactory = XMLInputFactory.newInstance(); inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD,false); return inputFactory.createXMLEventReader(stream); }
|
/**
* Initializes the XML reader.
*
* @param stream
* the stream
* @return An XML reader to use.
* @throws Exception
*/
|
Initializes the XML reader
|
initializeXmlReader
|
{
"repo_name": "daitangio/exchangews",
"path": "src/main/java/microsoft/exchange/webservices/data/EwsXmlReader.java",
"license": "lgpl-3.0",
"size": 32252
}
|
[
"java.io.InputStream",
"javax.xml.stream.XMLEventReader",
"javax.xml.stream.XMLInputFactory",
"javax.xml.stream.XMLStreamException"
] |
import java.io.InputStream; import javax.xml.stream.XMLEventReader; import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException;
|
import java.io.*; import javax.xml.stream.*;
|
[
"java.io",
"javax.xml"
] |
java.io; javax.xml;
| 2,903,871
|
public void setProductversion(String value) throws BuildException {
if (isReference()) {
throw tooManyAttributes();
}
productVersion = value;
}
|
void function(String value) throws BuildException { if (isReference()) { throw tooManyAttributes(); } productVersion = value; }
|
/**
* Sets product version.
* @param value new value
* @throws BuildException if specified with refid
*/
|
Sets product version
|
setProductversion
|
{
"repo_name": "cniweb/ant-contrib",
"path": "cpptasks/src/main/java/net/sf/antcontrib/cpptasks/VersionInfo.java",
"license": "apache-2.0",
"size": 20040
}
|
[
"org.apache.tools.ant.BuildException"
] |
import org.apache.tools.ant.BuildException;
|
import org.apache.tools.ant.*;
|
[
"org.apache.tools"
] |
org.apache.tools;
| 764,218
|
private void processAppliedProtocolTable(Connection connection)
throws SQLException, ObjectStoreException {
long bT = System.currentTimeMillis(); // to monitor time spent in the process
ResultSet res = getAppliedProtocols(connection);
int count = 0;
boolean isADeletedSub = false;
while (res.next()) {
Integer appliedProtocolId = new Integer(res.getInt("applied_protocol_id"));
Integer protocolId = new Integer(res.getInt("protocol_id"));
Integer submissionId = new Integer(res.getInt("experiment_id"));
// the results are ordered, first ap have a subId
// if we find a deleted sub, we know that subsequent records with null
// subId belongs to the deleted sub
if (submissionId == 0) {
boolean t = true;
if (isADeletedSub == t) {
continue;
}
} else {
if (deletedSubMap.containsKey(submissionId)) {
isADeletedSub = true;
continue;
} else {
isADeletedSub = false;
}
}
Item appliedProtocol = getChadoDBConverter().createItem("AppliedProtocol");
// creating and setting references to protocols
// String protocolItemId = protocolItemIds.get(protocolId);
if (protocolId != null) {
Protocol qq = protocolMap.get(protocolId);
String protocolItemId = createProtocol(qq);
appliedProtocol.setReference("protocol", protocolItemId);
}
if (submissionId > 0) {
// setting reference to submission
// probably to rm (we do it later anyway). TODO: check
appliedProtocol.setReference("submission",
submissionMap.get(submissionId).itemIdentifier);
}
// store it and add to maps
Integer intermineObjectId = getChadoDBConverter().store(appliedProtocol);
appliedProtocolIdMap .put(appliedProtocolId, intermineObjectId);
appliedProtocolIdRefMap .put(appliedProtocolId, appliedProtocol.getIdentifier());
count++;
}
LOG.info("created " + count + " appliedProtocol");
res.close();
LOG.info("PROCESS TIME applied protocols: " + (System.currentTimeMillis() - bT) + " ms");
}
|
void function(Connection connection) throws SQLException, ObjectStoreException { long bT = System.currentTimeMillis(); ResultSet res = getAppliedProtocols(connection); int count = 0; boolean isADeletedSub = false; while (res.next()) { Integer appliedProtocolId = new Integer(res.getInt(STR)); Integer protocolId = new Integer(res.getInt(STR)); Integer submissionId = new Integer(res.getInt(STR)); if (submissionId == 0) { boolean t = true; if (isADeletedSub == t) { continue; } } else { if (deletedSubMap.containsKey(submissionId)) { isADeletedSub = true; continue; } else { isADeletedSub = false; } } Item appliedProtocol = getChadoDBConverter().createItem(STR); if (protocolId != null) { Protocol qq = protocolMap.get(protocolId); String protocolItemId = createProtocol(qq); appliedProtocol.setReference(STR, protocolItemId); } if (submissionId > 0) { appliedProtocol.setReference(STR, submissionMap.get(submissionId).itemIdentifier); } Integer intermineObjectId = getChadoDBConverter().store(appliedProtocol); appliedProtocolIdMap .put(appliedProtocolId, intermineObjectId); appliedProtocolIdRefMap .put(appliedProtocolId, appliedProtocol.getIdentifier()); count++; } LOG.info(STR + count + STR); res.close(); LOG.info(STR + (System.currentTimeMillis() - bT) + STR); }
|
/**
* ======================
* APPLIED PROTOCOL
* ======================
*/
|
====================== APPLIED PROTOCOL ======================
|
processAppliedProtocolTable
|
{
"repo_name": "drhee/toxoMine",
"path": "bio/sources/chado-db/main/src/org/intermine/bio/dataconversion/ModEncodeMetaDataProcessor.java",
"license": "lgpl-2.1",
"size": 177770
}
|
[
"java.sql.Connection",
"java.sql.ResultSet",
"java.sql.SQLException",
"org.intermine.objectstore.ObjectStoreException",
"org.intermine.xml.full.Item"
] |
import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import org.intermine.objectstore.ObjectStoreException; import org.intermine.xml.full.Item;
|
import java.sql.*; import org.intermine.objectstore.*; import org.intermine.xml.full.*;
|
[
"java.sql",
"org.intermine.objectstore",
"org.intermine.xml"
] |
java.sql; org.intermine.objectstore; org.intermine.xml;
| 2,519,055
|
public static UUID fromUTF8(UUID namespace, String name) {
return UUID5.fromBytes(namespace, name.getBytes(Charset.forName("UTF-8")));
}
|
static UUID function(UUID namespace, String name) { return UUID5.fromBytes(namespace, name.getBytes(Charset.forName("UTF-8"))); }
|
/**
* Similar to UUID.nameUUIDFromBytes, but does version 5 (sha-1) not version 3 (md5) and uses a namespace
*
* @param namespace The namespace to use for this UUID. If null, uses 00000000-0000-0000-0000-000000000000
* @param name The string to be encoded in utf-8 to get the bytes to hash
* @return the UUID object
*/
|
Similar to UUID.nameUUIDFromBytes, but does version 5 (sha-1) not version 3 (md5) and uses a namespace
|
fromUTF8
|
{
"repo_name": "icgc-dcc/dcc-common",
"path": "dcc-common-core/src/main/java/org/icgc/dcc/common/core/util/UUID5.java",
"license": "gpl-3.0",
"size": 8643
}
|
[
"java.nio.charset.Charset"
] |
import java.nio.charset.Charset;
|
import java.nio.charset.*;
|
[
"java.nio"
] |
java.nio;
| 1,139,047
|
@Test
@AllowedFFDC("java.io.IOException")
public void testFormParamNoMultivaluedMapEntityValidation() throws Exception {
HttpPost httpMethod = new HttpPost(getBaseTestUri(valwar, "formparam", "params/form/validate/paramnotmultivaluedmaparam"));
StringEntity entity = new StringEntity("firstkey=somevalue&someothervalue=somethingelse");
entity.setContentType("application/x-www-form-urlencoded");
httpMethod.setEntity(entity);
HttpResponse resp = client.execute(httpMethod);
assertEquals(200, resp.getStatusLine().getStatusCode());
assertEquals("somevalue:firstkey=somevalue&someothervalue=somethingelse", asString(resp));
}
|
@AllowedFFDC(STR) void function() throws Exception { HttpPost httpMethod = new HttpPost(getBaseTestUri(valwar, STR, STR)); StringEntity entity = new StringEntity(STR); entity.setContentType(STR); httpMethod.setEntity(entity); HttpResponse resp = client.execute(httpMethod); assertEquals(200, resp.getStatusLine().getStatusCode()); assertEquals(STR, asString(resp)); }
|
/**
* {@link FormParam} annotated parameters with entity parameters are not
* supported.
*
* @throws Exception
*/
|
<code>FormParam</code> annotated parameters with entity parameters are not supported
|
testFormParamNoMultivaluedMapEntityValidation
|
{
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.jaxrs.2.0_fat/fat/src/com/ibm/ws/jaxrs20/fat/ValidationTest.java",
"license": "epl-1.0",
"size": 17245
}
|
[
"com.ibm.ws.jaxrs20.fat.TestUtils",
"org.apache.http.HttpResponse",
"org.apache.http.client.methods.HttpPost",
"org.apache.http.entity.StringEntity",
"org.junit.Assert"
] |
import com.ibm.ws.jaxrs20.fat.TestUtils; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.junit.Assert;
|
import com.ibm.ws.jaxrs20.fat.*; import org.apache.http.*; import org.apache.http.client.methods.*; import org.apache.http.entity.*; import org.junit.*;
|
[
"com.ibm.ws",
"org.apache.http",
"org.junit"
] |
com.ibm.ws; org.apache.http; org.junit;
| 656,237
|
@Override
public synchronized Object get(int index) {
while (index >= this.size()) {
try {
this.add(getObjectFactory().buildBean(clazz, ActionContext.getContext().getContextMap()));
} catch (Exception e) {
throw new XWorkException(e);
}
}
return super.get(index);
}
|
synchronized Object function(int index) { while (index >= this.size()) { try { this.add(getObjectFactory().buildBean(clazz, ActionContext.getContext().getContextMap())); } catch (Exception e) { throw new XWorkException(e); } } return super.get(index); }
|
/**
* <p>
* Returns the element at the specified position in this list.
* </p>
*
* <p>
* An object is guaranteed to be returned since it will create empty beans to fill the gap
* between the current list size and the requested index.
* </p>
*
* @param index index of element to return.
* @return the element at the specified position in this list.
*/
|
Returns the element at the specified position in this list. An object is guaranteed to be returned since it will create empty beans to fill the gap between the current list size and the requested index.
|
get
|
{
"repo_name": "txazo/struts2",
"path": "src/main/java/com/opensymphony/xwork2/util/XWorkList.java",
"license": "apache-2.0",
"size": 8367
}
|
[
"com.opensymphony.xwork2.ActionContext",
"com.opensymphony.xwork2.XWorkException"
] |
import com.opensymphony.xwork2.ActionContext; import com.opensymphony.xwork2.XWorkException;
|
import com.opensymphony.xwork2.*;
|
[
"com.opensymphony.xwork2"
] |
com.opensymphony.xwork2;
| 1,772,873
|
public void setFile(File file) throws ArgumentNotValid {
ArgumentNotValid.checkNotNull(file, "File file");
rf = RemoteFileFactory.getMovefileInstance(file);
}
|
void function(File file) throws ArgumentNotValid { ArgumentNotValid.checkNotNull(file, STR); rf = RemoteFileFactory.getMovefileInstance(file); }
|
/**
* Method for setting the resulting file. This file will be retrieved from
* the caller of this message. This should be a movable instance since the
* temporary file should be removed after is has been retrieved.
*
* TODO cleanup if remoteFile already has been set.
*
* @param file The file with the checksum message.
* @throws ArgumentNotValid If <b>file</b> is null.
*/
|
Method for setting the resulting file. This file will be retrieved from the caller of this message. This should be a movable instance since the temporary file should be removed after is has been retrieved. TODO cleanup if remoteFile already has been set
|
setFile
|
{
"repo_name": "netarchivesuite/netarchivesuite-svngit-migration",
"path": "src/dk/netarkivet/archive/checksum/distribute/GetAllChecksumsMessage.java",
"license": "lgpl-2.1",
"size": 4829
}
|
[
"dk.netarkivet.common.distribute.RemoteFileFactory",
"dk.netarkivet.common.exceptions.ArgumentNotValid",
"java.io.File"
] |
import dk.netarkivet.common.distribute.RemoteFileFactory; import dk.netarkivet.common.exceptions.ArgumentNotValid; import java.io.File;
|
import dk.netarkivet.common.distribute.*; import dk.netarkivet.common.exceptions.*; import java.io.*;
|
[
"dk.netarkivet.common",
"java.io"
] |
dk.netarkivet.common; java.io;
| 2,171,635
|
private int getByteBufferHashCode(ByteBuffer buf) {
int h = 1;
int p = buf.arrayOffset();
for (int j = buf.limit() - 1; j >= p; j--)
h = 31 * h + buf.get(j);
return h;
}
|
int function(ByteBuffer buf) { int h = 1; int p = buf.arrayOffset(); for (int j = buf.limit() - 1; j >= p; j--) h = 31 * h + buf.get(j); return h; }
|
/** ByteBuffer.hashCode() takes into account the position of the
* buffer, but we do not want that*/
|
ByteBuffer.hashCode() takes into account the position of the
|
getByteBufferHashCode
|
{
"repo_name": "arthur-evozon/gora",
"path": "gora-core/src/main/java/org/apache/gora/persistency/ws/impl/PersistentWSBase.java",
"license": "apache-2.0",
"size": 4371
}
|
[
"java.nio.ByteBuffer"
] |
import java.nio.ByteBuffer;
|
import java.nio.*;
|
[
"java.nio"
] |
java.nio;
| 2,850,647
|
public Bound to(
SerializableFunction<BoundedWindow, String> tableSpecFunction) {
return toTableReference(new TranslateTableSpecFunction(tableSpecFunction));
}
|
Bound function( SerializableFunction<BoundedWindow, String> tableSpecFunction) { return toTableReference(new TranslateTableSpecFunction(tableSpecFunction)); }
|
/**
* Returns a copy of this write transformation, but using the specified function to determine
* which table to write to for each window.
*
* <p>Does not modify this object.
*
* <p>{@code tableSpecFunction} should be deterministic. When given the same window, it
* should always return the same table specification.
*/
|
Returns a copy of this write transformation, but using the specified function to determine which table to write to for each window. Does not modify this object. tableSpecFunction should be deterministic. When given the same window, it should always return the same table specification
|
to
|
{
"repo_name": "joshualitt/DataflowJavaSDK",
"path": "sdk/src/main/java/com/google/cloud/dataflow/sdk/io/BigQueryIO.java",
"license": "apache-2.0",
"size": 108561
}
|
[
"com.google.cloud.dataflow.sdk.transforms.SerializableFunction",
"com.google.cloud.dataflow.sdk.transforms.windowing.BoundedWindow"
] |
import com.google.cloud.dataflow.sdk.transforms.SerializableFunction; import com.google.cloud.dataflow.sdk.transforms.windowing.BoundedWindow;
|
import com.google.cloud.dataflow.sdk.transforms.*; import com.google.cloud.dataflow.sdk.transforms.windowing.*;
|
[
"com.google.cloud"
] |
com.google.cloud;
| 2,383,863
|
protected LineReader newLineReader(InputStream is, int max_chars)
throws IOException {
return new LineReader(is, max_chars);
}
|
LineReader function(InputStream is, int max_chars) throws IOException { return new LineReader(is, max_chars); }
|
/** Create a new line reader.
*
* This method is solely so we can substitute a different
* LineReader to deal with the odd "<CR><LF>" (literally,
* those EIGHT characters) end-of-line marker that the
* NDOR v5 gate-controller sends. (See GateNdorV5Property
* for an example that overrides this method.)
*
* @param is InputStream to read from.
* @param max_chars Maximum number of characters on a line. */
|
Create a new line reader. This method is solely so we can substitute a different LineReader to deal with the odd "" (literally, those EIGHT characters) end-of-line marker that the NDOR v5 gate-controller sends. (See GateNdorV5Property for an example that overrides this method.)
|
newLineReader
|
{
"repo_name": "CA-IRIS/mn-iris",
"path": "src/us/mn/state/dot/tms/server/comm/AsciiDeviceProperty.java",
"license": "gpl-2.0",
"size": 5409
}
|
[
"java.io.IOException",
"java.io.InputStream",
"us.mn.state.dot.tms.utils.LineReader"
] |
import java.io.IOException; import java.io.InputStream; import us.mn.state.dot.tms.utils.LineReader;
|
import java.io.*; import us.mn.state.dot.tms.utils.*;
|
[
"java.io",
"us.mn.state"
] |
java.io; us.mn.state;
| 595,589
|
public void getData() {
m_wStepname.selectAll();
if (m_currentMeta.getInputFieldMetaFunctions() != null) {
for (int i = 0; i < m_currentMeta.getNumFieldsToProcess(); i++) {
UnivariateStatsMetaFunction fn =
m_currentMeta.getInputFieldMetaFunctions()[i];
TableItem item = m_wFields.table.getItem(i);
item.setText(1, Const.NVL(fn.getSourceFieldName(), ""));
item.setText(2, Const.NVL(
(fn.getCalcN())
? "True"
: "False", ""));
item.setText(3, Const.NVL(
(fn.getCalcMean())
? "True"
: "False", ""));
item.setText(4, Const.NVL(
(fn.getCalcStdDev())
? "True"
: "False", ""));
item.setText(5, Const.NVL(
(fn.getCalcMin())
? "True"
: "False", ""));
item.setText(6, Const.NVL(
(fn.getCalcMax())
? "True"
: "False", ""));
item.setText(7, Const.NVL(
(fn.getCalcMedian())
? "True"
: "False", ""));
double p = fn.getCalcPercentile();
NumberFormat pF = NumberFormat.getInstance();
pF.setMaximumFractionDigits(2);
String res = (p < 0)
? ""
: pF.format(p * 100);
item.setText(8, Const.NVL(res, ""));
item.setText(9, Const.NVL(
(fn.getInterpolatePercentile())
? "True"
: "False", ""));
}
m_wFields.setRowNums();
m_wFields.optWidth(true);
}
}
|
void function() { m_wStepname.selectAll(); if (m_currentMeta.getInputFieldMetaFunctions() != null) { for (int i = 0; i < m_currentMeta.getNumFieldsToProcess(); i++) { UnivariateStatsMetaFunction fn = m_currentMeta.getInputFieldMetaFunctions()[i]; TableItem item = m_wFields.table.getItem(i); item.setText(1, Const.NVL(fn.getSourceFieldName(), STRTrueSTRFalseSTRSTRTrueSTRFalseSTRSTRTrueSTRFalseSTRSTRTrueSTRFalseSTRSTRTrueSTRFalseSTRSTRTrueSTRFalseSTRSTRSTRSTRTrueSTRFalseSTR")); } m_wFields.setRowNums(); m_wFields.optWidth(true); } }
|
/**
* Copy information from the meta-data m_currentMeta to the
* dialog fields.
*/
|
Copy information from the meta-data m_currentMeta to the dialog fields
|
getData
|
{
"repo_name": "icholy/geokettle-2.0",
"path": "src-ui/org/pentaho/di/ui/trans/steps/univariatestats/UnivariateStatsDialog.java",
"license": "lgpl-2.1",
"size": 15312
}
|
[
"org.eclipse.swt.widgets.TableItem",
"org.pentaho.di.core.Const",
"org.pentaho.di.trans.steps.univariatestats.UnivariateStatsMetaFunction"
] |
import org.eclipse.swt.widgets.TableItem; import org.pentaho.di.core.Const; import org.pentaho.di.trans.steps.univariatestats.UnivariateStatsMetaFunction;
|
import org.eclipse.swt.widgets.*; import org.pentaho.di.core.*; import org.pentaho.di.trans.steps.univariatestats.*;
|
[
"org.eclipse.swt",
"org.pentaho.di"
] |
org.eclipse.swt; org.pentaho.di;
| 1,363,174
|
protected RegionEntry getCheckedRegionEntry() throws EntryNotFoundException {
RegionEntry result = this.re;
if (re == null || re.isDestroyedOrRemoved()) {
throw new EntryNotFoundException("expiration task no longer has access to region entry");
}
return result;
}
|
RegionEntry function() throws EntryNotFoundException { RegionEntry result = this.re; if (re == null re.isDestroyedOrRemoved()) { throw new EntryNotFoundException(STR); } return result; }
|
/**
* Returns the tasks region entry if it "checks" out. The check is to
* see if the region entry still exists.
* @throws EntryNotFoundException if the task no longer has a region entry or
* if the region entry it has is removed.
*/
|
Returns the tasks region entry if it "checks" out. The check is to see if the region entry still exists
|
getCheckedRegionEntry
|
{
"repo_name": "sshcherbakov/incubator-geode",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/EntryExpiryTask.java",
"license": "apache-2.0",
"size": 10590
}
|
[
"com.gemstone.gemfire.cache.EntryNotFoundException"
] |
import com.gemstone.gemfire.cache.EntryNotFoundException;
|
import com.gemstone.gemfire.cache.*;
|
[
"com.gemstone.gemfire"
] |
com.gemstone.gemfire;
| 965,461
|
return PhaseId.ANY_PHASE;
}
|
return PhaseId.ANY_PHASE; }
|
/**
* Return the identifier of the request processing phase during which this
* listener is interested in processing PhaseEvent events.
*/
|
Return the identifier of the request processing phase during which this listener is interested in processing PhaseEvent events
|
getPhaseId
|
{
"repo_name": "hantsy/spring4-sandbox",
"path": "mvc-jsf2/src/main/java/com/hantsylabs/example/spring/faces/MessageHandler.java",
"license": "apache-2.0",
"size": 4641
}
|
[
"javax.faces.event.PhaseId"
] |
import javax.faces.event.PhaseId;
|
import javax.faces.event.*;
|
[
"javax.faces"
] |
javax.faces;
| 1,543,261
|
public ArrayList<Integer> getFeatureIDs(Rectangle searchRec) {
IndexHelper saveToList = new IndexHelper();
rTree.intersects(searchRec, saveToList);
return saveToList.getIds();
}
|
ArrayList<Integer> function(Rectangle searchRec) { IndexHelper saveToList = new IndexHelper(); rTree.intersects(searchRec, saveToList); return saveToList.getIds(); }
|
/**
* Diese Methode gibt alle FeatureIDs wieder, die durch eine intersects-Anfrage
* an den Index gefunden wurden
*
* @param searchRec the search rec
* @return the feature i ds
*/
|
Diese Methode gibt alle FeatureIDs wieder, die durch eine intersects-Anfrage an den Index gefunden wurden
|
getFeatureIDs
|
{
"repo_name": "GeoTechSystems/GeoTechMobile",
"path": "app/src/main/java/de/geotech/systems/wfs/WFSLayer.java",
"license": "gpl-2.0",
"size": 18332
}
|
[
"com.infomatiq.jsi.Rectangle",
"java.util.ArrayList"
] |
import com.infomatiq.jsi.Rectangle; import java.util.ArrayList;
|
import com.infomatiq.jsi.*; import java.util.*;
|
[
"com.infomatiq.jsi",
"java.util"
] |
com.infomatiq.jsi; java.util;
| 2,100,973
|
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object)
{
if (childrenFeatures == null)
{
super.getChildrenFeatures(object);
childrenFeatures.add(SetupP2Package.Literals.P2_TASK__REQUIREMENTS);
childrenFeatures.add(SetupP2Package.Literals.P2_TASK__REPOSITORIES);
}
return childrenFeatures;
}
|
Collection<? extends EStructuralFeature> function(Object object) { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(SetupP2Package.Literals.P2_TASK__REQUIREMENTS); childrenFeatures.add(SetupP2Package.Literals.P2_TASK__REPOSITORIES); } return childrenFeatures; }
|
/**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
|
This specifies how to implement <code>#getChildren</code> and is used to deduce an appropriate feature for an <code>org.eclipse.emf.edit.command.AddCommand</code>, <code>org.eclipse.emf.edit.command.RemoveCommand</code> or <code>org.eclipse.emf.edit.command.MoveCommand</code> in <code>#createCommand</code>.
|
getChildrenFeatures
|
{
"repo_name": "peterkir/org.eclipse.oomph",
"path": "plugins/org.eclipse.oomph.setup.p2.edit/src/org/eclipse/oomph/setup/p2/provider/P2TaskItemProvider.java",
"license": "epl-1.0",
"size": 8532
}
|
[
"java.util.Collection",
"org.eclipse.emf.ecore.EStructuralFeature",
"org.eclipse.oomph.setup.p2.SetupP2Package"
] |
import java.util.Collection; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.oomph.setup.p2.SetupP2Package;
|
import java.util.*; import org.eclipse.emf.ecore.*; import org.eclipse.oomph.setup.p2.*;
|
[
"java.util",
"org.eclipse.emf",
"org.eclipse.oomph"
] |
java.util; org.eclipse.emf; org.eclipse.oomph;
| 955,554
|
public void exportSvg(FileOutputStream os, String extension) throws Exception {
mxGraph graph = component.getGraph();
Document doc = mxCellRenderer.createSvgDocument(graph, null, graph.getView().getScale(), null, null);
//write the SVG Document into the specified file
OutputStreamWriter writer = new OutputStreamWriter(os, "UTF-8");
writeDocument(doc, writer);
}
|
void function(FileOutputStream os, String extension) throws Exception { mxGraph graph = component.getGraph(); Document doc = mxCellRenderer.createSvgDocument(graph, null, graph.getView().getScale(), null, null); OutputStreamWriter writer = new OutputStreamWriter(os, "UTF-8"); writeDocument(doc, writer); }
|
/**
* Transfers graph into svg document with the usage of mxCellRenderer.
* @param os output sream
* @throws Exception
*/
|
Transfers graph into svg document with the usage of mxCellRenderer
|
exportSvg
|
{
"repo_name": "dprokopo/pi-visualizer",
"path": "pi-visualizer/src/main/java/cz/vutbr/fit/xproko26/pivis/gui/graph/graphlib/jgraphx/JGraphXFileExporter.java",
"license": "apache-2.0",
"size": 9047
}
|
[
"java.io.FileOutputStream",
"java.io.OutputStreamWriter",
"org.w3c.dom.Document"
] |
import java.io.FileOutputStream; import java.io.OutputStreamWriter; import org.w3c.dom.Document;
|
import java.io.*; import org.w3c.dom.*;
|
[
"java.io",
"org.w3c.dom"
] |
java.io; org.w3c.dom;
| 2,867,987
|
public synchronized <T> void addSettingsUpdateConsumer(Setting<T> setting, Consumer<T> consumer) {
addSettingsUpdateConsumer(setting, consumer, (s) -> {});
}
|
synchronized <T> void function(Setting<T> setting, Consumer<T> consumer) { addSettingsUpdateConsumer(setting, consumer, (s) -> {}); }
|
/**
* Adds a settings consumer.
* <p>
* Note: Only settings registered in {@link org.elasticsearch.cluster.ClusterModule} can be changed dynamically.
* </p>
*/
|
Adds a settings consumer. Note: Only settings registered in <code>org.elasticsearch.cluster.ClusterModule</code> can be changed dynamically.
|
addSettingsUpdateConsumer
|
{
"repo_name": "henakamaMSFT/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/common/settings/AbstractScopedSettings.java",
"license": "apache-2.0",
"size": 27074
}
|
[
"java.util.function.Consumer"
] |
import java.util.function.Consumer;
|
import java.util.function.*;
|
[
"java.util"
] |
java.util;
| 2,288,301
|
public byte[] getContent() {
return content == null?null:Arrays.copyOf(content, content.length);
}
|
byte[] function() { return content == null?null:Arrays.copyOf(content, content.length); }
|
/**
* The content being transfered
*/
|
The content being transfered
|
getContent
|
{
"repo_name": "Unipoole/unipoole-service",
"path": "src/main/java/coza/opencollab/unipoole/service/synch/so/SynchContent.java",
"license": "apache-2.0",
"size": 3273
}
|
[
"java.util.Arrays"
] |
import java.util.Arrays;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 704,746
|
String artifact = buildSAML2Artifact();
SAMLSSOArtifactResponse artifactResponse = new SAMLSSOArtifactResponse();
artifactResponse.setArtifact(artifact);
artifactResponse.setSamlMessage(SAMLSSOUtil.marshall(response));
artifactResponse.setSubject(subject);
ArtifactStorageRegistry.getInstance().getArtifactStorage().store(artifactResponse);
return artifact;
}
|
String artifact = buildSAML2Artifact(); SAMLSSOArtifactResponse artifactResponse = new SAMLSSOArtifactResponse(); artifactResponse.setArtifact(artifact); artifactResponse.setSamlMessage(SAMLSSOUtil.marshall(response)); artifactResponse.setSubject(subject); ArtifactStorageRegistry.getInstance().getArtifactStorage().store(artifactResponse); return artifact; }
|
/**
* Build the artifact and store it in the Artifact Storage along with the SAML response
* @param subject SAML request subject
* @return the Base 64 encoded artifact string
* @throws IdentityException
*/
|
Build the artifact and store it in the Artifact Storage along with the SAML response
|
buildArtifact
|
{
"repo_name": "manoramahp/carbon-identity",
"path": "components/identity/org.wso2.carbon.identity.sso.saml/src/main/java/org/wso2/carbon/identity/sso/saml/builders/SAMLArtifactBuilder.java",
"license": "apache-2.0",
"size": 3967
}
|
[
"org.wso2.carbon.identity.sso.saml.persistence.ArtifactStorageRegistry",
"org.wso2.carbon.identity.sso.saml.persistence.model.SAMLSSOArtifactResponse",
"org.wso2.carbon.identity.sso.saml.util.SAMLSSOUtil"
] |
import org.wso2.carbon.identity.sso.saml.persistence.ArtifactStorageRegistry; import org.wso2.carbon.identity.sso.saml.persistence.model.SAMLSSOArtifactResponse; import org.wso2.carbon.identity.sso.saml.util.SAMLSSOUtil;
|
import org.wso2.carbon.identity.sso.saml.persistence.*; import org.wso2.carbon.identity.sso.saml.persistence.model.*; import org.wso2.carbon.identity.sso.saml.util.*;
|
[
"org.wso2.carbon"
] |
org.wso2.carbon;
| 1,748,929
|
public static Enchantment get(String name) {
return enchantments.get(name);
}
|
static Enchantment function(String name) { return enchantments.get(name); }
|
/** Returns a BetterStorage enchantment with that name. <br>
* <b>Key:</b> unlocking, lockpicking, morphing. <br>
* <b>Lock:</b> persistance, security, shock, trigger. */
|
Returns a BetterStorage enchantment with that name. Key: unlocking, lockpicking, morphing.
|
get
|
{
"repo_name": "Adaptivity/BetterStorage",
"path": "src/main/java/net/mcft/copy/betterstorage/api/BetterStorageEnchantment.java",
"license": "mit",
"size": 1329
}
|
[
"net.minecraft.enchantment.Enchantment"
] |
import net.minecraft.enchantment.Enchantment;
|
import net.minecraft.enchantment.*;
|
[
"net.minecraft.enchantment"
] |
net.minecraft.enchantment;
| 2,156,009
|
Set<DocumentedTypeDTO> getReportingTaskTypes(final String bundleGroupFilter, final String bundleArtifactFilter, final String typeFilter);
|
Set<DocumentedTypeDTO> getReportingTaskTypes(final String bundleGroupFilter, final String bundleArtifactFilter, final String typeFilter);
|
/**
* Returns the list of reporting task types.
*
* @param bundleGroupFilter if specified, must be member of bundle group
* @param bundleArtifactFilter if specified, must be member of bundle artifact
* @param typeFilter if specified, type must match
* @return The list of available reporting task types matching specified criteria
*/
|
Returns the list of reporting task types
|
getReportingTaskTypes
|
{
"repo_name": "InspurUSA/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java",
"license": "apache-2.0",
"size": 75521
}
|
[
"java.util.Set",
"org.apache.nifi.web.api.dto.DocumentedTypeDTO"
] |
import java.util.Set; import org.apache.nifi.web.api.dto.DocumentedTypeDTO;
|
import java.util.*; import org.apache.nifi.web.api.dto.*;
|
[
"java.util",
"org.apache.nifi"
] |
java.util; org.apache.nifi;
| 1,815,767
|
public Builder withProperties(final Map<?, ?> properties, @Nullable final String prefix) {
final String p = prefix == null ? "" : prefix.endsWith(".") ? prefix : prefix + ".";
for (final Map.Entry<?, ?> entry : properties.entrySet()) {
if (entry.getKey() != null && entry.getValue() != null
&& entry.getKey().toString().startsWith(p)) {
final String name = entry.getKey().toString().substring(p.length());
final String value = Strings.emptyToNull(entry.getValue().toString());
if ("termSenseFiltering".equals(name)) {
withTermSenseFiltering(Boolean.valueOf(value));
} else if ("termSenseCompletion".equals(name)) {
withTermSenseCompletion(Boolean.valueOf(value));
} else if ("entityRemoveOverlaps".equals(name)) {
withEntityRemoveOverlaps(Boolean.valueOf(value));
} else if ("entitySpanFixing".equals(name)) {
withEntitySpanFixing(Boolean.valueOf(value));
} else if ("entityAddition".equals(name)) {
withEntityAddition(Boolean.valueOf(value));
} else if ("entityValueNormalization".equals(name)) {
withEntityValueNormalization(Boolean.valueOf(value));
} else if ("linkingCompletion".equals(name)) {
withLinkingCompletion(Boolean.valueOf(value));
} else if ("linkingFixing".equals(name)) {
withLinkingFixing(Boolean.valueOf(value));
} else if ("corefForRoleDependencies".equals(name)) {
withCorefForRoleDependencies(Boolean.valueOf(value));
} else if ("corefSpanFixing".equals(name)) {
withCorefSpanFixing(Boolean.valueOf(value));
} else if ("srlRemoveWrongRefs".equals(name)) {
withSRLRemoveWrongRefs(Boolean.valueOf(value));
} else if ("srlRemoveUnknownPredicates".equals(name)) {
withSRLRemoveUnknownPredicates(Boolean.valueOf(value));
} else if ("srlPredicateAddition".equals(name)) {
withSRLPredicateAddition(Boolean.valueOf(value));
} else if ("srlSelfArgFixing".equals(name)) {
withSRLSelfArgFixing(Boolean.valueOf(value));
} else if ("srlSenseMapping".equals(name)) {
withSRLSenseMapping(Boolean.valueOf(value));
} else if ("srlFrameBaseMapping".equals(name)) {
withSRLFrameBaseMapping(Boolean.valueOf(value));
} else if ("srlRoleLinking".equals(name)) {
if ("none".equalsIgnoreCase(value)) {
withSRLRoleLinking(false, false);
} else if ("exact".equalsIgnoreCase(value)) {
withSRLRoleLinking(false, false);
} else if ("coref".equalsIgnoreCase(value)) {
withSRLRoleLinking(false, false);
} else {
throw new IllegalArgumentException("Invalid srlRoleLinking: " + value);
}
} else if ("opinionLinking".equals(name)) {
if ("none".equalsIgnoreCase(value)) {
withOpinionLinking(false, false);
} else if ("exact".equalsIgnoreCase(value)) {
withOpinionLinking(false, false);
} else if ("coref".equalsIgnoreCase(value)) {
withOpinionLinking(false, false);
} else {
throw new IllegalArgumentException("Invalid srlRoleLinking: " + value);
}
}
}
}
return this;
}
|
Builder function(final Map<?, ?> properties, @Nullable final String prefix) { final String p = prefix == null ? STR.STR.STRtermSenseFilteringSTRtermSenseCompletionSTRentityRemoveOverlapsSTRentitySpanFixingSTRentityAdditionSTRentityValueNormalizationSTRlinkingCompletionSTRlinkingFixingSTRcorefForRoleDependenciesSTRcorefSpanFixingSTRsrlRemoveWrongRefsSTRsrlRemoveUnknownPredicatesSTRsrlPredicateAdditionSTRsrlSelfArgFixingSTRsrlSenseMappingSTRsrlFrameBaseMappingSTRsrlRoleLinkingSTRnoneSTRexactSTRcorefSTRInvalid srlRoleLinking: STRopinionLinkingSTRnoneSTRexactSTRcorefSTRInvalid srlRoleLinking: " + value); } } } } return this; }
|
/**
* Sets all the properties in the map supplied, matching an optional prefix.
*
* @param properties
* the properties to configure, not null
* @param prefix
* an optional prefix used to select the relevant properties in the map
* @return this builder object, for call chaining
*/
|
Sets all the properties in the map supplied, matching an optional prefix
|
withProperties
|
{
"repo_name": "dkmfbk/pikes",
"path": "pikes-resources/src/main/java/eu/fbk/dkm/pikes/resources/NAFFilter.java",
"license": "gpl-3.0",
"size": 100040
}
|
[
"java.util.Map",
"javax.annotation.Nullable"
] |
import java.util.Map; import javax.annotation.Nullable;
|
import java.util.*; import javax.annotation.*;
|
[
"java.util",
"javax.annotation"
] |
java.util; javax.annotation;
| 74,104
|
Collection<QName> deploy(File deploymentUnitDirectory);
|
Collection<QName> deploy(File deploymentUnitDirectory);
|
/**
* Deploys a process from the filesystem.
* @param deploymentUnitDirectory directory containing all deployment files
* @return a collection of process ids (deployed processes)
*/
|
Deploys a process from the filesystem
|
deploy
|
{
"repo_name": "dinkelaker/hbs4ode",
"path": "bpel-api/src/main/java/org/apache/ode/bpel/iapi/ProcessStore.java",
"license": "apache-2.0",
"size": 3396
}
|
[
"java.io.File",
"java.util.Collection",
"javax.xml.namespace.QName"
] |
import java.io.File; import java.util.Collection; import javax.xml.namespace.QName;
|
import java.io.*; import java.util.*; import javax.xml.namespace.*;
|
[
"java.io",
"java.util",
"javax.xml"
] |
java.io; java.util; javax.xml;
| 2,863,997
|
@Override
public void send( String text ) throws NotYetConnectedException, IOException {
if( text == null )
throw new IllegalArgumentException( "Cannot send 'null' data to a WebSocketImpl." );
send( draft.createFrames( text, role == Role.CLIENT ) );
}
|
void function( String text ) throws NotYetConnectedException, IOException { if( text == null ) throw new IllegalArgumentException( STR ); send( draft.createFrames( text, role == Role.CLIENT ) ); }
|
/**
* Send Text data to the other end.
*
* @throws IllegalArgumentException
* @throws InterruptedException
* @throws NotYetConnectedException
* @throws IOException
*/
|
Send Text data to the other end
|
send
|
{
"repo_name": "buksy/websocket_changes",
"path": "src/org/java_websocket/WebSocketImpl.java",
"license": "mit",
"size": 23214
}
|
[
"java.io.IOException",
"java.nio.channels.NotYetConnectedException"
] |
import java.io.IOException; import java.nio.channels.NotYetConnectedException;
|
import java.io.*; import java.nio.channels.*;
|
[
"java.io",
"java.nio"
] |
java.io; java.nio;
| 1,152,768
|
public KeyRestoreParameters withKeyBundleBackup(byte[] keyBundleBackup) {
if (keyBundleBackup == null) {
this.keyBundleBackup = null;
} else {
this.keyBundleBackup = Base64Url.encode(keyBundleBackup);
}
return this;
}
|
KeyRestoreParameters function(byte[] keyBundleBackup) { if (keyBundleBackup == null) { this.keyBundleBackup = null; } else { this.keyBundleBackup = Base64Url.encode(keyBundleBackup); } return this; }
|
/**
* Set the keyBundleBackup value.
*
* @param keyBundleBackup the keyBundleBackup value to set
* @return the KeyRestoreParameters object itself.
*/
|
Set the keyBundleBackup value
|
withKeyBundleBackup
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/keyvault/microsoft-azure-keyvault/src/main/java/com/microsoft/azure/keyvault/models/KeyRestoreParameters.java",
"license": "mit",
"size": 1272
}
|
[
"com.microsoft.rest.Base64Url"
] |
import com.microsoft.rest.Base64Url;
|
import com.microsoft.rest.*;
|
[
"com.microsoft.rest"
] |
com.microsoft.rest;
| 1,807,288
|
@Test
public void testManualDependenciesMerge() throws MojoExecutionException {
String d;
List<String> expected = new ArrayList<String>();
TargetConfiguration tc1 = new TargetConfiguration();
List<String> l1 = new ArrayList<String>();
d = "foo";
expected.add(d);
l1.add(d);
tc1.setManualDependencies(l1);
TargetConfiguration tc2 = new TargetConfiguration();
List<String> l2 = new ArrayList<String>();
d = "bar";
expected.add(d);
l2.add(d);
tc2.setManualDependencies(l2);
TargetConfiguration merged = Utils.mergeConfigurations(tc2, tc1);
Assert.assertEquals(expected, merged.getManualDependencies());
}
|
void function() throws MojoExecutionException { String d; List<String> expected = new ArrayList<String>(); TargetConfiguration tc1 = new TargetConfiguration(); List<String> l1 = new ArrayList<String>(); d = "foo"; expected.add(d); l1.add(d); tc1.setManualDependencies(l1); TargetConfiguration tc2 = new TargetConfiguration(); List<String> l2 = new ArrayList<String>(); d = "bar"; expected.add(d); l2.add(d); tc2.setManualDependencies(l2); TargetConfiguration merged = Utils.mergeConfigurations(tc2, tc1); Assert.assertEquals(expected, merged.getManualDependencies()); }
|
/**
* Tests whether the manual dependencies property is really and properly
* merged.
*
* @throws MojoExecutionException
*/
|
Tests whether the manual dependencies property is really and properly merged
|
testManualDependenciesMerge
|
{
"repo_name": "21Net/pkg-maven-plugin",
"path": "src/test/java/de/tarent/maven/plugins/pkg/TargetConfigurationTest.java",
"license": "gpl-2.0",
"size": 6832
}
|
[
"java.util.ArrayList",
"java.util.List",
"org.apache.maven.plugin.MojoExecutionException",
"org.junit.Assert"
] |
import java.util.ArrayList; import java.util.List; import org.apache.maven.plugin.MojoExecutionException; import org.junit.Assert;
|
import java.util.*; import org.apache.maven.plugin.*; import org.junit.*;
|
[
"java.util",
"org.apache.maven",
"org.junit"
] |
java.util; org.apache.maven; org.junit;
| 808,406
|
// Remove previous data sets
spectrumPlot.removeAllDataSets();
// Add scan data set
ScanDataSet scanDataSet = new ScanDataSet(previewScan);
spectrumPlot.addDataSet(scanDataSet, SpectraVisualizerTab.scanColor, false);
// If the scan is centroided, switch to centroid mode
spectrumPlot.setPlotMode(SpectrumPlotType.fromScan(previewScan));
// If the parameters are not complete, exit
ArrayList<String> errors = new ArrayList<String>();
boolean paramsOK = parameters.checkParameterValues(errors);
if (!paramsOK)
return;
// Get mass list
MassList massList = previewScan.getMassList();
if (massList == null)
return;
// Perform filtering
DataPoint mzValues[] = massList.getDataPoints();
DataPoint remainingMzValues[] = ShoulderPeaksFilter.filterMassValues(mzValues, parameters);
Vector<DataPoint> removedPeaks = new Vector<DataPoint>();
removedPeaks.addAll(Arrays.asList(mzValues));
removedPeaks.removeAll(Arrays.asList(remainingMzValues));
DataPoint removedMzValues[] = removedPeaks.toArray(new DataPoint[0]);
// Add mass list data sets
DataPointsDataSet removedPeaksDataSet = new DataPointsDataSet("Removed peaks", removedMzValues);
DataPointsDataSet remainingPeaksDataSet =
new DataPointsDataSet("Remaining peaks", remainingMzValues);
spectrumPlot.addDataSet(removedPeaksDataSet, removedPeaksColor, false);
spectrumPlot.addDataSet(remainingPeaksDataSet, SpectraVisualizerTab.peaksColor, false);
}
|
spectrumPlot.removeAllDataSets(); ScanDataSet scanDataSet = new ScanDataSet(previewScan); spectrumPlot.addDataSet(scanDataSet, SpectraVisualizerTab.scanColor, false); spectrumPlot.setPlotMode(SpectrumPlotType.fromScan(previewScan)); ArrayList<String> errors = new ArrayList<String>(); boolean paramsOK = parameters.checkParameterValues(errors); if (!paramsOK) return; MassList massList = previewScan.getMassList(); if (massList == null) return; DataPoint mzValues[] = massList.getDataPoints(); DataPoint remainingMzValues[] = ShoulderPeaksFilter.filterMassValues(mzValues, parameters); Vector<DataPoint> removedPeaks = new Vector<DataPoint>(); removedPeaks.addAll(Arrays.asList(mzValues)); removedPeaks.removeAll(Arrays.asList(remainingMzValues)); DataPoint removedMzValues[] = removedPeaks.toArray(new DataPoint[0]); DataPointsDataSet removedPeaksDataSet = new DataPointsDataSet(STR, removedMzValues); DataPointsDataSet remainingPeaksDataSet = new DataPointsDataSet(STR, remainingMzValues); spectrumPlot.addDataSet(removedPeaksDataSet, removedPeaksColor, false); spectrumPlot.addDataSet(remainingPeaksDataSet, SpectraVisualizerTab.peaksColor, false); }
|
/**
* This function set all the information into the plot chart
*
*/
|
This function set all the information into the plot chart
|
loadPreview
|
{
"repo_name": "tomas-pluskal/mzmine3",
"path": "src/main/java/io/github/mzmine/modules/dataprocessing/featdet_shoulderpeaksfilter/ShoulderPeaksFilterSetupDialog.java",
"license": "gpl-2.0",
"size": 3957
}
|
[
"io.github.mzmine.datamodel.DataPoint",
"io.github.mzmine.datamodel.MassList",
"io.github.mzmine.modules.visualization.spectra.simplespectra.SpectraVisualizerTab",
"io.github.mzmine.modules.visualization.spectra.simplespectra.SpectrumPlotType",
"io.github.mzmine.modules.visualization.spectra.simplespectra.datasets.DataPointsDataSet",
"io.github.mzmine.modules.visualization.spectra.simplespectra.datasets.ScanDataSet",
"java.util.ArrayList",
"java.util.Arrays",
"java.util.Vector"
] |
import io.github.mzmine.datamodel.DataPoint; import io.github.mzmine.datamodel.MassList; import io.github.mzmine.modules.visualization.spectra.simplespectra.SpectraVisualizerTab; import io.github.mzmine.modules.visualization.spectra.simplespectra.SpectrumPlotType; import io.github.mzmine.modules.visualization.spectra.simplespectra.datasets.DataPointsDataSet; import io.github.mzmine.modules.visualization.spectra.simplespectra.datasets.ScanDataSet; import java.util.ArrayList; import java.util.Arrays; import java.util.Vector;
|
import io.github.mzmine.datamodel.*; import io.github.mzmine.modules.visualization.spectra.simplespectra.*; import io.github.mzmine.modules.visualization.spectra.simplespectra.datasets.*; import java.util.*;
|
[
"io.github.mzmine",
"java.util"
] |
io.github.mzmine; java.util;
| 2,652,904
|
private String[] savedSearch( String savedSearchPathname ) {
final long nativePtr;
try {
nativePtr = beginSearch( savedSearchPathname );
}
catch (UnsupportedEncodingException e) {
return null;
}
if ( nativePtr == 0 )
return null;
try {
final ArrayList<String> contents = new ArrayList<String>();
while ( true ) {
final String next = getNextResult( nativePtr );
if ( next == null )
break;
contents.add( next );
}
return contents.toArray( new String[0] );
}
finally {
endSearch( nativePtr );
}
}
|
String[] function( String savedSearchPathname ) { final long nativePtr; try { nativePtr = beginSearch( savedSearchPathname ); } catch (UnsupportedEncodingException e) { return null; } if ( nativePtr == 0 ) return null; try { final ArrayList<String> contents = new ArrayList<String>(); while ( true ) { final String next = getNextResult( nativePtr ); if ( next == null ) break; contents.add( next ); } return contents.toArray( new String[0] ); } finally { endSearch( nativePtr ); } }
|
/**
* Perform a saved search.
*
* @param savedSearchPathname The full path to a <code>.search-ms</code>
* file.
* @return Returns an array of strings naming the files and directories in
* the directory or the results of the saved search denoted by this
* abstract pathname. The array will be empty if the directory is empty.
* Returns <code>null</code> if this abstract pathname does not denote a
* directory, or if an I/O error occurs.
*/
|
Perform a saved search
|
savedSearch
|
{
"repo_name": "MarinnaCole/LightZone",
"path": "windows/src/com/lightcrafts/platform/windows/WindowsSavedSearch.java",
"license": "bsd-3-clause",
"size": 8088
}
|
[
"java.io.UnsupportedEncodingException",
"java.util.ArrayList"
] |
import java.io.UnsupportedEncodingException; import java.util.ArrayList;
|
import java.io.*; import java.util.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 650,204
|
public static boolean validateIntegerParam(Map<String, String> params,
String paramName) throws ExecutorManagerException {
if (params != null && params.containsKey(paramName)
&& !StringUtils.isNumeric(params.get(paramName))) {
throw new ExecutorManagerException(paramName + " should be an integer");
}
return true;
}
|
static boolean function(Map<String, String> params, String paramName) throws ExecutorManagerException { if (params != null && params.containsKey(paramName) && !StringUtils.isNumeric(params.get(paramName))) { throw new ExecutorManagerException(paramName + STR); } return true; }
|
/**
* parse a string as number and throws exception if parsed value is not a
* valid integer
* @param params
* @param paramName
* @throws ExecutorManagerException if paramName is not a valid integer
*/
|
parse a string as number and throws exception if parsed value is not a valid integer
|
validateIntegerParam
|
{
"repo_name": "evlstyle/azkaban",
"path": "azkaban-common/src/main/java/azkaban/server/HttpRequestUtils.java",
"license": "apache-2.0",
"size": 11366
}
|
[
"java.util.Map",
"org.apache.commons.lang.StringUtils"
] |
import java.util.Map; import org.apache.commons.lang.StringUtils;
|
import java.util.*; import org.apache.commons.lang.*;
|
[
"java.util",
"org.apache.commons"
] |
java.util; org.apache.commons;
| 1,973,994
|
RightTupleList getFirst(int hash) {
RightTupleList[] tab = table;
return tab[hash & (tab.length - 1)];
}
// Object get(Object key, int hash) {
// if (count != 0) { // read-volatile
// RightTuple e = getFirst(hash);
// while (e != null) {
// if (e.hash == hash && key.equals(e.key)) {
// Object v = e.value;
// if (v != null)
// return v;
// return readValueUnderLock(e); // recheck
// }
// e = e.next;
// }
// }
// return null;
// }
//
// boolean containsKey(Object key, int hash) {
// if (count != 0) { // read-volatile
// HashEntry e = getFirst(hash);
// while (e != null) {
// if (e.hash == hash && key.equals(e.key))
// return true;
// e = e.next;
// }
// }
// return false;
// }
|
RightTupleList getFirst(int hash) { RightTupleList[] tab = table; return tab[hash & (tab.length - 1)]; }
|
/**
* Returns properly casted first entry of bin for given hash.
*/
|
Returns properly casted first entry of bin for given hash
|
getFirst
|
{
"repo_name": "pperboires/PocDrools",
"path": "drools-core/src/main/java/org/drools/core/util/ConcurrentHashTable.java",
"license": "apache-2.0",
"size": 27389
}
|
[
"org.drools.core.util.index.RightTupleList"
] |
import org.drools.core.util.index.RightTupleList;
|
import org.drools.core.util.index.*;
|
[
"org.drools.core"
] |
org.drools.core;
| 669,714
|
private void loadModule(String module) {
try {
Class modClass = loader.loadClass(module);
Module mod = (Module) modClass.newInstance();
this.modules.put(modClass, mod);
}
catch (Exception e) {
e.printStackTrace();
Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
}
}
|
void function(String module) { try { Class modClass = loader.loadClass(module); Module mod = (Module) modClass.newInstance(); this.modules.put(modClass, mod); } catch (Exception e) { e.printStackTrace(); Log.error(LocaleUtils.getLocalizedString(STR), e); } }
|
/**
* Loads a module.
*
* @param module the name of the class that implements the Module interface.
*/
|
Loads a module
|
loadModule
|
{
"repo_name": "surevine/openfire-bespoke",
"path": "src/java/org/jivesoftware/openfire/XMPPServer.java",
"license": "gpl-2.0",
"size": 58285
}
|
[
"org.jivesoftware.openfire.container.Module",
"org.jivesoftware.util.LocaleUtils"
] |
import org.jivesoftware.openfire.container.Module; import org.jivesoftware.util.LocaleUtils;
|
import org.jivesoftware.openfire.container.*; import org.jivesoftware.util.*;
|
[
"org.jivesoftware.openfire",
"org.jivesoftware.util"
] |
org.jivesoftware.openfire; org.jivesoftware.util;
| 630,892
|
Object[] deserialize(boolean passAdditionalFirstParam, JSONArray array, Class[] types) throws JSONException {
int additionalParam = passAdditionalFirstParam ? 1 : 0;
final Object[] ret = new Object[types.length];
for (int i = additionalParam; i < types.length; i++) {
ret[i] = deserialize(array.get(i - additionalParam), types[i]);
}
return ret;
}
|
Object[] deserialize(boolean passAdditionalFirstParam, JSONArray array, Class[] types) throws JSONException { int additionalParam = passAdditionalFirstParam ? 1 : 0; final Object[] ret = new Object[types.length]; for (int i = additionalParam; i < types.length; i++) { ret[i] = deserialize(array.get(i - additionalParam), types[i]); } return ret; }
|
/**
* Converts a {@link JSONArray} object to the class types specified in the
* second parameter. If error happens during conversion, even for one element
* only, the while conversion fails.
*
* @param array the array values which to convert to valid Java objects
* @param types the target types
* @return objects array with converted values.
* @throws JSONException if JSON data de-serialization error occurs
* @throws InstantiationException if any of the target types is array, List,
* Map, Dictionary and the target type cannot be instantiated.
* @throws IllegalAccessException if any of the target types is array, List,
* Map, Dictionary and the target type cannot be instantiated.
* @throws IllegalArgumentException if the value passes as parameter cannot be
* converted to requested parameter type.
* @throws java.lang.reflect.InvocationTargetException if the underlying method throws an
* exception.
*/
|
Converts a <code>JSONArray</code> object to the class types specified in the second parameter. If error happens during conversion, even for one element only, the while conversion fails
|
deserialize
|
{
"repo_name": "danchom/smarthome",
"path": "bundles/automation/org.eclipse.smarthome.automation.parser.json/src/main/java/org/eclipse/smarthome/automation/parser/json/Introspector.java",
"license": "epl-1.0",
"size": 28741
}
|
[
"org.json.JSONArray",
"org.json.JSONException"
] |
import org.json.JSONArray; import org.json.JSONException;
|
import org.json.*;
|
[
"org.json"
] |
org.json;
| 2,715,018
|
private void selectionChanged(ActionEvent e) {
m_lastSelectedIndex = m_taskSelector.getSelectedIndex();
updateGUI();
}
|
void function(ActionEvent e) { m_lastSelectedIndex = m_taskSelector.getSelectedIndex(); updateGUI(); }
|
/**
* update the gui when the selection is changed of the tasklist combobox selector
* @param e the event that happened
*/
|
update the gui when the selection is changed of the tasklist combobox selector
|
selectionChanged
|
{
"repo_name": "MartijnTheunissen/PLNR",
"path": "src/psopv/taskplanner/views/TaskListView.java",
"license": "gpl-2.0",
"size": 4493
}
|
[
"java.awt.event.ActionEvent"
] |
import java.awt.event.ActionEvent;
|
import java.awt.event.*;
|
[
"java.awt"
] |
java.awt;
| 2,325,114
|
public boolean isResinHomeValid(File resinHome)
{
if (! resinHome.isDirectory())
return false;
File lib = new File(resinHome, "lib");
if (! lib.isDirectory())
return false;
for (String jar : RESIN_REQUIRED_JARS) {
File file = new File(lib, jar);
if (! file.canRead()) {
return false;
}
}
return true;
}
|
boolean function(File resinHome) { if (! resinHome.isDirectory()) return false; File lib = new File(resinHome, "lib"); if (! lib.isDirectory()) return false; for (String jar : RESIN_REQUIRED_JARS) { File file = new File(lib, jar); if (! file.canRead()) { return false; } } return true; }
|
/**
* Checks if the resin-home is valid by checking for expected jar files
*/
|
Checks if the resin-home is valid by checking for expected jar files
|
isResinHomeValid
|
{
"repo_name": "christianchristensen/resin",
"path": "artifacts/netbeans/src/com/caucho/netbeans/ide/AddInstanceIterator.java",
"license": "gpl-2.0",
"size": 7091
}
|
[
"java.io.File"
] |
import java.io.File;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,086,706
|
@Test
public void descriptorSetsDependOnChildren() throws Exception {
scratch.file(
"x/BUILD",
"proto_library(name='alias', deps = ['foo'])",
"proto_library(name='foo', srcs=['foo.proto'], deps = ['bar'])",
"proto_library(name='bar', srcs=['bar.proto'])",
"proto_library(name='alias_to_no_srcs', deps = ['no_srcs'])",
"proto_library(name='no_srcs')");
assertThat(getDepsDescriptorSets(getDescriptorOutput("//x:alias")))
.containsExactly("x/foo-descriptor-set.proto.bin", "x/bar-descriptor-set.proto.bin");
assertThat(getDepsDescriptorSets(getDescriptorOutput("//x:foo")))
.containsExactly("x/bar-descriptor-set.proto.bin");
assertThat(getDepsDescriptorSets(getDescriptorOutput("//x:bar"))).isEmpty();
assertThat(getDepsDescriptorSets(getDescriptorOutput("//x:alias_to_no_srcs")))
.containsExactly("x/no_srcs-descriptor-set.proto.bin");
assertThat(getDepsDescriptorSets(getDescriptorOutput("//x:no_srcs"))).isEmpty();
}
|
void function() throws Exception { scratch.file( STR, STR, STR, STR, STR, STR); assertThat(getDepsDescriptorSets(getDescriptorOutput(STRx/foo-descriptor-set.proto.binSTRx/bar-descriptor-set.proto.bin"); assertThat(getDepsDescriptorSets(getDescriptorOutput(STRx/bar-descriptor-set.proto.binSTR assertThat(getDepsDescriptorSets(getDescriptorOutput(STRx/no_srcs-descriptor-set.proto.binSTR }
|
/**
* Asserts that the actions creating descriptor sets for rule R, take as input (=depend on) all of
* the descriptor sets of the transitive dependencies of R.
*
* <p>This is needed so that building R, that has a dependency R' which violates strict proto
* deps, would break.
*/
|
Asserts that the actions creating descriptor sets for rule R, take as input (=depend on) all of the descriptor sets of the transitive dependencies of R. This is needed so that building R, that has a dependency R' which violates strict proto deps, would break
|
descriptorSetsDependOnChildren
|
{
"repo_name": "Asana/bazel",
"path": "src/test/java/com/google/devtools/build/lib/rules/proto/BazelProtoLibraryTest.java",
"license": "apache-2.0",
"size": 11513
}
|
[
"com.google.common.truth.Truth"
] |
import com.google.common.truth.Truth;
|
import com.google.common.truth.*;
|
[
"com.google.common"
] |
com.google.common;
| 2,248,261
|
boolean checkSupported(@Nonnull MageController controller, @Nonnull String...fallbackTypes);
|
boolean checkSupported(@Nonnull MageController controller, @Nonnull String...fallbackTypes);
|
/**
* Convert this to cost to a different type if the current cost is not supported.
* If the first fallback is also not supported, the second fallback will be used.
*
* @param controller The controller to use to check for currency support
* @param fallbackTypes The types to use if this costs' type is not supported
* @return true if this cost was converted
*/
|
Convert this to cost to a different type if the current cost is not supported. If the first fallback is also not supported, the second fallback will be used
|
checkSupported
|
{
"repo_name": "elBukkit/MagicPlugin",
"path": "MagicAPI/src/main/java/com/elmakers/mine/bukkit/api/item/Cost.java",
"license": "mit",
"size": 7300
}
|
[
"com.elmakers.mine.bukkit.api.magic.MageController",
"javax.annotation.Nonnull"
] |
import com.elmakers.mine.bukkit.api.magic.MageController; import javax.annotation.Nonnull;
|
import com.elmakers.mine.bukkit.api.magic.*; import javax.annotation.*;
|
[
"com.elmakers.mine",
"javax.annotation"
] |
com.elmakers.mine; javax.annotation;
| 261,396
|
@Override public void visitTerminal(TerminalNode node) { }
|
@Override public void visitTerminal(TerminalNode node) { }
|
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
|
The default implementation does nothing
|
exitEveryRule
|
{
"repo_name": "cmingjian/notes_antlr4",
"path": "src/listeners/JSONBaseListener.java",
"license": "apache-2.0",
"size": 4147
}
|
[
"org.antlr.v4.runtime.tree.TerminalNode"
] |
import org.antlr.v4.runtime.tree.TerminalNode;
|
import org.antlr.v4.runtime.tree.*;
|
[
"org.antlr.v4"
] |
org.antlr.v4;
| 199,889
|
@Test
public void testLookupStar() throws Exception
{
Entry entry = connection.lookup( "cn=test,ou=system", "*" );
assertNotNull( entry );
// Check that we don't have any operational attributes :
// We should have only 3 attributes : objectClass, cn and sn
assertEquals( 3, entry.size() );
// Check that all the user attributes are present
assertEquals( "test", entry.get( "cn" ).getString() );
assertEquals( "sn_test", entry.get( "sn" ).getString() );
assertTrue( entry.contains( "objectClass", "top", "person" ) );
}
|
void function() throws Exception { Entry entry = connection.lookup( STR, "*" ); assertNotNull( entry ); assertEquals( 3, entry.size() ); assertEquals( "test", entry.get( "cn" ).getString() ); assertEquals( STR, entry.get( "sn" ).getString() ); assertTrue( entry.contains( STR, "top", STR ) ); }
|
/**
* Test a lookup( Dn, "*") operation
*/
|
Test a lookup( Dn, "*") operation
|
testLookupStar
|
{
"repo_name": "lucastheisen/apache-directory-server",
"path": "core-integ/src/test/java/org/apache/directory/server/core/operations/lookup/LookupIT.java",
"license": "apache-2.0",
"size": 7984
}
|
[
"org.apache.directory.api.ldap.model.entry.Entry",
"org.junit.Assert"
] |
import org.apache.directory.api.ldap.model.entry.Entry; import org.junit.Assert;
|
import org.apache.directory.api.ldap.model.entry.*; import org.junit.*;
|
[
"org.apache.directory",
"org.junit"
] |
org.apache.directory; org.junit;
| 198,696
|
void applyFacets(XSFacets facets, short presentFacet, short fixedFacet, short patternType, ValidationContext context)
throws InvalidDatatypeFacetException {
// if the object is immutable, should not apply facets...
if(fIsImmutable) return;
ValidatedInfo tempInfo = new ValidatedInfo();
// clear facets. because we always inherit facets in the constructor
// REVISIT: in fact, we don't need to clear them.
// we can convert 5 string values (4 bounds + 1 enum) to actual values,
// store them somewhere, then do facet checking at once, instead of
// going through the following steps. (lots of checking are redundant:
// for example, ((presentFacet & FACET_XXX) != 0))
fFacetsDefined = 0;
fFixedFacet = 0;
int result = 0 ;
// step 1: parse present facets
short allowedFacet = fDVs[fValidationDV].getAllowedFacets();
// length
if ((presentFacet & FACET_LENGTH) != 0) {
if ((allowedFacet & FACET_LENGTH) == 0) {
reportError("cos-applicable-facets", new Object[]{"length", fTypeName});
} else {
fLength = facets.length;
lengthAnnotation = facets.lengthAnnotation;
fFacetsDefined |= FACET_LENGTH;
if ((fixedFacet & FACET_LENGTH) != 0)
fFixedFacet |= FACET_LENGTH;
}
}
// minLength
if ((presentFacet & FACET_MINLENGTH) != 0) {
if ((allowedFacet & FACET_MINLENGTH) == 0) {
reportError("cos-applicable-facets", new Object[]{"minLength", fTypeName});
} else {
fMinLength = facets.minLength;
minLengthAnnotation = facets.minLengthAnnotation;
fFacetsDefined |= FACET_MINLENGTH;
if ((fixedFacet & FACET_MINLENGTH) != 0)
fFixedFacet |= FACET_MINLENGTH;
}
}
// maxLength
if ((presentFacet & FACET_MAXLENGTH) != 0) {
if ((allowedFacet & FACET_MAXLENGTH) == 0) {
reportError("cos-applicable-facets", new Object[]{"maxLength", fTypeName});
} else {
fMaxLength = facets.maxLength;
maxLengthAnnotation = facets.maxLengthAnnotation;
fFacetsDefined |= FACET_MAXLENGTH;
if ((fixedFacet & FACET_MAXLENGTH) != 0)
fFixedFacet |= FACET_MAXLENGTH;
}
}
// pattern
if ((presentFacet & FACET_PATTERN) != 0) {
if ((allowedFacet & FACET_PATTERN) == 0) {
reportError("cos-applicable-facets", new Object[]{"pattern", fTypeName});
} else {
patternAnnotations = facets.patternAnnotations;
RegularExpression regex = null;
try {
regex = new RegularExpression(facets.pattern, "X", context.getLocale());
} catch (Exception e) {
reportError("InvalidRegex", new Object[]{facets.pattern, e.getLocalizedMessage()});
}
if (regex != null) {
fPattern = new Vector();
fPattern.addElement(regex);
fPatternStr = new Vector();
fPatternStr.addElement(facets.pattern);
fFacetsDefined |= FACET_PATTERN;
if ((fixedFacet & FACET_PATTERN) != 0)
fFixedFacet |= FACET_PATTERN;
}
}
}
// whiteSpace
if ((presentFacet & FACET_WHITESPACE) != 0) {
if ((allowedFacet & FACET_WHITESPACE) == 0) {
reportError("cos-applicable-facets", new Object[]{"whiteSpace", fTypeName});
} else {
fWhiteSpace = facets.whiteSpace;
whiteSpaceAnnotation = facets.whiteSpaceAnnotation;
fFacetsDefined |= FACET_WHITESPACE;
if ((fixedFacet & FACET_WHITESPACE) != 0)
fFixedFacet |= FACET_WHITESPACE;
}
}
// enumeration
if ((presentFacet & FACET_ENUMERATION) != 0) {
if ((allowedFacet & FACET_ENUMERATION) == 0) {
reportError("cos-applicable-facets", new Object[]{"enumeration", fTypeName});
} else {
fEnumeration = new Vector();
Vector enumVals = facets.enumeration;
fEnumerationType = new short[enumVals.size()];
fEnumerationItemType = new ShortList[enumVals.size()];
Vector enumNSDecls = facets.enumNSDecls;
ValidationContextImpl ctx = new ValidationContextImpl(context);
enumerationAnnotations = facets.enumAnnotations;
for (int i = 0; i < enumVals.size(); i++) {
if (enumNSDecls != null)
ctx.setNSContext((NamespaceContext)enumNSDecls.elementAt(i));
try {
ValidatedInfo info = getActualEnumValue((String)enumVals.elementAt(i), ctx, tempInfo);
// check 4.3.5.c0 must: enumeration values from the value space of base
fEnumeration.addElement(info.actualValue);
fEnumerationType[i] = info.actualValueType;
fEnumerationItemType[i] = info.itemValueTypes;
} catch (InvalidDatatypeValueException ide) {
reportError("enumeration-valid-restriction", new Object[]{enumVals.elementAt(i), this.getBaseType().getName()});
}
}
fFacetsDefined |= FACET_ENUMERATION;
if ((fixedFacet & FACET_ENUMERATION) != 0)
fFixedFacet |= FACET_ENUMERATION;
}
}
// maxInclusive
if ((presentFacet & FACET_MAXINCLUSIVE) != 0) {
if ((allowedFacet & FACET_MAXINCLUSIVE) == 0) {
reportError("cos-applicable-facets", new Object[]{"maxInclusive", fTypeName});
} else {
maxInclusiveAnnotation = facets.maxInclusiveAnnotation;
try {
fMaxInclusive = fBase.getActualValue(facets.maxInclusive, context, tempInfo, true);
fFacetsDefined |= FACET_MAXINCLUSIVE;
if ((fixedFacet & FACET_MAXINCLUSIVE) != 0)
fFixedFacet |= FACET_MAXINCLUSIVE;
} catch (InvalidDatatypeValueException ide) {
reportError(ide.getKey(), ide.getArgs());
reportError("FacetValueFromBase", new Object[]{fTypeName, facets.maxInclusive,
"maxInclusive", fBase.getName()});
}
// check against fixed value in base
if (((fBase.fFacetsDefined & FACET_MAXINCLUSIVE) != 0)) {
if ((fBase.fFixedFacet & FACET_MAXINCLUSIVE) != 0) {
if (fDVs[fValidationDV].compare(fMaxInclusive, fBase.fMaxInclusive) != 0)
reportError( "FixedFacetValue", new Object[]{"maxInclusive", fMaxInclusive, fBase.fMaxInclusive, fTypeName});
}
}
// maxInclusive from base
try {
fBase.validate(context, tempInfo);
} catch (InvalidDatatypeValueException ide) {
reportError(ide.getKey(), ide.getArgs());
reportError("FacetValueFromBase", new Object[]{fTypeName, facets.maxInclusive,
"maxInclusive", fBase.getName()});
}
}
}
// maxExclusive
boolean needCheckBase = true;
if ((presentFacet & FACET_MAXEXCLUSIVE) != 0) {
if ((allowedFacet & FACET_MAXEXCLUSIVE) == 0) {
reportError("cos-applicable-facets", new Object[]{"maxExclusive", fTypeName});
} else {
maxExclusiveAnnotation = facets.maxExclusiveAnnotation;
try {
fMaxExclusive = fBase.getActualValue(facets.maxExclusive, context, tempInfo, true);
fFacetsDefined |= FACET_MAXEXCLUSIVE;
if ((fixedFacet & FACET_MAXEXCLUSIVE) != 0)
fFixedFacet |= FACET_MAXEXCLUSIVE;
} catch (InvalidDatatypeValueException ide) {
reportError(ide.getKey(), ide.getArgs());
reportError("FacetValueFromBase", new Object[]{fTypeName, facets.maxExclusive,
"maxExclusive", fBase.getName()});
}
// check against fixed value in base
if (((fBase.fFacetsDefined & FACET_MAXEXCLUSIVE) != 0)) {
result = fDVs[fValidationDV].compare(fMaxExclusive, fBase.fMaxExclusive);
if ((fBase.fFixedFacet & FACET_MAXEXCLUSIVE) != 0 && result != 0) {
reportError( "FixedFacetValue", new Object[]{"maxExclusive", facets.maxExclusive, fBase.fMaxExclusive, fTypeName});
}
if (result == 0) {
needCheckBase = false;
}
}
// maxExclusive from base
if (needCheckBase) {
try {
fBase.validate(context, tempInfo);
} catch (InvalidDatatypeValueException ide) {
reportError(ide.getKey(), ide.getArgs());
reportError("FacetValueFromBase", new Object[]{fTypeName, facets.maxExclusive,
"maxExclusive", fBase.getName()});
}
}
// If maxExclusive == base.maxExclusive, then we only need to check
// maxExclusive <= base.maxInclusive
else if (((fBase.fFacetsDefined & FACET_MAXINCLUSIVE) != 0)) {
if (fDVs[fValidationDV].compare(fMaxExclusive, fBase.fMaxInclusive) > 0) {
reportError( "maxExclusive-valid-restriction.2", new Object[]{facets.maxExclusive, fBase.fMaxInclusive});
}
}
}
}
// minExclusive
needCheckBase = true;
if ((presentFacet & FACET_MINEXCLUSIVE) != 0) {
if ((allowedFacet & FACET_MINEXCLUSIVE) == 0) {
reportError("cos-applicable-facets", new Object[]{"minExclusive", fTypeName});
} else {
minExclusiveAnnotation = facets.minExclusiveAnnotation;
try {
fMinExclusive = fBase.getActualValue(facets.minExclusive, context, tempInfo, true);
fFacetsDefined |= FACET_MINEXCLUSIVE;
if ((fixedFacet & FACET_MINEXCLUSIVE) != 0)
fFixedFacet |= FACET_MINEXCLUSIVE;
} catch (InvalidDatatypeValueException ide) {
reportError(ide.getKey(), ide.getArgs());
reportError("FacetValueFromBase", new Object[]{fTypeName, facets.minExclusive,
"minExclusive", fBase.getName()});
}
// check against fixed value in base
if (((fBase.fFacetsDefined & FACET_MINEXCLUSIVE) != 0)) {
result = fDVs[fValidationDV].compare(fMinExclusive, fBase.fMinExclusive);
if ((fBase.fFixedFacet & FACET_MINEXCLUSIVE) != 0 && result != 0) {
reportError( "FixedFacetValue", new Object[]{"minExclusive", facets.minExclusive, fBase.fMinExclusive, fTypeName});
}
if (result == 0) {
needCheckBase = false;
}
}
// minExclusive from base
if (needCheckBase) {
try {
fBase.validate(context, tempInfo);
} catch (InvalidDatatypeValueException ide) {
reportError(ide.getKey(), ide.getArgs());
reportError("FacetValueFromBase", new Object[]{fTypeName, facets.minExclusive,
"minExclusive", fBase.getName()});
}
}
// If minExclusive == base.minExclusive, then we only need to check
// minExclusive >= base.minInclusive
else if (((fBase.fFacetsDefined & FACET_MININCLUSIVE) != 0)) {
if (fDVs[fValidationDV].compare(fMinExclusive, fBase.fMinInclusive) < 0) {
reportError( "minExclusive-valid-restriction.3", new Object[]{facets.minExclusive, fBase.fMinInclusive});
}
}
}
}
// minInclusive
if ((presentFacet & FACET_MININCLUSIVE) != 0) {
if ((allowedFacet & FACET_MININCLUSIVE) == 0) {
reportError("cos-applicable-facets", new Object[]{"minInclusive", fTypeName});
} else {
minInclusiveAnnotation = facets.minInclusiveAnnotation;
try {
fMinInclusive = fBase.getActualValue(facets.minInclusive, context, tempInfo, true);
fFacetsDefined |= FACET_MININCLUSIVE;
if ((fixedFacet & FACET_MININCLUSIVE) != 0)
fFixedFacet |= FACET_MININCLUSIVE;
} catch (InvalidDatatypeValueException ide) {
reportError(ide.getKey(), ide.getArgs());
reportError("FacetValueFromBase", new Object[]{fTypeName, facets.minInclusive,
"minInclusive", fBase.getName()});
}
// check against fixed value in base
if (((fBase.fFacetsDefined & FACET_MININCLUSIVE) != 0)) {
if ((fBase.fFixedFacet & FACET_MININCLUSIVE) != 0) {
if (fDVs[fValidationDV].compare(fMinInclusive, fBase.fMinInclusive) != 0)
reportError( "FixedFacetValue", new Object[]{"minInclusive", facets.minInclusive, fBase.fMinInclusive, fTypeName});
}
}
// minInclusive from base
try {
fBase.validate(context, tempInfo);
} catch (InvalidDatatypeValueException ide) {
reportError(ide.getKey(), ide.getArgs());
reportError("FacetValueFromBase", new Object[]{fTypeName, facets.minInclusive,
"minInclusive", fBase.getName()});
}
}
}
// totalDigits
if ((presentFacet & FACET_TOTALDIGITS) != 0) {
if ((allowedFacet & FACET_TOTALDIGITS) == 0) {
reportError("cos-applicable-facets", new Object[]{"totalDigits", fTypeName});
} else {
totalDigitsAnnotation = facets.totalDigitsAnnotation;
fTotalDigits = facets.totalDigits;
fFacetsDefined |= FACET_TOTALDIGITS;
if ((fixedFacet & FACET_TOTALDIGITS) != 0)
fFixedFacet |= FACET_TOTALDIGITS;
}
}
// fractionDigits
if ((presentFacet & FACET_FRACTIONDIGITS) != 0) {
if ((allowedFacet & FACET_FRACTIONDIGITS) == 0) {
reportError("cos-applicable-facets", new Object[]{"fractionDigits", fTypeName});
} else {
fFractionDigits = facets.fractionDigits;
fractionDigitsAnnotation = facets.fractionDigitsAnnotation;
fFacetsDefined |= FACET_FRACTIONDIGITS;
if ((fixedFacet & FACET_FRACTIONDIGITS) != 0)
fFixedFacet |= FACET_FRACTIONDIGITS;
}
}
// token type: internal use, so do less checking
if (patternType != SPECIAL_PATTERN_NONE) {
fPatternType = patternType;
}
// step 2: check facets against each other: length, bounds
if(fFacetsDefined != 0) {
// check 4.3.2.c1 must: minLength <= maxLength
if(((fFacetsDefined & FACET_MINLENGTH ) != 0 ) && ((fFacetsDefined & FACET_MAXLENGTH) != 0))
{
if(fMinLength > fMaxLength)
reportError("minLength-less-than-equal-to-maxLength", new Object[]{Integer.toString(fMinLength), Integer.toString(fMaxLength), fTypeName});
}
// check 4.3.8.c1 error: maxInclusive + maxExclusive
if (((fFacetsDefined & FACET_MAXEXCLUSIVE) != 0) && ((fFacetsDefined & FACET_MAXINCLUSIVE) != 0)) {
reportError( "maxInclusive-maxExclusive", new Object[]{fMaxInclusive, fMaxExclusive, fTypeName});
}
// check 4.3.9.c1 error: minInclusive + minExclusive
if (((fFacetsDefined & FACET_MINEXCLUSIVE) != 0) && ((fFacetsDefined & FACET_MININCLUSIVE) != 0)) {
reportError("minInclusive-minExclusive", new Object[]{fMinInclusive, fMinExclusive, fTypeName});
}
// check 4.3.7.c1 must: minInclusive <= maxInclusive
if (((fFacetsDefined & FACET_MAXINCLUSIVE) != 0) && ((fFacetsDefined & FACET_MININCLUSIVE) != 0)) {
result = fDVs[fValidationDV].compare(fMinInclusive, fMaxInclusive);
if (result != -1 && result != 0)
reportError("minInclusive-less-than-equal-to-maxInclusive", new Object[]{fMinInclusive, fMaxInclusive, fTypeName});
}
// check 4.3.8.c2 must: minExclusive <= maxExclusive ??? minExclusive < maxExclusive
if (((fFacetsDefined & FACET_MAXEXCLUSIVE) != 0) && ((fFacetsDefined & FACET_MINEXCLUSIVE) != 0)) {
result = fDVs[fValidationDV].compare(fMinExclusive, fMaxExclusive);
if (result != -1 && result != 0)
reportError( "minExclusive-less-than-equal-to-maxExclusive", new Object[]{fMinExclusive, fMaxExclusive, fTypeName});
}
// check 4.3.9.c2 must: minExclusive < maxInclusive
if (((fFacetsDefined & FACET_MAXINCLUSIVE) != 0) && ((fFacetsDefined & FACET_MINEXCLUSIVE) != 0)) {
if (fDVs[fValidationDV].compare(fMinExclusive, fMaxInclusive) != -1)
reportError( "minExclusive-less-than-maxInclusive", new Object[]{fMinExclusive, fMaxInclusive, fTypeName});
}
// check 4.3.10.c1 must: minInclusive < maxExclusive
if (((fFacetsDefined & FACET_MAXEXCLUSIVE) != 0) && ((fFacetsDefined & FACET_MININCLUSIVE) != 0)) {
if (fDVs[fValidationDV].compare(fMinInclusive, fMaxExclusive) != -1)
reportError( "minInclusive-less-than-maxExclusive", new Object[]{fMinInclusive, fMaxExclusive, fTypeName});
}
// check 4.3.12.c1 must: fractionDigits <= totalDigits
if (((fFacetsDefined & FACET_FRACTIONDIGITS) != 0) &&
((fFacetsDefined & FACET_TOTALDIGITS) != 0)) {
if (fFractionDigits > fTotalDigits)
reportError( "fractionDigits-totalDigits", new Object[]{Integer.toString(fFractionDigits), Integer.toString(fTotalDigits), fTypeName});
}
// step 3: check facets against base
// check 4.3.1.c1 error: length & (fBase.maxLength | fBase.minLength)
if((fFacetsDefined & FACET_LENGTH) != 0 ){
if ((fBase.fFacetsDefined & FACET_MINLENGTH) != 0 &&
fLength < fBase.fMinLength) {
// length, fBase.minLength and fBase.maxLength defined
reportError("length-minLength-maxLength.1.1", new Object[]{fTypeName, Integer.toString(fLength), Integer.toString(fBase.fMinLength)});
}
if ((fBase.fFacetsDefined & FACET_MAXLENGTH) != 0 &&
fLength > fBase.fMaxLength) {
// length and fBase.maxLength defined
reportError("length-minLength-maxLength.2.1", new Object[]{fTypeName, Integer.toString(fLength), Integer.toString(fBase.fMaxLength)});
}
if ( (fBase.fFacetsDefined & FACET_LENGTH) != 0 ) {
// check 4.3.1.c2 error: length != fBase.length
if ( fLength != fBase.fLength )
reportError( "length-valid-restriction", new Object[]{Integer.toString(fLength), Integer.toString(fBase.fLength), fTypeName});
}
}
// check 4.3.1.c1 error: fBase.length & (maxLength | minLength)
if((fBase.fFacetsDefined & FACET_LENGTH) != 0 || (fFacetsDefined & FACET_LENGTH) != 0){
if ((fFacetsDefined & FACET_MINLENGTH) != 0){
if (fBase.fLength < fMinLength) {
// fBase.length, minLength and maxLength defined
reportError("length-minLength-maxLength.1.1", new Object[]{fTypeName, Integer.toString(fBase.fLength), Integer.toString(fMinLength)});
}
if ((fBase.fFacetsDefined & FACET_MINLENGTH) == 0){
reportError("length-minLength-maxLength.1.2.a", new Object[]{fTypeName});
}
if (fMinLength != fBase.fMinLength){
reportError("length-minLength-maxLength.1.2.b", new Object[]{fTypeName, Integer.toString(fMinLength), Integer.toString(fBase.fMinLength)});
}
}
if ((fFacetsDefined & FACET_MAXLENGTH) != 0){
if (fBase.fLength > fMaxLength) {
// fBase.length, minLength and maxLength defined
reportError("length-minLength-maxLength.2.1", new Object[]{fTypeName, Integer.toString(fBase.fLength), Integer.toString(fMaxLength)});
}
if ((fBase.fFacetsDefined & FACET_MAXLENGTH) == 0){
reportError("length-minLength-maxLength.2.2.a", new Object[]{fTypeName});
}
if (fMaxLength != fBase.fMaxLength){
reportError("length-minLength-maxLength.2.2.b", new Object[]{fTypeName, Integer.toString(fMaxLength), Integer.toString(fBase.fBase.fMaxLength)});
}
}
}
// check 4.3.2.c1 must: minLength <= fBase.maxLength
if ( ((fFacetsDefined & FACET_MINLENGTH ) != 0 ) ) {
if ( (fBase.fFacetsDefined & FACET_MAXLENGTH ) != 0 ) {
if ( fMinLength > fBase.fMaxLength ) {
reportError("minLength-less-than-equal-to-maxLength", new Object[]{Integer.toString(fMinLength), Integer.toString(fBase.fMaxLength), fTypeName});
}
}
else if ( (fBase.fFacetsDefined & FACET_MINLENGTH) != 0 ) {
if ( (fBase.fFixedFacet & FACET_MINLENGTH) != 0 && fMinLength != fBase.fMinLength ) {
reportError( "FixedFacetValue", new Object[]{"minLength", Integer.toString(fMinLength), Integer.toString(fBase.fMinLength), fTypeName});
}
// check 4.3.2.c2 error: minLength < fBase.minLength
if ( fMinLength < fBase.fMinLength ) {
reportError( "minLength-valid-restriction", new Object[]{Integer.toString(fMinLength), Integer.toString(fBase.fMinLength), fTypeName});
}
}
}
// check 4.3.2.c1 must: maxLength < fBase.minLength
if ( ((fFacetsDefined & FACET_MAXLENGTH ) != 0 ) && ((fBase.fFacetsDefined & FACET_MINLENGTH ) != 0 )) {
if ( fMaxLength < fBase.fMinLength) {
reportError("minLength-less-than-equal-to-maxLength", new Object[]{Integer.toString(fBase.fMinLength), Integer.toString(fMaxLength)});
}
}
// check 4.3.3.c1 error: maxLength > fBase.maxLength
if ( (fFacetsDefined & FACET_MAXLENGTH) != 0 ) {
if ( (fBase.fFacetsDefined & FACET_MAXLENGTH) != 0 ){
if(( (fBase.fFixedFacet & FACET_MAXLENGTH) != 0 )&& fMaxLength != fBase.fMaxLength ) {
reportError( "FixedFacetValue", new Object[]{"maxLength", Integer.toString(fMaxLength), Integer.toString(fBase.fMaxLength), fTypeName});
}
if ( fMaxLength > fBase.fMaxLength ) {
reportError( "maxLength-valid-restriction", new Object[]{Integer.toString(fMaxLength), Integer.toString(fBase.fMaxLength), fTypeName});
}
}
}
// check 4.3.11.c1 error: totalDigits > fBase.totalDigits
if (((fFacetsDefined & FACET_TOTALDIGITS) != 0)) {
if ((( fBase.fFacetsDefined & FACET_TOTALDIGITS) != 0)) {
if ((fBase.fFixedFacet & FACET_TOTALDIGITS) != 0 && fTotalDigits != fBase.fTotalDigits) {
reportError("FixedFacetValue", new Object[]{"totalDigits", Integer.toString(fTotalDigits), Integer.toString(fBase.fTotalDigits), fTypeName});
}
if (fTotalDigits > fBase.fTotalDigits) {
reportError( "totalDigits-valid-restriction", new Object[]{Integer.toString(fTotalDigits), Integer.toString(fBase.fTotalDigits), fTypeName});
}
}
}
// check 4.3.12.c1 must: fractionDigits <= base.totalDigits
if ((fFacetsDefined & FACET_FRACTIONDIGITS) != 0) {
if ((fBase.fFacetsDefined & FACET_TOTALDIGITS) != 0) {
if (fFractionDigits > fBase.fTotalDigits)
reportError( "fractionDigits-totalDigits", new Object[]{Integer.toString(fFractionDigits), Integer.toString(fTotalDigits), fTypeName});
}
}
// check 4.3.12.c2 error: fractionDigits > fBase.fractionDigits
// check fixed value for fractionDigits
if (((fFacetsDefined & FACET_FRACTIONDIGITS) != 0)) {
if ((( fBase.fFacetsDefined & FACET_FRACTIONDIGITS) != 0)) {
if (((fBase.fFixedFacet & FACET_FRACTIONDIGITS) != 0 && fFractionDigits != fBase.fFractionDigits) ||
(fValidationDV == DV_INTEGER && fFractionDigits != 0)) {
reportError("FixedFacetValue", new Object[]{"fractionDigits", Integer.toString(fFractionDigits), Integer.toString(fBase.fFractionDigits), fTypeName});
}
if (fFractionDigits > fBase.fFractionDigits) {
reportError( "fractionDigits-valid-restriction", new Object[]{Integer.toString(fFractionDigits), Integer.toString(fBase.fFractionDigits), fTypeName});
}
}
else if (fValidationDV == DV_INTEGER && fFractionDigits != 0) {
reportError("FixedFacetValue", new Object[]{"fractionDigits", Integer.toString(fFractionDigits), "0", fTypeName});
}
}
// check 4.3.6.c1 error:
// (whiteSpace = preserve || whiteSpace = replace) && fBase.whiteSpace = collapese or
// whiteSpace = preserve && fBase.whiteSpace = replace
if ( (fFacetsDefined & FACET_WHITESPACE) != 0 && (fBase.fFacetsDefined & FACET_WHITESPACE) != 0 ){
if ( (fBase.fFixedFacet & FACET_WHITESPACE) != 0 && fWhiteSpace != fBase.fWhiteSpace ) {
reportError( "FixedFacetValue", new Object[]{"whiteSpace", whiteSpaceValue(fWhiteSpace), whiteSpaceValue(fBase.fWhiteSpace), fTypeName});
}
if ( fWhiteSpace == WS_PRESERVE && fBase.fWhiteSpace == WS_COLLAPSE ){
reportError( "whiteSpace-valid-restriction.1", new Object[]{fTypeName, "preserve"});
}
if ( fWhiteSpace == WS_REPLACE && fBase.fWhiteSpace == WS_COLLAPSE ){
reportError( "whiteSpace-valid-restriction.1", new Object[]{fTypeName, "replace"});
}
if ( fWhiteSpace == WS_PRESERVE && fBase.fWhiteSpace == WS_REPLACE ){
reportError( "whiteSpace-valid-restriction.2", new Object[]{fTypeName});
}
}
}//fFacetsDefined != null
// step 4: inherit other facets from base (including fTokeyType)
// inherit length
if ( (fFacetsDefined & FACET_LENGTH) == 0 && (fBase.fFacetsDefined & FACET_LENGTH) != 0 ) {
fFacetsDefined |= FACET_LENGTH;
fLength = fBase.fLength;
lengthAnnotation = fBase.lengthAnnotation;
}
// inherit minLength
if ( (fFacetsDefined & FACET_MINLENGTH) == 0 && (fBase.fFacetsDefined & FACET_MINLENGTH) != 0 ) {
fFacetsDefined |= FACET_MINLENGTH;
fMinLength = fBase.fMinLength;
minLengthAnnotation = fBase.minLengthAnnotation;
}
// inherit maxLength
if ((fFacetsDefined & FACET_MAXLENGTH) == 0 && (fBase.fFacetsDefined & FACET_MAXLENGTH) != 0 ) {
fFacetsDefined |= FACET_MAXLENGTH;
fMaxLength = fBase.fMaxLength;
maxLengthAnnotation = fBase.maxLengthAnnotation;
}
// inherit pattern
if ( (fBase.fFacetsDefined & FACET_PATTERN) != 0 ) {
if ((fFacetsDefined & FACET_PATTERN) == 0) {
fFacetsDefined |= FACET_PATTERN;
fPattern = fBase.fPattern;
fPatternStr = fBase.fPatternStr;
patternAnnotations = fBase.patternAnnotations;
}
else {
for (int i = fBase.fPattern.size()-1; i >= 0; --i) {
fPattern.addElement(fBase.fPattern.elementAt(i));
fPatternStr.addElement(fBase.fPatternStr.elementAt(i));
}
if (fBase.patternAnnotations != null) {
if (patternAnnotations != null) {
for (int i = fBase.patternAnnotations.getLength()-1; i >= 0; --i) {
patternAnnotations.addXSObject(fBase.patternAnnotations.item(i));
}
}
else {
patternAnnotations = fBase.patternAnnotations;
}
}
}
}
// inherit whiteSpace
if ( (fFacetsDefined & FACET_WHITESPACE) == 0 && (fBase.fFacetsDefined & FACET_WHITESPACE) != 0 ) {
fFacetsDefined |= FACET_WHITESPACE;
fWhiteSpace = fBase.fWhiteSpace;
whiteSpaceAnnotation = fBase.whiteSpaceAnnotation;
}
// inherit enumeration
if ((fFacetsDefined & FACET_ENUMERATION) == 0 && (fBase.fFacetsDefined & FACET_ENUMERATION) != 0) {
fFacetsDefined |= FACET_ENUMERATION;
fEnumeration = fBase.fEnumeration;
enumerationAnnotations = fBase.enumerationAnnotations;
}
// inherit maxExclusive
if ((( fBase.fFacetsDefined & FACET_MAXEXCLUSIVE) != 0) &&
!((fFacetsDefined & FACET_MAXEXCLUSIVE) != 0) && !((fFacetsDefined & FACET_MAXINCLUSIVE) != 0)) {
fFacetsDefined |= FACET_MAXEXCLUSIVE;
fMaxExclusive = fBase.fMaxExclusive;
maxExclusiveAnnotation = fBase.maxExclusiveAnnotation;
}
// inherit maxInclusive
if ((( fBase.fFacetsDefined & FACET_MAXINCLUSIVE) != 0) &&
!((fFacetsDefined & FACET_MAXEXCLUSIVE) != 0) && !((fFacetsDefined & FACET_MAXINCLUSIVE) != 0)) {
fFacetsDefined |= FACET_MAXINCLUSIVE;
fMaxInclusive = fBase.fMaxInclusive;
maxInclusiveAnnotation = fBase.maxInclusiveAnnotation;
}
// inherit minExclusive
if ((( fBase.fFacetsDefined & FACET_MINEXCLUSIVE) != 0) &&
!((fFacetsDefined & FACET_MINEXCLUSIVE) != 0) && !((fFacetsDefined & FACET_MININCLUSIVE) != 0)) {
fFacetsDefined |= FACET_MINEXCLUSIVE;
fMinExclusive = fBase.fMinExclusive;
minExclusiveAnnotation = fBase.minExclusiveAnnotation;
}
// inherit minExclusive
if ((( fBase.fFacetsDefined & FACET_MININCLUSIVE) != 0) &&
!((fFacetsDefined & FACET_MINEXCLUSIVE) != 0) && !((fFacetsDefined & FACET_MININCLUSIVE) != 0)) {
fFacetsDefined |= FACET_MININCLUSIVE;
fMinInclusive = fBase.fMinInclusive;
minInclusiveAnnotation = fBase.minInclusiveAnnotation;
}
// inherit totalDigits
if ((( fBase.fFacetsDefined & FACET_TOTALDIGITS) != 0) &&
!((fFacetsDefined & FACET_TOTALDIGITS) != 0)) {
fFacetsDefined |= FACET_TOTALDIGITS;
fTotalDigits = fBase.fTotalDigits;
totalDigitsAnnotation = fBase.totalDigitsAnnotation;
}
// inherit fractionDigits
if ((( fBase.fFacetsDefined & FACET_FRACTIONDIGITS) != 0)
&& !((fFacetsDefined & FACET_FRACTIONDIGITS) != 0)) {
fFacetsDefined |= FACET_FRACTIONDIGITS;
fFractionDigits = fBase.fFractionDigits;
fractionDigitsAnnotation = fBase.fractionDigitsAnnotation;
}
//inherit tokeytype
if ((fPatternType == SPECIAL_PATTERN_NONE ) && (fBase.fPatternType != SPECIAL_PATTERN_NONE)) {
fPatternType = fBase.fPatternType ;
}
// step 5: mark fixed values
fFixedFacet |= fBase.fFixedFacet;
//step 6: setting fundamental facets
calcFundamentalFacets();
} //applyFacets()
|
void applyFacets(XSFacets facets, short presentFacet, short fixedFacet, short patternType, ValidationContext context) throws InvalidDatatypeFacetException { if(fIsImmutable) return; ValidatedInfo tempInfo = new ValidatedInfo(); fFacetsDefined = 0; fFixedFacet = 0; int result = 0 ; short allowedFacet = fDVs[fValidationDV].getAllowedFacets(); if ((presentFacet & FACET_LENGTH) != 0) { if ((allowedFacet & FACET_LENGTH) == 0) { reportError(STR, new Object[]{STR, fTypeName}); } else { fLength = facets.length; lengthAnnotation = facets.lengthAnnotation; fFacetsDefined = FACET_LENGTH; if ((fixedFacet & FACET_LENGTH) != 0) fFixedFacet = FACET_LENGTH; } } if ((presentFacet & FACET_MINLENGTH) != 0) { if ((allowedFacet & FACET_MINLENGTH) == 0) { reportError(STR, new Object[]{STR, fTypeName}); } else { fMinLength = facets.minLength; minLengthAnnotation = facets.minLengthAnnotation; fFacetsDefined = FACET_MINLENGTH; if ((fixedFacet & FACET_MINLENGTH) != 0) fFixedFacet = FACET_MINLENGTH; } } if ((presentFacet & FACET_MAXLENGTH) != 0) { if ((allowedFacet & FACET_MAXLENGTH) == 0) { reportError(STR, new Object[]{STR, fTypeName}); } else { fMaxLength = facets.maxLength; maxLengthAnnotation = facets.maxLengthAnnotation; fFacetsDefined = FACET_MAXLENGTH; if ((fixedFacet & FACET_MAXLENGTH) != 0) fFixedFacet = FACET_MAXLENGTH; } } if ((presentFacet & FACET_PATTERN) != 0) { if ((allowedFacet & FACET_PATTERN) == 0) { reportError(STR, new Object[]{STR, fTypeName}); } else { patternAnnotations = facets.patternAnnotations; RegularExpression regex = null; try { regex = new RegularExpression(facets.pattern, "X", context.getLocale()); } catch (Exception e) { reportError(STR, new Object[]{facets.pattern, e.getLocalizedMessage()}); } if (regex != null) { fPattern = new Vector(); fPattern.addElement(regex); fPatternStr = new Vector(); fPatternStr.addElement(facets.pattern); fFacetsDefined = FACET_PATTERN; if ((fixedFacet & FACET_PATTERN) != 0) fFixedFacet = FACET_PATTERN; } } } if ((presentFacet & FACET_WHITESPACE) != 0) { if ((allowedFacet & FACET_WHITESPACE) == 0) { reportError(STR, new Object[]{STR, fTypeName}); } else { fWhiteSpace = facets.whiteSpace; whiteSpaceAnnotation = facets.whiteSpaceAnnotation; fFacetsDefined = FACET_WHITESPACE; if ((fixedFacet & FACET_WHITESPACE) != 0) fFixedFacet = FACET_WHITESPACE; } } if ((presentFacet & FACET_ENUMERATION) != 0) { if ((allowedFacet & FACET_ENUMERATION) == 0) { reportError(STR, new Object[]{STR, fTypeName}); } else { fEnumeration = new Vector(); Vector enumVals = facets.enumeration; fEnumerationType = new short[enumVals.size()]; fEnumerationItemType = new ShortList[enumVals.size()]; Vector enumNSDecls = facets.enumNSDecls; ValidationContextImpl ctx = new ValidationContextImpl(context); enumerationAnnotations = facets.enumAnnotations; for (int i = 0; i < enumVals.size(); i++) { if (enumNSDecls != null) ctx.setNSContext((NamespaceContext)enumNSDecls.elementAt(i)); try { ValidatedInfo info = getActualEnumValue((String)enumVals.elementAt(i), ctx, tempInfo); fEnumeration.addElement(info.actualValue); fEnumerationType[i] = info.actualValueType; fEnumerationItemType[i] = info.itemValueTypes; } catch (InvalidDatatypeValueException ide) { reportError(STR, new Object[]{enumVals.elementAt(i), this.getBaseType().getName()}); } } fFacetsDefined = FACET_ENUMERATION; if ((fixedFacet & FACET_ENUMERATION) != 0) fFixedFacet = FACET_ENUMERATION; } } if ((presentFacet & FACET_MAXINCLUSIVE) != 0) { if ((allowedFacet & FACET_MAXINCLUSIVE) == 0) { reportError(STR, new Object[]{STR, fTypeName}); } else { maxInclusiveAnnotation = facets.maxInclusiveAnnotation; try { fMaxInclusive = fBase.getActualValue(facets.maxInclusive, context, tempInfo, true); fFacetsDefined = FACET_MAXINCLUSIVE; if ((fixedFacet & FACET_MAXINCLUSIVE) != 0) fFixedFacet = FACET_MAXINCLUSIVE; } catch (InvalidDatatypeValueException ide) { reportError(ide.getKey(), ide.getArgs()); reportError(STR, new Object[]{fTypeName, facets.maxInclusive, STR, fBase.getName()}); } if (((fBase.fFacetsDefined & FACET_MAXINCLUSIVE) != 0)) { if ((fBase.fFixedFacet & FACET_MAXINCLUSIVE) != 0) { if (fDVs[fValidationDV].compare(fMaxInclusive, fBase.fMaxInclusive) != 0) reportError( STR, new Object[]{STR, fMaxInclusive, fBase.fMaxInclusive, fTypeName}); } } try { fBase.validate(context, tempInfo); } catch (InvalidDatatypeValueException ide) { reportError(ide.getKey(), ide.getArgs()); reportError(STR, new Object[]{fTypeName, facets.maxInclusive, STR, fBase.getName()}); } } } boolean needCheckBase = true; if ((presentFacet & FACET_MAXEXCLUSIVE) != 0) { if ((allowedFacet & FACET_MAXEXCLUSIVE) == 0) { reportError(STR, new Object[]{STR, fTypeName}); } else { maxExclusiveAnnotation = facets.maxExclusiveAnnotation; try { fMaxExclusive = fBase.getActualValue(facets.maxExclusive, context, tempInfo, true); fFacetsDefined = FACET_MAXEXCLUSIVE; if ((fixedFacet & FACET_MAXEXCLUSIVE) != 0) fFixedFacet = FACET_MAXEXCLUSIVE; } catch (InvalidDatatypeValueException ide) { reportError(ide.getKey(), ide.getArgs()); reportError(STR, new Object[]{fTypeName, facets.maxExclusive, STR, fBase.getName()}); } if (((fBase.fFacetsDefined & FACET_MAXEXCLUSIVE) != 0)) { result = fDVs[fValidationDV].compare(fMaxExclusive, fBase.fMaxExclusive); if ((fBase.fFixedFacet & FACET_MAXEXCLUSIVE) != 0 && result != 0) { reportError( STR, new Object[]{STR, facets.maxExclusive, fBase.fMaxExclusive, fTypeName}); } if (result == 0) { needCheckBase = false; } } if (needCheckBase) { try { fBase.validate(context, tempInfo); } catch (InvalidDatatypeValueException ide) { reportError(ide.getKey(), ide.getArgs()); reportError(STR, new Object[]{fTypeName, facets.maxExclusive, STR, fBase.getName()}); } } else if (((fBase.fFacetsDefined & FACET_MAXINCLUSIVE) != 0)) { if (fDVs[fValidationDV].compare(fMaxExclusive, fBase.fMaxInclusive) > 0) { reportError( STR, new Object[]{facets.maxExclusive, fBase.fMaxInclusive}); } } } } needCheckBase = true; if ((presentFacet & FACET_MINEXCLUSIVE) != 0) { if ((allowedFacet & FACET_MINEXCLUSIVE) == 0) { reportError(STR, new Object[]{STR, fTypeName}); } else { minExclusiveAnnotation = facets.minExclusiveAnnotation; try { fMinExclusive = fBase.getActualValue(facets.minExclusive, context, tempInfo, true); fFacetsDefined = FACET_MINEXCLUSIVE; if ((fixedFacet & FACET_MINEXCLUSIVE) != 0) fFixedFacet = FACET_MINEXCLUSIVE; } catch (InvalidDatatypeValueException ide) { reportError(ide.getKey(), ide.getArgs()); reportError(STR, new Object[]{fTypeName, facets.minExclusive, STR, fBase.getName()}); } if (((fBase.fFacetsDefined & FACET_MINEXCLUSIVE) != 0)) { result = fDVs[fValidationDV].compare(fMinExclusive, fBase.fMinExclusive); if ((fBase.fFixedFacet & FACET_MINEXCLUSIVE) != 0 && result != 0) { reportError( STR, new Object[]{STR, facets.minExclusive, fBase.fMinExclusive, fTypeName}); } if (result == 0) { needCheckBase = false; } } if (needCheckBase) { try { fBase.validate(context, tempInfo); } catch (InvalidDatatypeValueException ide) { reportError(ide.getKey(), ide.getArgs()); reportError(STR, new Object[]{fTypeName, facets.minExclusive, STR, fBase.getName()}); } } else if (((fBase.fFacetsDefined & FACET_MININCLUSIVE) != 0)) { if (fDVs[fValidationDV].compare(fMinExclusive, fBase.fMinInclusive) < 0) { reportError( STR, new Object[]{facets.minExclusive, fBase.fMinInclusive}); } } } } if ((presentFacet & FACET_MININCLUSIVE) != 0) { if ((allowedFacet & FACET_MININCLUSIVE) == 0) { reportError(STR, new Object[]{STR, fTypeName}); } else { minInclusiveAnnotation = facets.minInclusiveAnnotation; try { fMinInclusive = fBase.getActualValue(facets.minInclusive, context, tempInfo, true); fFacetsDefined = FACET_MININCLUSIVE; if ((fixedFacet & FACET_MININCLUSIVE) != 0) fFixedFacet = FACET_MININCLUSIVE; } catch (InvalidDatatypeValueException ide) { reportError(ide.getKey(), ide.getArgs()); reportError(STR, new Object[]{fTypeName, facets.minInclusive, STR, fBase.getName()}); } if (((fBase.fFacetsDefined & FACET_MININCLUSIVE) != 0)) { if ((fBase.fFixedFacet & FACET_MININCLUSIVE) != 0) { if (fDVs[fValidationDV].compare(fMinInclusive, fBase.fMinInclusive) != 0) reportError( STR, new Object[]{STR, facets.minInclusive, fBase.fMinInclusive, fTypeName}); } } try { fBase.validate(context, tempInfo); } catch (InvalidDatatypeValueException ide) { reportError(ide.getKey(), ide.getArgs()); reportError(STR, new Object[]{fTypeName, facets.minInclusive, STR, fBase.getName()}); } } } if ((presentFacet & FACET_TOTALDIGITS) != 0) { if ((allowedFacet & FACET_TOTALDIGITS) == 0) { reportError(STR, new Object[]{STR, fTypeName}); } else { totalDigitsAnnotation = facets.totalDigitsAnnotation; fTotalDigits = facets.totalDigits; fFacetsDefined = FACET_TOTALDIGITS; if ((fixedFacet & FACET_TOTALDIGITS) != 0) fFixedFacet = FACET_TOTALDIGITS; } } if ((presentFacet & FACET_FRACTIONDIGITS) != 0) { if ((allowedFacet & FACET_FRACTIONDIGITS) == 0) { reportError(STR, new Object[]{STR, fTypeName}); } else { fFractionDigits = facets.fractionDigits; fractionDigitsAnnotation = facets.fractionDigitsAnnotation; fFacetsDefined = FACET_FRACTIONDIGITS; if ((fixedFacet & FACET_FRACTIONDIGITS) != 0) fFixedFacet = FACET_FRACTIONDIGITS; } } if (patternType != SPECIAL_PATTERN_NONE) { fPatternType = patternType; } if(fFacetsDefined != 0) { if(((fFacetsDefined & FACET_MINLENGTH ) != 0 ) && ((fFacetsDefined & FACET_MAXLENGTH) != 0)) { if(fMinLength > fMaxLength) reportError(STR, new Object[]{Integer.toString(fMinLength), Integer.toString(fMaxLength), fTypeName}); } if (((fFacetsDefined & FACET_MAXEXCLUSIVE) != 0) && ((fFacetsDefined & FACET_MAXINCLUSIVE) != 0)) { reportError( STR, new Object[]{fMaxInclusive, fMaxExclusive, fTypeName}); } if (((fFacetsDefined & FACET_MINEXCLUSIVE) != 0) && ((fFacetsDefined & FACET_MININCLUSIVE) != 0)) { reportError(STR, new Object[]{fMinInclusive, fMinExclusive, fTypeName}); } if (((fFacetsDefined & FACET_MAXINCLUSIVE) != 0) && ((fFacetsDefined & FACET_MININCLUSIVE) != 0)) { result = fDVs[fValidationDV].compare(fMinInclusive, fMaxInclusive); if (result != -1 && result != 0) reportError(STR, new Object[]{fMinInclusive, fMaxInclusive, fTypeName}); } if (((fFacetsDefined & FACET_MAXEXCLUSIVE) != 0) && ((fFacetsDefined & FACET_MINEXCLUSIVE) != 0)) { result = fDVs[fValidationDV].compare(fMinExclusive, fMaxExclusive); if (result != -1 && result != 0) reportError( STR, new Object[]{fMinExclusive, fMaxExclusive, fTypeName}); } if (((fFacetsDefined & FACET_MAXINCLUSIVE) != 0) && ((fFacetsDefined & FACET_MINEXCLUSIVE) != 0)) { if (fDVs[fValidationDV].compare(fMinExclusive, fMaxInclusive) != -1) reportError( STR, new Object[]{fMinExclusive, fMaxInclusive, fTypeName}); } if (((fFacetsDefined & FACET_MAXEXCLUSIVE) != 0) && ((fFacetsDefined & FACET_MININCLUSIVE) != 0)) { if (fDVs[fValidationDV].compare(fMinInclusive, fMaxExclusive) != -1) reportError( STR, new Object[]{fMinInclusive, fMaxExclusive, fTypeName}); } if (((fFacetsDefined & FACET_FRACTIONDIGITS) != 0) && ((fFacetsDefined & FACET_TOTALDIGITS) != 0)) { if (fFractionDigits > fTotalDigits) reportError( STR, new Object[]{Integer.toString(fFractionDigits), Integer.toString(fTotalDigits), fTypeName}); } if((fFacetsDefined & FACET_LENGTH) != 0 ){ if ((fBase.fFacetsDefined & FACET_MINLENGTH) != 0 && fLength < fBase.fMinLength) { reportError(STR, new Object[]{fTypeName, Integer.toString(fLength), Integer.toString(fBase.fMinLength)}); } if ((fBase.fFacetsDefined & FACET_MAXLENGTH) != 0 && fLength > fBase.fMaxLength) { reportError(STR, new Object[]{fTypeName, Integer.toString(fLength), Integer.toString(fBase.fMaxLength)}); } if ( (fBase.fFacetsDefined & FACET_LENGTH) != 0 ) { if ( fLength != fBase.fLength ) reportError( STR, new Object[]{Integer.toString(fLength), Integer.toString(fBase.fLength), fTypeName}); } } if((fBase.fFacetsDefined & FACET_LENGTH) != 0 (fFacetsDefined & FACET_LENGTH) != 0){ if ((fFacetsDefined & FACET_MINLENGTH) != 0){ if (fBase.fLength < fMinLength) { reportError(STR, new Object[]{fTypeName, Integer.toString(fBase.fLength), Integer.toString(fMinLength)}); } if ((fBase.fFacetsDefined & FACET_MINLENGTH) == 0){ reportError(STR, new Object[]{fTypeName}); } if (fMinLength != fBase.fMinLength){ reportError(STR, new Object[]{fTypeName, Integer.toString(fMinLength), Integer.toString(fBase.fMinLength)}); } } if ((fFacetsDefined & FACET_MAXLENGTH) != 0){ if (fBase.fLength > fMaxLength) { reportError(STR, new Object[]{fTypeName, Integer.toString(fBase.fLength), Integer.toString(fMaxLength)}); } if ((fBase.fFacetsDefined & FACET_MAXLENGTH) == 0){ reportError(STR, new Object[]{fTypeName}); } if (fMaxLength != fBase.fMaxLength){ reportError(STR, new Object[]{fTypeName, Integer.toString(fMaxLength), Integer.toString(fBase.fBase.fMaxLength)}); } } } if ( ((fFacetsDefined & FACET_MINLENGTH ) != 0 ) ) { if ( (fBase.fFacetsDefined & FACET_MAXLENGTH ) != 0 ) { if ( fMinLength > fBase.fMaxLength ) { reportError(STR, new Object[]{Integer.toString(fMinLength), Integer.toString(fBase.fMaxLength), fTypeName}); } } else if ( (fBase.fFacetsDefined & FACET_MINLENGTH) != 0 ) { if ( (fBase.fFixedFacet & FACET_MINLENGTH) != 0 && fMinLength != fBase.fMinLength ) { reportError( STR, new Object[]{STR, Integer.toString(fMinLength), Integer.toString(fBase.fMinLength), fTypeName}); } if ( fMinLength < fBase.fMinLength ) { reportError( STR, new Object[]{Integer.toString(fMinLength), Integer.toString(fBase.fMinLength), fTypeName}); } } } if ( ((fFacetsDefined & FACET_MAXLENGTH ) != 0 ) && ((fBase.fFacetsDefined & FACET_MINLENGTH ) != 0 )) { if ( fMaxLength < fBase.fMinLength) { reportError(STR, new Object[]{Integer.toString(fBase.fMinLength), Integer.toString(fMaxLength)}); } } if ( (fFacetsDefined & FACET_MAXLENGTH) != 0 ) { if ( (fBase.fFacetsDefined & FACET_MAXLENGTH) != 0 ){ if(( (fBase.fFixedFacet & FACET_MAXLENGTH) != 0 )&& fMaxLength != fBase.fMaxLength ) { reportError( STR, new Object[]{STR, Integer.toString(fMaxLength), Integer.toString(fBase.fMaxLength), fTypeName}); } if ( fMaxLength > fBase.fMaxLength ) { reportError( STR, new Object[]{Integer.toString(fMaxLength), Integer.toString(fBase.fMaxLength), fTypeName}); } } } if (((fFacetsDefined & FACET_TOTALDIGITS) != 0)) { if ((( fBase.fFacetsDefined & FACET_TOTALDIGITS) != 0)) { if ((fBase.fFixedFacet & FACET_TOTALDIGITS) != 0 && fTotalDigits != fBase.fTotalDigits) { reportError(STR, new Object[]{STR, Integer.toString(fTotalDigits), Integer.toString(fBase.fTotalDigits), fTypeName}); } if (fTotalDigits > fBase.fTotalDigits) { reportError( STR, new Object[]{Integer.toString(fTotalDigits), Integer.toString(fBase.fTotalDigits), fTypeName}); } } } if ((fFacetsDefined & FACET_FRACTIONDIGITS) != 0) { if ((fBase.fFacetsDefined & FACET_TOTALDIGITS) != 0) { if (fFractionDigits > fBase.fTotalDigits) reportError( STR, new Object[]{Integer.toString(fFractionDigits), Integer.toString(fTotalDigits), fTypeName}); } } if (((fFacetsDefined & FACET_FRACTIONDIGITS) != 0)) { if ((( fBase.fFacetsDefined & FACET_FRACTIONDIGITS) != 0)) { if (((fBase.fFixedFacet & FACET_FRACTIONDIGITS) != 0 && fFractionDigits != fBase.fFractionDigits) (fValidationDV == DV_INTEGER && fFractionDigits != 0)) { reportError(STR, new Object[]{STR, Integer.toString(fFractionDigits), Integer.toString(fBase.fFractionDigits), fTypeName}); } if (fFractionDigits > fBase.fFractionDigits) { reportError( STR, new Object[]{Integer.toString(fFractionDigits), Integer.toString(fBase.fFractionDigits), fTypeName}); } } else if (fValidationDV == DV_INTEGER && fFractionDigits != 0) { reportError(STR, new Object[]{STR, Integer.toString(fFractionDigits), "0", fTypeName}); } } if ( (fFacetsDefined & FACET_WHITESPACE) != 0 && (fBase.fFacetsDefined & FACET_WHITESPACE) != 0 ){ if ( (fBase.fFixedFacet & FACET_WHITESPACE) != 0 && fWhiteSpace != fBase.fWhiteSpace ) { reportError( STR, new Object[]{STR, whiteSpaceValue(fWhiteSpace), whiteSpaceValue(fBase.fWhiteSpace), fTypeName}); } if ( fWhiteSpace == WS_PRESERVE && fBase.fWhiteSpace == WS_COLLAPSE ){ reportError( STR, new Object[]{fTypeName, STR}); } if ( fWhiteSpace == WS_REPLACE && fBase.fWhiteSpace == WS_COLLAPSE ){ reportError( STR, new Object[]{fTypeName, STR}); } if ( fWhiteSpace == WS_PRESERVE && fBase.fWhiteSpace == WS_REPLACE ){ reportError( STR, new Object[]{fTypeName}); } } } if ( (fFacetsDefined & FACET_LENGTH) == 0 && (fBase.fFacetsDefined & FACET_LENGTH) != 0 ) { fFacetsDefined = FACET_LENGTH; fLength = fBase.fLength; lengthAnnotation = fBase.lengthAnnotation; } if ( (fFacetsDefined & FACET_MINLENGTH) == 0 && (fBase.fFacetsDefined & FACET_MINLENGTH) != 0 ) { fFacetsDefined = FACET_MINLENGTH; fMinLength = fBase.fMinLength; minLengthAnnotation = fBase.minLengthAnnotation; } if ((fFacetsDefined & FACET_MAXLENGTH) == 0 && (fBase.fFacetsDefined & FACET_MAXLENGTH) != 0 ) { fFacetsDefined = FACET_MAXLENGTH; fMaxLength = fBase.fMaxLength; maxLengthAnnotation = fBase.maxLengthAnnotation; } if ( (fBase.fFacetsDefined & FACET_PATTERN) != 0 ) { if ((fFacetsDefined & FACET_PATTERN) == 0) { fFacetsDefined = FACET_PATTERN; fPattern = fBase.fPattern; fPatternStr = fBase.fPatternStr; patternAnnotations = fBase.patternAnnotations; } else { for (int i = fBase.fPattern.size()-1; i >= 0; --i) { fPattern.addElement(fBase.fPattern.elementAt(i)); fPatternStr.addElement(fBase.fPatternStr.elementAt(i)); } if (fBase.patternAnnotations != null) { if (patternAnnotations != null) { for (int i = fBase.patternAnnotations.getLength()-1; i >= 0; --i) { patternAnnotations.addXSObject(fBase.patternAnnotations.item(i)); } } else { patternAnnotations = fBase.patternAnnotations; } } } } if ( (fFacetsDefined & FACET_WHITESPACE) == 0 && (fBase.fFacetsDefined & FACET_WHITESPACE) != 0 ) { fFacetsDefined = FACET_WHITESPACE; fWhiteSpace = fBase.fWhiteSpace; whiteSpaceAnnotation = fBase.whiteSpaceAnnotation; } if ((fFacetsDefined & FACET_ENUMERATION) == 0 && (fBase.fFacetsDefined & FACET_ENUMERATION) != 0) { fFacetsDefined = FACET_ENUMERATION; fEnumeration = fBase.fEnumeration; enumerationAnnotations = fBase.enumerationAnnotations; } if ((( fBase.fFacetsDefined & FACET_MAXEXCLUSIVE) != 0) && !((fFacetsDefined & FACET_MAXEXCLUSIVE) != 0) && !((fFacetsDefined & FACET_MAXINCLUSIVE) != 0)) { fFacetsDefined = FACET_MAXEXCLUSIVE; fMaxExclusive = fBase.fMaxExclusive; maxExclusiveAnnotation = fBase.maxExclusiveAnnotation; } if ((( fBase.fFacetsDefined & FACET_MAXINCLUSIVE) != 0) && !((fFacetsDefined & FACET_MAXEXCLUSIVE) != 0) && !((fFacetsDefined & FACET_MAXINCLUSIVE) != 0)) { fFacetsDefined = FACET_MAXINCLUSIVE; fMaxInclusive = fBase.fMaxInclusive; maxInclusiveAnnotation = fBase.maxInclusiveAnnotation; } if ((( fBase.fFacetsDefined & FACET_MINEXCLUSIVE) != 0) && !((fFacetsDefined & FACET_MINEXCLUSIVE) != 0) && !((fFacetsDefined & FACET_MININCLUSIVE) != 0)) { fFacetsDefined = FACET_MINEXCLUSIVE; fMinExclusive = fBase.fMinExclusive; minExclusiveAnnotation = fBase.minExclusiveAnnotation; } if ((( fBase.fFacetsDefined & FACET_MININCLUSIVE) != 0) && !((fFacetsDefined & FACET_MINEXCLUSIVE) != 0) && !((fFacetsDefined & FACET_MININCLUSIVE) != 0)) { fFacetsDefined = FACET_MININCLUSIVE; fMinInclusive = fBase.fMinInclusive; minInclusiveAnnotation = fBase.minInclusiveAnnotation; } if ((( fBase.fFacetsDefined & FACET_TOTALDIGITS) != 0) && !((fFacetsDefined & FACET_TOTALDIGITS) != 0)) { fFacetsDefined = FACET_TOTALDIGITS; fTotalDigits = fBase.fTotalDigits; totalDigitsAnnotation = fBase.totalDigitsAnnotation; } if ((( fBase.fFacetsDefined & FACET_FRACTIONDIGITS) != 0) && !((fFacetsDefined & FACET_FRACTIONDIGITS) != 0)) { fFacetsDefined = FACET_FRACTIONDIGITS; fFractionDigits = fBase.fFractionDigits; fractionDigitsAnnotation = fBase.fractionDigitsAnnotation; } if ((fPatternType == SPECIAL_PATTERN_NONE ) && (fBase.fPatternType != SPECIAL_PATTERN_NONE)) { fPatternType = fBase.fPatternType ; } fFixedFacet = fBase.fFixedFacet; calcFundamentalFacets(); }
|
/**
* If <restriction> is chosen, or built-in derived types by restriction
*/
|
If is chosen, or built-in derived types by restriction
|
applyFacets
|
{
"repo_name": "PrincetonUniversity/NVJVM",
"path": "build/linux-amd64/jaxp/drop/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/dv/xs/XSSimpleTypeDecl.java",
"license": "gpl-2.0",
"size": 138930
}
|
[
"com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeFacetException",
"com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException",
"com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo",
"com.sun.org.apache.xerces.internal.impl.dv.ValidationContext",
"com.sun.org.apache.xerces.internal.impl.dv.XSFacets",
"com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression",
"com.sun.org.apache.xerces.internal.xni.NamespaceContext",
"com.sun.org.apache.xerces.internal.xs.ShortList",
"java.util.Vector"
] |
import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeFacetException; import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException; import com.sun.org.apache.xerces.internal.impl.dv.ValidatedInfo; import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; import com.sun.org.apache.xerces.internal.impl.dv.XSFacets; import com.sun.org.apache.xerces.internal.impl.xpath.regex.RegularExpression; import com.sun.org.apache.xerces.internal.xni.NamespaceContext; import com.sun.org.apache.xerces.internal.xs.ShortList; import java.util.Vector;
|
import com.sun.org.apache.xerces.internal.impl.dv.*; import com.sun.org.apache.xerces.internal.impl.xpath.regex.*; import com.sun.org.apache.xerces.internal.xni.*; import com.sun.org.apache.xerces.internal.xs.*; import java.util.*;
|
[
"com.sun.org",
"java.util"
] |
com.sun.org; java.util;
| 94,442
|
private Path generateFilledPath(List<Entry> entries, float fillMin, int from, int to) {
float phaseX = mAnimator.getPhaseX();
float phaseY = mAnimator.getPhaseY();
Path filled = new Path();
filled.moveTo(entries.get(from).getXIndex(), fillMin);
filled.lineTo(entries.get(from).getXIndex(), entries.get(from).getVal() * phaseY);
// create a new path
for (int x = from + 1, count = (int) Math.ceil((to - from) * phaseX + from); x < count; x++) {
Entry e = entries.get(x);
filled.lineTo(e.getXIndex(), e.getVal() * phaseY);
}
// close up
filled.lineTo(
entries.get(
Math.max(
Math.min((int) Math.ceil((to - from) * phaseX + from) - 1,
entries.size() - 1), 0)).getXIndex(), fillMin);
filled.close();
return filled;
}
|
Path function(List<Entry> entries, float fillMin, int from, int to) { float phaseX = mAnimator.getPhaseX(); float phaseY = mAnimator.getPhaseY(); Path filled = new Path(); filled.moveTo(entries.get(from).getXIndex(), fillMin); filled.lineTo(entries.get(from).getXIndex(), entries.get(from).getVal() * phaseY); for (int x = from + 1, count = (int) Math.ceil((to - from) * phaseX + from); x < count; x++) { Entry e = entries.get(x); filled.lineTo(e.getXIndex(), e.getVal() * phaseY); } filled.lineTo( entries.get( Math.max( Math.min((int) Math.ceil((to - from) * phaseX + from) - 1, entries.size() - 1), 0)).getXIndex(), fillMin); filled.close(); return filled; }
|
/**
* Generates the path that is used for filled drawing.
*
* @param entries
* @return
*/
|
Generates the path that is used for filled drawing
|
generateFilledPath
|
{
"repo_name": "fernando-napier/FarmProfitCalculator",
"path": "MPChartLib/src/com/github/mikephil/charting/renderer/LineChartRenderer.java",
"license": "mit",
"size": 19446
}
|
[
"android.graphics.Path",
"com.github.mikephil.charting.data.Entry",
"java.util.List"
] |
import android.graphics.Path; import com.github.mikephil.charting.data.Entry; import java.util.List;
|
import android.graphics.*; import com.github.mikephil.charting.data.*; import java.util.*;
|
[
"android.graphics",
"com.github.mikephil",
"java.util"
] |
android.graphics; com.github.mikephil; java.util;
| 2,711,300
|
public static void addAgent(Model model,
org.ontoware.rdf2go.model.node.Resource instanceResource,
Agent value) {
Base.add(model, instanceResource, AGENT, value);
}
|
static void function(Model model, org.ontoware.rdf2go.model.node.Resource instanceResource, Agent value) { Base.add(model, instanceResource, AGENT, value); }
|
/**
* Adds a value to property Agent from an instance of Agent
*
* @param model an RDF2Go model
* @param resource an RDF2Go resource [Generated from RDFReactor template
* rule #add3static]
*/
|
Adds a value to property Agent from an instance of Agent
|
addAgent
|
{
"repo_name": "m0ep/master-thesis",
"path": "source/apis/rdf2go/rdf2go-w3-wacl/src/main/java/org/w3/ns/auth/acl/Authorization.java",
"license": "mit",
"size": 78044
}
|
[
"com.xmlns.foaf.Agent",
"org.ontoware.rdf2go.model.Model",
"org.ontoware.rdf2go.model.node.Resource",
"org.ontoware.rdfreactor.runtime.Base"
] |
import com.xmlns.foaf.Agent; import org.ontoware.rdf2go.model.Model; import org.ontoware.rdf2go.model.node.Resource; import org.ontoware.rdfreactor.runtime.Base;
|
import com.xmlns.foaf.*; import org.ontoware.rdf2go.model.*; import org.ontoware.rdf2go.model.node.*; import org.ontoware.rdfreactor.runtime.*;
|
[
"com.xmlns.foaf",
"org.ontoware.rdf2go",
"org.ontoware.rdfreactor"
] |
com.xmlns.foaf; org.ontoware.rdf2go; org.ontoware.rdfreactor;
| 675,110
|
protected final void redef(String name, Parser parser) {
if (!parsers.containsKey(name)) {
throw new IllegalStateException("Undefined production: " + name);
}
parsers.put(Objects.requireNonNull(name), Objects.requireNonNull(parser));
}
/**
* Redefines an existing production with a {@code name} and a {@code function}
|
final void function(String name, Parser parser) { if (!parsers.containsKey(name)) { throw new IllegalStateException(STR + name); } parsers.put(Objects.requireNonNull(name), Objects.requireNonNull(parser)); } /** * Redefines an existing production with a {@code name} and a {@code function}
|
/**
* Redefines an existing production with a {@code name} and a new {@code
* parser}.
*/
|
Redefines an existing production with a name and a new parser
|
redef
|
{
"repo_name": "petitparser/java-petitparser",
"path": "petitparser-core/src/main/java/org/petitparser/tools/GrammarDefinition.java",
"license": "mit",
"size": 5768
}
|
[
"java.util.Objects",
"org.petitparser.parser.Parser"
] |
import java.util.Objects; import org.petitparser.parser.Parser;
|
import java.util.*; import org.petitparser.parser.*;
|
[
"java.util",
"org.petitparser.parser"
] |
java.util; org.petitparser.parser;
| 2,317,904
|
public static Date parse(String date) {
try {
int offset = 0;
// extract year
int year = parseInt(date, offset, offset += 4);
checkOffset(date, offset, '-');
// extract month
int month = parseInt(date, offset += 1, offset += 2);
checkOffset(date, offset, '-');
// extract day
int day = parseInt(date, offset += 1, offset += 2);
checkOffset(date, offset, 'T');
// extract hours, minutes, seconds and milliseconds
int hour = parseInt(date, offset += 1, offset += 2);
checkOffset(date, offset, ':');
int minutes = parseInt(date, offset += 1, offset += 2);
checkOffset(date, offset, ':');
int seconds = parseInt(date, offset += 1, offset += 2);
Calendar calendar = new GregorianCalendar(TIMEZONE_GMT);
calendar.setLenient(false);
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month - 1);
calendar.set(Calendar.DAY_OF_MONTH, day);
calendar.set(Calendar.HOUR_OF_DAY, hour);
calendar.set(Calendar.MINUTE, minutes);
calendar.set(Calendar.SECOND, seconds);
return calendar.getTime();
} catch (IndexOutOfBoundsException e) {
throw new IllegalArgumentException("Failed to parse date " + date, e);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Failed to parse date " + date, e);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Failed to parse date " + date, e);
}
}
|
static Date function(String date) { try { int offset = 0; int year = parseInt(date, offset, offset += 4); checkOffset(date, offset, '-'); int month = parseInt(date, offset += 1, offset += 2); checkOffset(date, offset, '-'); int day = parseInt(date, offset += 1, offset += 2); checkOffset(date, offset, 'T'); int hour = parseInt(date, offset += 1, offset += 2); checkOffset(date, offset, ':'); int minutes = parseInt(date, offset += 1, offset += 2); checkOffset(date, offset, ':'); int seconds = parseInt(date, offset += 1, offset += 2); Calendar calendar = new GregorianCalendar(TIMEZONE_GMT); calendar.setLenient(false); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month - 1); calendar.set(Calendar.DAY_OF_MONTH, day); calendar.set(Calendar.HOUR_OF_DAY, hour); calendar.set(Calendar.MINUTE, minutes); calendar.set(Calendar.SECOND, seconds); return calendar.getTime(); } catch (IndexOutOfBoundsException e) { throw new IllegalArgumentException(STR + date, e); } catch (NumberFormatException e) { throw new IllegalArgumentException(STR + date, e); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(STR + date, e); } }
|
/**
* Parse a date from ISO-8601 formatted string. It expects a format yyyy-MM-ddThh:mm:ss
*
* @param date ISO string to parse in the appropriate format.
* @return the parsed date
* @throws IllegalArgumentException if the date is not in the appropriate format
*/
|
Parse a date from ISO-8601 formatted string. It expects a format yyyy-MM-ddThh:mm:ss
|
parse
|
{
"repo_name": "HKMOpen/UrbanDicSDK",
"path": "urbanSDK/urbansdk/src/main/java/com/hkm/urbansdk/gson/Iso8601DateFormat.java",
"license": "mit",
"size": 6298
}
|
[
"java.util.Calendar",
"java.util.Date",
"java.util.GregorianCalendar"
] |
import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,380,823
|
public void dumpStats() {
final IgniteLogger log = this.diagnosticLog;
if (log != null) {
StringBuilder sb = new StringBuilder();
dumpInfo(sb, null);
U.warn(log, sb.toString());
GridNioServer<Message> nioSrvr = nioSrvWrapper.nio();
if (nioSrvr != null) {
nioSrvr.dumpStats().listen(fut -> {
try {
U.warn(log, fut.get());
}
catch (Exception e) {
U.error(log, "Failed to dump NIO server statistics: " + e, e);
}
});
}
}
}
|
void function() { final IgniteLogger log = this.diagnosticLog; if (log != null) { StringBuilder sb = new StringBuilder(); dumpInfo(sb, null); U.warn(log, sb.toString()); GridNioServer<Message> nioSrvr = nioSrvWrapper.nio(); if (nioSrvr != null) { nioSrvr.dumpStats().listen(fut -> { try { U.warn(log, fut.get()); } catch (Exception e) { U.error(log, STR + e, e); } }); } } }
|
/**
* Dumps SPI per-connection stats to logs.
*/
|
Dumps SPI per-connection stats to logs
|
dumpStats
|
{
"repo_name": "samaitra/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java",
"license": "apache-2.0",
"size": 55076
}
|
[
"org.apache.ignite.IgniteLogger",
"org.apache.ignite.internal.util.nio.GridNioServer",
"org.apache.ignite.internal.util.typedef.internal.U",
"org.apache.ignite.plugin.extensions.communication.Message"
] |
import org.apache.ignite.IgniteLogger; import org.apache.ignite.internal.util.nio.GridNioServer; import org.apache.ignite.internal.util.typedef.internal.U; import org.apache.ignite.plugin.extensions.communication.Message;
|
import org.apache.ignite.*; import org.apache.ignite.internal.util.nio.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.apache.ignite.plugin.extensions.communication.*;
|
[
"org.apache.ignite"
] |
org.apache.ignite;
| 2,512,990
|
List<PropertyValidationInfo> basicValidations = new ArrayList();
DomainBuilder domainBuilder = new DomainBuilder(domain);
List attributes = domainBuilder.getAllAttributes();
for (Iterator iterator = attributes.iterator(); iterator.hasNext();) {
String attrName = (String) iterator.next();
Method method = domainBuilder.getMethodFor(attrName);
if (method != null) {
PropertyValidationInfo propertyValidationInfo = PropertyValidationInfoFactory.createBasedOn(method, attrName);
basicValidations.add(propertyValidationInfo);
}
}
return basicValidations;
}
|
List<PropertyValidationInfo> basicValidations = new ArrayList(); DomainBuilder domainBuilder = new DomainBuilder(domain); List attributes = domainBuilder.getAllAttributes(); for (Iterator iterator = attributes.iterator(); iterator.hasNext();) { String attrName = (String) iterator.next(); Method method = domainBuilder.getMethodFor(attrName); if (method != null) { PropertyValidationInfo propertyValidationInfo = PropertyValidationInfoFactory.createBasedOn(method, attrName); basicValidations.add(propertyValidationInfo); } } return basicValidations; }
|
/**
* Generate the needed information for Basic validation
* @param domain
*/
|
Generate the needed information for Basic validation
|
generateBasicValidationsInfoBasedOn
|
{
"repo_name": "AlanGuerraQuispe/SisAtuxVenta",
"path": "atux-base/src/main/java/com/aw/core/validation/BasicValidationGenerator.java",
"license": "gpl-2.0",
"size": 1184
}
|
[
"com.aw.core.binding.DomainBuilder",
"java.lang.reflect.Method",
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List"
] |
import com.aw.core.binding.DomainBuilder; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Iterator; import java.util.List;
|
import com.aw.core.binding.*; import java.lang.reflect.*; import java.util.*;
|
[
"com.aw.core",
"java.lang",
"java.util"
] |
com.aw.core; java.lang; java.util;
| 1,343,789
|
public PlayerData getPlayerInfo(Player player) {
return getDatabase().getPlayerData(player.getName());
}
|
PlayerData function(Player player) { return getDatabase().getPlayerData(player.getName()); }
|
/**
* Get the data for the player
* Each data is being stored centrally
*
* @param player The player class
* @return PlayerData class
*/
|
Get the data for the player Each data is being stored centrally
|
getPlayerInfo
|
{
"repo_name": "larryTheCoder/ASkyBlock-Nukkit",
"path": "src/main/java/com/larryTheCoder/ASkyBlock.java",
"license": "gpl-3.0",
"size": 24994
}
|
[
"cn.nukkit.Player"
] |
import cn.nukkit.Player;
|
import cn.nukkit.*;
|
[
"cn.nukkit"
] |
cn.nukkit;
| 172,989
|
public Task cancelAsync(Connection c) throws
BadServerResponse,
XenAPIException,
XmlRpcException,
Types.OperationNotAllowed {
String method_call = "Async.task.cancel";
String session = c.getSessionReference();
Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)};
Map response = c.dispatch(method_call, method_params);
Object result = response.get("Value");
return Types.toTask(result);
}
|
Task function(Connection c) throws BadServerResponse, XenAPIException, XmlRpcException, Types.OperationNotAllowed { String method_call = STR; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(this.ref)}; Map response = c.dispatch(method_call, method_params); Object result = response.get("Value"); return Types.toTask(result); }
|
/**
* Request that a task be cancelled. Note that a task may fail to be cancelled and may complete or fail normally and note that, even when a task does cancel, it might take an arbitrary amount of time.
*
* @return Task
*/
|
Request that a task be cancelled. Note that a task may fail to be cancelled and may complete or fail normally and note that, even when a task does cancel, it might take an arbitrary amount of time
|
cancelAsync
|
{
"repo_name": "mufaddalq/cloudstack-datera-driver",
"path": "deps/XenServerJava/src/com/xensource/xenapi/Task.java",
"license": "apache-2.0",
"size": 25995
}
|
[
"com.xensource.xenapi.Types",
"java.util.Map",
"org.apache.xmlrpc.XmlRpcException"
] |
import com.xensource.xenapi.Types; import java.util.Map; import org.apache.xmlrpc.XmlRpcException;
|
import com.xensource.xenapi.*; import java.util.*; import org.apache.xmlrpc.*;
|
[
"com.xensource.xenapi",
"java.util",
"org.apache.xmlrpc"
] |
com.xensource.xenapi; java.util; org.apache.xmlrpc;
| 1,130,357
|
public List<GHIssue> getIssues(GHIssueState state, GHMilestone milestone) throws IOException {
return queryIssues().milestone(milestone == null ? "none" : "" + milestone.getNumber())
.state(state)
.list()
.toList();
}
/**
* Lists up all the issues in this repository.
*
* @param state
* the state
* @return the paged iterable
* @deprecated Use {@link #queryIssues()}
|
List<GHIssue> function(GHIssueState state, GHMilestone milestone) throws IOException { return queryIssues().milestone(milestone == null ? "none" : "" + milestone.getNumber()) .state(state) .list() .toList(); } /** * Lists up all the issues in this repository. * * @param state * the state * @return the paged iterable * @deprecated Use {@link #queryIssues()}
|
/**
* Gets issues.
*
* @param state
* the state
* @param milestone
* the milestone
* @return the issues
* @throws IOException
* the io exception
*/
|
Gets issues
|
getIssues
|
{
"repo_name": "kohsuke/github-api",
"path": "src/main/java/org/kohsuke/github/GHRepository.java",
"license": "mit",
"size": 103118
}
|
[
"java.io.IOException",
"java.util.List"
] |
import java.io.IOException; import java.util.List;
|
import java.io.*; import java.util.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 2,288,961
|
LibraryTestSetup libraryTestSetup = new LibraryTestSetup();
inputParameters = libraryTestSetup.setupInputParameterList();
outputParameters = libraryTestSetup.setupOutputParameterList();
}
|
LibraryTestSetup libraryTestSetup = new LibraryTestSetup(); inputParameters = libraryTestSetup.setupInputParameterList(); outputParameters = libraryTestSetup.setupOutputParameterList(); }
|
/**
* Set up the ParameterValueLists to simulate the fUML system before calling
* the doBody() method on the library classes.
*/
|
Set up the ParameterValueLists to simulate the fUML system before calling the doBody() method on the library classes
|
setUp
|
{
"repo_name": "moliz/moliz.fuml",
"path": "test/org/modeldriven/fuml/library/booleanfunctions/BooleanToBooleanFunctionBehaviorExecutionTest.java",
"license": "epl-1.0",
"size": 4176
}
|
[
"org.modeldriven.fuml.library.LibraryTestSetup"
] |
import org.modeldriven.fuml.library.LibraryTestSetup;
|
import org.modeldriven.fuml.library.*;
|
[
"org.modeldriven.fuml"
] |
org.modeldriven.fuml;
| 1,424,746
|
private void ensureRegistered(TokenGenerator tokenGenerator, String serverFrontendAddress) {
ParticipantId robotId = null;
try {
robotId = ParticipantId.of(getRobotId() + "@" + waveDomain);
} catch (InvalidParticipantAddress e) {
LOG.log(Level.SEVERE, "Failed to register the agent:" + getRobotId(), e);
return;
}
try {
String location = "http://" + serverFrontendAddress + getRobotUri();
// In order to re-register the agents if the server frontend address has changed.
robotRegistrar.registerOrUpdate(robotId, location);
} catch (RobotRegistrationException e) {
LOG.log(Level.SEVERE, "Failed to register the agent:" + getRobotId(), e);
} catch (PersistenceException e) {
LOG.log(Level.SEVERE, "Failed to register the agent:" + getRobotId(), e);
}
}
|
void function(TokenGenerator tokenGenerator, String serverFrontendAddress) { ParticipantId robotId = null; try { robotId = ParticipantId.of(getRobotId() + "@" + waveDomain); } catch (InvalidParticipantAddress e) { LOG.log(Level.SEVERE, STR + getRobotId(), e); return; } try { String location = "http: robotRegistrar.registerOrUpdate(robotId, location); } catch (RobotRegistrationException e) { LOG.log(Level.SEVERE, STR + getRobotId(), e); } catch (PersistenceException e) { LOG.log(Level.SEVERE, STR + getRobotId(), e); } }
|
/**
* Ensures that the robot agent is registered in the {@link AccountStore}.
*/
|
Ensures that the robot agent is registered in the <code>AccountStore</code>
|
ensureRegistered
|
{
"repo_name": "nelsonsilva/wave-protocol",
"path": "src/org/waveprotocol/box/server/robots/agent/AbstractBaseRobotAgent.java",
"license": "apache-2.0",
"size": 5416
}
|
[
"java.util.logging.Level",
"org.waveprotocol.box.server.persistence.PersistenceException",
"org.waveprotocol.box.server.robots.util.RobotsUtil",
"org.waveprotocol.wave.model.id.TokenGenerator",
"org.waveprotocol.wave.model.wave.InvalidParticipantAddress",
"org.waveprotocol.wave.model.wave.ParticipantId"
] |
import java.util.logging.Level; import org.waveprotocol.box.server.persistence.PersistenceException; import org.waveprotocol.box.server.robots.util.RobotsUtil; import org.waveprotocol.wave.model.id.TokenGenerator; import org.waveprotocol.wave.model.wave.InvalidParticipantAddress; import org.waveprotocol.wave.model.wave.ParticipantId;
|
import java.util.logging.*; import org.waveprotocol.box.server.persistence.*; import org.waveprotocol.box.server.robots.util.*; import org.waveprotocol.wave.model.id.*; import org.waveprotocol.wave.model.wave.*;
|
[
"java.util",
"org.waveprotocol.box",
"org.waveprotocol.wave"
] |
java.util; org.waveprotocol.box; org.waveprotocol.wave;
| 1,921,080
|
public void setApiKey(String key) {
this.apiKey = key;
credsProvider.setCredentials(new AuthScope(API_CRED_SCOPE, 443), new UsernamePasswordCredentials(key, null));
try {
httpClient.close();
} catch (Exception e) {
// Whether NullPointerException or an IO error, just ignore it.
}
httpClient = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build();
synchronized (this) {
if (this.websocketShouldBeRunning) {
try {
this.websocketSession.close();
} catch (Exception ex) {
// Not expecting any trouble, even if there's an exception
}
}
} // end sync
}
|
void function(String key) { this.apiKey = key; credsProvider.setCredentials(new AuthScope(API_CRED_SCOPE, 443), new UsernamePasswordCredentials(key, null)); try { httpClient.close(); } catch (Exception e) { } httpClient = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build(); synchronized (this) { if (this.websocketShouldBeRunning) { try { this.websocketSession.close(); } catch (Exception ex) { } } } }
|
/**
* Sets the key used to access a Pushbullet account. Will restart the
* websocket if it is running.
*
* @param key Sets the key used to access a pushbullet account
*/
|
Sets the key used to access a Pushbullet account. Will restart the websocket if it is running
|
setApiKey
|
{
"repo_name": "rharder/jpushbullet2",
"path": "src/main/java/net/iharder/jpushbullet2/PushbulletClient.java",
"license": "cc0-1.0",
"size": 64236
}
|
[
"org.apache.http.auth.AuthScope",
"org.apache.http.auth.UsernamePasswordCredentials",
"org.apache.http.impl.client.HttpClients"
] |
import org.apache.http.auth.AuthScope; import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.auth.*; import org.apache.http.impl.client.*;
|
[
"org.apache.http"
] |
org.apache.http;
| 876,285
|
public Properties getProperties() {
return properties;
}
|
Properties function() { return properties; }
|
/**
* Getter for properties
* @return The properties
*/
|
Getter for properties
|
getProperties
|
{
"repo_name": "jpaoletti/jpospm_core",
"path": "src/org/jpos/ee/pm/core/monitor/MonitorSource.java",
"license": "agpl-3.0",
"size": 2589
}
|
[
"java.util.Properties"
] |
import java.util.Properties;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 850,665
|
public void testSingleValueWithOffsetMinDocCount() throws Exception {
prepareIndex(date("2014-03-11T00:00:00+00:00"), 12, 1, 0);
prepareIndex(date("2014-03-14T00:00:00+00:00"), 12, 1, 13);
SearchResponse response = client().prepareSearch("idx2")
.setQuery(matchAllQuery())
.addAggregation(dateHistogram("date_histo")
.field("date")
.offset("6h")
.minDocCount(0)
.format(DATE_FORMAT)
.dateHistogramInterval(DateHistogramInterval.DAY))
.execute().actionGet();
assertThat(response.getHits().getTotalHits(), equalTo(24L));
Histogram histo = response.getAggregations().get("date_histo");
List<? extends Histogram.Bucket> buckets = histo.getBuckets();
assertThat(buckets.size(), equalTo(5));
checkBucketFor(buckets.get(0), new DateTime(2014, 3, 10, 6, 0, DateTimeZone.UTC), 6L);
checkBucketFor(buckets.get(1), new DateTime(2014, 3, 11, 6, 0, DateTimeZone.UTC), 6L);
checkBucketFor(buckets.get(2), new DateTime(2014, 3, 12, 6, 0, DateTimeZone.UTC), 0L);
checkBucketFor(buckets.get(3), new DateTime(2014, 3, 13, 6, 0, DateTimeZone.UTC), 6L);
checkBucketFor(buckets.get(4), new DateTime(2014, 3, 14, 6, 0, DateTimeZone.UTC), 6L);
}
|
void function() throws Exception { prepareIndex(date(STR), 12, 1, 0); prepareIndex(date(STR), 12, 1, 13); SearchResponse response = client().prepareSearch("idx2") .setQuery(matchAllQuery()) .addAggregation(dateHistogram(STR) .field("date") .offset("6h") .minDocCount(0) .format(DATE_FORMAT) .dateHistogramInterval(DateHistogramInterval.DAY)) .execute().actionGet(); assertThat(response.getHits().getTotalHits(), equalTo(24L)); Histogram histo = response.getAggregations().get(STR); List<? extends Histogram.Bucket> buckets = histo.getBuckets(); assertThat(buckets.size(), equalTo(5)); checkBucketFor(buckets.get(0), new DateTime(2014, 3, 10, 6, 0, DateTimeZone.UTC), 6L); checkBucketFor(buckets.get(1), new DateTime(2014, 3, 11, 6, 0, DateTimeZone.UTC), 6L); checkBucketFor(buckets.get(2), new DateTime(2014, 3, 12, 6, 0, DateTimeZone.UTC), 0L); checkBucketFor(buckets.get(3), new DateTime(2014, 3, 13, 6, 0, DateTimeZone.UTC), 6L); checkBucketFor(buckets.get(4), new DateTime(2014, 3, 14, 6, 0, DateTimeZone.UTC), 6L); }
|
/**
* Set offset so day buckets start at 6am. Index first 12 hours for two days, with one day gap.
*/
|
Set offset so day buckets start at 6am. Index first 12 hours for two days, with one day gap
|
testSingleValueWithOffsetMinDocCount
|
{
"repo_name": "camilojd/elasticsearch",
"path": "core/src/test/java/org/elasticsearch/search/aggregations/bucket/DateHistogramOffsetIT.java",
"license": "apache-2.0",
"size": 7799
}
|
[
"java.util.List",
"org.elasticsearch.action.search.SearchResponse",
"org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval",
"org.elasticsearch.search.aggregations.bucket.histogram.Histogram",
"org.hamcrest.Matchers",
"org.joda.time.DateTime",
"org.joda.time.DateTimeZone"
] |
import java.util.List; import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval; import org.elasticsearch.search.aggregations.bucket.histogram.Histogram; import org.hamcrest.Matchers; import org.joda.time.DateTime; import org.joda.time.DateTimeZone;
|
import java.util.*; import org.elasticsearch.action.search.*; import org.elasticsearch.search.aggregations.bucket.histogram.*; import org.hamcrest.*; import org.joda.time.*;
|
[
"java.util",
"org.elasticsearch.action",
"org.elasticsearch.search",
"org.hamcrest",
"org.joda.time"
] |
java.util; org.elasticsearch.action; org.elasticsearch.search; org.hamcrest; org.joda.time;
| 125,878
|
public EReference getReceipt_VendorShift() {
return (EReference)getReceipt().getEStructuralFeatures().get(0);
}
|
EReference function() { return (EReference)getReceipt().getEStructuralFeatures().get(0); }
|
/**
* Returns the meta object for the reference '{@link CIM15.IEC61968.PaymentMetering.Receipt#getVendorShift <em>Vendor Shift</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>Vendor Shift</em>'.
* @see CIM15.IEC61968.PaymentMetering.Receipt#getVendorShift()
* @see #getReceipt()
* @generated
*/
|
Returns the meta object for the reference '<code>CIM15.IEC61968.PaymentMetering.Receipt#getVendorShift Vendor Shift</code>'.
|
getReceipt_VendorShift
|
{
"repo_name": "SES-fortiss/SmartGridCoSimulation",
"path": "core/cim15/src/CIM15/IEC61968/PaymentMetering/PaymentMeteringPackage.java",
"license": "apache-2.0",
"size": 290630
}
|
[
"org.eclipse.emf.ecore.EReference"
] |
import org.eclipse.emf.ecore.EReference;
|
import org.eclipse.emf.ecore.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 1,148,527
|
public HTTPClient getHTTPClient() throws IOException {
if (!httpClientInitialized) {
if (userAgent == null) {
throw new IOException("Must call " + Any23.class.getSimpleName() +
".setHTTPUserAgent(String) before extracting from HTTP URI");
}
|
HTTPClient function() throws IOException { if (!httpClientInitialized) { if (userAgent == null) { throw new IOException(STR + Any23.class.getSimpleName() + STR); }
|
/**
* Returns the current {@link org.deri.any23.http.HTTPClient} implementation.
*
* @return instance of HTTPClient.
* @throws IOException if the HTTP client has not initialized.
*/
|
Returns the current <code>org.deri.any23.http.HTTPClient</code> implementation
|
getHTTPClient
|
{
"repo_name": "venukb/any23",
"path": "any23-core/src/main/java/org/deri/any23/Any23.java",
"license": "apache-2.0",
"size": 18932
}
|
[
"java.io.IOException",
"org.deri.any23.http.HTTPClient"
] |
import java.io.IOException; import org.deri.any23.http.HTTPClient;
|
import java.io.*; import org.deri.any23.http.*;
|
[
"java.io",
"org.deri.any23"
] |
java.io; org.deri.any23;
| 1,818,877
|
public static void logSuccess(String user, String operation, String target,
ApplicationId appId) {
if (LOG.isInfoEnabled()) {
LOG.info(createSuccessLog(user, operation, target, appId, null, null));
}
}
|
static void function(String user, String operation, String target, ApplicationId appId) { if (LOG.isInfoEnabled()) { LOG.info(createSuccessLog(user, operation, target, appId, null, null)); } }
|
/**
* Create a readable and parseable audit log string for a successful event.
*
* @param user User who made the service request to the ResourceManager.
* @param operation Operation requested by the user.
* @param target The target on which the operation is being performed.
* @param appId Application Id in which operation was performed.
*
* <br><br>
* Note that the {@link RMAuditLogger} uses tabs ('\t') as a key-val delimiter
* and hence the value fields should not contains tabs ('\t').
*/
|
Create a readable and parseable audit log string for a successful event
|
logSuccess
|
{
"repo_name": "ict-carch/hadoop-plus",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAuditLogger.java",
"license": "apache-2.0",
"size": 11942
}
|
[
"org.apache.hadoop.yarn.api.records.ApplicationId"
] |
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
import org.apache.hadoop.yarn.api.records.*;
|
[
"org.apache.hadoop"
] |
org.apache.hadoop;
| 1,651,518
|
@Deprecated
public List<Put> put(byte[] tableName, final List<Put> puts) {
return put(TableName.valueOf(tableName), puts);
}
|
List<Put> function(byte[] tableName, final List<Put> puts) { return put(TableName.valueOf(tableName), puts); }
|
/**
* Deprecated. Use {@link #put(TableName, List) } instead.
*/
|
Deprecated. Use <code>#put(TableName, List) </code> instead
|
put
|
{
"repo_name": "Jackygq1982/hbase_src",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTableMultiplexer.java",
"license": "apache-2.0",
"size": 22442
}
|
[
"java.util.List",
"org.apache.hadoop.hbase.TableName"
] |
import java.util.List; import org.apache.hadoop.hbase.TableName;
|
import java.util.*; import org.apache.hadoop.hbase.*;
|
[
"java.util",
"org.apache.hadoop"
] |
java.util; org.apache.hadoop;
| 1,890,690
|
private void LocationFound() {
Intent i = new Intent(MainActivity.this, LocationFound.class);
startActivity(i);
}
public static class PlaceholderFragment extends Fragment {
public PlaceholderFragment() {
}
|
void function() { Intent i = new Intent(MainActivity.this, LocationFound.class); startActivity(i); } public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { }
|
/**
* Launching new activity
* */
|
Launching new activity
|
LocationFound
|
{
"repo_name": "jimmycdinata/androidactionbar",
"path": "src/info/androidhive/actionbar/MainActivity.java",
"license": "apache-2.0",
"size": 8607
}
|
[
"android.app.Fragment",
"android.content.Intent"
] |
import android.app.Fragment; import android.content.Intent;
|
import android.app.*; import android.content.*;
|
[
"android.app",
"android.content"
] |
android.app; android.content;
| 2,715,485
|
public Boolean getSettingAsBoolean(String category, String setting, Boolean defaultValue) {
Map<String, String> keyval = data.get(category);
String item = matchCase ? setting : setting.toLowerCase();
if (keyval == null || keyval.get(item) == null || keyval.get(item).length()==0) {
return defaultValue;
}
return Boolean.parseBoolean(keyval.get(item));
}
|
Boolean function(String category, String setting, Boolean defaultValue) { Map<String, String> keyval = data.get(category); String item = matchCase ? setting : setting.toLowerCase(); if (keyval == null keyval.get(item) == null keyval.get(item).length()==0) { return defaultValue; } return Boolean.parseBoolean(keyval.get(item)); }
|
/**
* Gets the setting as boolean.
*
* @param category the category to select.
* @param setting the setting or key to select.
* @param defaultValue the default value if the key is not found.
* @return the setting as boolean
*/
|
Gets the setting as boolean
|
getSettingAsBoolean
|
{
"repo_name": "rauenzi/Tools-and-Utilities",
"path": "Java/Settings.java",
"license": "apache-2.0",
"size": 8231
}
|
[
"java.util.Map"
] |
import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,860,848
|
private static void handleError(int status, Exception exception, Response response){
LOG.error("REST error", exception);
response.status(status);
response.body(Json.object("exception", exception.getMessage()).toString());
response.type(ContentType.APPLICATION_JSON.getMimeType());
}
|
static void function(int status, Exception exception, Response response){ LOG.error(STR, exception); response.status(status); response.body(Json.object(STR, exception.getMessage()).toString()); response.type(ContentType.APPLICATION_JSON.getMimeType()); }
|
/**
* Handle any {@link Exception} that are thrown by the server. Configures and returns
* the correct JSON response with the given status.
*
* @param exception exception thrown by the server
* @param response response to the client
*/
|
Handle any <code>Exception</code> that are thrown by the server. Configures and returns the correct JSON response with the given status
|
handleError
|
{
"repo_name": "burukuru/grakn",
"path": "grakn-engine/src/main/java/ai/grakn/engine/controller/GraqlController.java",
"license": "gpl-3.0",
"size": 15581
}
|
[
"org.apache.http.entity.ContentType"
] |
import org.apache.http.entity.ContentType;
|
import org.apache.http.entity.*;
|
[
"org.apache.http"
] |
org.apache.http;
| 527,620
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.