buggy_function
stringlengths
1
391k
fixed_function
stringlengths
0
392k
public void initialize(ApplicationListener listener, AndroidApplicationConfiguration config) { graphics = new AndroidGraphicsLiveWallpaper(this, config.useGL20, config.resolutionStrategy==null?new FillResolutionStrategy():config.resolutionStrategy); input = new AndroidInput(this, this.getService(), null, config); ...
public void initialize(ApplicationListener listener, AndroidApplicationConfiguration config) { graphics = new AndroidGraphicsLiveWallpaper(this, config.useGL20, config.resolutionStrategy==null?new FillResolutionStrategy():config.resolutionStrategy); input = AndroidInputFactory.newAndroidInput(this, this.getService...
@Inject public NettyHttpServerTransport(Settings settings, NetworkService networkService) { super(settings); this.networkService = networkService; ByteSizeValue maxContentLength = componentSettings.getAsBytesSize("max_content_length", settings.getAsBytesSize("http.max_content_length", new By...
@Inject public NettyHttpServerTransport(Settings settings, NetworkService networkService) { super(settings); this.networkService = networkService; ByteSizeValue maxContentLength = componentSettings.getAsBytesSize("max_content_length", settings.getAsBytesSize("http.max_content_length", new By...
@Inject public NettyMemcachedServerTransport(Settings settings, RestController restController, NetworkService networkService) { super(settings); this.restController = restController; this.networkService = networkService; this.workerCount = componentSettings.getAsInt("worker_count", ...
@Inject public NettyMemcachedServerTransport(Settings settings, RestController restController, NetworkService networkService) { super(settings); this.restController = restController; this.networkService = networkService; this.workerCount = componentSettings.getAsInt("worker_count", ...
public void testUpdatePrecision() throws Exception { prepareCreate("test").addMapping("type1", XContentFactory.jsonBuilder().startObject() .startObject("type1") .startObject("properties") .startObject("pin") .field("type...
public void testUpdatePrecision() throws Exception { prepareCreate("test").addMapping("type1", XContentFactory.jsonBuilder().startObject() .startObject("type1") .startObject("properties") .startObject("pin") .field("type...
public String[] concreteIndices(String[] aliasesOrIndices, IndicesOptions indicesOptions) throws IndexMissingException { if (isAllIndices(aliasesOrIndices)) { String[] concreteIndices; if (indicesOptions.expandWildcardsOpen() && indicesOptions.expandWildcardsClosed()) { ...
public String[] concreteIndices(String[] aliasesOrIndices, IndicesOptions indicesOptions) throws IndexMissingException { if (isAllIndices(aliasesOrIndices)) { String[] concreteIndices; if (indicesOptions.expandWildcardsOpen() && indicesOptions.expandWildcardsClosed()) { ...
protected GroupShardsIterator shards(ClusterState clusterState, ValidateQueryRequest request, String[] concreteIndices) { // Hard-code routing to limit request to a single shard, but still, randomize it... Map<String, Set<String>> routingMap = clusterState.metaData().resolveSearchRouting(Integer.toS...
protected GroupShardsIterator shards(ClusterState clusterState, ValidateQueryRequest request, String[] concreteIndices) { // Hard-code routing to limit request to a single shard, but still, randomize it... Map<String, Set<String>> routingMap = clusterState.metaData().resolveSearchRouting(Integer.toS...
protected GroupShardsIterator shards(ClusterState clusterState, CountRequest request, String[] concreteIndices) { Map<String, Set<String>> routingMap = clusterState.metaData().resolveSearchRouting(request.routing(), request.indices()); return clusterService.operationRouting().searchShards(clusterSta...
protected GroupShardsIterator shards(ClusterState clusterState, CountRequest request, String[] concreteIndices) { Map<String, Set<String>> routingMap = clusterState.metaData().resolveSearchRouting(request.routing(), request.indices()); return clusterService.operationRouting().searchShards(clusterSta...
public static RestResponse buildTextPlainResponse(Table table, RestRequest request, RestChannel channel) { boolean verbose = request.paramAsBoolean("v", true); int[] width = buildWidths(table, request, verbose); Set<String> displayHeaders = buildDisplayHeaders(table, request); Strin...
public static RestResponse buildTextPlainResponse(Table table, RestRequest request, RestChannel channel) { boolean verbose = request.paramAsBoolean("v", false); int[] width = buildWidths(table, request, verbose); Set<String> displayHeaders = buildDisplayHeaders(table, request); Stri...
private void processKeys () { float x0 = (Gdx.input.getX(0) / (float)Gdx.graphics.getWidth()) * 480; float x1 = (Gdx.input.getX(1) / (float)Gdx.graphics.getWidth()) * 480; float y0 = 320 - (Gdx.input.getY(0) / (float)Gdx.graphics.getHeight()) * 320; float y1 = 320 - (Gdx.input.getY(1) / (float)Gdx.graphics.get...
private void processKeys () { float x0 = (Gdx.input.getX(0) / (float)Gdx.graphics.getWidth()) * 480; float x1 = (Gdx.input.getX(1) / (float)Gdx.graphics.getWidth()) * 480; float y0 = 320 - (Gdx.input.getY(0) / (float)Gdx.graphics.getHeight()) * 320; float y1 = 320 - (Gdx.input.getY(1) / (float)Gdx.graphics.get...
public void readFrom(StreamInput in) throws IOException { super.readFrom(in); clusterName = ClusterName.readClusterName(in); clusterState = ClusterState.Builder.readFrom(in, null, clusterName); }
public void readFrom(StreamInput in) throws IOException { super.readFrom(in); clusterName = ClusterName.readClusterName(in); clusterState = ClusterState.Builder.readFrom(in, null); }
protected XContentBuilder doInternalXContent(XContentBuilder builder, Params params) throws IOException { if (ranges.isEmpty()) { throw new SearchSourceBuilderException("at least one range must be defined for range aggregation [" + getName() + "]"); }
protected XContentBuilder doInternalXContent(XContentBuilder builder, Params params) throws IOException { if (ranges.isEmpty()) { throw new SearchSourceBuilderException("at least one range must be defined for range aggregation [" + name + "]"); }
public void testNestedSorting(MultiValueMode sortMode) throws IOException { final String[] values = new String[randomIntBetween(2, 20)]; for (int i = 0; i < values.length; ++i) { values[i] = TestUtil.randomSimpleString(getRandom()); } final int numParents = scaledRandomIn...
public void testNestedSorting(MultiValueMode sortMode) throws IOException { final String[] values = new String[randomIntBetween(2, 20)]; for (int i = 0; i < values.length; ++i) { values[i] = TestUtil.randomSimpleString(getRandom()); } final int numParents = scaledRandomIn...
public void testBasicQuerySanities() { Query childQuery = new TermQuery(new Term("field", "value")); ScoreType scoreType = ScoreType.values()[random().nextInt(ScoreType.values().length)]; ParentFieldMapper parentFieldMapper = SearchContext.current().mapperService().documentMapper("child").pa...
public void testBasicQuerySanities() { Query childQuery = new TermQuery(new Term("field", "value")); ScoreType scoreType = ScoreType.values()[random().nextInt(ScoreType.values().length)]; ParentFieldMapper parentFieldMapper = SearchContext.current().mapperService().documentMapper("child").pa...
protected void assertAvgScoreMode(Filter parentFilter, IndexSearcher searcher) throws IOException { MultiValueMode sortMode = MultiValueMode.AVG; Filter childFilter = new NotFilter(parentFilter); XFieldComparatorSource nestedComparatorSource = createFieldComparator("field2", sortMode, -127, ...
protected void assertAvgScoreMode(Filter parentFilter, IndexSearcher searcher) throws IOException { MultiValueMode sortMode = MultiValueMode.AVG; Filter childFilter = new NotFilter(parentFilter); XFieldComparatorSource nestedComparatorSource = createFieldComparator("field2", sortMode, -127, ...
protected void assertAvgScoreMode(Filter parentFilter, IndexSearcher searcher, IndexFieldData.XFieldComparatorSource innerFieldComparator) throws IOException { MultiValueMode sortMode = MultiValueMode.AVG; Filter childFilter = new NotFilter(parentFilter); XFieldComparatorSource nestedCompara...
protected void assertAvgScoreMode(Filter parentFilter, IndexSearcher searcher, IndexFieldData.XFieldComparatorSource innerFieldComparator) throws IOException { MultiValueMode sortMode = MultiValueMode.AVG; Filter childFilter = new NotFilter(parentFilter); XFieldComparatorSource nestedCompara...
protected Settings nodeSettings(int nodeOrdinal) { return builder().put(super.nodeSettings(nodeOrdinal)).put("gateway.type", "local").build(); }
protected Settings nodeSettings(int nodeOrdinal) { return builder().put("gateway.type", "local").build(); }
protected Settings nodeSettings(int nodeOrdinal) { return settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put("plugin.types", CustomScriptPlugin.class.getName()).build(); }
protected Settings nodeSettings(int nodeOrdinal) { return settingsBuilder().put("plugin.types", CustomScriptPlugin.class.getName()).put(super.nodeSettings(nodeOrdinal)).build(); }
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { return builder.startObject(getName()) .startObject(type) .field("field", "date") ...
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { return builder.startObject(name) .startObject(type) .field("field", "date") ....
protected Settings nodeSettings(int nodeOrdinal) { return ImmutableSettings.settingsBuilder().put(super.nodeSettings(nodeOrdinal)).put("plugin.types", CustomSuggesterPlugin.class.getName()).build(); }
protected Settings nodeSettings(int nodeOrdinal) { return ImmutableSettings.settingsBuilder().put("plugin.types", CustomSuggesterPlugin.class.getName()).put(super.nodeSettings(nodeOrdinal)).build(); }
public static void setupSecondCluster() throws Exception { ElasticsearchIntegrationTest.beforeClass(); // create another cluster cluster2 = new InternalTestCluster(randomLong(), 2, 2, Strings.randomBase64UUID(getRandom()), 0, false, CHILD_JVM_ID); cluster2.beforeTest(getRandom(), 0.1...
public static void setupSecondCluster() throws Exception { ElasticsearchIntegrationTest.beforeClass(); // create another cluster cluster2 = new InternalTestCluster(randomLong(), 2, 2, Strings.randomBase64UUID(getRandom()), 0, false); cluster2.beforeTest(getRandom(), 0.1); clu...
public String toString() { return "[" + index + "][" + type + "][" + id + "]: routing [" + routing + "]"; }
public String toString() { return "get [" + index + "][" + type + "][" + id + "]: routing [" + routing + "]"; }
public BitmapFont loadSync (AssetManager manager, String fileName, FileHandle file, BitmapFontParameter parameter) { if (parameter != null && parameter.atlasName != null) { TextureAtlas atlas = manager.get(parameter.atlasName, TextureAtlas.class); String name = file.sibling(data.imagePaths[0]).nameWithoutExten...
public BitmapFont loadSync (AssetManager manager, String fileName, FileHandle file, BitmapFontParameter parameter) { if (parameter != null && parameter.atlasName != null) { TextureAtlas atlas = manager.get(parameter.atlasName, TextureAtlas.class); String name = file.sibling(data.imagePaths[0]).nameWithoutExten...
public void hideList () { if (list.getParent() == null) return; getStage().removeCaptureListener(list.stageListener); list.addAction(sequence(fadeOut(0.15f, Interpolation.fade), removeActor())); }
public void hideList () { if (list.getParent() == null) return; getStage().removeCaptureListener(list.stageListener) list.addAction(sequence(fadeOut(0.15f, Interpolation.fade), removeActor())); }
public ModelInstance(Model model, final Matrix4 transform, final String nodeId, boolean recursive, boolean parentTransform, boolean mergeTransform) { this.model = model; this.transform = transform == null ? new Matrix4() : transform; nodePartBones.clear(); Node copy, node = model.getNode(nodeId /*, recursive*...
public ModelInstance(Model model, final Matrix4 transform, final String nodeId, boolean recursive, boolean parentTransform, boolean mergeTransform) { this.model = model; this.transform = transform == null ? new Matrix4() : transform; nodePartBones.clear(); Node copy, node = model.getNode(nodeId, recursive); ...
public static String VERSION = "0.51"; }
public static String VERSION = "0.52"; }
@Override public void run() { indexShard.recovering(); StopWatch throttlingWaitTime = new StopWatch().start(); // we know we are on a thread, we can spin till we can engage in recovery while (!recoveryThrottler.tryRecovery(shardId, "gateway")...
@Override public void run() { indexShard.recovering(); StopWatch throttlingWaitTime = new StopWatch().start(); // we know we are on a thread, we can spin till we can engage in recovery while (!recoveryThrottler.tryRecovery(shardId, "gateway")...
@Override public String toString() { return "none"; }
@Override public String toString() { return "_none_"; }
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Object item = parent.getItemAtPosition(position); if (item instanceof RepositoryCommit) startActivity(CommitViewActivity.createIntent(repository, ((RepositoryCommit) item).g...
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Object item = parent.getItemAtPosition(position); if (item instanceof RepositoryCommit) startActivity(CommitViewActivity.createIntent(repository, ((RepositoryCommit) item).g...
public boolean match(DiscoveryNode node) { if (filters.isEmpty()) { return true; } for (Map.Entry<String, String[]> entry : filters.entrySet()) { String attr = entry.getKey(); String[] values = entry.getValue(); if ("_ip".equals(attr)) { ...
public boolean match(DiscoveryNode node) { if (filters.isEmpty()) { return true; } for (Map.Entry<String, String[]> entry : filters.entrySet()) { String attr = entry.getKey(); String[] values = entry.getValue(); if ("_ip".equals(attr)) { ...
protected MergeSchedulerProvider createMergeScheduler() { return new SerialMergeSchedulerProvider(shardId, EMPTY_SETTINGS); }
protected MergeSchedulerProvider createMergeScheduler() { return new SerialMergeSchedulerProvider(shardId, EMPTY_SETTINGS, threadPool); }
protected int getFrameRate () { int frameRate = Display.isActive() ? graphics.config.foregroundFPS : graphics.config.backgroundFPS; if (frameRate == -1) frameRate = 10; if (frameRate == 0) frameRate = graphics.config.backgroundFPS; if (frameRate == 0) frameRate = 30; return frameRate; }
protected int getFrameRate () { int frameRate = Display.isActive() ? graphics.config.foregroundFPS : graphics.config.backgroundFPS; if (frameRate == -1) frameRate = 10; if (frameRate == 0) frameRate = graphics.config.backgroundFPS; if (frameRate == 0) frameRate = 30; return 0; }
public int compare(OrdAndId o1, OrdAndId o2) { if (o1.id < o2.id) { return -1; } if (o1.id == o2.id) { if (o1.ord < o2.ord) { return -1; } if (o1.ord > o2.o...
public int compare(OrdAndId o1, OrdAndId o2) { if (o1.id < o2.id) { return -1; } if (o1.id == o2.id) { if (o1.ord < o2.ord) { return -1; } if (o1.ord > o2.o...
@Override public void parse(XContentParser parser, SearchContext context) throws Exception { XContentParser.Token token; List<FacetCollector> facetCollectors = null; String topLevelFieldName = null; while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { ...
@Override public void parse(XContentParser parser, SearchContext context) throws Exception { XContentParser.Token token; List<FacetCollector> facetCollectors = null; String topLevelFieldName = null; while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { ...
public void setOwnedTextures(Array<Texture> textures) { this.ownedTextures = textures; }
public TiledMap() { tilesets = new TiledMapTileSets(); } /** * Used by TmxMapLoader to set textures when loading the map * directly, without {@link AssetManager}. To be disposed in * {@link #dispose()}. * @param textures */ void setOwnedTextures(Array<Texture> textures) { this.ownedTextures = textur...
protected void loadTileSet(TiledMap map, Element element, FileHandle tmxFile, ImageResolver imageResolver) { if (element.getName().equals("tileset")) { String name = element.get("name", null); int firstgid = element.getIntAttribute("firstgid", 1); int tilewidth = element.getIntAttribute("tilewidth", 0); ...
protected void loadTileSet(TiledMap map, Element element, FileHandle tmxFile, ImageResolver imageResolver) { if (element.getName().equals("tileset")) { String name = element.get("name", null); int firstgid = element.getIntAttribute("firstgid", 1); int tilewidth = element.getIntAttribute("tilewidth", 0); ...
public void initialize (ApplicationListener listener, AndroidApplicationConfiguration config) { if (DEBUG) Log.d(TAG, " > AndroidLiveWallpaperService - initialize()"); app.initialize(listener, config); if (config.getTouchEventsForLiveWallpaper && Integer.parseInt(android.os.Build.VERSION.SDK) >= 7) link...
public void initialize (ApplicationListener listener, AndroidApplicationConfiguration config) { if (DEBUG) Log.d(TAG, " > AndroidLiveWallpaperService - initialize()"); app.initialize(listener, config); if (config.getTouchEventsForLiveWallpaper && Integer.parseInt(android.os.Build.VERSION.SDK) < 9) linke...
@Inject public ZenPingService(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterName clusterName) { super(settings); ImmutableList.Builder<ZenPing> zenPingsBuilder = ImmutableList.builder(); if (componentSettings.getAsBoolean("multicast.enabled", true)) { ...
@Inject public ZenPingService(Settings settings, ThreadPool threadPool, TransportService transportService, ClusterName clusterName) { super(settings); ImmutableList.Builder<ZenPing> zenPingsBuilder = ImmutableList.builder(); if (componentSettings.getAsBoolean("multicast.enabled", true)) { ...
public static byte setError(byte value) { value |= RESPONSE_TYPE; return value; } } void transportServiceAdapter(TransportServiceAdapter service); /** * The address the transport is bound on. */ BoundTransportAddress boundAddress(); /** * Re...
public static byte setError(byte value) { value |= RESPONSE_TYPE; return value; } } void transportServiceAdapter(TransportServiceAdapter service); /** * The address the transport is bound on. */ BoundTransportAddress boundAddress(); /** * Re...
public void beforeGroup (int group, Array<Decal> contents) { if (group == GROUP_BLEND) { Gdx.gl.glEnable(GL10.GL_BLEND); contents.sort(cameraSorter); } else { for (int i = 0, n = contents.size; i < n; i++) { Decal decal = contents.get(i); Array<Decal> materialGroup = materialGroups.get(decal.mater...
public void beforeGroup (int group, Array<Decal> contents) { if (group == GROUP_BLEND) { Gdx.gl.glEnable(GL10.GL_BLEND); contents.sort(cameraSorter); } else { for (int i = 0, n = contents.size; i < n; i++) { Decal decal = contents.get(i); Array<Decal> materialGroup = materialGroups.get(decal.mater...
public void glBufferData (int target, int size, Buffer data, int usage) { if(data == null) throw new GdxRuntimeException("Using null for the data not possible, blame LWJGL"); else if (data instanceof ByteBuffer) GL15.glBufferData(target, (ByteBuffer)data, usage); else if (data instanceof IntBuffer) GL15...
public void glBufferData (int target, int size, Buffer data, int usage) { if(data == null) GL15.glBufferData(target, size, usage); else if (data instanceof ByteBuffer) GL15.glBufferData(target, (ByteBuffer)data, usage); else if (data instanceof IntBuffer) GL15.glBufferData(target, (IntBuffer)data, usage...
static public boolean isInstance (Class c, Object obj) { return isAssignableFrom(c, obj.getClass()); }
static public boolean isInstance (Class c, Object obj) { return obj != null && isAssignableFrom(c, obj.getClass()); }
public Class[] getParameterTypes () { Parameter[] parameters = method.getParameters(); Class[] parameterTypes = new Class[parameters.length]; for (int i = 0, j = parameters.length; i < j; i++) { parameterTypes[i] = parameters[i].getType(); } return parameterTypes; }
public Class[] getParameterTypes () { Parameter[] parameters = method.getParameters(); Class[] parameterTypes = new Class[parameters.length]; for (int i = 0, j = parameters.length; i < j; i++) { parameterTypes[i] = parameters[i].getClazz(); } return parameterTypes; }
public static void generateMipMap (int target, Pixmap pixmap, int textureWidth, int textureHeight) { if (!useHWMipMap) { generateMipMapCPU(target, pixmap, textureWidth, textureHeight); return; } if (Gdx.app.getType() == ApplicationType.Android || Gdx.app.getType() == ApplicationType.WebGL) { if (Gdx.gr...
public static void generateMipMap (int target, Pixmap pixmap, int textureWidth, int textureHeight) { if (!useHWMipMap) { generateMipMapCPU(target, pixmap, textureWidth, textureHeight); return; } if (Gdx.app.getType() == ApplicationType.Android || Gdx.app.getType() == ApplicationType.WebGL || Gdx.app.getTy...
public Array<GridPoint2> line(GridPoint2 start, GridPoint2 end) { return line(start.x, start.y, end.y, end.y); }
public Array<GridPoint2> line(GridPoint2 start, GridPoint2 end) { return line(start.x, start.y, end.x, end.y); }
private boolean canWrite (File file) { if (file.canWrite()) return true; // File exists and is writable. File parent = file.getParentFile(); parent.mkdirs(); if (!parent.isDirectory()) return false; try { new FileOutputStream(file).close(); file.delete(); return true; } catch (Throwable ex) { r...
private boolean canWrite (File file) { if (file.canWrite() && file.canExecute()) return true; // File exists and is writable. File parent = file.getParentFile(); parent.mkdirs(); if (!parent.isDirectory()) return false; try { new FileOutputStream(file).close(); file.delete(); return true; } catch ...
public BigArrays(Settings settings, PageCacheRecycler recycler) { this(settings, recycler, settings.getAsMemory(MAX_SIZE_IN_BYTES_SETTING, "20%").bytes()); }
public BigArrays(Settings settings, PageCacheRecycler recycler) { this(settings, recycler, settings.getAsMemory(MAX_SIZE_IN_BYTES_SETTING, Long.toString(Long.MAX_VALUE)).bytes()); }
public void removeLifecycleListener (LifecycleListener listener) { synchronized(lifecycleListeners) { lifecycleListeners.removeValue(listener, true); } } native static void consoleLog(String message) /*-{ console.log( "GWT: " + message ); }-*/; }
native static public void consoleLog(String message) /*-{ console.log( "GWT: " + message ); }-*/; }
public ApplicationListener getApplicationListener () { return new AssetManagerTest(); }
public ApplicationListener getApplicationListener () { return new GwtTestWrapper(); }
public <T> T readValue (Class<T> type, Class elementType, JsonValue jsonData) { if (jsonData == null) return null; if (jsonData.isObject()) { String className = typeName == null ? null : jsonData.getString(typeName, null); if (className != null) { jsonData.remove(typeName); try { type = (Class<...
public <T> T readValue (Class<T> type, Class elementType, JsonValue jsonData) { if (jsonData == null) return null; if (jsonData.isObject()) { String className = typeName == null ? null : jsonData.getString(typeName, null); if (className != null) { jsonData.remove(typeName); try { type = (Class<...
public MasterFaultDetection(Settings settings, ThreadPool threadPool, TransportService transportService, DiscoveryNodesProvider nodesProvider) { super(settings); this.threadPool = threadPool; this.transportService = transportService; this.nodesProvider = nodesProvider; this....
public MasterFaultDetection(Settings settings, ThreadPool threadPool, TransportService transportService, DiscoveryNodesProvider nodesProvider) { super(settings); this.threadPool = threadPool; this.transportService = transportService; this.nodesProvider = nodesProvider; this....
public NodesFaultDetection(Settings settings, ThreadPool threadPool, TransportService transportService) { super(settings); this.threadPool = threadPool; this.transportService = transportService; this.connectOnNetworkDisconnect = componentSettings.getAsBoolean("connect_on_network_dis...
public NodesFaultDetection(Settings settings, ThreadPool threadPool, TransportService transportService) { super(settings); this.threadPool = threadPool; this.transportService = transportService; this.connectOnNetworkDisconnect = componentSettings.getAsBoolean("connect_on_network_dis...
public NodesStatsResponse() { }
@Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeVInt(nodes.length); for (NodeStats node : nodes) { node.writeTo(out); } } }
package org.elasticsearch.index.mapper.object; /* * 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 Apach...
package org.elasticsearch.index.mapper.object; /* * 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 Apach...
private void validate(Request request, ClusterState state) throws ElasticSearchException { if (state.routingTable().hasIndex(request.index)) { throw new IndexAlreadyExistsException(new Index(request.index)); } if (state.metaData().hasIndex(request.index)) { throw new ...
private void validate(Request request, ClusterState state) throws ElasticSearchException { if (state.routingTable().hasIndex(request.index)) { throw new IndexAlreadyExistsException(new Index(request.index)); } if (state.metaData().hasIndex(request.index)) { throw new ...
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 static Clipboard getDefaultKeyboard() { if(Gdx.app.getType() == ApplicationType.Android) return new AndroidClipboard(); else { try { return (Clipboard)(Class.forName("com.badlogic.gdx.scenes.scene2d.ui.utils.DesktopClipboard").newInstance()); } catch(Exception e) { throw new GdxRuntimeExceptio...
public static Clipboard getDefaultClipboard() { if(Gdx.app.getType() == ApplicationType.Android) return new AndroidClipboard(); else { try { return (Clipboard)(Class.forName("com.badlogic.gdx.scenes.scene2d.ui.utils.DesktopClipboard").newInstance()); } catch(Exception e) { throw new GdxRuntimeExcepti...
public void setCursorPosition (int x, int y) { Mouse.setCursorPosition(x, Gdx.graphics.getHeight() - 1 - y); }
public void setCursorPosition (int x, int y) { Mouse.setCursorPosition(x, y - 1); }
public TextBounds getBounds (CharSequence str) { return getBounds(str, 0, str.length(), cache.getBounds()); }
public TextBounds getBounds (CharSequence str) { return getBounds(str, 0, str.length()); }
public Color getColor () { int intBits = NumberUtils.floatToIntColor(color); Color color = tempColor; color.r = (intBits & 0xff) / 255f; color.g = ((intBits >>> 8) & 0xff) / 255f; color.b = ((intBits >>> 16) & 0xff) / 255f; color.a = ((intBits >>> 24) & 0xff) / 255f; return color; }
public Color getColor () { int intBits = NumberUtils.floatToIntColor(color); Color color = this.tempColor; color.r = (intBits & 0xff) / 255f; color.g = ((intBits >>> 8) & 0xff) / 255f; color.b = ((intBits >>> 16) & 0xff) / 255f; color.a = ((intBits >>> 24) & 0xff) / 255f; return color; }
private static native void nativeArraycopy(Object src, int srcOfs, Object dest, int destOfs, int len) /*-{ // TODO(jgw): using Function.apply() blows up for large arrays (around 8k items at least). if (src == dest && srcOfs < destOfs) { srcOfs += len; for (var destEnd = destOfs + len; destEn...
private static native void nativeArraycopy(Object src, int srcOfs, Object dest, int destOfs, int len) /*-{ // TODO(jgw): using Function.apply() blows up for large arrays (around 8k items at least). if (src == dest && srcOfs < destOfs) { srcOfs += len; for (var destEnd = destOfs + len; destEn...
public boolean overlaps (Sphere sphere) { return center.dst2(sphere.center) < (radius+sphere.radius)*(radius+sphere.radius); }
public boolean overlaps (Sphere sphere) { return center.dst2(sphere.center) < radius * radius + sphere.radius * radius; }
private void testLocal () throws IOException { String path = "meow"; FileHandle handle = Gdx.files.local(path); handle.delete(); if (handle.exists()) fail(); if (handle.isDirectory()) fail(); if (handle.delete()) fail(); if (handle.list().length != 0) fail(); if (handle.child("meow").exists()) fail(); ...
private void testLocal () throws IOException { String path = "meow"; FileHandle handle = Gdx.files.local(path); handle.delete(); if (handle.exists()) fail(); if (handle.isDirectory()) fail(); if (handle.delete()) fail(); if (handle.list().length != 0) fail(); if (handle.child("meow").exists()) fail(); ...
private void drawSolidCircle( Vector2 center, float radius, Vector2 axis, Color color ) { renderer.begin( GL10.GL_LINE_LOOP ); float angle = 0; float angleInc = 2 * (float)Math.PI / 20; for( int i = 0; i < 20; i++, angle += angleInc ) { v.set( (float)Math.cos(angle) * radius + center.x, (float)Math.sin(a...
private void drawSolidCircle( Vector2 center, float radius, Vector2 axis, Color color ) { renderer.begin( GL10.GL_LINE_LOOP ); float angle = 0; float angleInc = 2 * (float)Math.PI / 20; for( int i = 0; i < 20; i++, angle += angleInc ) { v.set( (float)Math.cos(angle) * radius + center.x, (float)Math.sin(a...
public static ESLogger getLogger(String s) { return ESLoggerFactory.getLogger(s); }
public static ESLogger getLogger(String s) { return ESLoggerFactory.getLogger(getLoggerName(s)); }
public BulkRequest add(BytesReference data, boolean contentUnsafe, @Nullable String defaultIndex, @Nullable String defaultType, @Nullable Object payload) throws Exception { XContent xContent = XContentFactory.xContent(data); int from = 0; int length = data.length(); byte marker = xCo...
public BulkRequest add(BytesReference data, boolean contentUnsafe, @Nullable String defaultIndex, @Nullable String defaultType, @Nullable Object payload) throws Exception { XContent xContent = XContentFactory.xContent(data); int from = 0; int length = data.length(); byte marker = xCo...
public static void main (String[] argv) { // this is only here for me to debug native code faster new SharedLibraryLoader("../../gdx/libs/gdx-natives.jar").load("gdx"); new SharedLibraryLoader("../../extensions/gdx-audio/libs/gdx-audio-natives.jar").load("gdx-audio"); GdxTest test = new SpriteBatchTest(); ...
public static void main (String[] argv) { // this is only here for me to debug native code faster new SharedLibraryLoader("../../gdx/libs/gdx-natives.jar").load("gdx"); new SharedLibraryLoader("../../extensions/gdx-audio/libs/gdx-audio-natives.jar").load("gdx-audio"); GdxTest test = new SoundTouchTest(); ...
public int getY () { return app.graphics.getHeight() - 1 - glfwGetCursorPosY(app.graphics.window); }
public int getY () { return glfwGetCursorPosY(app.graphics.window); }
public static void main (String[] argv) { // this is only here for me to debug native code faster // new SharedLibraryLoader("../../extensions/gdx-audio/libs/gdx-audio-natives.jar").load("gdx-audio"); // new SharedLibraryLoader("../../extensions/gdx-image/libs/gdx-image-natives.jar").load("gdx-image"); // new Sha...
public static void main (String[] argv) { // this is only here for me to debug native code faster // new SharedLibraryLoader("../../extensions/gdx-audio/libs/gdx-audio-natives.jar").load("gdx-audio"); // new SharedLibraryLoader("../../extensions/gdx-image/libs/gdx-image-natives.jar").load("gdx-image"); // new Sha...
public void run () { Gdx.app.log("TimerTest", "ping"); } }, 0, 1); }
public void run () { Gdx.app.log("TimerTest", "ping"); } }, 1, 1); }
public void surfaceChanged (int width, int height) { gui.setSize(); }
public void surfaceChanged (int width, int height) { TwlRenderer.updateSize(gui); }
public static void main (String[] argv) { JFrame frame = new JFrame("Gdx - Jogl Test Launcher"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
public static void main (String[] argv) { JFrame frame = new JFrame("GDX - Jogl Test Launcher"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
public static void main (String[] argv) { JFrame frame = new JFrame("Gdx - LWJGL Test Launcher"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
public static void main (String[] argv) { JFrame frame = new JFrame("GDX - LWJGL Test Launcher"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
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 Settings (Settings settings) { fast = settings.fast; rotation = settings.rotation; pot = settings.pot; minWidth = settings.minWidth; minHeight = settings.minHeight; maxWidth = settings.maxWidth; maxHeight = settings.maxHeight; paddingX = settings.paddingX; paddingY = settings.padding...
public Settings (Settings settings) { fast = settings.fast; rotation = settings.rotation; pot = settings.pot; minWidth = settings.minWidth; minHeight = settings.minHeight; maxWidth = settings.maxWidth; maxHeight = settings.maxHeight; paddingX = settings.paddingX; paddingY = settings.padding...
public void glReadPixels (int x, int y, int width, int height, int format, int type, Buffer pixels) { // verify request if ((format != WebGLRenderingContext.UNSIGNED_BYTE) || (type != WebGLRenderingContext.RGBA)) { throw new GdxRuntimeException("Only format UNSIGNED_BYTE for type RGBA is currently supported.");...
public void glReadPixels (int x, int y, int width, int height, int format, int type, Buffer pixels) { // verify request if ((format != WebGLRenderingContext.RGBA) || (type != WebGLRenderingContext.UNSIGNED_BYTE)) { throw new GdxRuntimeException("Only format UNSIGNED_BYTE for type RGBA is currently supported.");...
public void execute(Runnable command) { if (!(command instanceof PrioritizedRunnable)) { command = PrioritizedRunnable.wrap(command, Priority.NORMAL); } super.execute(command); }
public void execute(Runnable command) { if (!(command instanceof Comparable)) { command = PrioritizedRunnable.wrap(command, Priority.NORMAL); } super.execute(command); }
private boolean allocateUnassigned(RoutingNodes routingNodes) { boolean changed = false; List<RoutingNode> nodes = routingNodes.sortedNodesLeastToHigh(); Iterator<MutableShardRouting> unassignedIterator = routingNodes.unassigned().iterator(); int lastNode = 0; while (unassig...
private boolean allocateUnassigned(RoutingNodes routingNodes) { boolean changed = false; List<RoutingNode> nodes = routingNodes.sortedNodesLeastToHigh(); Iterator<MutableShardRouting> unassignedIterator = routingNodes.unassigned().iterator(); int lastNode = 0; while (unassig...
private OnCompletionListener onCompletionListener;
private final OALAudioTrack track; OnCompletionListener onCompletionListener;
@Inject public InternalIndicesService(Settings settings, NodeEnvironment nodeEnv, ThreadPool threadPool, IndicesLifecycle indicesLifecycle, IndicesAnalysisService indicesAnalysisService, IndicesStore indicesStore, Injector injector) { super(settings); this.nodeEnv = nodeEnv; this.threadPool ...
@Inject public InternalIndicesService(Settings settings, NodeEnvironment nodeEnv, ThreadPool threadPool, IndicesLifecycle indicesLifecycle, IndicesAnalysisService indicesAnalysisService, IndicesStore indicesStore, Injector injector) { super(settings); this.nodeEnv = nodeEnv; this.threadPool ...
@Override public void processTokenizers(TokenizersBindings tokenizersBindings) { tokenizersBindings.processTokenizer("standard", StandardTokenizerFactory.class); tokenizersBindings.processTokenizer("uax_url_email", UAX29URLEmailTokenizerFactory.class); tokenizersBindings.proc...
@Override public void processTokenizers(TokenizersBindings tokenizersBindings) { tokenizersBindings.processTokenizer("standard", StandardTokenizerFactory.class); tokenizersBindings.processTokenizer("uax_url_email", UAX29URLEmailTokenizerFactory.class); tokenizersBindings.proc...
private boolean workerCanExit() { final ReentrantLock mainLock = this.mainLock; mainLock.lock(); boolean canExit; try { canExit = runState >= STOP || queueSize.get() == 0; } finally { mainLock.unlock(); } return canExit; }
private boolean workerCanExit() { final ReentrantLock mainLock = this.mainLock; mainLock.lock(); boolean canExit; try { canExit = runState >= STOP || (queueSize.get() == 0 && poolSize.get() > corePoolSize); } finally { mainLock.unlock(); } ...
public void onSurfaceCreated(javax.microedition.khronos.opengles.GL10 gl, EGLConfig config) { setupGL( gl ); if( listener != null ) listener.setup( app ); }
public void onSurfaceCreated(javax.microedition.khronos.opengles.GL10 gl, EGLConfig config) { setupGL( gl ); if( listener != null ) listener.surfaceCreated( app ); }
protected AlertDialog createDialog() { final AlertDialog dialog = new LightAlertDialog(getActivity()); dialog.setTitle(getTitle()); dialog.setMessage(getMessage()); dialog.setCancelable(true); dialog.setOnCancelListener(this); return dialog; }
protected AlertDialog createDialog() { final AlertDialog dialog = LightAlertDialog.create(getActivity()); dialog.setTitle(getTitle()); dialog.setMessage(getMessage()); dialog.setCancelable(true); dialog.setOnCancelListener(this); return dialog; }
@Override public void run() { recoveryStatus.index().addRetryTime(recoveryThrottler.throttleInterval().millis()); if (recoveryThrottler.tryStream(shardId, fileToRecover.name())) { // we managed to get a recovery going ...
@Override public void run() { recoveryStatus.index().addRetryTime(recoveryThrottler.throttleInterval().millis()); if (recoveryThrottler.tryStream(shardId, fileToRecover.name())) { // we managed to get a recovery going ...
protected void configure() { bind(ClusterService.class).toProvider(Providers.of((ClusterService) null)); } } ).createInjector(); String mapping = copyToStringFromClasspath("/org/elasticsearch/test/unit/index/query/mapping.j...
protected void configure() { bind(ClusterService.class).toProvider(Providers.of((ClusterService) null)); } } ).createInjector(); String mapping = copyToStringFromClasspath("/org/elasticsearch/test/unit/index/query/mapping.j...
public void testSnapshotMoreThanOnce() throws ExecutionException, InterruptedException { Client client = client(); logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") .setType("fs").setSettings(ImmutableSettings.set...
public void testSnapshotMoreThanOnce() throws ExecutionException, InterruptedException { Client client = client(); logger.info("--> creating repository"); assertAcked(client.admin().cluster().preparePutRepository("test-repo") .setType("fs").setSettings(ImmutableSettings.set...
public void testSnapshotMoreThanOnce() throws ExecutionException, InterruptedException, IOException { Client client = client(); final File tempDir = newTempDir(LifecycleScope.SUITE).getAbsoluteFile(); logger.info("--> creating repository"); assertAcked(client.admin().cluster().prepa...
public void testSnapshotMoreThanOnce() throws ExecutionException, InterruptedException, IOException { Client client = client(); final File tempDir = newTempDir(LifecycleScope.SUITE).getAbsoluteFile(); logger.info("--> creating repository"); assertAcked(client.admin().cluster().prepa...
protected OptimizeResponse optimize() { waitForRelocation(); OptimizeResponse actionGet = client().admin().indices().prepareOptimize().setForce(randomBoolean()).execute().actionGet(); assertNoFailures(actionGet); return actionGet; }
protected OptimizeResponse optimize() { waitForRelocation(); OptimizeResponse actionGet = client().admin().indices().prepareOptimize().execute().actionGet(); assertNoFailures(actionGet); return actionGet; }
public void testExplainWithFields() throws Exception { client().admin().indices().prepareCreate("test").execute().actionGet(); client().admin().cluster().prepareHealth("test").setWaitForGreenStatus().execute().actionGet(); client().prepareIndex("test", "test", "1") .setSourc...
public void testExplainWithFields() throws Exception { createIndex("test"); client().admin().cluster().prepareHealth("test").setWaitForGreenStatus().execute().actionGet(); client().prepareIndex("test", "test", "1") .setSource( jsonBuilder().startObjec...
public void testOpenCloseUpdateSettings() throws Exception { client().admin().indices().prepareCreate("test").execute().actionGet(); try { client().admin().indices().prepareUpdateSettings("test") .setSettings(ImmutableSettings.settingsBuilder() ...
public void testOpenCloseUpdateSettings() throws Exception { createIndex("test"); try { client().admin().indices().prepareUpdateSettings("test") .setSettings(ImmutableSettings.settingsBuilder() .put("index.refresh_interval", -1) // this o...
public void deleteNonExistentIndexWarmerTest() { client().admin().indices().prepareCreate("test").execute().actionGet(); try { client().admin().indices().prepareDeleteWarmer().setIndices("test").setName("foo").execute().actionGet(1000); assert false : "warmer foo should not ...
public void deleteNonExistentIndexWarmerTest() { createIndex("test"); try { client().admin().indices().prepareDeleteWarmer().setIndices("test").setName("foo").execute().actionGet(1000); assert false : "warmer foo should not exist"; } catch (IndexWarmerMissingExceptio...
public void testFullRollingRestart() throws Exception { cluster().startNode(); client().admin().indices().prepareCreate("test").execute().actionGet(); for (int i = 0; i < 1000; i++) { client().prepareIndex("test", "type1", Long.toString(i)) .setSource(Map...
public void testFullRollingRestart() throws Exception { cluster().startNode(); createIndex("test"); for (int i = 0; i < 1000; i++) { client().prepareIndex("test", "type1", Long.toString(i)) .setSource(MapBuilder.<String, Object>newMapBuilder().put("test",...
public void testSimpleSearchRouting() { client().admin().indices().prepareCreate("test").execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); logger.info("--> indexing with id [1], and routing [0]...
public void testSimpleSearchRouting() { createIndex("test"); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); logger.info("--> indexing with id [1], and routing [0]"); client().prepareIndex("test", "type1", ...
private void verifySource(Boolean compress) throws IOException { try { client().admin().indices().prepareDelete("test").execute().actionGet(); } catch (Exception e) { // ignore } client().admin().indices().prepareCreate("test").execute().actionGet(); c...
private void verifySource(Boolean compress) throws IOException { try { client().admin().indices().prepareDelete("test").execute().actionGet(); } catch (Exception e) { // ignore } createIndex("test"); client().admin().cluster().prepareHealth().setWaitFo...
public void simplePreferenceTests() throws Exception { client().admin().indices().prepareCreate("test").execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); client().prepareIndex("test", "type1")....
public void simplePreferenceTests() throws Exception { createIndex("test"); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); client().prepareIndex("test", "type1").setSource("field1", "value1").execute().actionGet()...
public void create () { Sprite sprite = new Sprite(Gdx.graphics.newTexture(Gdx.files.internal("data/badlogicsmall.jpg"), Linear, Linear, ClampToEdge, ClampToEdge)); sprite.setSize(tileSize, tileSize); cache = new SpriteCache(1000); for (int y = 0; y < tileMapHeight; y++) { cache.beginCache(); for (in...
public void create () { Sprite sprite = new Sprite(Gdx.graphics.newTexture(Gdx.files.internal("data/badlogicsmall.jpg"), Linear, Linear, ClampToEdge, ClampToEdge)); sprite.setSize(tileSize, tileSize); cache = new SpriteCache(1000, false); for (int y = 0; y < tileMapHeight; y++) { cache.beginCache(); ...
@Override public void create () { spriteCache = new SpriteCache(1000); Pixmap pixmap = Gdx.graphics.newPixmap(Gdx.files.getFileHandle("data/badlogicsmall.jpg", FileType.Internal)); texture = Gdx.graphics.newUnmanagedTexture(32, 32, Format.RGB565, TextureFilter.Linear, TextureFilter.Linear, TextureWrap.ClampT...
@Override public void create () { spriteCache = new SpriteCache(1000, true); Pixmap pixmap = Gdx.graphics.newPixmap(Gdx.files.getFileHandle("data/badlogicsmall.jpg", FileType.Internal)); texture = Gdx.graphics.newUnmanagedTexture(32, 32, Format.RGB565, TextureFilter.Linear, TextureFilter.Linear, TextureWrap....
public static XContentBuilder restContentBuilder(RestRequest request, @Nullable BytesReference autoDetectSource) throws IOException { XContentType contentType = XContentType.fromRestContentType(request.param("format", request.header("Content-Type"))); if (contentType == null) { // try an...
public static XContentBuilder restContentBuilder(RestRequest request, @Nullable BytesReference autoDetectSource) throws IOException { XContentType contentType = XContentType.fromRestContentType(request.param("format", request.header("Content-Type"))); if (contentType == null) { // try an...
public void addImage (File file) { BufferedImage image; try { image = ImageIO.read(file); } catch (IOException ex) { throw new RuntimeException("Error reading image: " + file, ex); } if (image == null) throw new RuntimeException("Unable to read image: " + file); // Strip root dir off front of image ...
public void addImage (File file) { BufferedImage image; try { image = ImageIO.read(file); } catch (IOException ex) { throw new RuntimeException("Error reading image: " + file, ex); } if (image == null) throw new RuntimeException("Unable to read image: " + file); // Strip root dir off front of image ...
public Term createIndexNameTerm(String value) { return indexNameTermFactory.createTerm(value); }
public Term createIndexNameTerm(String value) { return new Term(indexName, value); }