buggy_function stringlengths 1 391k | fixed_function stringlengths 0 392k |
|---|---|
private float getNodeAt (Array<Node> nodes, float y, float rowY) {
for (int i = 0, n = nodes.size; i < n; i++) {
Node node = nodes.get(i);
if (y >= rowY - node.height - ySpacing && y < rowY) {
foundNode = node;
return -1;
}
rowY -= node.height + ySpacing;
if (node.expanded) {
rowY = getNod... | private float getNodeAt (Array<Node> nodes, float y, float rowY) {
for (int i = 0, n = nodes.size; i < n; i++) {
Node node = nodes.get(i);
if (y >= rowY - node.height - ySpacing && y < rowY) {
foundNode = node;
return -1;
}
rowY -= node.height + ySpacing;
if (node.expanded) {
rowY = getNod... |
public Class getClassOfType () {
return clazz;
}
/** @return the super class of this type or null */
public Type getSuperclass () {
try {
return superClass == null ? null : ReflectionCache.forName(superClass.getName());
} catch (ClassNotFoundException e) {
return null;
}
}
| public Class getClassOfType () {
return clazz;
}
/** @return the super class of this type or null */
public Type getSuperclass () {
try {
return ReflectionCache.forName(superClass.getName());
} catch (ClassNotFoundException e) {
return null;
}
}
|
public float[] getTransformedVertices () {
if (!dirty) return worldVertices;
dirty = false;
final float[] localVertices = this.localVertices;
if (worldVertices == null || worldVertices.length != localVertices.length) worldVertices = new float[localVertices.length];
final float[] worldVertices = this.worldV... | public float[] getTransformedVertices () {
if (!dirty) return worldVertices;
dirty = false;
final float[] localVertices = this.localVertices;
if (worldVertices == null || worldVertices.length < localVertices.length) worldVertices = new float[localVertices.length];
final float[] worldVertices = this.worldVe... |
protected int compareTerm(Terms.Bucket other) {
return BytesRef.getUTF8SortedAsUnicodeComparator().compare(termBytes, ((Bucket) other).termBytes);
}
}
| public Number getKeyAsNumber() {
// this method is needed for scripted numeric faceting
return Double.parseDouble(termBytes.utf8ToString());
}
@Override
int compareTerm(Terms.Bucket other) {
return BytesRef.getUTF8SortedAsUnicodeComparator().compare(t... |
public TextureRegion getRegion (String name) {
TextureRegion region = optional(name, TextureRegion.class);
if (region != null) return region;
Texture texture = optional(name, Texture.class);
if (texture == null) throw new GdxRuntimeException("No TextureRegion or Texture registered with name: " + name);
regi... | public TextureRegion getRegion (String name) {
TextureRegion region = optional(name, TextureRegion.class);
if (region != null) return region;
Texture texture = optional(name, Texture.class);
if (texture == null) throw new GdxRuntimeException("No TextureRegion or Texture registered with name: " + name);
regi... |
public DocumentMapper(String index, @Nullable Settings indexSettings, DocumentMapperParser docMapperParser,
RootObjectMapper rootObjectMapper,
ImmutableMap<String, Object> meta,
NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer,
... | public DocumentMapper(String index, @Nullable Settings indexSettings, DocumentMapperParser docMapperParser,
RootObjectMapper rootObjectMapper,
ImmutableMap<String, Object> meta,
NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer,
... |
@Override public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
boolean cache = true; // since usually term filter is on repeating terms, cache it by default
CacheKeyFilter.Key cacheKey = null;
... | @Override public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
boolean cache = true; // since usually term filter is on repeating terms, cache it by default
CacheKeyFilter.Key cacheKey = null;
... |
public Vector3 getCenter (Vector3 out) {
return cnt;
}
| public Vector3 getCenter (Vector3 out) {
return out.set(cnt);
}
|
public void init() throws Exception {
CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder()
.put(indexSettings())
.put(SETTING_NUMBER_OF_SHARDS, 1)
.put(SETTING_NUMBER_OF_REPLICAS, 0)
.put("index.analysis.analy... | public void init() throws Exception {
CreateIndexRequestBuilder builder = prepareCreate("test").setSettings(settingsBuilder()
.put(indexSettings())
.put(SETTING_NUMBER_OF_SHARDS, 1)
.put(SETTING_NUMBER_OF_REPLICAS, 0)
.put("index.analysis.analy... |
import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... | import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... |
import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... | import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... |
import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... | import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... |
import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... | import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... |
import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... | import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... |
import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... | import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... |
import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... | import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... |
import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... | import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... |
import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... | import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... |
import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... | import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... |
@Override public StringJsonBuilder raw(byte[] json) throws IOException {
flush();
UnicodeUtil.UTF16Result result = Unicode.unsafeFromBytesAsUtf16(json);
writer.write(result.result, 0, result.length);
| @Override public StringJsonBuilder raw(byte[] json) throws IOException {
flush();
Unicode.UTF16Result result = Unicode.unsafeFromBytesAsUtf16(json);
writer.write(result.result, 0, result.length);
|
import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... | import org.elasticsearch.util.io.stream.Streamable;
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to you under the ... |
@Override public Facet facet() {
return new InternalStringTermsFacet(facetName, "_index", comparatorType, size, Sets.newHashSet(new InternalStringTermsFacet.StringEntry(indexName, count)));
}
| @Override public Facet facet() {
return new InternalStringTermsFacet(facetName, "_index", comparatorType, size, Sets.newHashSet(new InternalStringTermsFacet.StringEntry(indexName, count)), 0);
}
|
Boolean paramAsBooleanOptional(String key, Boolean defaultValue);
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to ... | Boolean paramAsBooleanOptional(String key, Boolean defaultValue);
/*
* Licensed to Elastic Search and Shay Banon under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. Elastic Search licenses this
* file to ... |
public void clear() {
value = null;
valueLoaded = false;
values.clear();
valuesLoaded = true;
doc = null;
}
| public void clear() {
value = null;
valueLoaded = false;
values.clear();
valuesLoaded = false;
doc = null;
}
|
public TieredMergePolicyProvider(Store store, IndexSettingsService indexSettingsService) {
super(store.shardId(), store.indexSettings());
this.indexSettingsService = indexSettingsService;
this.compoundFormat = indexSettings.getAsBoolean("index.compound_format", store.suggestUseCompoundFile(... | public TieredMergePolicyProvider(Store store, IndexSettingsService indexSettingsService) {
super(store.shardId(), store.indexSettings());
this.indexSettingsService = indexSettingsService;
this.compoundFormat = indexSettings.getAsBoolean("index.compound_format", store.suggestUseCompoundFile(... |
public AudioDevice newAudioDevice(boolean isMono)
{
return null;
}
| public AudioDevice newAudioDevice(boolean isMono)
{
return new AndroidAudioDevice( isMono );
}
|
public void setEnvironment (String name) {
if (name == null) return;
if (cubemap != null) {
cubemap.dispose();
cubemap = null;
}
if (name.equals("<none>")) {
if (lights.has(CubemapAttribute.EnvironmentMap)) {
lights.remove(CubemapAttribute.EnvironmentMap);
shaderProvider.clear();
}
} else... | public void setEnvironment (String name) {
if (name == null) return;
if (cubemap != null) {
cubemap.dispose();
cubemap = null;
}
if (name.equals("<none>")) {
if (lights.has(CubemapAttribute.EnvironmentMap)) {
lights.remove(CubemapAttribute.EnvironmentMap);
shaderProvider.clear();
}
} else... |
@Override protected String transportAction() {
return TransportActions.Admin.Indices.STATUS;
}
| @Override protected String transportAction() {
return TransportActions.Admin.Indices.STATS;
}
|
public void execute(RoutingAllocation allocation) throws ElasticSearchException {
DiscoveryNode fromDiscoNode = allocation.nodes().resolveNode(fromNode);
DiscoveryNode toDiscoNode = allocation.nodes().resolveNode(toNode);
boolean found = false;
for (MutableShardRouting shardRouting ... | public void execute(RoutingAllocation allocation) throws ElasticSearchException {
DiscoveryNode fromDiscoNode = allocation.nodes().resolveNode(fromNode);
DiscoveryNode toDiscoNode = allocation.nodes().resolveNode(toNode);
boolean found = false;
for (MutableShardRouting shardRouting ... |
@Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (filter == null) {
throw new SearchSourceBuilderException("filter must be set on filter facet for facet [" + name + "]");
}
builder.startObject(name);
builder.field(FilterFace... | @Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (filter == null) {
throw new SearchSourceBuilderException("filter must be set on filter facet for facet [" + name + "]");
}
builder.startObject(name);
builder.field(FilterFace... |
@Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (fieldName == null) {
throw new SearchSourceBuilderException("field must be set on geo_distance facet for facet [" + name + "]");
}
if (entries.isEmpty()) {
throw new Sear... | @Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (fieldName == null) {
throw new SearchSourceBuilderException("field must be set on geo_distance facet for facet [" + name + "]");
}
if (entries.isEmpty()) {
throw new Sear... |
@Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (keyFieldName == null) {
throw new SearchSourceBuilderException("field must be set on histogram facet for facet [" + name + "]");
}
if (interval < 0) {
throw new SearchSou... | @Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (keyFieldName == null) {
throw new SearchSourceBuilderException("field must be set on histogram facet for facet [" + name + "]");
}
if (interval < 0) {
throw new SearchSou... |
@Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (keyScript == null && keyFieldName == null) {
throw new SearchSourceBuilderException("key_script or key_field must be set on histogram script facet for facet [" + name + "]");
}
if (v... | @Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (keyScript == null && keyFieldName == null) {
throw new SearchSourceBuilderException("key_script or key_field must be set on histogram script facet for facet [" + name + "]");
}
if (v... |
@Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (query == null) {
throw new SearchSourceBuilderException("query must be set on query facet for facet [" + name + "]");
}
builder.startObject(name);
builder.field(QueryFacetCol... | @Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (query == null) {
throw new SearchSourceBuilderException("query must be set on query facet for facet [" + name + "]");
}
builder.startObject(name);
builder.field(QueryFacet.TY... |
@Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (keyFieldName == null) {
throw new SearchSourceBuilderException("field must be set on range facet for facet [" + name + "]");
}
if (entries.isEmpty()) {
throw new SearchS... | @Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (keyFieldName == null) {
throw new SearchSourceBuilderException("field must be set on range facet for facet [" + name + "]");
}
if (entries.isEmpty()) {
throw new SearchS... |
@Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (keyScript == null) {
throw new SearchSourceBuilderException("key_script must be set on range script facet for facet [" + name + "]");
}
if (valueScript == null) {
throw n... | @Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (keyScript == null) {
throw new SearchSourceBuilderException("key_script must be set on range script facet for facet [" + name + "]");
}
if (valueScript == null) {
throw n... |
@Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (fieldName == null && fieldsNames == null) {
throw new SearchSourceBuilderException("field must be set on statistical facet for facet [" + name + "]");
}
builder.startObject(name);
... | @Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (fieldName == null && fieldsNames == null) {
throw new SearchSourceBuilderException("field must be set on statistical facet for facet [" + name + "]");
}
builder.startObject(name);
... |
@Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (script == null) {
throw new SearchSourceBuilderException("script must be set on statistical script facet [" + name + "]");
}
builder.startObject(name);
builder.startObject(S... | @Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (script == null) {
throw new SearchSourceBuilderException("script must be set on statistical script facet [" + name + "]");
}
builder.startObject(name);
builder.startObject(S... |
@Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (fieldName == null && fieldsNames == null && script == null) {
throw new SearchSourceBuilderException("field/fields/script must be set on terms facet for facet [" + name + "]");
}
bui... | @Override public void toXContent(XContentBuilder builder, Params params) throws IOException {
if (fieldName == null && fieldsNames == null && script == null) {
throw new SearchSourceBuilderException("field/fields/script must be set on terms facet for facet [" + name + "]");
}
bui... |
public ProgressBar (float min, float max, float stepSize, boolean vertical, ProgressBarStyle style) {
if (min > max) throw new IllegalArgumentException("min must be > max: " + min + " > " + max);
if (stepSize <= 0) throw new IllegalArgumentException("stepSize must be > 0: " + stepSize);
setStyle(style);
this.m... | public ProgressBar (float min, float max, float stepSize, boolean vertical, ProgressBarStyle style) {
if (min > max) throw new IllegalArgumentException("max must be > min. min,max: " + min + ", " + max);
if (stepSize <= 0) throw new IllegalArgumentException("stepSize must be > 0: " + stepSize);
setStyle(style);
... |
public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
XContentParser.Token token = parser.nextToken();
if (token != XContentParser.Token.FIELD_NAME) {
throw new QueryParsingException(parseCo... | public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
XContentParser.Token token = parser.nextToken();
if (token != XContentParser.Token.FIELD_NAME) {
throw new QueryParsingException(parseCo... |
public Mesh (VertexDataType type, boolean isStatic, int maxVertices, int maxIndices, VertexAttribute... attributes) {
// if (type == VertexDataType.VertexArray && Gdx.graphics.isGL20Available()) type = VertexDataType.VertexBufferObject;
if (type == VertexDataType.VertexBufferObject) {
vertices = new VertexBuffer... | public Mesh (VertexDataType type, boolean isStatic, int maxVertices, int maxIndices, VertexAttribute... attributes) {
// if (type == VertexDataType.VertexArray && Gdx.graphics.isGL20Available()) type = VertexDataType.VertexBufferObject;
if (type == VertexDataType.VertexBufferObject || Mesh.forceVBO) {
vertices =... |
public String create () {
ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory(packageName, simpleName);
composer.addImplementedInterface("com.badlogic.gwtref.client.IReflectionCache");
imports(composer);
PrintWriter printWriter = context.tryCreate(logger, packageName, simpleName);
if... | public String create () {
ClassSourceFileComposerFactory composer = new ClassSourceFileComposerFactory(packageName, simpleName);
composer.addImplementedInterface("com.badlogic.gwtref.client.IReflectionCache");
imports(composer);
PrintWriter printWriter = context.tryCreate(logger, packageName, simpleName);
if... |
public void create () {
super.create();
showAxes = true;
onModelClicked("g3d/knight.g3dj");
}
| public void create () {
super.create();
showAxes = true;
onModelClicked("g3d/teapot.g3db");
}
|
public void actionPerformed (ActionEvent event) {
chart.setExpanded(!chart.isExpanded());
boolean expanded = chart.isExpanded();
GridBagLayout layout = (GridBagLayout)getContentPanel().getLayout();
GridBagConstraints chartConstraints = layout.getConstraints(chart);
GridBagConstraints expandButton... | public void actionPerformed (ActionEvent event) {
chart.setExpanded(!chart.isExpanded());
boolean expanded = chart.isExpanded();
GridBagLayout layout = (GridBagLayout)getContentPanel().getLayout();
GridBagConstraints chartConstraints = layout.getConstraints(chart);
GridBagConstraints expandButton... |
@Override protected ShardIterator shards(ClusterState clusterState, SinglePingRequest request) throws ElasticSearchException {
return clusterService.operationRouting()
.indexShards(clusterService.state(), request.index(), request.type, request.id, null);
}
| @Override protected ShardIterator shards(ClusterState clusterState, SinglePingRequest request) throws ElasticSearchException {
return clusterService.operationRouting()
.getShards(clusterService.state(), request.index(), request.type, request.id, null, null);
}
|
@Override protected ShardsIterator shards(ClusterState clusterState, AnalyzeRequest request) {
request.index(clusterState.metaData().concreteIndex(request.index()));
return clusterState.routingTable().index(request.index()).randomAllShardsIt();
}
| @Override protected ShardsIterator shards(ClusterState clusterState, AnalyzeRequest request) {
request.index(clusterState.metaData().concreteIndex(request.index()));
return clusterState.routingTable().index(request.index()).randomAllActiveShardsIt();
}
|
@Override protected GroupShardsIterator shards(ClearIndicesCacheRequest request, String[] concreteIndices, ClusterState clusterState) {
return clusterState.routingTable().allShardsGrouped(concreteIndices);
}
| @Override protected GroupShardsIterator shards(ClearIndicesCacheRequest request, String[] concreteIndices, ClusterState clusterState) {
return clusterState.routingTable().allActiveShardsGrouped(concreteIndices, true);
}
|
@Override protected GroupShardsIterator shards(FlushRequest request, String[] concreteIndices, ClusterState clusterState) {
return clusterState.routingTable().allShardsGrouped(concreteIndices);
}
| @Override protected GroupShardsIterator shards(FlushRequest request, String[] concreteIndices, ClusterState clusterState) {
return clusterState.routingTable().allActiveShardsGrouped(concreteIndices, true);
}
|
@Override protected GroupShardsIterator shards(GatewaySnapshotRequest request, String[] concreteIndices, ClusterState clusterState) {
return clusterState.routingTable().primaryShardsGrouped(concreteIndices);
}
| @Override protected GroupShardsIterator shards(GatewaySnapshotRequest request, String[] concreteIndices, ClusterState clusterState) {
return clusterState.routingTable().activePrimaryShardsGrouped(concreteIndices, true);
}
|
@Override protected GroupShardsIterator shards(OptimizeRequest request, String[] concreteIndices, ClusterState clusterState) {
return clusterState.routingTable().allShardsGrouped(concreteIndices);
}
| @Override protected GroupShardsIterator shards(OptimizeRequest request, String[] concreteIndices, ClusterState clusterState) {
return clusterState.routingTable().allActiveShardsGrouped(concreteIndices, true);
}
|
@Override protected GroupShardsIterator shards(RefreshRequest request, String[] concreteIndices, ClusterState clusterState) {
return clusterState.routingTable().allShardsGrouped(concreteIndices);
}
| @Override protected GroupShardsIterator shards(RefreshRequest request, String[] concreteIndices, ClusterState clusterState) {
return clusterState.routingTable().allActiveShardsGrouped(concreteIndices, true);
}
|
@Override protected ShardsIterator shards(ClusterState clusterState, PercolateRequest request) {
request.index(clusterState.metaData().concreteIndex(request.index()));
return clusterState.routingTable().index(request.index()).randomAllShardsIt();
}
| @Override protected ShardsIterator shards(ClusterState clusterState, PercolateRequest request) {
request.index(clusterState.metaData().concreteIndex(request.index()));
return clusterState.routingTable().index(request.index()).randomAllActiveShardsIt();
}
|
public boolean scrolled (int amount) {
app.graphics.requestRendering();
return processor != null ? processor.scrolled(amount) : false;
}
};
if (queueEvents)
inputProcessor = processorQueue = new InputProcessorQueue(inputProcessor);
else
processorQueue = null;
app.callbacks.add(new GlfwInpu... | public boolean scrolled (int amount) {
app.graphics.requestRendering();
return processor != null ? processor.scrolled(amount) : false;
}
};
if (queueEvents)
inputProcessor = processorQueue = new InputProcessorQueue(inputProcessor);
else
processorQueue = null;
app.getCallbacks().add(new Glf... |
private ImmutableMap<ShardId, SnapshotMetaData.ShardSnapshotStatus> shards(SnapshotId snapshotId, ClusterState clusterState, ImmutableList<String> indices) {
ImmutableMap.Builder<ShardId, SnapshotMetaData.ShardSnapshotStatus> builder = ImmutableMap.builder();
MetaData metaData = clusterState.metaDat... | private ImmutableMap<ShardId, SnapshotMetaData.ShardSnapshotStatus> shards(SnapshotId snapshotId, ClusterState clusterState, ImmutableList<String> indices) {
ImmutableMap.Builder<ShardId, SnapshotMetaData.ShardSnapshotStatus> builder = ImmutableMap.builder();
MetaData metaData = clusterState.metaDat... |
public RestDeleteIndexedScriptAction(Settings settings, Client client,
ScriptService scriptService, RestController controller) {
super(settings, client);
controller.registerHandler(DELETE, "/_search/script/{lang}/{id}", this);
this.scriptService = scr... | public RestDeleteIndexedScriptAction(Settings settings, Client client,
ScriptService scriptService, RestController controller) {
super(settings, client);
controller.registerHandler(DELETE, "/_scripts/{lang}/{id}", this);
this.scriptService = scriptSer... |
public RestGetIndexedScriptAction(Settings settings, Client client,
ScriptService scriptService, RestController controller) {
super(settings, client);
controller.registerHandler(GET, "/_search/script/{lang}/{id}", this);
}
| public RestGetIndexedScriptAction(Settings settings, Client client,
ScriptService scriptService, RestController controller) {
super(settings, client);
controller.registerHandler(GET, "/_scripts/{lang}/{id}", this);
}
|
public void onItemClick(AdapterView<?> view, View arg1, int position, long id) {
Repository repo = (Repository) view.getItemAtPosition(position);
Iterator<String> iter = recentRepos.iterator();
String repoId = repo.generateId();
while (iter.has... | public void onItemClick(AdapterView<?> view, View arg1, int position, long id) {
Repository repo = (Repository) view.getItemAtPosition(position);
Iterator<String> iter = recentRepos.iterator();
String repoId = repo.generateId();
while (iter.has... |
public static void main (String[] argv) {
GdxTest test = new MD5Test();
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.useGL20 = test.needsGL20();
config.vSyncEnabled = true;
new LwjglApplication(test, config);
}
| public static void main (String[] argv) {
GdxTest test = new Box2DTest();
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.useGL20 = test.needsGL20();
config.vSyncEnabled = true;
new LwjglApplication(test, config);
}
|
public static float intersectLinePlane (float x, float y, float z, float x2, float y2, float z2, Plane plane,
Vector3 intersection) {
Vector3 direction = tmp.set(x2, y2, z2).sub(x, y, z);
Vector3 origin = tmp2.set(x, y, z);
float denom = direction.dot(plane.getNormal());
if (denom != 0) {
float t = -(orig... | public static float intersectLinePlane (float x, float y, float z, float x2, float y2, float z2, Plane plane,
Vector3 intersection) {
Vector3 direction = tmp.set(x2, y2, z2).sub(x, y, z);
Vector3 origin = tmp2.set(x, y, z);
float denom = direction.dot(plane.getNormal());
if (denom != 0) {
float t = -(orig... |
public static native String getFailureReason (); /*
gdx2d_get_failure_reason();
*/
| public static native String getFailureReason (); /*
return return env->NewStringUTF(gdx2d_get_failure_reason());
*/
|
public SimpleIdReaderTypeCache(String type, ExtTObjectIntHasMap<BytesWrap> idToDoc,
BytesWrap[] parentIdsValues, int[] parentIdsOrdinals) {
this.type = type;
this.idToDoc = idToDoc.defaultReturnValue(-1);
this.idToDoc.trimToSize();
this.parentIdsVal... | public SimpleIdReaderTypeCache(String type, ExtTObjectIntHasMap<BytesWrap> idToDoc,
BytesWrap[] parentIdsValues, int[] parentIdsOrdinals) {
this.type = type;
this.idToDoc = idToDoc;
this.idToDoc.trimToSize();
this.parentIdsValues = parentIdsValues;
... |
public enum OfferType {
/** A consumable can be purchased multiple times and diminishes once used (e.g. virtual money, coins). */
CONSUMABLE,
/** An entitlement can only be purchased once (e.g. one time upgrade). Basically a non-consumable. */
CONSUMABLE_NOT;
} | public enum OfferType {
/** A consumable can be purchased multiple times and diminishes once used (e.g. virtual money, coins). */
CONSUMABLE,
/** An entitlement can only be purchased once (e.g. one time upgrade). Basically a non-consumable. */
ENTITLEMENT;
} |
public boolean exists () {
switch (type) {
case Internal:
if (file.exists()) return true;
// Fall through.
case Classpath:
return FileHandle.class.getResource("/" + file.getPath().replace('\\', '/')) != null;
}
return file().exists();
}
| public boolean exists () {
switch (type) {
case Internal:
if (file().exists()) return true;
// Fall through.
case Classpath:
return FileHandle.class.getResource("/" + file.getPath().replace('\\', '/')) != null;
}
return file().exists();
}
|
public RandomizingClient(Client client, Random random) {
super(client);
// we don't use the QUERY_AND_FETCH types that break quite a lot of tests
// given that they return `size*num_shards` hits instead of `size`
defaultSearchType = RandomPicks.randomFrom(random, Arrays.asList(
... | public RandomizingClient(Client client, Random random) {
super(client);
// we don't use the QUERY_AND_FETCH types that break quite a lot of tests
// given that they return `size*num_shards` hits instead of `size`
defaultSearchType = RandomPicks.randomFrom(random, Arrays.asList(
... |
public void create () {
Gdx.app.log("MD5 Test", "created");
model = MD5Loader.loadModel(Gdx.files.internal("data/zfat.md5mesh").read(), false);
anim = MD5Loader.loadAnimation(Gdx.files.internal("data/walk1.md5anim").read());
skeleton = new MD5Joints();
skeleton.joints = new float[anim.frames[0].joints.length... | public void create () {
Gdx.app.log("MD5 Test", "created");
model = MD5Loader.loadModel(Gdx.files.internal("data/zfat.md5mesh").read(), false);
anim = MD5Loader.loadAnimation(Gdx.files.internal("data/walk1.md5anim").read());
skeleton = new MD5Joints();
skeleton.joints = new float[anim.frames[0].joints.length... |
public JglfwApplication (ApplicationListener listener) {
this(listener, listener.getClass().getSimpleName(), 640, 480, false);
}
| public JglfwApplication (ApplicationListener listener) {
this(listener, listener.getClass().getSimpleName(), 640, 480, true);
}
|
public void surfaceCreated () {
if (gui != null) return;
Button button = new Button("Click Me");
FPSCounter fpsCounter = new FPSCounter(4, 2);
DialogLayout layout = new DialogLayout();
layout.setTheme("");
layout.setHorizontalGroup(layout.createParallelGroup().addWidgets(button, fpsCounter));
layout.se... | public void surfaceCreated () {
if (gui != null) return;
Button button = new Button("Click Me");
FPSCounter fpsCounter = new FPSCounter(4, 2);
DialogLayout layout = new DialogLayout();
layout.setTheme("");
layout.setHorizontalGroup(layout.createParallelGroup().addWidgets(button, fpsCounter));
layout.se... |
public void handleRequest(final RestRequest request, final RestChannel channel) {
boolean helpWanted = request.paramAsBoolean("h", false);
if (helpWanted) {
Table table = getTableWithHeader(request);
int[] width = buildHelpWidths(table, request, false);
StringBuil... | public void handleRequest(final RestRequest request, final RestChannel channel) {
boolean helpWanted = request.paramAsBoolean("h", false);
if (helpWanted) {
Table table = getTableWithHeader(request);
int[] width = buildHelpWidths(table, request, false);
StringBuil... |
public static void main (String[] args) {
Plane plane = new Plane(new Vector3(1, 0, 0), 0);
SplitTriangle split = new SplitTriangle(3);
float[] fTriangle = {-10, 0, 10, -1, 0, 0, -10, 0, 10};
Intersector.splitTriangle(fTriangle, plane, split);
System.out.println(split);
float[] triangle = {-10, 0, 10, 10,... | public static void main (String[] args) {
Plane plane = new Plane(new Vector3(1, 0, 0), 0);
SplitTriangle split = new SplitTriangle(3);
float[] fTriangle = {-10, 0, 10, -1, 0, 0, -10, 0, 10};
Intersector.splitTriangle(fTriangle, plane, split);
System.out.println(split);
float[] triangle = {-10, 0, 10, 10,... |
public static long getUnsafeByteBufferAddress(ByteBuffer buffer) {
synchronized(unsafeBuffers) {
if (unsafeBuffers.contains(buffer, true))
return 0;
}
return getByteBufferAddress(buffer);
}
| public static long getUnsafeByteBufferAddress(ByteBuffer buffer) {
synchronized(unsafeBuffers) {
if (!unsafeBuffers.contains(buffer, true))
return 0;
}
return getByteBufferAddress(buffer);
}
|
protected void beforeLocalFork() {
}
} | public void beforeLocalFork() {
}
} |
public int compare(TextFragment o1, TextFragment o2) {
return Math.round(o2.getScore() - o1.getScore());
}
});
}
String[] fragments = null;
// numbe... | public int compare(TextFragment o1, TextFragment o2) {
return Math.round(o2.getScore() - o1.getScore());
}
});
}
String[] fragments = null;
// numbe... |
private static final String FINALIZER_CLASS_NAME
= "org.elasticsearch.util.gcommon.base.internal.Finalizer";
| private static final String FINALIZER_CLASS_NAME
= "org.elasticsearch.util.base.internal.Finalizer";
|
public static void main (String[] args) throws Exception {
String JNI_DIR = "jni";
String LIBS_DIR = "libs";
// generate C/C++ code
new NativeCodeGenerator().generate("src", "bin", JNI_DIR, new String[] {"**/*"}, null);
// generate iOS GL ES 1.x bindings
new NativeCodeGenerator().generate("../backends/... | public static void main (String[] args) throws Exception {
String JNI_DIR = "jni";
String LIBS_DIR = "libs";
// generate C/C++ code
new NativeCodeGenerator().generate("src", "bin", JNI_DIR, new String[] {"**/*"}, null);
// generate iOS GL ES 1.x bindings
new NativeCodeGenerator().generate("../backends/... |
public DocumentMapper(String index, @Nullable Settings indexSettings, DocumentMapperParser docMapperParser,
RootObjectMapper rootObjectMapper,
ImmutableMap<String, Object> meta,
NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer, N... | public DocumentMapper(String index, @Nullable Settings indexSettings, DocumentMapperParser docMapperParser,
RootObjectMapper rootObjectMapper,
ImmutableMap<String, Object> meta,
NamedAnalyzer indexAnalyzer, NamedAnalyzer searchAnalyzer, N... |
public Filter nullValueFilter() {
if (nullValue == null) {
return null;
}
return fieldFilter(nullValue, null);
}
| public Filter nullValueFilter() {
if (nullValue == null) {
return null;
}
return termFilter(nullValue, null);
}
|
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
String fieldName = null;
boolean disableCoord = false;
float boost = 1.0f;
String minimumShouldMatch = null;
List<String> val... | public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
String fieldName = null;
boolean disableCoord = false;
float boost = 1.0f;
String minimumShouldMatch = null;
List<String> val... |
public static <T extends FieldData> T load(AtomicReader reader, String field, TypeLoader<T> loader) throws IOException {
loader.init();
ArrayList<int[]> ordinals = new ArrayList<int[]>();
int[] idx = new int[reader.maxDoc()];
ordinals.add(new int[reader.maxDoc()]);
int t = ... | public static <T extends FieldData> T load(AtomicReader reader, String field, TypeLoader<T> loader) throws IOException {
loader.init();
ArrayList<int[]> ordinals = new ArrayList<int[]>();
int[] idx = new int[reader.maxDoc()];
ordinals.add(new int[reader.maxDoc()]);
int t = ... |
public void simpleDeleteMapping() throws Exception {
for (int i = 0; i < 10; i++) {
client().prepareIndex("test", "type1", Integer.toString(i)).setSource(jsonBuilder().startObject()
.field("value", "test" + i)
.endObject()).execute().actionGet();
}... | public void simpleDeleteMapping() throws Exception {
for (int i = 0; i < 10; i++) {
client().prepareIndex("test", "type1", Integer.toString(i)).setSource(jsonBuilder().startObject()
.field("value", "test" + i)
.endObject()).execute().actionGet();
}... |
public void getMappingsWhereThereAreNone() {
createIndex("index");
GetMappingsResponse response = client().admin().indices().prepareGetMappings().execute().actionGet();
assertThat(response.mappings(), hasKey("index"));
assertThat(response.mappings().get("index").size(), equalTo(0));
... | public void getMappingsWhereThereAreNone() {
createIndex("index");
GetMappingsResponse response = client().admin().indices().prepareGetMappings().execute().actionGet();
assertThat(response.mappings().containsKey("index"), equalTo(true));
assertThat(response.mappings().get("index").si... |
static public final float atan2 (float y, float x) {
float add, mul;
if (x < 0) {
if (y < 0) {
y = -y;
mul = 1;
} else
mul = -1;
x = -x;
add = -3.141592653f;
} else {
if (y < 0) {
y = -y;
mul = -1;
} else
mul = 1;
add = 0;
}
float invDiv = 1 / ((x < y ? y : x) * I... | static public final float atan2 (float y, float x) {
float add, mul;
if (x < 0) {
if (y < 0) {
y = -y;
mul = 1;
} else
mul = -1;
x = -x;
add = -PI;
} else {
if (y < 0) {
y = -y;
mul = -1;
} else
mul = 1;
add = 0;
}
float invDiv = 1 / ((x < y ? y : x) * INV_ATAN2_D... |
public SpriteBatch (int size, ShaderProgram defaultShader) {
this(size, Gdx.graphics.isGL20Available() ? 10 : 1, defaultShader);
}
| public SpriteBatch (int size, ShaderProgram defaultShader) {
this(size, 1, defaultShader);
}
|
public void dispose () {
if (Gdx.gl20 != null) {
tmpHandle.clear();
tmpHandle.put(bufferHandle);
tmpHandle.flip();
GL20 gl = Gdx.gl20;
gl.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
gl.glDeleteBuffers(1, tmpHandle);
bufferHandle = 0;
} else if (Gdx.gl11 != null) {
tmpHandle.clear();
t... | public void dispose () {
if (Gdx.gl20 != null) {
tmpHandle.clear();
tmpHandle.put(bufferHandle);
tmpHandle.flip();
GL20 gl = Gdx.gl20;
gl.glBindBuffer(GL20.GL_ELEMENT_ARRAY_BUFFER, 0);
gl.glDeleteBuffers(1, tmpHandle);
bufferHandle = 0;
} else if (Gdx.gl11 != null) {
tmpHandle.clear();
t... |
public void dispose () {
BufferUtils.freeMemory(byteBuffer);
}
| public void dispose () {
BufferUtils.disposeUnsafeByteBuffer(byteBuffer);
}
|
public void dispose () {
if (Gdx.gl20 != null) {
tmpHandle.clear();
tmpHandle.put(bufferHandle);
tmpHandle.flip();
GL20 gl = Gdx.gl20;
gl.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
gl.glDeleteBuffers(1, tmpHandle);
bufferHandle = 0;
} else {
tmpHandle.clear();
tmpHandle.put(bufferHandle);
... | public void dispose () {
if (Gdx.gl20 != null) {
tmpHandle.clear();
tmpHandle.put(bufferHandle);
tmpHandle.flip();
GL20 gl = Gdx.gl20;
gl.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0);
gl.glDeleteBuffers(1, tmpHandle);
bufferHandle = 0;
} else {
tmpHandle.clear();
tmpHandle.put(bufferHandle);
... |
protected Query newMatchAllDocsQuery() {
return Queries.MATCH_ALL_QUERY;
}
| protected Query newMatchAllDocsQuery() {
return Queries.newMatchAllQuery();
}
|
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
Query query = Queries.MATCH_ALL_QUERY;
Filter filter = null;
boolean filterFound = false;
float boost = 1.0f;
boolean cache =... | public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
Query query = Queries.newMatchAllQuery();
Filter filter = null;
boolean filterFound = false;
float boost = 1.0f;
boolean cach... |
protected Query zeroTermsQuery() {
return zeroTermsQuery == ZeroTermsQuery.NONE ? MatchNoDocsQuery.INSTANCE : Queries.MATCH_ALL_QUERY;
}
| protected Query zeroTermsQuery() {
return zeroTermsQuery == ZeroTermsQuery.NONE ? MatchNoDocsQuery.INSTANCE : Queries.newMatchAllQuery();
}
|
public void preProcess() {
if (query() == null) {
parsedQuery(ParsedQuery.MATCH_ALL_PARSED_QUERY);
}
if (queryBoost() != 1.0f) {
parsedQuery(new ParsedQuery(new FunctionScoreQuery(query(), new BoostScoreFunction(queryBoost)), parsedQuery()));
}
Filter ... | public void preProcess() {
if (query() == null) {
parsedQuery(ParsedQuery.parsedMatchAllQuery());
}
if (queryBoost() != 1.0f) {
parsedQuery(new ParsedQuery(new FunctionScoreQuery(query(), new BoostScoreFunction(queryBoost)), parsedQuery()));
}
Filter s... |
public static Matcher<Engine.Searcher> engineSearcherTotalHits(int totalHits) {
return new EngineSearcherTotalHitsMatcher(Queries.MATCH_ALL_QUERY, totalHits);
}
| public static Matcher<Engine.Searcher> engineSearcherTotalHits(int totalHits) {
return new EngineSearcherTotalHitsMatcher(Queries.newMatchAllQuery(), totalHits);
}
|
public TimeValue afterDisruptionTimeOut();
} | public TimeValue expectedTimeToHeal();
} |
public void testFieldIndexedScript() throws ExecutionException, InterruptedException{
List<IndexRequestBuilder> builders = new ArrayList();
builders.add(client().prepareIndex(ScriptService.SCRIPT_INDEX, "groovy", "script1").setSource("{" +
"\"script\":\"2\""+
"}"));
... | public void testFieldIndexedScript() throws ExecutionException, InterruptedException{
List<IndexRequestBuilder> builders = new ArrayList();
builders.add(client().prepareIndex(ScriptService.SCRIPT_INDEX, "groovy", "script1").setSource("{" +
"\"script\":\"2\""+
"}"));
... |
public boolean canAllocate(MetaData metaData, RoutingTable routingTable) {
return shards().size() < metaData.maxNumberOfShardsPerNode();
}
| public boolean canAllocate(MetaData metaData, RoutingTable routingTable) {
return true;
}
|
private void getPrefixTerms(List<Term> terms, final Term prefix, final IndexReader reader) throws IOException {
TermEnum enumerator = reader.terms(prefix);
try {
do {
Term term = enumerator.term();
if (term != null
&& term.text().st... | private void getPrefixTerms(List<Term> terms, final Term prefix, final IndexReader reader) throws IOException {
TermEnum enumerator = reader.terms(prefix);
try {
do {
Term term = enumerator.term();
if (term != null
&& term.text().st... |
public boolean containsValue (float value, float epsilon) {
if (hasZeroValue && zeroValue == value) return true;
float[] valueTable = this.valueTable;
for (int i = capacity + stashSize; i-- > 0;)
if (Math.abs(valueTable[i] - value) <= epsilon) return true;
return false;
}
| public boolean containsValue (float value, float epsilon) {
if (hasZeroValue && Math.abs(zeroValue - value) <= epsilon) return true;
float[] valueTable = this.valueTable;
for (int i = capacity + stashSize; i-- > 0;)
if (Math.abs(valueTable[i] - value) <= epsilon) return true;
return false;
}
|
private SearchRequest parseSearchRequest(RestRequest request) {
String[] indices = RestActions.splitIndices(request.param("index"));
SearchRequest searchRequest = new SearchRequest(indices);
// get the content, and put it in the body
if (request.hasContent()) {
searchRequ... | private SearchRequest parseSearchRequest(RestRequest request) {
String[] indices = RestActions.splitIndices(request.param("index"));
SearchRequest searchRequest = new SearchRequest(indices);
// get the content, and put it in the body
if (request.hasContent()) {
searchRequ... |
private HighlightUtils() {
}
static List<Object> loadFieldValues(SearchContextHighlight.Field field, FieldMapper<?> mapper, SearchContext searchContext, FetchSubPhase.HitContext hitContext) throws IOException {
//percolator needs to always load from source, thus it sets the global force source to ... | private HighlightUtils() {
}
static List<Object> loadFieldValues(SearchContextHighlight.Field field, FieldMapper<?> mapper, SearchContext searchContext, FetchSubPhase.HitContext hitContext) throws IOException {
//percolator needs to always load from source, thus it sets the global force source to ... |
private int partition(int left, int right, int pivot) {
T pivotValue = array[pivot];
swap(right, pivot);
int storage = left;
for (int i = left; i < right; i++) {
if (comp.compare(array[i], pivotValue) == -1) {
swap(storage, i);
storage++;
}
}
swap(right, storage);
return storage;
}
| private int partition(int left, int right, int pivot) {
T pivotValue = array[pivot];
swap(right, pivot);
int storage = left;
for (int i = left; i < right; i++) {
if (comp.compare(array[i], pivotValue) < 0) {
swap(storage, i);
storage++;
}
}
swap(right, storage);
return storage;
}
|
protected IOSApplication createApplication() {
IOSApplicationConfiguration config = new IOSApplicationConfiguration();
return new IOSApplication(new PingPongSocketExample(), config);
}
| protected IOSApplication createApplication() {
IOSApplicationConfiguration config = new IOSApplicationConfiguration();
return new IOSApplication(new BulletTestCollection(), config);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.