buggy_function
stringlengths
1
391k
fixed_function
stringlengths
0
392k
@Override public void writeTo(DataOutput out) throws IOException { out.write(facets.size()); for (Facet facet : facets) { out.write(facet.type().id()); facet.writeTo(out); } }
@Override public void writeTo(DataOutput out) throws IOException { out.writeInt(facets.size()); for (Facet facet : facets) { out.write(facet.type().id()); facet.writeTo(out); } }
public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); config.useWakelock = true; config.useGL20 = false; initialize(new GdxInv...
public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); config.useWakelock = true; config.useGL20 = true; initialize(new GdxInva...
public static void main (String[] argv) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.title = "Gdx Invaders"; config.vSyncEnabled = true; config.useGL20 = false; new LwjglApplication(new GdxInvaders(), config); }
public static void main (String[] argv) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.title = "Gdx Invaders"; config.vSyncEnabled = true; config.useGL20 = true; new LwjglApplication(new GdxInvaders(), config); }
public TiledMap load (String fileName) { try { FileHandle tideFile = resolve(fileName); root = xml.parse(tideFile); ObjectMap<String, Texture> textures = new ObjectMap<String, Texture>(); for(FileHandle textureFile: loadTileSheets(root, tideFile)) { textures.put(textureFile.path(), new Texture(textur...
public TiledMap load (String fileName) { try { FileHandle tideFile = resolve(fileName); root = xml.parse(tideFile); ObjectMap<String, Texture> textures = new ObjectMap<String, Texture>(); for(FileHandle textureFile: loadTileSheets(root, tideFile)) { textures.put(textureFile.path(), new Texture(textur...
public TiledMap load (String fileName, TmxMapLoader.Parameters parameters) { try { this.yUp = parameters.yUp; FileHandle tmxFile = resolve(fileName); root = xml.parse(tmxFile); ObjectMap<String, Texture> textures = new ObjectMap<String, Texture>(); for (FileHandle textureFile : loadTilesets(root, tmxF...
public TiledMap load (String fileName, TmxMapLoader.Parameters parameters) { try { this.yUp = parameters.yUp; FileHandle tmxFile = resolve(fileName); root = xml.parse(tmxFile); ObjectMap<String, Texture> textures = new ObjectMap<String, Texture>(); for (FileHandle textureFile : loadTilesets(root, tmxF...
private void touch(int x, int y) { t = paths.get(currentPath).approximate(tmpV.set(x, Gdx.graphics.getHeight()-y)); paths.get(currentPath).valueAt(tmpV, t); obj.setPosition(tmpV.x, tmpV.y); wait = 0.2f; }
private void touch(int x, int y) { t = paths.get(currentPath).locate(tmpV.set(x, Gdx.graphics.getHeight()-y)); paths.get(currentPath).valueAt(tmpV, t); obj.setPosition(tmpV.x, tmpV.y); wait = 0.2f; }
public static void main (String[] argv) { new LwjglApplication(new Cubocy(), "Cubocy", 480, 320); // After creating the Application instance we can set the log level to // show the output of calls to Gdx.app.debug Gdx.app.setLogLevel(Application.LOG_DEBUG); }
public static void main (String[] argv) { new LwjglApplication(new Cubocy(), "Cubocy", 480, 320, true); // After creating the Application instance we can set the log level to // show the output of calls to Gdx.app.debug Gdx.app.setLogLevel(Application.LOG_DEBUG); }
public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); initialize(new Metagun()); }
public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); initialize(new Metagun(), false); }
public static void main (String[] argv) { new LwjglApplication(new Metagun(), "Metagun", 320, 240); }
public static void main (String[] argv) { new LwjglApplication(new Metagun(), "Metagun", 320, 240, false); }
public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); initialize(new SuperJumper()); }
public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); initialize(new SuperJumper(), false); }
public static void main (String[] argv) { new LwjglApplication(new SuperJumper(), "Super Jumper", 320, 480); }
public static void main (String[] argv) { new LwjglApplication(new SuperJumper(), "Super Jumper", 320, 480, false); }
public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); initialize(new Bouncy()); }
public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); initialize(new Bouncy(), false); }
public static void main (String[] argv) { new LwjglApplication(new Bouncy(), "Bouncy", 320, 480); }
public static void main (String[] argv) { new LwjglApplication(new Bouncy(), "Bouncy", 320, 480, true); }
public static void main (String[] args) { new LwjglApplication(new VeryAngryRobotsGame(), "Very Angry Robots", WINDOW_WIDTH, WINDOW_HEIGHT); }
public static void main (String[] args) { new LwjglApplication(new VeryAngryRobotsGame(), "Very Angry Robots", WINDOW_WIDTH, WINDOW_HEIGHT, false); }
public void dispose () { } }); }
public void dispose () { } }, false); }
public Hiero4 () { super("Hiero v4.0 - Bitmap Font Tool"); Splash splash = new Splash(this, "/splash.jpg", 2000); initialize(); splash.close(); gamePanel.add(new LwjglCanvas(renderer = new Renderer()).getCanvas()); prefs = Preferences.userNodeForPackage(Hiero4.class); java.awt.Color backgroundColor = E...
public Hiero4 () { super("Hiero v4.0 - Bitmap Font Tool"); Splash splash = new Splash(this, "/splash.jpg", 2000); initialize(); splash.close(); gamePanel.add(new LwjglCanvas(renderer = new Renderer(), false).getCanvas()); prefs = Preferences.userNodeForPackage(Hiero4.class); java.awt.Color backgroundCo...
public void remove () { if (currentIndex < 0) throw new IllegalStateException("next must be called before remove."); if (currentIndex >= map.capacity) { map.removeStashIndex(currentIndex); nextIndex = currentIndex - 1; findNextIndex(); } else { map.keyTable[currentIndex] = null; map.value...
public void remove () { if (currentIndex < 0) throw new IllegalStateException("next must be called before remove."); if (currentIndex >= map.capacity) { map.removeStashIndex(currentIndex); nextIndex = currentIndex; findNextIndex(); } else { map.keyTable[currentIndex] = null; map.valueTabl...
public void remove () { if (currentIndex == INDEX_ZERO && map.hasZeroValue) { map.hasZeroValue = false; } else if (currentIndex < 0) { throw new IllegalStateException("next must be called before remove."); } else if (currentIndex >= map.capacity) { map.removeStashIndex(currentIndex); nextInde...
public void remove () { if (currentIndex == INDEX_ZERO && map.hasZeroValue) { map.hasZeroValue = false; } else if (currentIndex < 0) { throw new IllegalStateException("next must be called before remove."); } else if (currentIndex >= map.capacity) { map.removeStashIndex(currentIndex); nextInde...
public void remove () { if (currentIndex == INDEX_ZERO && map.hasZeroValue) { map.zeroValue = null; map.hasZeroValue = false; } else if (currentIndex < 0) { throw new IllegalStateException("next must be called before remove."); } else if (currentIndex >= map.capacity) { map.removeStashIndex(c...
public void remove () { if (currentIndex == INDEX_ZERO && map.hasZeroValue) { map.zeroValue = null; map.hasZeroValue = false; } else if (currentIndex < 0) { throw new IllegalStateException("next must be called before remove."); } else if (currentIndex >= map.capacity) { map.removeStashIndex(c...
public String[] asStringArray () { if (type != ValueType.array) throw new IllegalStateException("Value is not an array: " + type); String[] array = new String[size]; int i = 0; for (JsonValue value = child; value != null; value = value.next, i++) { String v; switch (value.type) { case stringValue: ...
public String[] asStringArray () { if (type != ValueType.array) throw new IllegalStateException("Value is not an array: " + type); String[] array = new String[size]; int i = 0; for (JsonValue value = child; value != null; value = value.next, i++) { String v; switch (type) { case stringValue: v = v...
public void remove () { if (currentIndex < 0) throw new IllegalStateException("next must be called before remove."); if (currentIndex >= map.capacity) { map.removeStashIndex(currentIndex); nextIndex = currentIndex - 1; findNextIndex(); } else { map.keyTable[currentIndex] = null; } curre...
public void remove () { if (currentIndex < 0) throw new IllegalStateException("next must be called before remove."); if (currentIndex >= map.capacity) { map.removeStashIndex(currentIndex); nextIndex = currentIndex; findNextIndex(); } else { map.keyTable[currentIndex] = null; } currentIn...
public void remove () { if (currentIndex < 0) throw new IllegalStateException("next must be called before remove."); if (currentIndex >= map.capacity) { map.removeStashIndex(currentIndex); nextIndex = currentIndex - 1; advance(); } else { map.keyTable[currentIndex] = null; map.valueTable[...
public void remove () { if (currentIndex < 0) throw new IllegalStateException("next must be called before remove."); if (currentIndex >= map.capacity) { map.removeStashIndex(currentIndex); nextIndex = currentIndex; advance(); } else { map.keyTable[currentIndex] = null; map.valueTable[curr...
public void formatPreCodeOnly() { String html = "<pre><code>a\nb\nc\n</code></pre>"; CharSequence formatted = HtmlUtils.format(html); assertNotNull(formatted); assertEquals("<pre><code>a<br>b<br>c<br></code></pre>", formatted.toString()); }
public void formatPreCodeOnly() { String html = "<pre><code>a\nb\nc\n</code></pre>"; CharSequence formatted = HtmlUtils.format(html); assertNotNull(formatted); assertEquals("<pre><code>a<br>b<br>c</code></pre>", formatted.toString()); }
public void testRandom() throws IOException { String compressor = "lzf"; CompressorFactory.configure(ImmutableSettings.settingsBuilder().put("compress.default.type", compressor).build()); Random r = getRandom(); for (int i = 0; i < 2000; i++) { String string = TestUtil.ra...
public void testRandom() throws IOException { String compressor = "lzf"; CompressorFactory.configure(ImmutableSettings.settingsBuilder().put("compress.default.type", compressor).build()); Random r = getRandom(); for (int i = 0; i < 1000; i++) { String string = TestUtil.ra...
public void display (GLAutoDrawable arg0) { synchronized (this) { if (!paused) { updateTimes(); synchronized (((JoglApplication)Gdx.app).runnables) { JoglApplication app = ((JoglApplication)Gdx.app); app.executedRunnables.clear(); app.executedRunnables.addAll(app.runnables); app.runnab...
public void display (GLAutoDrawable arg0) { synchronized (this) { if (!paused) { updateTimes(); synchronized (((JoglApplication)Gdx.app).runnables) { JoglApplication app = ((JoglApplication)Gdx.app); app.executedRunnables.clear(); app.executedRunnables.addAll(app.runnables); app.runnab...
public boolean isTouched (int pointer) { if (pointer == 0) return touchDown; else return false; } void processEvents () { synchronized (this) { justTouched = false; if (processor != null) { InputProcessor processor = this.processor; int len = keyEvents.size(); for (int i = 0; i < len...
public boolean isTouched (int pointer) { if (pointer == 0) return touchDown; else return false; } void processEvents () { synchronized (this) { justTouched = false; if (processor != null) { InputProcessor processor = this.processor; int len = keyEvents.size(); for (int i = 0; i < len...
public static void disposeUnsafeByteBuffer(ByteBuffer buffer) { int size = buffer.capacity(); synchronized(unsafeBuffers) { if(!unsafeBuffers.removeValue(buffer, true)) throw new IllegalArgumentException("buffer not allocated with newUnsafeByteBuffer or already disposed"); } allocatedUnsafe -= size; ...
public static void disposeUnsafeByteBuffer(ByteBuffer buffer) { int size = 0; synchronized(unsafeBuffers) { if(!unsafeBuffers.removeValue(buffer, true)) throw new IllegalArgumentException("buffer not allocated with newUnsafeByteBuffer or already disposed"); } allocatedUnsafe -= size; freeMemory(buffer...
public ScriptService(Settings settings, Environment env, Set<ScriptEngineService> scriptEngines, ResourceWatcherService resourceWatcherService) { super(settings); int cacheMaxSize = componentSettings.getAsInt("cache.max_size", 500); TimeValue cacheExpire = component...
public ScriptService(Settings settings, Environment env, Set<ScriptEngineService> scriptEngines, ResourceWatcherService resourceWatcherService) { super(settings); int cacheMaxSize = componentSettings.getAsInt("cache.max_size", 500); TimeValue cacheExpire = component...
public void testFieldCollapsing() throws Exception { SearchResponse response = client().prepareSearch("idx").setTypes("field-collapsing") .setSearchType(SearchType.DFS_QUERY_THEN_FETCH) .setQuery(matchQuery("text", "term rare")) .addAggregation(terms("terms") ...
public void testFieldCollapsing() throws Exception { SearchResponse response = client().prepareSearch("idx").setTypes("field-collapsing") .setSearchType(SearchType.DFS_QUERY_THEN_FETCH) .setQuery(matchQuery("text", "term rare")) .addAggregation(terms("terms") ...
public static void main (String[] argv) { new JoglApplication(new com.badlogic.gdx.tests.CullTest(), "Debug Test", 480, 320, false); }
public static void main (String[] argv) { new JoglApplication(new com.badlogic.gdx.tests.UITest(), "Debug Test", 480, 320, false); }
private void touch(int x, int y) { t = paths.get(currentPath).locate(tmpV.set(x, Gdx.graphics.getHeight()-y)); paths.get(currentPath).valueAt(tmpV, t); obj.setPosition(tmpV.x, tmpV.y); wait = 0.2f; }
private void touch(int x, int y) { t = paths.get(currentPath).approximate(tmpV.set(x, Gdx.graphics.getHeight()-y)); paths.get(currentPath).valueAt(tmpV, t); obj.setPosition(tmpV.x, tmpV.y); wait = 0.2f; }
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, PolygonRegionParameters params) { if (params == null) params = defaultParameters; String image = null; try { BufferedReader reader = file.reader(params.readerBuffer); for (String line = reader.readLine(); line != null; line = ...
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, PolygonRegionParameters params) { if (params == null) params = defaultParameters; String image = null; try { BufferedReader reader = file.reader(params.readerBuffer); for (String line = reader.readLine(); line != null; line = ...
public double readDouble () throws IOException { throw new RuntimeException("readDouble"); }
public double readDouble () throws IOException { return Double.longBitsToDouble(readLong()); }
public void cylinder(float width, float height, float depth, int divisions) { // FIXME create better cylinder method (- fill the sides, - axis on which to create the cylinder (matrix?), - partial cylinder) final float hw = width * 0.5f; final float hh = height * 0.5f; final float hd = depth * 0.5f; final flo...
public void cylinder(float width, float height, float depth, int divisions) { // FIXME create better cylinder method (- fill the sides, - axis on which to create the cylinder (matrix?), - partial cylinder) final float hw = width * 0.5f; final float hh = height * 0.5f; final float hd = depth * 0.5f; final flo...
private int next (int idx) { return (idx + 1) % queue.length(); }
private int next (int idx) { return idx + 1 & queue.length() - 1; }
public void render() { angle += 45 * Gdx.graphics.getDeltaTime(); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); cam.update(); matrix.setToRotation(0, 1, 0, angle); cam.combined.mul(matrix); fbo.begin(); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); ...
public void render() { angle += 45 * Gdx.graphics.getDeltaTime(); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); cam.update(); matrix.setToRotation(0, 1, 0, angle); cam.combined.mul(matrix); fbo.begin(); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); ...
public static BinaryXContentBuilder restContentBuilder(RestRequest request) throws IOException { XContentType contentType = XContentType.fromRestContentType(request.header("Content-Type")); if (contentType == null) { // try and guess it from the body, if exists if (request.ha...
public static BinaryXContentBuilder restContentBuilder(RestRequest request) throws IOException { XContentType contentType = XContentType.fromRestContentType(request.header("Content-Type")); if (contentType == null) { // try and guess it from the body, if exists if (request.ha...
public static void main(String[] args) throws Exception { System.setProperty("es.logger.prefix", ""); int numberOfNodes = 2; Settings settings = ImmutableSettings.settingsBuilder() .put("index.shard.check_index", true) .put("gateway.type", "fs") ...
public static void main(String[] args) throws Exception { System.setProperty("es.logger.prefix", ""); int numberOfNodes = 2; Settings settings = ImmutableSettings.settingsBuilder() .put("index.shard.check_index", true) .put("gateway.type", "local") ...
public RestStatus status() { return RestStatus.CONFLICT; }
public RestStatus status() { return RestStatus.NOT_FOUND; }
public static final List<Class<? extends GdxTest>> tests = new ArrayList<Class<? extends GdxTest>>(Arrays.asList( AnimationTest.class, AccelerometerTest.class, ActionTest.class, ActionSequenceTest.class, LetterBoxTest3.class, GroupTest.class, AlphaTest.class, AtlasIssueTest.class, AssetManagerTest.class, FilterPer...
public static final List<Class<? extends GdxTest>> tests = new ArrayList<Class<? extends GdxTest>>(Arrays.asList( AnimationTest.class, AccelerometerTest.class, ActionTest.class, ActionSequenceTest.class, LetterBoxTest3.class, GroupTest.class, AlphaTest.class, AtlasIssueTest.class, AssetManagerTest.class, FilterPer...
public void testFacets() throws Exception { client().admin().indices().prepareCreate("test").execute().actionGet(); ensureGreen(); int numQueries = atLeast(250); int numUniqueQueries = randomInt(numQueries / 2); String[] values = new String[numUniqueQueries]; for (in...
public void testFacets() throws Exception { client().admin().indices().prepareCreate("test").execute().actionGet(); ensureGreen(); int numQueries = atLeast(250); int numUniqueQueries = between(1, numQueries / 2); String[] values = new String[numUniqueQueries]; for (i...
public void render () { Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1.0f); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); Gdx.gl.glEnable(GL10.GL_DEPTH_TEST); cam.update(); cam.apply(Gdx.gl10); drawAxes(); if (hasNormals) { Gdx.gl.glEnable(GL10.GL_LIGHTING); Gdx.gl.glEnable(GL10....
public void render () { Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1.0f); Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); Gdx.gl.glEnable(GL10.GL_DEPTH_TEST); cam.update(); cam.apply(Gdx.gl10); drawAxes(); if (hasNormals) { Gdx.gl.glEnable(GL10.GL_LIGHTING); Gdx.gl.glEnable(GL10....
public boolean act (float delta) { if (executedCount == repeatCount) return true; if (action.act(delta)) { if (repeatCount > 0) executedCount++; if (executedCount == repeatCount) return true; if (action != null) action.restart(); } return false; }
public boolean act (float delta) { if (executedCount == repeatCount) return true; if (action.act(delta)) { if (repeatCount > 0) executedCount++; if (executedCount == repeatCount) return true; action.restart(); } return false; }
public void tick() { final long t = System.nanoTime(); if (lastTick > 0L) tick((lastTick - t) * nano2seconds); lastTick = t; }
public void tick() { final long t = System.nanoTime(); if (lastTick > 0L) tick((t - lastTick) * nano2seconds); lastTick = t; }
public ApplicationListener getApplicationListener () { return new UITest(); }
public ApplicationListener getApplicationListener () { return new GwtTestWrapper(); }
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, ...
private MD2Frame loadFrame (MD2Header header, LittleEndianInputStream in) throws IOException { MD2Frame frame = new MD2Frame(); frame.vertices = new float[header.numVertices * 3]; frame.normalIndices = new int[header.numVertices]; float scaleX = in.readFloat(), scaleY = in.readFloat(), scaleZ = in.readFloat()...
private MD2Frame loadFrame (MD2Header header, LittleEndianInputStream in) throws IOException { MD2Frame frame = new MD2Frame(); frame.vertices = new float[header.numVertices * 3]; frame.normalIndices = new int[header.numVertices]; float scaleX = in.readFloat(), scaleY = in.readFloat(), scaleZ = in.readFloat()...
private static native long getBufferAddress (Buffer buffer); /* return (long) buffer; */
private static native long getBufferAddress (Buffer buffer); /* return (jlong) buffer; */
@Override public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException { XContentParser parser = parseContext.parser(); XContentParser.Token token = parser.nextToken(); assert token == XContentParser.Token.FIELD_NAME; String fieldName = parser.current...
@Override public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException { XContentParser parser = parseContext.parser(); XContentParser.Token token = parser.nextToken(); assert token == XContentParser.Token.FIELD_NAME; String fieldName = parser.current...
public static void main (String[] argv) { new JoglApplication(new com.badlogic.gdx.tests.SimpleAnimationTest(), "Debug Test", 480, 320, false); }
public static void main (String[] argv) { new JoglApplication(new com.badlogic.gdx.tests.EdgeDetectionTest(), "Debug Test", 480, 320, true); }
private static Pattern lessThanPattern = Pattern.compile("<"); static int calculateMinShouldMatch(int optionalClauseCount, String spec) { int result = optionalClauseCount; spec = spec.trim(); if (-1 < spec.indexOf("<")) { /* we have conditional spec(s) */ spec =...
public static int calculateMinShouldMatch(int optionalClauseCount, String spec) { int result = optionalClauseCount; spec = spec.trim(); if (-1 < spec.indexOf("<")) { /* we have conditional spec(s) */ spec = spaceAroundLessThanPattern.matcher(spec).replaceAll("<"); ...
static public boolean isAssignableFrom (Class c1, Class c2) { Type c1Type = ReflectionCache.getType(c1); Type c2Type = ReflectionCache.getType(c2); return c2Type.isAssignableFrom(c1Type); }
static public boolean isAssignableFrom (Class c1, Class c2) { Type c1Type = ReflectionCache.getType(c1); Type c2Type = ReflectionCache.getType(c2); return c1Type.isAssignableFrom(c2Type); }
public enum ApplicationType { Android, Desktop, HeadlessDesktop, Applet, WebGL, iOS }
public enum ApplicationType { Android, Desktop, Applet, WebGL, iOS }
public static String VERSION = "0.9.9"; }
public static final String VERSION = "0.9.9"; }
protected ShardFlushResponse shardOperation(ShardFlushRequest request) throws ElasticSearchException { IndexShard indexShard = indicesService.indexServiceSafe(request.index()).shardSafe(request.shardId()); indexShard.flush(new Engine.Flush().refresh(request.refresh()).type(request.full() ? Engine.Fl...
protected ShardFlushResponse shardOperation(ShardFlushRequest request) throws ElasticSearchException { IndexShard indexShard = indicesService.indexServiceSafe(request.index()).shardSafe(request.shardId()); indexShard.flush(new Engine.Flush().type(request.full() ? Engine.Flush.Type.NEW_WRITER : Engin...
public String asString () { if (stringValue != null) return stringValue; if (doubleValue != null) { if (doubleValue == longValue) return Long.toString(longValue); return Double.toString(doubleValue); } if (booleanValue != null) return Boolean.toString(booleanValue); if (type == ValueType.nullValue) ret...
public String asString () { if (stringValue != null) return stringValue; if (doubleValue != null) { if (doubleValue % 1 == 0) return Long.toString(longValue); return Double.toString(doubleValue); } if (booleanValue != null) return Boolean.toString(booleanValue); if (type == ValueType.nullValue) return ...
@Test public void testIndexActions() throws Exception { createIndex(); logger.info("Running Cluster Health"); ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("Done Cluster Health, status " + ...
@Test public void testIndexActions() throws Exception { createIndex(); logger.info("Running Cluster Health"); ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet(); logger.info("Done Cluster Health, status " + ...
@Override public boolean isPeripheralAvailable (Peripheral peripheral) { if(peripheral == Peripheral.Accelerometer) return accelerometerAvailable; if(peripheral == Peripheral.Compass) return compassAvailable; if(peripheral == Peripheral.HardwareKeyboard) return keyboardAvailable; if(peripheral == Peripheral.On...
@Override public boolean isPeripheralAvailable (Peripheral peripheral) { if(peripheral == Peripheral.Accelerometer) return accelerometerAvailable; if(peripheral == Peripheral.Compass) return compassAvailable; if(peripheral == Peripheral.HardwareKeyboard) return keyboardAvailable; if(peripheral == Peripheral.On...
@Override public boolean isPeripheralAvailable (Peripheral peripheral) { if(peripheral == Peripheral.Accelerometer) return accelerometerAvailable; if(peripheral == Peripheral.Compass) return compassAvailable; if(peripheral == Peripheral.HardwareKeyboard) return keyboardAvailable; if(peripheral == Peripheral.On...
@Override public boolean isPeripheralAvailable (Peripheral peripheral) { if(peripheral == Peripheral.Accelerometer) return accelerometerAvailable; if(peripheral == Peripheral.Compass) return compassAvailable; if(peripheral == Peripheral.HardwareKeyboard) return keyboardAvailable; if(peripheral == Peripheral.On...
public Object invoke (Object obj, Object... params) { if (parameters != null && (params == null || params.length != parameters.length)) throw new IllegalArgumentException("Parameter mismatch"); if (parameters == null && params != null && params.length > 0) { throw new IllegalArgumentException("Parameter mism...
public Object invoke (Object obj, Object... params) { if (parameters != null && (params == null || params.length != parameters.length)) throw new IllegalArgumentException("Parameter mismatch"); if (parameters == null && params != null && params.length > 0) { throw new IllegalArgumentException("Parameter mism...
@Override public void render () { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); batch.begin(); font.drawMultiLine(batch, message, 20, Gdx.graphics.getHeight() - 20, Color.WHITE); batch.end(); }
@Override public void render () { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT); batch.begin(); font.drawMultiLine(batch, message, 20, Gdx.graphics.getHeight() - 20); batch.end(); }
public void render() { Gdx.gl10.glClear(GL10.GL_COLOR_BUFFER_BIT); batch.begin(); float width = (int)(Gdx.graphics.getPpcX() * 2); float height = (int)(Gdx.graphics.getPpcY() * 1); batch.draw(texture, 10, 100, width, height, 0, 0, 64, 32, Color.WHITE, false, false ); font.draw(batch, "button is 2x1 cm (...
public void render() { Gdx.gl10.glClear(GL10.GL_COLOR_BUFFER_BIT); batch.begin(); float width = (int)(Gdx.graphics.getPpcX() * 2); float height = (int)(Gdx.graphics.getPpcY() * 1); batch.draw(texture, 10, 100, width, height, 0, 0, 64, 32, Color.WHITE, false, false ); font.draw(batch, "button is 2x1 cm (...
private static KeyframedSubMesh readMesh (BufferedReader in, boolean flipV) throws IOException { String name = readString(in); IntArray indices = readFaces(in); int numVertices = readInt(in); int numAttributes = readInt(in); if (!readString(in).equals("position")) throw new GdxRuntimeException("first attrib...
private static KeyframedSubMesh readMesh (BufferedReader in, boolean flipV) throws IOException { String name = readString(in); IntArray indices = readFaces(in); int numVertices = readInt(in); int numAttributes = readInt(in); if (!readString(in).equals("position")) throw new GdxRuntimeException("first attrib...
public final Searcher acquireSearcher(String source) throws EngineException { SearcherManager manager = this.searcherManager; if (manager == null) { throw new EngineClosedException(shardId); } try { IndexSearcher searcher = manager.acquire(); retur...
public final Searcher acquireSearcher(String source) throws EngineException { SearcherManager manager = this.searcherManager; if (manager == null) { throw new EngineClosedException(shardId); } try { IndexSearcher searcher = manager.acquire(); retur...
public static void closeQuietly (Closeable c) { if (c != null) try { c.close(); } catch (IOException e) { // ignore } }
public static void closeQuietly (Closeable c) { if (c != null) try { c.close(); } catch (Exception e) { // ignore } }
@Inject public MapperService(Index index, @IndexSettings Settings indexSettings, Environment environment, AnalysisService analysisService) { super(index, indexSettings); this.documentParser = new JsonDocumentMapperParser(analysisService); this.searchAnalyzer = new SmartIndexNameSearchAnalyze...
@Inject public MapperService(Index index, @IndexSettings Settings indexSettings, Environment environment, AnalysisService analysisService) { super(index, indexSettings); this.documentParser = new JsonDocumentMapperParser(analysisService); this.searchAnalyzer = new SmartIndexNameSearchAnalyze...
public static String copyToString(Reader in) throws IOException { StringWriter out = new StringWriter(); copy(in, out); return out.toString(); } public static String copyToStringFromClasspath(ClassLoader classLoader, String path) throws IOException { InputStream is = classLo...
public static String copyToString(Reader in) throws IOException { StringWriter out = new StringWriter(); copy(in, out); return out.toString(); } public static String copyToStringFromClasspath(ClassLoader classLoader, String path) throws IOException { InputStream is = classLo...
@Inject public TranslogService(ShardId shardId, @IndexSettings Settings indexSettings, IndexSettingsService indexSettingsService, ThreadPool threadPool, IndexShard indexShard, Translog translog) { super(shardId, indexSettings); this.threadPool = threadPool; this.indexSettingsService = indexS...
@Inject public TranslogService(ShardId shardId, @IndexSettings Settings indexSettings, IndexSettingsService indexSettingsService, ThreadPool threadPool, IndexShard indexShard, Translog translog) { super(shardId, indexSettings); this.threadPool = threadPool; this.indexSettingsService = indexS...
public void create () { stage = new Stage(); texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), false); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); img = new Image(new TextureRegion(texture)); img.setSize(100, 100); img.setOrigin(50, 50); img.setPosition(100, 100); img2 ...
public void create () { stage = new Stage(480, 320, true); texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), false); texture.setFilter(TextureFilter.Linear, TextureFilter.Linear); img = new Image(new TextureRegion(texture)); img.setSize(100, 100); img.setOrigin(50, 50); img.setPosition(100, ...
public void create () { if (app == null) { app = Gdx.app; tests[testIndex].create(); } cameraController = new CameraInputController(tests[testIndex].camera); cameraController.activateKey = Keys.CONTROL_LEFT; cameraController.autoUpdate = false; cameraController.forwardTarget = false; cameraControl...
public void create () { if (app == null) { app = Gdx.app; tests[testIndex].create(); } cameraController = new CameraInputController(tests[testIndex].camera); cameraController.activateKey = Keys.CONTROL_LEFT; cameraController.autoUpdate = false; cameraController.forwardTarget = false; cameraControl...
public void create () { stage = new Stage(); Action complexAction = forever(sequence(parallel(rotateBy(180, 2), scaleTo(1.4f, 1.4f, 2), alpha(0.7f, 2)), parallel(rotateBy(180, 2), scaleTo(1.0f, 1.0f, 2), alpha(1.0f, 2)))); texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), false); texture.setF...
public void create () { stage = new Stage(480, 320, true); Action complexAction = forever(sequence(parallel(rotateBy(180, 2), scaleTo(1.4f, 1.4f, 2), alpha(0.7f, 2)), parallel(rotateBy(180, 2), scaleTo(1.0f, 1.0f, 2), alpha(1.0f, 2)))); texture = new Texture(Gdx.files.internal("data/badlogic.jpg"), false); ...
public void resize (int width, int height) { stage.getViewport().update(width, height); }
public void resize (int width, int height) { stage.setViewport(width, height, false); }
public void resize (int width, int height) { stage.getViewport().update(width, height); }
public void resize (int width, int height) { stage.setViewport(width, height, true); }
public void create () { texture = new Texture(Gdx.files.internal("data/badlogicsmall.jpg")); stage = new Stage(); for (int i = 0; i < 100; i++) { Image img = new Image(new TextureRegion(texture)); img.setX((float)Math.random() * 480); img.setY((float)Math.random() * 320); img.getColor().a = (float)M...
public void create () { texture = new Texture(Gdx.files.internal("data/badlogicsmall.jpg")); stage = new Stage(480, 320, true); for (int i = 0; i < 100; i++) { Image img = new Image(new TextureRegion(texture)); img.setX((float)Math.random() * 480); img.setY((float)Math.random() * 320); img.getColor(...
private void createUI () { skin = new Skin(Gdx.files.internal("data/uiskin.json")); ui = new Stage(); String[] filters = new String[TextureFilter.values().length]; int idx = 0; for (TextureFilter filter : TextureFilter.values()) { filters[idx++] = filter.toString(); } hwMipMap = new CheckBox("Hardwar...
private void createUI () { skin = new Skin(Gdx.files.internal("data/uiskin.json")); ui = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false); String[] filters = new String[TextureFilter.values().length]; int idx = 0; for (TextureFilter filter : TextureFilter.values()) { filters[idx++] = f...
public void create () { // create a stage and a camera controller so we can pan the view. stage = new Stage();; camController = new OrthoCamController((OrthographicCamera)stage.getCamera()); // we know it's an ortho cam at this point!
public void create () { // create a stage and a camera controller so we can pan the view. stage = new Stage(480, 320, false); camController = new OrthoCamController((OrthographicCamera)stage.getCamera()); // we know it's an ortho cam at this point!
public void create () { // load the koala frames, split them, and assign them to Animations koalaTexture = new Texture("data/maps/tiled/super-koalio/koalio.png"); TextureRegion[] regions = TextureRegion.split(koalaTexture, 18, 26)[0]; stand = new Animation(0, regions[0]); jump = new Animation(0, regions[1]);...
public void create () { // load the koala frames, split them, and assign them to Animations koalaTexture = new Texture("data/maps/tiled/super-koalio/koalio.png"); TextureRegion[] regions = TextureRegion.split(koalaTexture, 18, 26)[0]; stand = new Animation(0, regions[0]); jump = new Animation(0, regions[1]);...
public void run () { graphics.setVSync(graphics.config.vSyncEnabled); try { LwjglApplication.this.mainLoop(); } catch (Throwable t) { if (audio != null) audio.dispose(); if (t instanceof RuntimeException) throw (RuntimeException)t; else throw new GdxRuntimeException(t); ...
public void run () { graphics.setVSync(graphics.config.vSyncEnabled); try { LwjglApplication.this.mainLoop(); } catch (Throwable t) { if (audio != null) audio.dispose(); if (t instanceof RuntimeException) throw (RuntimeException)t; else throw new GdxRuntimeException(t); ...
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, PolygonRegionParameters params) { if (params == null) params = defaultParameters; String image = null; try { BufferedReader reader = file.reader(params.readerBuffer); for (String line = reader.readLine(); line != null; line = ...
public Array<AssetDescriptor> getDependencies (String fileName, FileHandle file, PolygonRegionParameters params) { if (params == null) params = defaultParameters; String image = null; try { BufferedReader reader = file.reader(params.readerBuffer); for (String line = reader.readLine(); line != null; line = ...
public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); config.useWakelock = true; config.useGL20 = true; initialize(new GdxInva...
public void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); config.useWakelock = true; config.useGL20 = false; initialize(new GdxInv...
public static void main (String[] argv) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.title = "Gdx Invaders"; config.vSyncEnabled = true; config.useGL20 = true; new LwjglApplication(new GdxInvaders(), config); }
public static void main (String[] argv) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.title = "Gdx Invaders"; config.vSyncEnabled = true; config.useGL20 = false; new LwjglApplication(new GdxInvaders(), config); }
public String header(String name) { return request.getHeader(name); }
public String header(String name) { return request.headers().get(name); }
public void listBenchmarks(final BenchmarkStatusRequest request, final ActionListener<BenchmarkStatusResponse> listener) { final List<DiscoveryNode> nodes = availableBenchmarkNodes(); if (nodes.size() == 0) { listener.onFailure(new BenchmarkNodeMissingException("No available nodes for e...
public void listBenchmarks(final BenchmarkStatusRequest request, final ActionListener<BenchmarkStatusResponse> listener) { final List<DiscoveryNode> nodes = availableBenchmarkNodes(); if (nodes.size() == 0) { listener.onResponse(new BenchmarkStatusResponse()); } else { ...
public boolean collide( CollisionMesh mesh, Vector position, Vector velocity, float displacementDistance ) { boolean collided = false; int iterations = 0; while( true ) { packet.set( position, velocity ); CollisionDetection.collide( mesh, packet ); if( packet.isColliding() && iterations < 20 ) ...
public boolean collide( CollisionMesh mesh, Vector position, Vector velocity, float displacementDistance ) { boolean collided = false; int iterations = 0; while( true ) { packet.set( position, velocity ); CollisionDetection.collide( mesh, packet ); if( packet.isColliding() && iterations < 5 ) ...
protected void consolidate () { if (newData == null) { return; } // System.out.println("consolidate(); ndp: " + newDataPos + " nd-len: " + newData.length()); if (data.length() < newDataPos) { StringBuilder filler = new StringBuilder(); while (data.length() + filler.length() < newDataPos) { filler....
public void close () throws IOException { if (data != null) { flush(); data = null; } } void consolidate () { if (newData == null) { return; } // System.out.println("consolidate(); ndp: " + newDataPos + " nd-len: " + newData.length()); if (data.length() < newDataPos) { StringBuilder filler =...
public void setScale (float scaleX, float scaleY) { BitmapFontData data = this.data; float x = scaleX / data.scaleX; float y = scaleY / data.scaleY; data.lineHeight = data.lineHeight * x; data.spaceWidth = data.spaceWidth * x; data.xHeight = data.xHeight * y; data.capHeight = data.capHeight * y; data.a...
public void setScale (float scaleX, float scaleY) { BitmapFontData data = this.data; float x = scaleX / data.scaleX; float y = scaleY / data.scaleY; data.lineHeight = data.lineHeight * y; data.spaceWidth = data.spaceWidth * x; data.xHeight = data.xHeight * y; data.capHeight = data.capHeight * y; data.a...
private <V> V read(File file) { long start = System.currentTimeMillis(); long length = file.length(); V data = new RequestReader(file, FORMAT_VERSION).read(); if (data != null) Log.d(TAG, MessageFormat.format("Cache hit to {0}, {1} ms to load {2} bytes...
private <V> V read(File file) { long start = System.currentTimeMillis(); long length = file.length(); V data = new RequestReader(file, FORMAT_VERSION).read(); if (data != null) Log.d(TAG, MessageFormat.format("Cache hit to {0}, {1} ms to load {2} bytes...
public <V> V read() { if (!handle.exists() || handle.length() == 0) return null; RandomAccessFile dir = null; FileLock lock = null; ObjectInputStream input = null; boolean delete = false; try { dir = new RandomAccessFile(handle, "rw"); ...
public <V> V read() { if (!handle.exists() || handle.length() == 0) return null; RandomAccessFile dir = null; FileLock lock = null; ObjectInputStream input = null; boolean delete = false; try { dir = new RandomAccessFile(handle, "rw"); ...
void close(); /* * 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 Apache License, Version 2.0 (the * "L...
void close(); /* * 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 Apache License, Version 2.0 (the * "L...
@Override protected void configure() { bind(Map.class).annotatedWith(IndexerSettings.class).toInstance(settings); }
@Override protected void configure() { bind(IndexerSettings.class).toInstance(new IndexerSettings(globalSettings, settings)); }
@Inject public RestDeleteMappingAction(Settings settings, Client client, RestController controller) { super(settings, client); controller.registerHandler(DELETE, "/{index}/{type}/_mapping", this); controller.registerHandler(DELETE, "/{index}/{type}/", this); }
@Inject public RestDeleteMappingAction(Settings settings, Client client, RestController controller) { super(settings, client); controller.registerHandler(DELETE, "/{index}/{type}/_mapping", this); controller.registerHandler(DELETE, "/{index}/{type}", this); }
public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException { XContentParser parser = parseContext.parser(); XContentParser.Token token; while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { } return Queries.MATCH_ALL_FI...
public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException { XContentParser parser = parseContext.parser(); XContentParser.Token token; while (((token = parser.nextToken()) != XContentParser.Token.END_OBJECT && token != XContentParser.Token.END_ARRAY)) { ...
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException { XContentParser parser = parseContext.parser(); float boost = 1.0f; String normsField = null; String currentFieldName = null; XContentParser.Token token; while ((token = pa...
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException { XContentParser parser = parseContext.parser(); float boost = 1.0f; String normsField = null; String currentFieldName = null; XContentParser.Token token; while (((token = p...
public static void main (String[] argv) { new JoglApplication(new com.badlogic.gdx.tests.ActionTest(), "Debug Test", 480, 320, false); }
public static void main (String[] argv) { new JoglApplication(new com.badlogic.gdx.tests.MultiTouchActorTest(), "Debug Test", 480, 320, false); }
public float getPosition () { return (float)(track.getCurrentTime() * 1000.0); }
public float getPosition () { return (float)(track.getCurrentTime()); }
private String getAssetOutputPath (GeneratorContext context) { ConfigurationProperty assetPathProperty = null; try { assetPathProperty = context.getPropertyOracle().getConfigurationProperty("gdx.assetoutputpath"); } catch (BadPropertyValueException e) { return null; } if (assetPathProperty.getValues()....
private String getAssetOutputPath (GeneratorContext context) { ConfigurationProperty assetPathProperty = null; try { assetPathProperty = context.getPropertyOracle().getConfigurationProperty("gdx.assetoutputpath"); } catch (BadPropertyValueException e) { return null; } if (assetPathProperty.getValues()....
public GwtApplicationConfiguration getConfig () { return new GwtApplicationConfiguration(640, 640); }
public GwtApplicationConfiguration getConfig () { return new GwtApplicationConfiguration(480, 320); }
@Override protected void doXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(HasChildFilterParser.NAME); builder.field("query"); queryBuilder.toXContent(builder, params); builder.field("type", childType); if (scope != null) { ...
@Override protected void doXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(HasChildFilterParser.NAME); builder.field("query"); queryBuilder.toXContent(builder, params); builder.field("type", childType); if (scope != null) { ...
@Override public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException { XContentParser parser = parseContext.parser(); Query query = null; String childType = null; String scope = null; String filterName = null; String currentFieldNa...
@Override public Filter parse(QueryParseContext parseContext) throws IOException, QueryParsingException { XContentParser parser = parseContext.parser(); Query query = null; String childType = null; String scope = null; String filterName = null; String currentFieldNa...
@Override protected void doXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(HasChildQueryParser.NAME); builder.field("query"); queryBuilder.toXContent(builder, params); builder.field("type", childType); if (scope != null) { ...
@Override protected void doXContent(XContentBuilder builder, Params params) throws IOException { builder.startObject(HasChildQueryParser.NAME); builder.field("query"); queryBuilder.toXContent(builder, params); builder.field("type", childType); if (scope != null) { ...