buggy_function stringlengths 1 391k | fixed_function stringlengths 0 392k |
|---|---|
package org.elasticsearch.cluster.routing.allocation;
/*
* 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 th... | package org.elasticsearch.cluster.routing.allocation;
/*
* 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 th... |
public boolean canCache(ShardSearchRequest request, SearchContext context) {
// TODO: for now, template is not supported, though we could use the generated bytes as the key
if (hasLength(request.templateSource())) {
return false;
}
// for now, only enable it for search ty... | public boolean canCache(ShardSearchRequest request, SearchContext context) {
// TODO: for now, template is not supported, though we could use the generated bytes as the key
if (hasLength(request.templateSource())) {
return false;
}
// for now, only enable it for search ty... |
public static void main(String[] args) throws Exception {
Random random = new Random();
Settings settings = settingsBuilder()
.put("cluster.routing.schedule", 200, TimeUnit.MILLISECONDS)
.put("index.engine.robin.refreshInterval", "-1")
.put("gateway.t... | public static void main(String[] args) throws Exception {
Random random = new Random();
Settings settings = settingsBuilder()
.put("cluster.routing.schedule", 200, TimeUnit.MILLISECONDS)
.put("index.engine.robin.refreshInterval", "-1")
.put("gateway.t... |
@Override public void messageReceived(InternalSearchRequest request, TransportChannel channel) throws Exception {
QueryFetchSearchResult result = searchService.executeFetchPhase(request);
channel.sendResponse(result);
}
}
private class SearchQueryQueryFetchTransportHandl... | @Override public void messageReceived(InternalSearchRequest request, TransportChannel channel) throws Exception {
QueryFetchSearchResult result = searchService.executeFetchPhase(request);
channel.sendResponse(result);
}
}
private class SearchQueryQueryFetchTransportHandl... |
public TranslogService(ShardId shardId, @IndexSettings Settings indexSettings, IndexSettingsService indexSettingsService, ThreadPool threadPool, IndexShard indexShard, Translog translog) {
super(shardId, indexSettings);
this.threadPool = threadPool;
this.indexSettingsService = indexSettingsS... | public TranslogService(ShardId shardId, @IndexSettings Settings indexSettings, IndexSettingsService indexSettingsService, ThreadPool threadPool, IndexShard indexShard, Translog translog) {
super(shardId, indexSettings);
this.threadPool = threadPool;
this.indexSettingsService = indexSettingsS... |
private Executor build(String name, String defaultType, @Nullable Settings settings, Settings defaultSettings) {
if (settings == null) {
settings = ImmutableSettings.Builder.EMPTY_SETTINGS;
}
String type = settings.get("type", defaultType);
ThreadFactory threadFactory = E... | private Executor build(String name, String defaultType, @Nullable Settings settings, Settings defaultSettings) {
if (settings == null) {
settings = ImmutableSettings.Builder.EMPTY_SETTINGS;
}
String type = settings.get("type", defaultType);
ThreadFactory threadFactory = E... |
protected String executor() {
return ThreadPool.Names.MANAGEMENT;
}
| protected String executor() {
return ThreadPool.Names.FLUSH;
}
|
protected String executor() {
return ThreadPool.Names.MANAGEMENT;
}
| protected String executor() {
return ThreadPool.Names.SNAPSHOT;
}
|
private static void clearThreadLocalMap(Object map, Field internalTableField) throws NoSuchMethodException, IllegalAccessException, NoSuchFieldException, InvocationTargetException {
if (map != null) {
Method mapRemove = map.getClass().getDeclaredMethod("remove", ThreadLocal.class);
m... | private static void clearThreadLocalMap(Object map, Field internalTableField) throws NoSuchMethodException, IllegalAccessException, NoSuchFieldException, InvocationTargetException {
if (map != null) {
Method mapRemove = map.getClass().getDeclaredMethod("remove", ThreadLocal.class);
m... |
public void draw (SpriteBatch batch, float parentAlpha) {
if (widget == null) return;
validate();
// Setup transform for this group.
applyTransform(batch);
if (scrollX) hKnobBounds.x = hScrollBounds.x + (int)((hScrollBounds.width - hKnobBounds.width) * getScrollPercentX());
if (scrollY)
vKnobBounds.y... | public void draw (SpriteBatch batch, float parentAlpha) {
if (widget == null) return;
validate();
// Setup transform for this group.
applyTransform(batch, computeTransform());
if (scrollX) hKnobBounds.x = hScrollBounds.x + (int)((hScrollBounds.width - hKnobBounds.width) * getScrollPercentX());
if (scrol... |
public void draw (SpriteBatch batch, float parentAlpha) {
validate();
Color color = getColor();
Drawable handle = style.handle;
applyTransform(batch);
Matrix4 transform = batch.getTransformMatrix();
if (firstWidget != null) {
ScissorStack.calculateScissors(getStage().getCamera(), transform, firstWidge... | public void draw (SpriteBatch batch, float parentAlpha) {
validate();
Color color = getColor();
Drawable handle = style.handle;
applyTransform(batch, computeTransform());
Matrix4 transform = batch.getTransformMatrix();
if (firstWidget != null) {
ScissorStack.calculateScissors(getStage().getCamera(), t... |
private Table buildTable(RestRequest req, ClusterStateResponse state, NodesInfoResponse nodesInfo, NodesStatsResponse nodesStats) {
boolean fullId = req.paramAsBoolean("full_id", false);
String masterId = state.getState().nodes().masterNodeId();
Table table = getTableWithHeader(req);
... | private Table buildTable(RestRequest req, ClusterStateResponse state, NodesInfoResponse nodesInfo, NodesStatsResponse nodesStats) {
boolean fullId = req.paramAsBoolean("full_id", false);
String masterId = state.getState().nodes().masterNodeId();
Table table = getTableWithHeader(req);
... |
public void setupSuiteScopeCluster() throws Exception {
assertAcked(
prepareCreate("test")
.addMapping("article")
.addMapping("comment", "_parent", "type=article", "_id", "index=not_analyzed")
);
List<IndexRequestBuilder> requests = ne... | public void setupSuiteScopeCluster() throws Exception {
assertAcked(
prepareCreate("test")
.addMapping("article", "_id", "index=not_analyzed")
.addMapping("comment", "_parent", "type=article", "_id", "index=not_analyzed")
);
List<Index... |
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
XContentParser.Token token = parser.currentToken();
if (token == XContentParser.Token.START_OBJECT) {
token = parser.nextToken();
... | public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
XContentParser.Token token = parser.currentToken();
if (token == XContentParser.Token.START_OBJECT) {
token = parser.nextToken();
... |
public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
MapperService.SmartNameFieldMappers smartNameFieldMappers = null;
Boolean cache = null;
String filterName = null;
String currentFiel... | public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
MapperService.SmartNameFieldMappers smartNameFieldMappers = null;
Boolean cache = null;
String filterName = null;
String currentFiel... |
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
XContentParser.Token token = parser.nextToken();
if (token != XContentParser.Token.FIELD_NAME) {
throw new QueryParsingException(parseCon... | public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
XContentParser.Token token = parser.nextToken();
if (token != XContentParser.Token.FIELD_NAME) {
throw new QueryParsingException(parseCon... |
public TermsFilterValue call() throws Exception {
GetResponse getResponse = client.get(new GetRequest(lookup.getIndex(), lookup.getType(), lookup.getId()).preference("_local")).actionGet();
if (!getResponse.isExists()) {
return NO_TERMS;
... | public TermsFilterValue call() throws Exception {
GetResponse getResponse = client.get(new GetRequest(lookup.getIndex(), lookup.getType(), lookup.getId()).preference("_local").routing(lookup.getRouting())).actionGet();
if (!getResponse.isExists()) {
... |
public void draw( Sprite sprite )
{
if( !drawing )
throw new IllegalStateException( "you have to call SpriteBatch.begin() first" );
if( sprite.texture != lastTexture )
{
renderMesh( );
lastTexture = sprite.texture;
invTexWidth = 1.0f / sprite.texture.getWidth();
invTexHeight = 1.0f / sprite.... | public void draw( Sprite sprite )
{
if( !drawing )
throw new IllegalStateException( "you have to call SpriteBatch.begin() first" );
if( sprite.texture != lastTexture )
{
renderMesh( );
lastTexture = sprite.texture;
invTexWidth = 1.0f / sprite.texture.getWidth();
invTexHeight = 1.0f / sprite.... |
@Inject public RecoverySource(Settings settings, ThreadPool threadPool, TransportService transportService, IndicesService indicesService) {
super(settings);
this.threadPool = threadPool;
this.transportService = transportService;
this.indicesService = indicesService;
int conc... | @Inject public RecoverySource(Settings settings, ThreadPool threadPool, TransportService transportService, IndicesService indicesService) {
super(settings);
this.threadPool = threadPool;
this.transportService = transportService;
this.indicesService = indicesService;
int conc... |
private void loadTileSheet(TiledMap map, Element element, FileHandle tideFile, ImageResolver imageResolver) {
if (element.getName().equals("TileSheet")) {
String id = element.getAttribute("Id");
String description = element.getChildByName("Description").getText();
String imageSource = element.getChildByName... | private void loadTileSheet(TiledMap map, Element element, FileHandle tideFile, ImageResolver imageResolver) {
if (element.getName().equals("TileSheet")) {
String id = element.getAttribute("Id");
String description = element.getChildByName("Description").getText();
String imageSource = element.getChildByName... |
@Inject public LogByteSizeMergePolicyProvider(Store store) {
super(store.shardId(), store.indexSettings());
Preconditions.checkNotNull(store, "Store must be provided to merge policy");
this.minMergeSize = componentSettings.getAsBytesSize("min_merge_size", new ByteSizeValue((long) LogByteSiz... | @Inject public LogByteSizeMergePolicyProvider(Store store) {
super(store.shardId(), store.indexSettings());
Preconditions.checkNotNull(store, "Store must be provided to merge policy");
this.minMergeSize = componentSettings.getAsBytesSize("min_merge_size", new ByteSizeValue((long) (LogByteSi... |
public IOSApplication(UIApplication uiApp, ApplicationListener listener) {
this.uiApp = uiApp;
this.listener = listener;
Gdx.app = this;
RectangleF bounds = UIScreen.get_MainScreen().get_Bounds();
this.graphics = new IOSGraphics(bounds, this);
this.files = new IOSFiles();
this.audio = new IOSAudio(... | public IOSApplication(UIApplication uiApp, ApplicationListener listener) {
this.uiApp = uiApp;
this.listener = listener;
Gdx.app = this;
RectangleF bounds = UIScreen.get_MainScreen().get_Bounds();
this.graphics = new IOSGraphics(bounds, this);
this.files = new IOSFiles();
this.audio = new IOSAudio(... |
public void testSizeAndSort() throws Exception {
client.admin().indices().prepareDelete().execute().actionGet();
client.admin().indices().prepareCreate("test")
.setSettings(settingsBuilder()
.put(SETTING_NUMBER_OF_SHARDS, 5)
.put(SETTIN... | public void testSizeAndSort() throws Exception {
client.admin().indices().prepareDelete().execute().actionGet();
client.admin().indices().prepareCreate("test")
.setSettings(settingsBuilder()
.put(SETTING_NUMBER_OF_SHARDS, 5)
.put(SETTIN... |
public static void load () {
try {
FileHandle filehandle = Gdx.files.external(file);
String[] strings = filehandle.readString().split("\n");
soundEnabled = Boolean.parseBoolean(strings[0];
for (int i = 0; i < 5; i++) {
highscores[i] = Integer.parseInt(strings[i+1]);
}
} catch (Throwable ... | public static void load () {
try {
FileHandle filehandle = Gdx.files.external(file);
String[] strings = filehandle.readString().split("\n");
soundEnabled = Boolean.parseBoolean(strings[0]);
for (int i = 0; i < 5; i++) {
highscores[i] = Integer.parseInt(strings[i+1]);
}
} catch (Throwable... |
public void testSnapshotMoreThanOnce() throws ExecutionException, InterruptedException, IOException {
Client client = client();
logger.info("--> creating repository");
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
.setType("fs").setSettings(Immutabl... | public void testSnapshotMoreThanOnce() throws ExecutionException, InterruptedException, IOException {
Client client = client();
logger.info("--> creating repository");
assertAcked(client.admin().cluster().preparePutRepository("test-repo")
.setType("fs").setSettings(Immutabl... |
@Override public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
Filter filter = null;
float boost = 1.0f;
boolean cache = true;
String currentFieldName = null;
XContentParser.Tok... | @Override public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
Filter filter = null;
float boost = 1.0f;
boolean cache = false;
String currentFieldName = null;
XContentParser.To... |
@Override public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
Query query = null;
Filter filter = null;
float boost = 1.0f;
boolean cache = true;
String currentFieldName = null... | @Override public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
Query query = null;
Filter filter = null;
float boost = 1.0f;
boolean cache = false;
String currentFieldName = nul... |
public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
MapperService.SmartNameFieldMappers smartNameFieldMappers;
Boolean cache = null;
String filterName = null;
String currentFieldName =... | public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
MapperService.SmartNameFieldMappers smartNameFieldMappers;
Boolean cache = null;
String filterName = null;
String currentFieldName =... |
private static Method getDurationMethod;
static {
runtimeMXBean = ManagementFactory.getRuntimeMXBean();
memoryMXBean = ManagementFactory.getMemoryMXBean();
threadMXBean = ManagementFactory.getThreadMXBean();
boolean enableLastGc = Booleans.parseBoolean(System.getProperty("monit... | private static Method getDurationMethod;
static {
runtimeMXBean = ManagementFactory.getRuntimeMXBean();
memoryMXBean = ManagementFactory.getMemoryMXBean();
threadMXBean = ManagementFactory.getThreadMXBean();
boolean enableLastGc = Booleans.parseBoolean(System.getProperty("monit... |
public Joint joint2 = null;
/**
* The gear ratio.
* @see GearJoint for explanation.
*/
float ratio = 1;
} | public float ratio = 1;
} |
public final Vector2 localAnchorB = new Vector2();
/// The body2 angle minus body1 angle in the reference state (radians).
float referenceAngle = 0;
} | public float referenceAngle = 0;
} |
public void onDestroy() {
graphics.clearManagedCaches();
// graphics.destroy();
}
| public void onDestroy() {
graphics.clearManagedCaches();
graphics.destroy();
}
|
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
XContentParser.Token token = parser.currentToken();
if (token == XContentParser.Token.START_OBJECT) {
token = parser.nextToken();
... | public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException {
XContentParser parser = parseContext.parser();
XContentParser.Token token = parser.currentToken();
if (token == XContentParser.Token.START_OBJECT) {
token = parser.nextToken();
... |
public void setTitle (String title) {
if (title == null) glfwSetWindowTitle(window, "");
glfwSetWindowTitle(window, title);
this.title = title;
}
| public void setTitle (String title) {
if (title == null) title = "";
glfwSetWindowTitle(window, title);
this.title = title;
}
|
public void sizeIsZero() {
final int minDocCount = randomInt(1);
SearchResponse response = client().prepareSearch("idx").setTypes("high_card_type")
.addAggregation(terms("terms")
.executionHint(randomExecutionHint())
.field(SINGLE_VALUE... | public void sizeIsZero() {
final int minDocCount = randomInt(1);
SearchResponse response = client().prepareSearch("idx").setTypes("high_card_type")
.addAggregation(terms("terms")
.executionHint(randomExecutionHint())
.field(SINGLE_VALUE... |
public static void main(String[] args) throws Exception {
String JNI_DIR = "jni-new";
String LIBS_DIR = "libs-new";
// MD5Jni
String[] includes = { "**/MD5Jni.java" };
new NativeCodeGenerator().generate("src", "bin", JNI_DIR + "/", includes, null);
// Matrix4
includes = new String[] { "**/Matrix4.j... | public static void main(String[] args) throws Exception {
String JNI_DIR = "jni-new";
String LIBS_DIR = "libs-new";
// MD5Jni
String[] includes = { "**/MD5Jni.java" };
new NativeCodeGenerator().generate("src", "bin", JNI_DIR + "/", includes, null);
// Matrix4
includes = new String[] { "**/Matrix4.j... |
private IndexWriter createWriter() throws IOException {
IndexWriter indexWriter = null;
try {
// release locks when started
if (IndexWriter.isLocked(store.directory())) {
logger.warn("shard is locked, releasing lock");
IndexWriter.unlock(store.... | private IndexWriter createWriter() throws IOException {
IndexWriter indexWriter = null;
try {
// release locks when started
if (IndexWriter.isLocked(store.directory())) {
logger.warn("shard is locked, releasing lock");
IndexWriter.unlock(store.... |
@Inject public RecoverySource(Settings settings, ThreadPool threadPool, TransportService transportService, IndicesService indicesService) {
super(settings);
this.threadPool = threadPool;
this.transportService = transportService;
this.indicesService = indicesService;
int conc... | @Inject public RecoverySource(Settings settings, ThreadPool threadPool, TransportService transportService, IndicesService indicesService) {
super(settings);
this.threadPool = threadPool;
this.transportService = transportService;
this.indicesService = indicesService;
int conc... |
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, BitmapFontParameter parameter) {
Array<AssetDescriptor> deps = Array.of(AssetDescriptor.class);
if (parameter != null && parameter.bitmapFontData != null) {
data = parameter.bitmapFontData;
return deps;
}
data = new BitmapFo... | public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, BitmapFontParameter parameter) {
Array<AssetDescriptor> deps = new Array();
if (parameter != null && parameter.bitmapFontData != null) {
data = parameter.bitmapFontData;
return deps;
}
data = new BitmapFontData(file, paramet... |
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, ParticleEffectParameter param) {
Array<AssetDescriptor> deps = null;
if (param != null && param.atlasFile != null) {
deps = Array.of(AssetDescriptor.class);
deps.add(new AssetDescriptor<TextureAtlas>(param.atlasFile, TextureAtla... | public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, ParticleEffectParameter param) {
Array<AssetDescriptor> deps = null;
if (param != null && param.atlasFile != null) {
deps = new Array();
deps.add(new AssetDescriptor<TextureAtlas>(param.atlasFile, TextureAtlas.class));
}
ret... |
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle atlasFile, TextureAtlasParameter parameter) {
FileHandle imgDir = atlasFile.parent();
if (parameter != null)
data = new TextureAtlasData(atlasFile, imgDir, parameter.flip);
else {
data = new TextureAtlasData(atlasFile, imgDir, fals... | public Array<AssetDescriptor> getDependencies (String fileName, FileHandle atlasFile, TextureAtlasParameter parameter) {
FileHandle imgDir = atlasFile.parent();
if (parameter != null)
data = new TextureAtlasData(atlasFile, imgDir, parameter.flip);
else {
data = new TextureAtlasData(atlasFile, imgDir, fals... |
protected Array<Decal> newObject () {
return Array.of(Decal.class);
}
};
| protected Array<Decal> newObject () {
return new Array();
}
};
|
public void create () {
batch = new SpriteBatch();
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.position.set(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, 0);
camera.update();
Pixmap pixmap1 = new Pixmap(Gdx.files.internal("data/badlogic.jpg"));
... | public void create () {
batch = new SpriteBatch();
camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.position.set(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, 0);
camera.update();
Pixmap pixmap1 = new Pixmap(Gdx.files.internal("data/badlogic.jpg"));
... |
public static void main (String[] argv) {
new AngleApplication(new com.badlogic.gdx.tests.MeshShaderTest(), "Angle Test", 480, 320, false);
}
| public static void main (String[] argv) {
new AngleApplication(new com.badlogic.gdx.tests.gles2.SimpleVertexShader(), "Angle Test", 480, 320, true);
}
|
public void run() {
try {
sendPings(timeout, TimeValue.timeValueMillis(timeout.millis() / 2), sendPingsHandler);
ConcurrentMap<DiscoveryNode, PingResponse> responses = receivedResponses.remove(sendPingsHandler.id());
... | public void run() {
try {
sendPings(timeout, TimeValue.timeValueMillis(timeout.millis() / 2), sendPingsHandler);
ConcurrentMap<DiscoveryNode, PingResponse> responses = receivedResponses.remove(sendPingsHandler.id());
... |
@Override public void create () {
model = new MD2Loader().load(Gdx.files.internal("data/knight.md2").read());
Material material = new Material("knight", new TextureAttribute(new Texture("data/knight.jpg"), 0, "a_tex0"));
model.setMaterial(material);
cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), G... | @Override public void create () {
model = new MD2Loader().load(Gdx.files.internal("data/knight.md2").read(), 0.2f);
Material material = new Material("knight", new TextureAttribute(new Texture("data/knight.jpg"), 0, "a_tex0"));
model.setMaterial(material);
cam = new PerspectiveCamera(67, Gdx.graphics.getWidt... |
private static String buildMessage(SearchContext context, String msg) {
StringBuilder sb = new StringBuilder();
sb.append('[').append(context.shardTarget().index()).append("][").append(context.shardTarget().shardId()).append("]: ");
sb.append("query[").append(context.query()).append("],from[... | private static String buildMessage(SearchContext context, String msg) {
StringBuilder sb = new StringBuilder();
sb.append('[').append(context.shardTarget().index()).append("][").append(context.shardTarget().shardId()).append("]: ");
sb.append("query[").append(context.originalQuery()).append(... |
public static int calculateUncompressedSize(byte[] data, int ptr, int length) throws IOException {
int uncompressedSize = 0;
int blockNr = 0;
final int end = ptr + length;
while (ptr < end) {
// can use optional end marker
if (ptr == (data.length + 1) && data... | public static int calculateUncompressedSize(byte[] data, int ptr, int length) throws IOException {
int uncompressedSize = 0;
int blockNr = 0;
final int end = ptr + length;
while (ptr < end) {
// can use optional end marker
if (ptr == (data.length + 1) && data... |
public FieldMetadata (Field field) {
this.field = field;
int index = (ClassReflection.isAssignableFrom(ObjectMap.class, field.getType()) || ClassReflection.isAssignableFrom(
HashMap.class, field.getType())) ? 1 : 0;
this.elementType = field.getElementType(index);
}
}
| public FieldMetadata (Field field) {
this.field = field;
int index = (ClassReflection.isAssignableFrom(ObjectMap.class, field.getType()) || ClassReflection.isAssignableFrom(
Map.class, field.getType())) ? 1 : 0;
this.elementType = field.getElementType(index);
}
}
|
public void testRandom() throws IOException {
int iterations = atLeast(400); // don't worry that is fast!
for (int iter = 0; iter < iterations; iter++) {
int numClauses = 1 + random().nextInt(10);
FilterClause[] clauses = new FilterClause[numClauses];
BooleanQuery... | public void testRandom() throws IOException {
int iterations = atLeast(400); // don't worry that is fast!
for (int iter = 0; iter < iterations; iter++) {
int numClauses = 1 + random().nextInt(10);
FilterClause[] clauses = new FilterClause[numClauses];
BooleanQuery... |
public void onTestFailure(ITestResult result) {
logger.error("==> Test Success [{}]", extractTestName(result));
}
| public void onTestFailure(ITestResult result) {
logger.error("==> Test Failure [{}]", extractTestName(result));
}
|
private StoreFilesMetaData listStoreMetaData(ShardId shardId) throws IOException {
IndexService indexService = indicesService.indexService(shardId.index().name());
if (indexService != null) {
InternalIndexShard indexShard = (InternalIndexShard) indexService.shard(shardId.id());
... | private StoreFilesMetaData listStoreMetaData(ShardId shardId) throws IOException {
IndexService indexService = indicesService.indexService(shardId.index().name());
if (indexService != null) {
InternalIndexShard indexShard = (InternalIndexShard) indexService.shard(shardId.id());
... |
public void end( )
{
if( idxPos == 0 )
return;
gl.glEnableClientState( GL10.GL_VERTEX_ARRAY );
positionsBuffer.clear();
positionsBuffer.put( positions, 0, idxPos );
positionsBuffer.flip();
gl.glVertexPointer( 3, GL10.GL_FLOAT, 0, positionsBuffer );
if( colorsDefined )
{
gl.glEnableClientS... | public void end( )
{
if( idxPos == 0 )
return;
gl.glEnableClientState( GL10.GL_VERTEX_ARRAY );
positionsBuffer.clear();
positionsBuffer.put( positions, 0, idxPos );
positionsBuffer.flip();
gl.glVertexPointer( 3, GL10.GL_FLOAT, 0, positionsBuffer );
if( colorsDefined )
{
gl.glEnableClientS... |
protected AbstractConcurrentMapFilterCache(Index index, @IndexSettings Settings indexSettings, ThreadPool threadPool,
ConcurrentMap<IndexReader, ConcurrentMap<Filter, DocIdSet>> cache) {
super(index, indexSettings);
this.cache = cache;
this.rea... | protected AbstractConcurrentMapFilterCache(Index index, @IndexSettings Settings indexSettings, ThreadPool threadPool,
ConcurrentMap<IndexReader, ConcurrentMap<Filter, DocIdSet>> cache) {
super(index, indexSettings);
this.cache = cache;
this.rea... |
public boolean touchMoved (float x, float y) {
if (!touchable || !visible) return false;
int len = children.size() - 1;
for (int i = len; i >= 0; i--) {
Actor child = children.get(i);
if (!child.touchable || !child.touchable) continue;
toChildCoordinates(child, x, y, point);
if (child.touchMoved(p... | public boolean touchMoved (float x, float y) {
if (!touchable || !visible) return false;
int len = children.size() - 1;
for (int i = len; i >= 0; i--) {
Actor child = children.get(i);
if (!child.touchable || !child.visible) continue;
toChildCoordinates(child, x, y, point);
if (child.touchMoved(poi... |
public BufferFormat getBufferFormat () {
return new BufferFormat(8, 8, 8, 0, 16, config.stencil?8:0, 0, false); // FIXME
}
| public BufferFormat getBufferFormat () {
return new BufferFormat(8, 8, 8, 0, 16, config.stencil?8:0, 0, false);
}
|
public ShardCountRequest(String index, int shardId, @Nullable String[] filteringAliases, CountRequest request) {
super(index, shardId, request);
this.minScore = request.minScore();
this.querySource = request.querySource();
this.types = request.types();
this.filteringAliases =... | public ShardCountRequest(String index, int shardId, @Nullable String[] filteringAliases, CountRequest request) {
super(index, shardId, request);
this.minScore = request.minScore();
this.querySource = request.source();
this.types = request.types();
this.filteringAliases = filt... |
@Override public void run() {
try {
RecoveryResponse response = recover(request);
channel.sendResponse(response);
} catch (Exception e) {
try {
channel.sendResponse... | @Override public void run() {
try {
RecoveryResponse response = recover(request);
channel.sendResponse(response);
} catch (Exception e) {
try {
channel.sendResponse... |
public void onFailure(Throwable e) {
if (!(ExceptionsHelper.unwrapCause(e) instanceof IndexAlreadyExistsException)) {
// fail all requests involving this index, if create didnt work
for (int i = 0; i < bu... | public void onFailure(Throwable e) {
if (!(ExceptionsHelper.unwrapCause(e) instanceof IndexAlreadyExistsException)) {
// fail all requests involving this index, if create didnt work
for (int i = 0; i < bu... |
public InternalClusterInfoService(Settings settings, NodeSettingsService nodeSettingsService,
TransportNodesStatsAction transportNodesStatsAction,
TransportIndicesStatsAction transportIndicesStatsAction, ClusterService clusterService,
... | public InternalClusterInfoService(Settings settings, NodeSettingsService nodeSettingsService,
TransportNodesStatsAction transportNodesStatsAction,
TransportIndicesStatsAction transportIndicesStatsAction, ClusterService clusterService,
... |
public Vector3 getEndPoint (float distance) {
return new Vector3(origin).add(direction.tmp().scl(distance));
}
| public Vector3 getEndPoint (float distance) {
return new Vector3(origin).add(direction.tmp().mul(distance));
}
|
public void create () {
camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.position.set(0, 2, 3).nor().scl(10);
camera.lookAt(0, 0, 0);
camera2 = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera2.position.set(-3, 2, 0);
camera2... | public void create () {
camera = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.position.set(0, 2, 3).nor().mul(10);
camera.lookAt(0, 0, 0);
camera2 = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera2.position.set(-3, 2, 0);
camera2... |
public BulletEntity shoot(final String what, final float x, final float y, final float impulse) {
// Shoot a box
Ray ray = camera.getPickRay(x, y);
BulletEntity entity = world.add(what, ray.origin.x, ray.origin.y, ray.origin.z);
entity.color.set(0.5f + 0.5f * (float)Math.random(), 0.5f + 0.5f * (float)Math.ran... | public BulletEntity shoot(final String what, final float x, final float y, final float impulse) {
// Shoot a box
Ray ray = camera.getPickRay(x, y);
BulletEntity entity = world.add(what, ray.origin.x, ray.origin.y, ray.origin.z);
entity.color.set(0.5f + 0.5f * (float)Math.random(), 0.5f + 0.5f * (float)Math.ran... |
protected String executor() {
return ThreadPool.Names.CACHED;
}
| protected String executor() {
return ThreadPool.Names.GENERIC;
}
|
public String executor() {
return ThreadPool.Names.CACHED;
}
}
| public String executor() {
return ThreadPool.Names.GENERIC;
}
}
|
public String executor() {
return ThreadPool.Names.CACHED;
}
| public String executor() {
return ThreadPool.Names.GENERIC;
}
|
public static void main(String[] args) {
final String executor = ThreadPool.Names.CACHED;
final boolean waitForRequest = true;
final ByteSizeValue payloadSize = new ByteSizeValue(100, ByteSizeUnit.BYTES);
final int NUMBER_OF_CLIENTS = 1;
final int NUMBER_OF_ITERATIONS = 10000... | public static void main(String[] args) {
final String executor = ThreadPool.Names.GENERIC;
final boolean waitForRequest = true;
final ByteSizeValue payloadSize = new ByteSizeValue(100, ByteSizeUnit.BYTES);
final int NUMBER_OF_CLIENTS = 1;
final int NUMBER_OF_ITERATIONS = 1000... |
public NettyHttpServerTransport(Settings settings, NetworkService networkService) {
super(settings);
this.networkService = networkService;
if (settings.getAsBoolean("netty.epollBugWorkaround", false)) {
System.setProperty("org.jboss.netty.epollBugWorkaround", "true");
}
... | public NettyHttpServerTransport(Settings settings, NetworkService networkService) {
super(settings);
this.networkService = networkService;
if (settings.getAsBoolean("netty.epollBugWorkaround", false)) {
System.setProperty("org.jboss.netty.epollBugWorkaround", "true");
}
... |
public RobinEngine(ShardId shardId, @IndexSettings Settings indexSettings, ThreadPool threadPool,
IndexSettingsService indexSettingsService, ShardIndexingService indexingService, @Nullable IndicesWarmer warmer,
Store store, SnapshotDeletionPolicy deletionPolicy, Translo... | public RobinEngine(ShardId shardId, @IndexSettings Settings indexSettings, ThreadPool threadPool,
IndexSettingsService indexSettingsService, ShardIndexingService indexingService, @Nullable IndicesWarmer warmer,
Store store, SnapshotDeletionPolicy deletionPolicy, Translo... |
protected void drawChildren (SpriteBatch batch, float parentAlpha) {
parentAlpha *= color.a;
if (cullingArea != null) {
if (transform) {
for (int i = 0; i < children.size(); i++) {
Actor child = children.get(i);
if (!child.visible) continue;
if (child.x <= cullingArea.x + cullingArea.width &&... | protected void drawChildren (SpriteBatch batch, float parentAlpha) {
parentAlpha *= color.a;
if (cullingArea != null) {
if (transform) {
for (int i = 0; i < children.size(); i++) {
Actor child = children.get(i);
if (!child.visible) continue;
if (child.x <= cullingArea.x + cullingArea.width &&... |
public AtomicGeoPointFieldData<ScriptDocValues> loadDirect(AtomicReaderContext context) throws Exception {
AtomicReader reader = context.reader();
Terms terms = reader.terms(getFieldNames().indexName());
AtomicGeoPointFieldData data = null;
// TODO: Use an actual estimator to estima... | public AtomicGeoPointFieldData<ScriptDocValues> loadDirect(AtomicReaderContext context) throws Exception {
AtomicReader reader = context.reader();
Terms terms = reader.terms(getFieldNames().indexName());
AtomicGeoPointFieldData data = null;
// TODO: Use an actual estimator to estima... |
protected FieldDataType getFieldDataType() {
return new FieldDataType("double");
}
| protected FieldDataType getFieldDataType() {
return new FieldDataType("double", getFieldDataSettings());
}
|
protected FieldDataType getFieldDataType() {
return new FieldDataType("float");
}
| protected FieldDataType getFieldDataType() {
return new FieldDataType("float", getFieldDataSettings());
}
|
public void close(boolean delete) {
}
} | public void close() {
}
} |
public void tearDown() {
translog.close(true);
}
| public void tearDown() {
translog.closeWithDelete();
}
|
public static void main (String[] argv) {
new SharedLibraryLoader("../../gdx/libs/gdx-natives.jar").load("gdx");
GdxTest test = new MD5Test();
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.useGL20 = test.needsGL20();
config.vSyncEnabled = true;
config.resizable = true;
... | public static void main (String[] argv) {
new SharedLibraryLoader("../../gdx/libs/gdx-natives.jar").load("gdx");
GdxTest test = new InputTest();
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.useGL20 = test.needsGL20();
config.vSyncEnabled = true;
config.resizable = true... |
public void create () {
// Gdx.input = new RemoteInput();
Gdx.input.setInputProcessor(this);
Gdx.input.setCursorCatched(true);
}
| public void create () {
// Gdx.input = new RemoteInput();
Gdx.input.setInputProcessor(this);
// Gdx.input.setCursorCatched(true);
}
|
public void create () {
Gdx.app.log("MD5 Test", "created");
boolean useNormals = false;
model = MD5Loader.loadModel(Gdx.files.internal("data/zfat.md5mesh").read(), useNormals);
anim = MD5Loader.loadAnimation(Gdx.files.internal("data/walk1.md5anim").read());
skeleton = new MD5Joints();
skeleton.joints = new... | public void create () {
Gdx.app.log("MD5 Test", "created");
boolean useNormals = false;
model = MD5Loader.loadModel(Gdx.files.internal("data/zfat.md5mesh").read(), useNormals);
anim = MD5Loader.loadAnimation(Gdx.files.internal("data/walk1.md5anim").read());
skeleton = new MD5Joints();
skeleton.joints = new... |
private VertexAttribute[] parseAttributes (Array<Object> attributes) {
Array<VertexAttribute> vertexAttributes = new Array<VertexAttribute>();
int unit = 0;
for(Object attribute: attributes) {
String attr = (String)attribute;
if(attr.equals("POSITION")) {
vertexAttributes.add(VertexAttribute.Position()... | private VertexAttribute[] parseAttributes (Array<Object> attributes) {
Array<VertexAttribute> vertexAttributes = new Array<VertexAttribute>();
int unit = 0;
for(Object attribute: attributes) {
String attr = (String)attribute;
if(attr.equals("POSITION")) {
vertexAttributes.add(VertexAttribute.Position()... |
protected NodeInfo nodeOperation(NodeInfoRequest nodeRequest) throws ElasticsearchException {
NodesInfoRequest request = nodeRequest.request;
return nodeService.info(request.settings(), request.os(), request.process(), request.jvm(), request.threadPool(),
request.network(), request.t... | protected NodeInfo nodeOperation(NodeInfoRequest nodeRequest) throws ElasticsearchException {
NodesInfoRequest request = nodeRequest.request;
return nodeService.info(request.settings(), request.os(), request.process(), request.jvm(), request.threadPool(),
request.network(), request.t... |
public void testNodeInfoPlugin() throws URISyntaxException {
// We start four nodes
// The first has no plugin
String server1NodeId = startNodeWithPlugins(1);
// The second has one site plugin with a es-plugin.properties file (description and version)
String server2NodeId = s... | public void testNodeInfoPlugin() throws URISyntaxException {
// We start four nodes
// The first has no plugin
String server1NodeId = startNodeWithPlugins(1);
// The second has one site plugin with a es-plugin.properties file (description and version)
String server2NodeId = s... |
private void assertPluginLoaded(String pluginName) {
NodesInfoResponse nodesInfoResponse = client().admin().cluster().prepareNodesInfo().clear().setPlugin(true).get();
assertThat(nodesInfoResponse.getNodes().length, equalTo(1));
assertThat(nodesInfoResponse.getNodes()[0].getPlugins().getInfo... | private void assertPluginLoaded(String pluginName) {
NodesInfoResponse nodesInfoResponse = client().admin().cluster().prepareNodesInfo().clear().setPlugins(true).get();
assertThat(nodesInfoResponse.getNodes().length, equalTo(1));
assertThat(nodesInfoResponse.getNodes()[0].getPlugins().getInf... |
public static final List<Class<? extends GdxTest>> tests = new ArrayList<Class<? extends GdxTest>>(Arrays.asList(
AnimationTest.class, AccelerometerTest.class, ActionTest.class, ActionSequenceTest.class,
GroupTest.class, AlphaTest.class, AtlasIssueTest.class, AssetManagerTest.class, FilterPerformanceTest.class,
... | public static final List<Class<? extends GdxTest>> tests = new ArrayList<Class<? extends GdxTest>>(Arrays.asList(
AnimationTest.class, AccelerometerTest.class, ActionTest.class, ActionSequenceTest.class,
GroupTest.class, AlphaTest.class, AtlasIssueTest.class, AssetManagerTest.class, FilterPerformanceTest.class,
... |
public void hide () {
System.out.println("dispose intro");
batch.dispose();
intro.getTexture().dispose();
}
| public void hide () {
Gdx.app.debug("Cubocy", "dispose intro");
batch.dispose();
intro.getTexture().dispose();
}
|
public void hide () {
System.out.println("dispose game screen");
renderer.dispose();
controlRenderer.dispose();
}
| public void hide () {
Gdx.app.debug("Cubocy", "dispose game screen");
renderer.dispose();
controlRenderer.dispose();
}
|
public void hide () {
System.out.println("dispose main menu");
batch.dispose();
title.getTexture().dispose();
}
| public void hide () {
Gdx.app.debug("Cubocy", "dispose main menu");
batch.dispose();
title.getTexture().dispose();
}
|
public static Account getAccount(final AccountManager manager, final Activity activity) {
final boolean loggable = Log.isLoggable(TAG, DEBUG);
if (loggable)
Log.d(TAG, "Getting account");
if (activity == null)
throw new RuntimeException("Can't create new GitHub accou... | public static Account getAccount(final AccountManager manager, final Activity activity) {
final boolean loggable = Log.isLoggable(TAG, DEBUG);
if (loggable)
Log.d(TAG, "Getting account");
if (activity == null)
throw new IllegalArgumentException("Activity cannot be nu... |
public static void main (String[] argv) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.width = 800;
config.height = 480;
config.useGL20 = true;
new LwjglApplication(new ETC1Test(), config);
}
| public static void main (String[] argv) {
LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
config.width = 800;
config.height = 480;
config.useGL20 = true;
new LwjglApplication(new AssetManagerTest(), config);
}
|
public static void buildBroadcastShardsHeader(XContentBuilder builder, BroadcastOperationResponse response) throws IOException {
builder.startObject("_shards");
builder.field("total", response.getTotalShards());
builder.field("successful", response.getSuccessfulShards());
builder.fie... | public static void buildBroadcastShardsHeader(XContentBuilder builder, BroadcastOperationResponse response) throws IOException {
builder.startObject("_shards");
builder.field("total", response.getTotalShards());
builder.field("successful", response.getSuccessfulShards());
builder.fie... |
public SuggestBuilder suggest() {
if (suggestBuilder == null) {
suggestBuilder = new SuggestBuilder();
}
return suggestBuilder;
}
| public SuggestBuilder suggest() {
if (suggestBuilder == null) {
suggestBuilder = new SuggestBuilder("suggest");
}
return suggestBuilder;
}
|
public void readFrom(StreamInput in) throws IOException {
hits = readSearchHits(in);
if (in.readBoolean()) {
facets = InternalFacets.readFacets(in);
}
if (in.readBoolean()) {
suggest = Suggest.readSuggest(in);
}
timedOut = in.readBoolean();
... | public void readFrom(StreamInput in) throws IOException {
hits = readSearchHits(in);
if (in.readBoolean()) {
facets = InternalFacets.readFacets(in);
}
if (in.readBoolean()) {
suggest = Suggest.readSuggest(Suggest.Fields.SUGGEST, in);
}
timedOut... |
public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
id = in.readLong();
// shardTarget = readSearchShardTarget(in);
from = in.readVInt();
size = in.readVInt();
topDocs = readTopDocs(in);
if (in.readBoolean()) {
facets = Int... | public void readFrom(StreamInput in) throws IOException {
super.readFrom(in);
id = in.readLong();
// shardTarget = readSearchShardTarget(in);
from = in.readVInt();
size = in.readVInt();
topDocs = readTopDocs(in);
if (in.readBoolean()) {
facets = Int... |
public void onFailure(Throwable e) {
try {
channel.sendResponse(new XContentThrowableRestResponse(request, e));
} catch (IOException e1) {
logger.error("Failed to send failure response", e1);
}
}
});
... | public void onFailure(Throwable e) {
try {
channel.sendResponse(new XContentThrowableRestResponse(request, e));
} catch (IOException e1) {
logger.error("Failed to send failure response", e1);
}
}
});
... |
@Override public <T extends Streamable> void sendRequest(final DiscoveryNode node, final long requestId, final String action, final Streamable message, TransportRequestOptions options) throws IOException, TransportException {
Channel targetChannel = nodeChannel(node);
if (compress) {
op... | @Override public <T extends Streamable> void sendRequest(final DiscoveryNode node, final long requestId, final String action, final Streamable message, TransportRequestOptions options) throws IOException, TransportException {
Channel targetChannel = nodeChannel(node);
if (compress) {
op... |
public void onFailure(Throwable t) {
if (logger.isDebugEnabled()) {
logger.debug("[{}] Failed to execute query phase", t, querySearchRequest.id());
}
AsyncAction.this.addShardFailure(shardIndex, dfsResult.shardTarget(), ... | public void onFailure(Throwable t) {
if (logger.isDebugEnabled()) {
logger.debug("[{}] Failed to execute query phase", t, querySearchRequest.id());
}
AsyncAction.this.addShardFailure(shardIndex, dfsResult.shardTarget(), ... |
public void onFailure(Throwable t) {
if (logger.isDebugEnabled()) {
logger.debug("[{}] Failed to execute fetch phase", t, fetchSearchRequest.id());
}
AsyncAction.this.addShardFailure(shardIndex, shardTarget, t);
... | public void onFailure(Throwable t) {
if (logger.isDebugEnabled()) {
logger.debug("[{}] Failed to execute fetch phase", t, fetchSearchRequest.id());
}
AsyncAction.this.addShardFailure(shardIndex, shardTarget, t);
... |
public static ByteBuffer allocateDirect (int capacity) {
if (capacity < 0) {
throw new IllegalArgumentException();
}
return BufferFactory.newDirectByteBuffer(capacity);
}
| public static ByteBuffer allocateDirect (int capacity) {
if (capacity < 0) {
throw new IllegalArgumentException();
}
return BufferFactory.newByteBuffer(capacity);
}
|
protected IOSApplication createApplication() {
IOSApplicationConfiguration config = new IOSApplicationConfiguration();
return new IOSApplication(new BulletTestCollection(), config);
}
| protected IOSApplication createApplication() {
IOSApplicationConfiguration config = new IOSApplicationConfiguration();
return new IOSApplication(new PingPongSocketExample(), config);
}
|
public boolean overlaps (Circle c) {
float dx = x - c.x;
float dy = y - c.y;
float distance = dx * dx + dy * dy;
float radiusSum = radius + c.radius;
return distance <= radiusSum * radiusSum;
}
| public boolean overlaps (Circle c) {
float dx = x - c.x;
float dy = y - c.y;
float distance = dx * dx + dy * dy;
float radiusSum = radius + c.radius;
return distance < radiusSum * radiusSum;
}
|
public CacheStats stats() {
return new CacheStats(fieldDataCache.evictions(), fieldDataCache.sizeInBytes(), filterCache.sizeInBytes(), bloomCache.sizeInBytes());
}
| public CacheStats stats() {
return new CacheStats(fieldDataCache.evictions(), filterCache.evictions(), fieldDataCache.sizeInBytes(), filterCache.sizeInBytes(), filterCache.count(), bloomCache.sizeInBytes());
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.