buggy_function
stringlengths
1
391k
fixed_function
stringlengths
0
392k
@Override public void run() { Path file = new Path(path, blobName); FSDataOutputStream fileStream; try { fileStream = blobStore.fileSystem().create(file, true); } catch (IOException e) { listener.onFailu...
@Override public void run() { Path file = new Path(path, blobName); FSDataOutputStream fileStream; try { fileStream = blobStore.fileSystem().create(file, true); } catch (IOException e) { listener.onFailu...
public float getPrefWidth () { if (wrap) return 150; return bounds.width; }
public float getPrefWidth () { if (wrap) return 0; return bounds.width; }
public boolean touchDown (float x, float y, int pointer) { if (pointer != 0) return false; selected = (int)((height - y) / itemHeight); selected = Math.max(0, selected); selected = Math.min(items.length - 1, selected); if (listener != null) listener.selected(this, selected, items[selected]); return true; ...
public boolean touchDown (float x, float y, int pointer) { if (pointer != 0) return false; selected = (int)((height - y) / itemHeight); selected = Math.max(0, selected); selected = Math.min(items.length - 1, selected); if (listener != null && items.length > 0) listener.selected(this, selected, items[selected...
private Map<String, Object> parseBody(RestResponse response) throws IOException { return XContentFactory.xContent(XContentType.JSON).createParser(response.getBody().array(), response.getBody().arrayOffset(), response.getBody().remaining()).map(); }
private Map<String, Object> parseBody(RestResponse response) throws IOException { return XContentFactory.xContent(XContentType.JSON).createParser(response.BufferForBody().array(), response.BufferForBody().arrayOffset(), response.BufferForBody().remaining()).map(); }
public static String generateNodeId(Settings settings) { String seed = settings.get("discovery.id.seed"); if (seed != null) { Strings.randomBase64UUID(new Random(Long.parseLong(seed))); }
public static String generateNodeId(Settings settings) { String seed = settings.get("discovery.id.seed"); if (seed != null) { return Strings.randomBase64UUID(new Random(Long.parseLong(seed))); }
public FieldComparator<?> newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException { assert fieldname.equals(indexFieldData.getFieldName()); if (indexFieldData.valuesOrdered() && indexFieldData instanceof IndexOrdinalFieldData) { return new BytesRefO...
public FieldComparator<?> newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException { assert fieldname.equals(indexFieldData.getFieldNames().indexName()); if (indexFieldData.valuesOrdered() && indexFieldData instanceof IndexOrdinalFieldData) { return ...
public FieldComparator<?> newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException { assert fieldname.equals(indexFieldData.getFieldName()); double dMissingValue; if (missingValue == null || "_last".equals(missingValue)) { dMissingValue = re...
public FieldComparator<?> newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException { assert fieldname.equals(indexFieldData.getFieldNames().indexName()); double dMissingValue; if (missingValue == null || "_last".equals(missingValue)) { dMiss...
public TokenStreamToAutomaton getTokenStreamToAutomaton() { final TokenStreamToAutomaton tsta = super.getTokenStreamToAutomaton(); tsta.setUnicodeArcs(unicodeAware); return tsta; } Automaton toLevenshteinAutomata(Automaton automaton) { final Set<IntsRef> ref = XSpecialOperations.g...
public TokenStreamToAutomaton getTokenStreamToAutomaton() { final TokenStreamToAutomaton tsta = super.getTokenStreamToAutomaton(); tsta.setUnicodeArcs(unicodeAware); return tsta; } Automaton toLevenshteinAutomata(Automaton automaton) { final Set<IntsRef> ref = SpecialOperations.ge...
public final void close() { bigArrays.ramBytesUsed.addAndGet(-sizeInBytes()); assert !released : "double release"; released = true; doClose(); }
public final void close() { bigArrays.ramBytesUsed.addAndGet(-ramBytesUsed()); assert !released : "double release"; released = true; doClose(); }
public TokenStream create(TokenStream tokenStream) { if (version.onOrAfter(Version.LUCENE_48)) { return new WordDelimiterFilter(version, tokenStream, charTypeTable, flags, protoWords); } else { return new Luce...
public TokenStream create(TokenStream tokenStream) { if (version.onOrAfter(Version.LUCENE_4_8)) { return new WordDelimiterFilter(version, tokenStream, charTypeTable, flags, protoWords); } else { return new Luc...
public static void main(String[] args) throws Exception { final IndexWriterConfig iwc = new IndexWriterConfig(Lucene.VERSION, new KeywordAnalyzer()); final String fieldName = "f"; final int numDocs = 1000000; System.out.println("Data\tLoading time\tImplementation\tActual size\tExpect...
public static void main(String[] args) throws Exception { final IndexWriterConfig iwc = new IndexWriterConfig(Lucene.VERSION, new KeywordAnalyzer()); final String fieldName = "f"; final int numDocs = 1000000; System.out.println("Data\tLoading time\tImplementation\tActual size\tExpect...
public void setUp() throws Exception { super.setUp(); referenceAll = Maps.newHashMap(); referenceNotDeleted = Maps.newHashMap(); referenceFilter = Maps.newHashMap(); Directory dir = newDirectory(); IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, n...
public void setUp() throws Exception { super.setUp(); referenceAll = Maps.newHashMap(); referenceNotDeleted = Maps.newHashMap(); referenceFilter = Maps.newHashMap(); Directory dir = newDirectory(); IndexWriterConfig conf = newIndexWriterConfig(TEST_VERSION_CURRENT, n...
public void testGetBytesValues() throws Exception { IndexFieldData indexFieldData = getForField(childType); AtomicFieldData fieldData = indexFieldData.load(refreshReader()); assertThat(fieldData.getMemorySizeInBytes(), greaterThan(0l)); BytesValues bytesValues = fieldData.getBytesVa...
public void testGetBytesValues() throws Exception { IndexFieldData indexFieldData = getForField(childType); AtomicFieldData fieldData = indexFieldData.load(refreshReader()); assertThat(fieldData.ramBytesUsed(), greaterThan(0l)); BytesValues bytesValues = fieldData.getBytesValues(); ...
private static void assertPrecisionStepEquals(int expected, IndexableField field) throws IOException { assertNotNull(field); assertThat(field, instanceOf(Field.class)); // check fieldtype's precisionstep assertEquals(expected, ((Field)field).fieldType().numericPrecisionStep(...
private static void assertPrecisionStepEquals(int expected, IndexableField field) throws IOException { assertNotNull(field); assertThat(field, instanceOf(Field.class)); // check fieldtype's precisionstep assertEquals(expected, ((Field)field).fieldType().numericPrecisionStep(...
public void testEnabled() throws Exception { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("_timestamp").field("enabled", "yes").field("store", "yes").endObject() .endObject().endObject().string(); DocumentMapper docMapp...
public void testEnabled() throws Exception { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("_timestamp").field("enabled", "yes").field("store", "yes").endObject() .endObject().endObject().string(); DocumentMapper docMapp...
private List<IndexShard> getShardsToPurge() { List<IndexShard> shardsToPurge = new ArrayList<IndexShard>(); for (IndexService indexService : indicesService) { // should be optimized with the hasTTL flag FieldMappers ttlFieldMappers = indexService.mapperSer...
private List<IndexShard> getShardsToPurge() { List<IndexShard> shardsToPurge = new ArrayList<IndexShard>(); for (IndexService indexService : indicesService) { // should be optimized with the hasTTL flag FieldMappers ttlFieldMappers = indexService.mapperSer...
protected void processFile (Entry inputFile) throws Exception { String content = new FileHandle(inputFile.inputFile).readString(); content = content.trim(); if (content.startsWith("package")) { System.out.println("File '" + inputFile.inputFile + "' header fixed"); BufferedWriter writer = new Buffered...
protected void processFile (Entry inputFile) throws Exception { String content = new FileHandle(inputFile.inputFile).readString(); content = content.trim(); if (content.startsWith("package")) { System.out.println("File '" + inputFile.inputFile + "' header fixed"); BufferedWriter writer = new Buffered...
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException { XContentParser parser = parseContext.parser(); Query query = null; boolean queryFound = false; Filter filter = null; boolean filterFound = false; float boost = 1.0f; ...
public Query parse(QueryParseContext parseContext) throws IOException, QueryParsingException { XContentParser parser = parseContext.parser(); Query query = null; boolean queryFound = false; Filter filter = null; boolean filterFound = false; float boost = 1.0f; ...
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 SharedLib...
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 SharedLib...
@BeforeTest public void setupMapperParser() { mapperParser = new JsonDocumentMapperParser(new AnalysisService(new Index("test"))); mapperParser.putTypeParser(JsonAttachmentMapper.JSON_TYPE, new JsonAttachmentTypeParser()); }
@BeforeTest public void setupMapperParser() { mapperParser = new JsonDocumentMapperParser(new AnalysisService(new Index("test"))); mapperParser.putTypeParser(JsonAttachmentMapper.JSON_TYPE, new JsonAttachmentMapper.TypeParser()); }
public InternalNode(Settings pSettings, boolean loadConfigSettings) throws ElasticsearchException { Tuple<Settings, Environment> tuple = InternalSettingsPreparer.prepareSettings(pSettings, loadConfigSettings); tuple = new Tuple<>(TribeService.processSettings(tuple.v1()), tuple.v2()); // The...
public InternalNode(Settings pSettings, boolean loadConfigSettings) throws ElasticsearchException { Tuple<Settings, Environment> tuple = InternalSettingsPreparer.prepareSettings(pSettings, loadConfigSettings); tuple = new Tuple<>(TribeService.processSettings(tuple.v1()), tuple.v2()); // The...
@Inject public TieredMergePolicyProvider(Store store, IndexSettingsService indexSettingsService) { super(store.shardId(), store.indexSettings()); this.indexSettingsService = indexSettingsService; this.compoundFormat = indexSettings.getAsBoolean("index.compound_format", store.suggestUseCompo...
@Inject public TieredMergePolicyProvider(Store store, IndexSettingsService indexSettingsService) { super(store.shardId(), store.indexSettings()); this.indexSettingsService = indexSettingsService; this.compoundFormat = indexSettings.getAsBoolean("index.compound_format", store.suggestUseCompo...
public void consumeCompressedData (int target) { throw new GdxRuntimeException("This TextureData implementation does not upload data itself"); } }
public void consumeCompressedData () { throw new GdxRuntimeException("This TextureData implementation does not upload data itself"); } }
final protected static int binarySearch(BytesValues.WithOrdinals a, BytesRef key) { return binarySearch(a, key, 1, a.ordinals().getNumOrds() - 1); }
final protected static int binarySearch(BytesValues.WithOrdinals a, BytesRef key) { return binarySearch(a, key, 1, a.ordinals().getNumOrds()); }
public TextBounds getMultiLineBounds (CharSequence str) { int start = 0; float maxWidth = 0; int numLines = 0; int length = str.length(); while (start < length) { int lineEnd = indexOf(str, '\n', start); float lineWidth = getBounds(str, start, lineEnd).width; maxWidth = Math.max(maxWidth, lineWidth)...
public TextBounds getMultiLineBounds (CharSequence str) { int start = 0; float maxWidth = 0; int numLines = 0; int length = str.length(); while (start < length) { int lineEnd = indexOf(str, '\n', start); float lineWidth = getBounds(str, start, lineEnd).width; maxWidth = Math.max(maxWidth, lineWidth)...
private void deleteShard(int shardId, boolean delete, boolean snapshotGateway, boolean deleteGateway) throws ElasticSearchException { Injector shardInjector; IndexShard indexShard; synchronized (this) { Map<Integer, Injector> tmpShardInjectors = newHashMap(shardsInjectors); ...
private void deleteShard(int shardId, boolean delete, boolean snapshotGateway, boolean deleteGateway) throws ElasticSearchException { Injector shardInjector; IndexShard indexShard; synchronized (this) { Map<Integer, Injector> tmpShardInjectors = newHashMap(shardsInjectors); ...
@Override public boolean release() throws ElasticSearchException { raf.decreaseRefCount(); return true; }
@Override public boolean release() throws ElasticSearchException { raf.decreaseRefCount(true); return true; }
@Override public boolean release() throws ElasticSearchException { try { dis.close(); } catch (IOException e) { // ignore } raf.decreaseRefCount(); return true; }
@Override public boolean release() throws ElasticSearchException { try { dis.close(); } catch (IOException e) { // ignore } raf.decreaseRefCount(true); return true; }
@AfterMethod public void tearDown() { translog.close(); }
@AfterMethod public void tearDown() { translog.close(true); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(string.no_news)); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(string.no_news); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(string.no_gists)); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(string.no_gists); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(string.no_filters)); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(string.no_filters); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(string.no_issues)); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(string.no_issues); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(string.no_repositories)); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(string.no_repositories); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(string.no_followers)); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(string.no_followers); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(string.no_people)); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(string.no_people); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(getString(string.no_members)); }
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setEmptyText(string.no_members); }
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 ZenDiscovery(Settings settings, ClusterName clusterName, ThreadPool threadPool, TransportService transportService, ClusterService clusterService, NodeSettingsService nodeSettingsService, DiscoveryNodeService discoveryNodeService, ZenPingService pingService, Ver...
public ZenDiscovery(Settings settings, ClusterName clusterName, ThreadPool threadPool, TransportService transportService, ClusterService clusterService, NodeSettingsService nodeSettingsService, DiscoveryNodeService discoveryNodeService, ZenPingService pingService, Ver...
public static void main (String[] argv) { new JoglApplication(new com.badlogic.gdx.tests.OrthoCamBorderTest(), "Debug Test", 800, 480, false); }
public static void main (String[] argv) { new JoglApplication(new com.badlogic.gdx.tests.Gdx2DTest(), "Debug Test", 480, 320, false); }
public boolean handle (Event e) { if (!(e instanceof ActorEvent)) return false; ActorEvent event = (ActorEvent)e; switch (event.getType()) { case keyDown: return keyDown(event, event.getKeyCode()); case keyUp: return keyUp(event, event.getKeyCode()); case keyTyped: return keyTyped(event, event.ge...
public boolean handle (Event e) { if (!(e instanceof ActorEvent)) return false; ActorEvent event = (ActorEvent)e; switch (event.getType()) { case keyDown: return keyDown(event, event.getKeyCode()); case keyUp: return keyUp(event, event.getKeyCode()); case keyTyped: return keyTyped(event, event.ge...
public void touchUp (ActorEvent event, float x, float y, int pointer, int button) { if (pointer == 0 && button == getButton() && isOver(event.getCurrentTarget(), x, y)) clicked(event, x, y); super.touchUp(event, x, y, pointer, button); }
public void touchUp (ActorEvent event, float x, float y, int pointer, int button) { if (pointer == 0 && button == getButton() && isOver(event.getListenerActor(), x, y)) clicked(event, x, y); super.touchUp(event, x, y, pointer, button); }
public void touchDragged (ActorEvent event, float x, float y, int pointer) { pressed = Gdx.input.isButtonPressed(button) && isOver(event.getCurrentTarget(), x, y); if (!pressed) { // Once outside the tap square, don't use the tap square anymore. touchDownX = -1; touchDownY = -1; } }
public void touchDragged (ActorEvent event, float x, float y, int pointer) { pressed = Gdx.input.isButtonPressed(button) && isOver(event.getListenerActor(), x, y); if (!pressed) { // Once outside the tap square, don't use the tap square anymore. touchDownX = -1; touchDownY = -1; } }
public FileHandle internal (String path) { return new IOSFileHandle(path, FileType.Internal); }
public FileHandle internal (String path) { return new IOSFileHandle(new File(internalPath, path), FileType.Internal); }
private void restart () { delay = delayValue.active ? delayValue.newLowValue() : 0; delayTimer = 0; durationTimer -= duration; duration = durationValue.newLowValue(); emission = (int)emissionValue.newLowValue(); emissionDiff = (int)emissionValue.newHighValue(); if (!emissionValue.isRelative()) emission...
private void restart () { delay = delayValue.active ? delayValue.newLowValue() : 0; delayTimer = 0; durationTimer -= duration; duration = durationValue.newLowValue(); emission = (int)emissionValue.newLowValue(); emissionDiff = (int)emissionValue.newHighValue(); if (!emissionValue.isRelative()) emission...
public CodecService(Index index, @IndexSettings Settings indexSettings, PostingsFormatService postingsFormatService, MapperService mapperService) { super(index, indexSettings); this.postingsFormatService = postingsFormatService; this.mapperService = mapperService; ...
public CodecService(Index index, @IndexSettings Settings indexSettings, PostingsFormatService postingsFormatService, MapperService mapperService) { super(index, indexSettings); this.postingsFormatService = postingsFormatService; this.mapperService = mapperService; ...
public Mapper.Builder<?, ?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { DateFieldMapper.Builder builder = dateField(name); parseNumberField(builder, name, node, parserContext); for (Map.Entry<String, Object> entry ...
public Mapper.Builder<?, ?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { DateFieldMapper.Builder builder = dateField(name); parseNumberField(builder, name, node, parserContext); for (Map.Entry<String, Object> entry ...
public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { StringFieldMapper.Builder builder = stringField(name); parseField(builder, name, node, parserContext); for (Map.Entry<String, Object> entry : node.e...
public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { StringFieldMapper.Builder builder = stringField(name); parseField(builder, name, node, parserContext); for (Map.Entry<String, Object> entry : node.e...
public Mapper.Builder<?, ?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { Builder builder = geoPointField(name); parseField(builder, name, node, parserContext); for (Map.Entry<String, Object> entry : node.entrySet())...
public Mapper.Builder<?, ?> parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { Builder builder = geoPointField(name); parseField(builder, name, node, parserContext); for (Map.Entry<String, Object> entry : node.entrySet())...
public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { TimestampFieldMapper.Builder builder = timestamp(); parseField(builder, builder.name, node, parserContext); for (Map.Entry<String, Object> entry : n...
public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { TimestampFieldMapper.Builder builder = timestamp(); parseField(builder, builder.name, node, parserContext); for (Map.Entry<String, Object> entry : n...
public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { ExternalMapper.Builder builder = new ExternalMapper.Builder(name, generatedValue, mapperName); parseField(builder, name, node, parserContext); for (...
public Mapper.Builder parse(String name, Map<String, Object> node, ParserContext parserContext) throws MapperParsingException { ExternalMapper.Builder builder = new ExternalMapper.Builder(name, generatedValue, mapperName); parseField(builder, name, node, parserContext); for (...
IndexEngine engine(); /* * 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 (t...
IndexEngine engine(); /* * 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 (t...
protected final BulletTest[] tests = {new ShootTest(), new KinematicTest(), new ConstraintsTest(), new MeshShapeTest(), new ConvexHullTest(), new RayCastTest(), new RayPickRagdollTest(), new InternalTickTest(), new CollisionWorldTest(), new CollisionTest(), new FrustumCullingTest(), new ContactCallbackTest(), ...
protected final BulletTest[] tests = {new ShootTest(), new KinematicTest(), new ConstraintsTest(), new MeshShapeTest(), new ConvexHullTest(), new RayCastTest(), new RayPickRagdollTest(), new InternalTickTest(), new CollisionWorldTest(), new CollisionTest(), new FrustumCullingTest(), new ContactCallbackTest(), ...
public void create () { super.create(); world.maxSubSteps = 20; world.add("ground", 0f, 0f, 0f) .getColor().set(0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(), 1f); // Note: not every model is suitable for a one on one translation with a...
public void create () { super.create(); world.maxSubSteps = 20; world.add("ground", 0f, 0f, 0f) .setColor(0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(), 0.25f + 0.5f * (float)Math.random(), 1f); // Note: not every model is suitable for a one on one translation with a soft ...
@Override public void handleRequest(RestRequest request, RestChannel channel) { try { JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request).prettyPrint(); builder.startObject(); builder.field("ok", true); if (settings.get("name") != null) { ...
@Override public void handleRequest(RestRequest request, RestChannel channel) { try { JsonBuilder builder = RestJsonBuilder.restJsonBuilder(request).prettyPrint(); builder.startObject(); builder.field("ok", true); if (settings.get("name") != null) { ...
public void testDefaultMappingAndNoMappingWithMapperService() throws Exception { String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING) .startObject("_source").field("enabled", false).endObject() .endObject().endObject()...
public void testDefaultMappingAndNoMappingWithMapperService() throws Exception { String defaultMapping = XContentFactory.jsonBuilder().startObject().startObject(MapperService.DEFAULT_MAPPING) .startObject("_source").field("enabled", false).endObject() .endObject().endObject()...
public TokenStream create(TokenStream tokenStream) { return new WordDelimiterFilter(tokenStream, WordDelimiterIterator.DEFAULT_WORD_DELIM_TABLE, generateWordParts ? 1 : 0, generateNumberParts ? 1 : 0, catenateWords ? 1 : 0, cate...
public TokenStream create(TokenStream tokenStream) { return new WordDelimiterFilter(tokenStream, charTypeTable, generateWordParts ? 1 : 0, generateNumberParts ? 1 : 0, catenateWords ? 1 : 0, catenateNumbers ? 1 : 0, ...
@Inject public JvmMonitorService(Settings settings, ThreadPool threadPool, DumpMonitorService dumpMonitorService) { super(settings); this.threadPool = threadPool; this.dumpMonitorService = dumpMonitorService; this.enabled = componentSettings.getAsBoolean("enabled", true); th...
@Inject public JvmMonitorService(Settings settings, ThreadPool threadPool, DumpMonitorService dumpMonitorService) { super(settings); this.threadPool = threadPool; this.dumpMonitorService = dumpMonitorService; this.enabled = componentSettings.getAsBoolean("enabled", true); th...
public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && requestCode == ISSUE_FILTER_EDIT && data != null) { IssueFilter newFilter = (IssueFilter) data.getSerializableExtra(EXTRA_ISSUE_FILTER); if (!filter.equals(newFilter)) { ...
public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK && requestCode == ISSUE_FILTER_EDIT && data != null) { IssueFilter newFilter = (IssueFilter) data.getSerializableExtra(EXTRA_ISSUE_FILTER); if (!filter.equals(newFilter)) { ...
protected void viewIssue(Issue issue) { startActivity(IssuesViewActivity.createIntent(Collections.singletonList(issue), repo, 0)); }
protected void viewIssue(Issue issue) { startActivity(IssuesViewActivity.createIntent(issue, repo)); }
protected AnimationDesc setAnimation(final AnimationDesc anim) { if (updating) // FIXME Remove this? Just intended for debugging throw new GdxRuntimeException("Cannot change animation during update"); if (current == null) current = anim; else { if (anim != null && current.animation == anim.animation) ...
protected AnimationDesc setAnimation(final AnimationDesc anim) { if (updating) // FIXME Remove this? Just intended for debugging throw new GdxRuntimeException("Cannot change animation during update"); if (current == null) current = anim; else { if (!allowSameAnimation && anim != null && current.animatio...
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 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 InternalAggregation reduce(ReduceContext reduceContext) { List<InternalAggregation> aggregations = reduceContext.aggregations(); if (aggregations.size() == 1) { return aggregations.get(0); } TopDocs[] shardDocs = new TopDocs[aggregations.size()]; InternalS...
public InternalAggregation reduce(ReduceContext reduceContext) { List<InternalAggregation> aggregations = reduceContext.aggregations(); if (aggregations.size() == 1 && from == 0) { return aggregations.get(0); } TopDocs[] shardDocs = new TopDocs[aggregations.size()]; ...
public static ByteBuffer allocateDirect (int capacity) { if (capacity < 0) { throw new IllegalArgumentException(); } return BufferFactory.newByteBuffer(capacity); }
public static ByteBuffer allocateDirect (int capacity) { if (capacity < 0) { throw new IllegalArgumentException(); } return BufferFactory.newDirectByteBuffer(capacity); }
public static final native ArrayBuffer create(int length) /*-{ return new WebGLArrayBuffer(length); }-*/;
public static final native ArrayBuffer create(int length) /*-{ return new ArrayBuffer(length); }-*/;
private AnalyzerMapper.Builder parseAnalyzerField(Map<String, Object> analyzerNode, XContentMapper.TypeParser.ParserContext parserContext) { AnalyzerMapper.Builder builder = analyzer(); for (Map.Entry<String, Object> entry : analyzerNode.entrySet()) { String fieldName = Strings.toUndersc...
private AnalyzerMapper.Builder parseAnalyzerField(Map<String, Object> analyzerNode, XContentMapper.TypeParser.ParserContext parserContext) { AnalyzerMapper.Builder builder = analyzer(); for (Map.Entry<String, Object> entry : analyzerNode.entrySet()) { String fieldName = Strings.toUndersc...
@Test public void testLatLonValues() throws Exception { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("_analyzer").field("field", "field_analyzer").endObject() .startObject("properties") .startObject("field_analy...
@Test public void testLatLonValues() throws Exception { String mapping = XContentFactory.jsonBuilder().startObject().startObject("type") .startObject("_analyzer").field("path", "field_analyzer").endObject() .startObject("properties") .startObject("field_analyz...
public void create () { lightManager = new LightManager(LIGHTS_NUM, LightQuality.FRAGMENT); for (int i = 0; i < LIGHTS_NUM; i++) { PointLight l = new PointLight(); l.position.set(MathUtils.random(6) - 3, 1 + MathUtils.random(6), MathUtils.random(6) - 3); l.color.r = MathUtils.random(); l.color.b = Mat...
public void create () { lightManager = new LightManager(LIGHTS_NUM, LightQuality.FRAGMENT); for (int i = 0; i < LIGHTS_NUM; i++) { PointLight l = new PointLight(); l.position.set(MathUtils.random(6) - 3, 1 + MathUtils.random(6), MathUtils.random(6) - 3); l.color.r = MathUtils.random(); l.color.b = Mat...
public static void main (String[] argv) { // if(argv.length != 1 && argv.length != 2) { // System.out.println("KeyframedModelViewer <filename> ?<texture-filename>"); // System.exit(-1); // } new LwjglApplication(new SkeletonModelViewer("data/models/robot-mesh.xml", "data/models/robot.jpg"), "SkeletonModel Viewer", 8...
public static void main (String[] argv) { // if(argv.length != 1 && argv.length != 2) { // System.out.println("KeyframedModelViewer <filename> ?<texture-filename>"); // System.exit(-1); // } new LwjglApplication(new SkeletonModelViewer("data/models/ninja.mesh.xml", "data/models/ninja.jpg"), "SkeletonModel Viewer", 8...
protected void masterOperation(final ClusterSearchShardsRequest request, final ClusterState state, final ActionListener<ClusterSearchShardsResponse> listener) throws ElasticSearchException { ClusterState clusterState = clusterService.state(); String[] concreteIndices = clusterState.metaData().concre...
protected void masterOperation(final ClusterSearchShardsRequest request, final ClusterState state, final ActionListener<ClusterSearchShardsResponse> listener) throws ElasticSearchException { ClusterState clusterState = clusterService.state(); String[] concreteIndices = clusterState.metaData().concre...
protected void masterOperation(GetAliasesRequest request, ClusterState state, ActionListener<AliasesExistResponse> listener) throws ElasticSearchException { String[] concreteIndices = state.metaData().concreteIndices(request.indices(), request.ignoreIndices(), true); request.indices(concreteIndices)...
protected void masterOperation(GetAliasesRequest request, ClusterState state, ActionListener<AliasesExistResponse> listener) throws ElasticSearchException { String[] concreteIndices = state.metaData().concreteIndices(request.indices(), request.indicesOptions()); request.indices(concreteIndices); ...
protected void masterOperation(GetAliasesRequest request, ClusterState state, ActionListener<GetAliasesResponse> listener) throws ElasticSearchException { String[] concreteIndices = state.metaData().concreteIndices(request.indices(), request.ignoreIndices(), true); request.indices(concreteIndices); ...
protected void masterOperation(GetAliasesRequest request, ClusterState state, ActionListener<GetAliasesResponse> listener) throws ElasticSearchException { String[] concreteIndices = state.metaData().concreteIndices(request.indices(), request.indicesOptions()); request.indices(concreteIndices); ...
protected void doExecute(CloseIndexRequest request, ActionListener<CloseIndexResponse> listener) { ClusterState state = clusterService.state(); String[] indicesOrAliases = request.indices(); request.indices(state.metaData().concreteIndices(indicesOrAliases, request.ignoreIndices(), false)); ...
protected void doExecute(CloseIndexRequest request, ActionListener<CloseIndexResponse> listener) { ClusterState state = clusterService.state(); String[] indicesOrAliases = request.indices(); request.indices(state.metaData().concreteIndices(indicesOrAliases, request.indicesOptions())); ...
protected void doExecute(DeleteIndexRequest request, ActionListener<DeleteIndexResponse> listener) { ClusterState state = clusterService.state(); String[] indicesOrAliases = request.indices(); request.indices(state.metaData().concreteIndices(request.indices())); if (disableDeleteAl...
protected void doExecute(DeleteIndexRequest request, ActionListener<DeleteIndexResponse> listener) { ClusterState state = clusterService.state(); String[] indicesOrAliases = request.indices(); request.indices(state.metaData().concreteIndices(request.indices(), request.indicesOptions())); ...
protected void masterOperation(final TypesExistsRequest request, final ClusterState state, final ActionListener<TypesExistsResponse> listener) throws ElasticSearchException { String[] concreteIndices = state.metaData().concreteIndices(request.indices(), request.ignoreIndices(), false); if (concreteI...
protected void masterOperation(final TypesExistsRequest request, final ClusterState state, final ActionListener<TypesExistsResponse> listener) throws ElasticSearchException { String[] concreteIndices = state.metaData().concreteIndices(request.indices(), request.indicesOptions()); if (concreteIndices...
protected void doExecute(OpenIndexRequest request, ActionListener<OpenIndexResponse> listener) { request.indices(clusterService.state().metaData().concreteIndices(request.indices(), request.ignoreIndices(), false)); super.doExecute(request, listener); }
protected void doExecute(OpenIndexRequest request, ActionListener<OpenIndexResponse> listener) { request.indices(clusterService.state().metaData().concreteIndices(request.indices(), request.indicesOptions())); super.doExecute(request, listener); }
protected void doExecute(DeleteWarmerRequest request, ActionListener<DeleteWarmerResponse> listener) { // update to concrete indices request.indices(clusterService.state().metaData().concreteIndices(request.indices())); super.doExecute(request, listener); }
protected void doExecute(DeleteWarmerRequest request, ActionListener<DeleteWarmerResponse> listener) { // update to concrete indices request.indices(clusterService.state().metaData().concreteIndices(request.indices(), request.indicesOptions())); super.doExecute(request, listener); }
protected void doExecute(SearchRequest searchRequest, ActionListener<SearchResponse> listener) { // optimize search type for cases where there is only one shard group to search on if (optimizeSingleShard && searchRequest.searchType() != SCAN && searchRequest.searchType() != COUNT) { try ...
protected void doExecute(SearchRequest searchRequest, ActionListener<SearchResponse> listener) { // optimize search type for cases where there is only one shard group to search on if (optimizeSingleShard && searchRequest.searchType() != SCAN && searchRequest.searchType() != COUNT) { try ...
protected final void masterOperation(final Request request, final ClusterState state, final ActionListener<Response> listener) throws ElasticSearchException { String[] concreteIndices = state.metaData().concreteIndices(request.indices(), request.ignoreIndices(), true); request.indices(concreteIndice...
protected final void masterOperation(final Request request, final ClusterState state, final ActionListener<Response> listener) throws ElasticSearchException { String[] concreteIndices = state.metaData().concreteIndices(request.indices(), request.indicesOptions()); request.indices(concreteIndices); ...
protected AbstractConcurrentMapFilterCache(Index index, @IndexSettings Settings indexSettings, ThreadPool threadPool) { super(index, indexSettings); this.readerCleanerSchedule = componentSettings.getAsTime("readerCleanerSchedule", TimeValue.timeValueMinutes(1)); logger.debug("Using weak fi...
protected AbstractConcurrentMapFilterCache(Index index, @IndexSettings Settings indexSettings, ThreadPool threadPool) { super(index, indexSettings); this.readerCleanerSchedule = componentSettings.getAsTime("readerCleanerSchedule", TimeValue.timeValueMinutes(1)); logger.debug("Using [" + ty...
public boolean onContactAdded(btManifoldPoint cp, btCollisionObject colObj0, int partId0, int index0, boolean match0, btCollisionObject colObj1, int partId1, int index1, boolean match1) { return gdxBulletJNI.ContactAddedListenerByObject_onContactAdded(swigCPtr, this, btManifoldPoint.getCPtr(cp), cp, btCollisionOb...
public boolean onContactAdded(btManifoldPoint cp, btCollisionObject colObj0, int partId0, int index0, boolean match0, btCollisionObject colObj1, int partId1, int index1, boolean match1) { return gdxBulletJNI.ContactAddedListenerByObject_onContactAdded(swigCPtr, this, cp, btCollisionObject.getCPtr(colObj0), colObj...
public boolean onContactAdded(btManifoldPoint cp, int userValue0, int partId0, int index0, boolean match0, int userValue1, int partId1, int index1, boolean match1) { return gdxBulletJNI.ContactAddedListenerByValue_onContactAdded(swigCPtr, this, btManifoldPoint.getCPtr(cp), cp, userValue0, partId0, index0, match0,...
public boolean onContactAdded(btManifoldPoint cp, int userValue0, int partId0, int index0, boolean match0, int userValue1, int partId1, int index1, boolean match1) { return gdxBulletJNI.ContactAddedListenerByValue_onContactAdded(swigCPtr, this, cp, userValue0, partId0, index0, match0, userValue1, partId1, index1,...
public boolean onContactAdded(btManifoldPoint cp, btCollisionObjectWrapper colObj0Wrap, int partId0, int index0, boolean match0, btCollisionObjectWrapper colObj1Wrap, int partId1, int index1, boolean match1) { return gdxBulletJNI.ContactAddedListenerByWrapper_onContactAdded(swigCPtr, this, btManifoldPoint.getCPtr...
public boolean onContactAdded(btManifoldPoint cp, btCollisionObjectWrapper colObj0Wrap, int partId0, int index0, boolean match0, btCollisionObjectWrapper colObj1Wrap, int partId1, int index1, boolean match1) { return gdxBulletJNI.ContactAddedListenerByWrapper_onContactAdded(swigCPtr, this, cp, btCollisionObjectWr...
public void onContactProcessed(btManifoldPoint cp, btCollisionObject colObj0, boolean match0, btCollisionObject colObj1, boolean match1) { gdxBulletJNI.ContactProcessedListenerByObject_onContactProcessed(swigCPtr, this, btManifoldPoint.getCPtr(cp), cp, btCollisionObject.getCPtr(colObj0), colObj0, match0, btCollis...
public void onContactProcessed(btManifoldPoint cp, btCollisionObject colObj0, boolean match0, btCollisionObject colObj1, boolean match1) { gdxBulletJNI.ContactProcessedListenerByObject_onContactProcessed(swigCPtr, this, cp, btCollisionObject.getCPtr(colObj0), colObj0, match0, btCollisionObject.getCPtr(colObj1), c...
public void onContactProcessed(btManifoldPoint cp, int userValue0, boolean match0, int userValue1, boolean match1) { gdxBulletJNI.ContactProcessedListenerByValue_onContactProcessed(swigCPtr, this, btManifoldPoint.getCPtr(cp), cp, userValue0, match0, userValue1, match1); }
public void onContactProcessed(btManifoldPoint cp, int userValue0, boolean match0, int userValue1, boolean match1) { gdxBulletJNI.ContactProcessedListenerByValue_onContactProcessed(swigCPtr, this, cp, userValue0, match0, userValue1, match1); }
private void serializeValue(final ParseContext context, String currentFieldName, XContentParser.Token token) throws IOException { if (currentFieldName == null) { throw new MapperParsingException("object mapping [" + name + "] trying to serialize a value with no field associated with it, current ...
private void serializeValue(final ParseContext context, String currentFieldName, XContentParser.Token token) throws IOException { if (currentFieldName == null) { throw new MapperParsingException("object mapping [" + name + "] trying to serialize a value with no field associated with it, current ...
@Override public void readFrom(StreamInput in) throws IOException { clusterName = ClusterName.readClusterName(in); clusterState = ClusterState.Builder.readFrom(in, null, null); }
@Override public void readFrom(StreamInput in) throws IOException { clusterName = ClusterName.readClusterName(in); clusterState = ClusterState.Builder.readFrom(in, null); }
private MetaData readMetaData(byte[] data) throws IOException { XContentParser parser = null; try { parser = XContentFactory.xContent(XContentType.JSON).createParser(data); return MetaData.Builder.fromXContent(parser, settings); } finally { if (parser != n...
private MetaData readMetaData(byte[] data) throws IOException { XContentParser parser = null; try { parser = XContentFactory.xContent(XContentType.JSON).createParser(data); return MetaData.Builder.fromXContent(parser); } finally { if (parser != null) { ...
public void testSimpleJsonFromAndTo() throws IOException { MetaData metaData = newMetaDataBuilder() .put(newIndexMetaDataBuilder("test1") .numberOfShards(1) .numberOfReplicas(2)) .put(newIndexMetaDataBuilder("test2") ...
public void testSimpleJsonFromAndTo() throws IOException { MetaData metaData = newMetaDataBuilder() .put(newIndexMetaDataBuilder("test1") .numberOfShards(1) .numberOfReplicas(2)) .put(newIndexMetaDataBuilder("test2") ...
@Override protected ShardCountRequest newShardRequest(ShardRouting shard, CountRequest request) { return new ShardCountRequest(shard.index(), shard.id(), request.querySource(), request.minScore(), request.queryParserName(), request.types()); }
@Override protected ShardCountRequest newShardRequest(ShardRouting shard, CountRequest request) { return new ShardCountRequest(shard.index(), shard.id(), request); }
private ArgumentType getArgumentType (Parameter parameter) { String[] typeTokens = parameter.getType().toString().split("\\."); String type = typeTokens[typeTokens.length - 1]; int arrayDim = 0; for (int i = 0; i < type.length(); i++) { if (type.charAt(i) == '[') arrayDim++; } type = type.replace("[", "...
private ArgumentType getArgumentType (Parameter parameter) { String[] typeTokens = parameter.getType().toString().split("\\."); String type = typeTokens[typeTokens.length - 1]; int arrayDim = 0; for (int i = 0; i < type.length(); i++) { if (type.charAt(i) == '[') arrayDim++; } type = type.replace("[", "...
public void restoreIndexWithMissingShards() throws Exception { logger.info("--> start 2 nodes"); cluster().startNode(settingsBuilder().put("gateway.type", "local")); cluster().startNode(settingsBuilder().put("gateway.type", "local")); immutableCluster().wipeIndices("_all"); ...
public void restoreIndexWithMissingShards() throws Exception { logger.info("--> start 2 nodes"); cluster().startNode(settingsBuilder().put("gateway.type", "local")); cluster().startNode(settingsBuilder().put("gateway.type", "local")); immutableCluster().wipeIndices("_all"); ...
public boolean handle (Event event) { if (!ClassReflection.isInstance(eventClass, event)) return false; result = EventAction.this.handle((T) event); return result; } };
public boolean handle (Event event) { if (!active || !ClassReflection.isInstance(eventClass, event)) return false; result = EventAction.this.handle((T) event); return result; } };
protected void processFile (InputFile inputFile) throws Exception { System.out.println("Processing " + inputFile.inputFile); Pixmap pixmap = new Pixmap(new FileHandle(inputFile.inputFile)); if (pixmap.getFormat() != Format.RGB888 && pixmap.getFormat() != Format.RGB565) { System.out.println("Converting fr...
protected void processFile (InputFile inputFile) throws Exception { System.out.println("Processing " + inputFile.inputFile); Pixmap pixmap = new Pixmap(new FileHandle(inputFile.inputFile)); if (pixmap.getFormat() != Format.RGB888 && pixmap.getFormat() != Format.RGB565) { System.out.println("Converting fr...
@Override protected BulkShardResponse shardOperationOnPrimary(ClusterState clusterState, ShardOperationRequest shardRequest) { IndexShard indexShard = indexShard(shardRequest); final BulkShardRequest request = shardRequest.request; BulkItemResponse[] responses = new BulkItemResponse[request....
@Override protected BulkShardResponse shardOperationOnPrimary(ClusterState clusterState, ShardOperationRequest shardRequest) { IndexShard indexShard = indexShard(shardRequest); final BulkShardRequest request = shardRequest.request; BulkItemResponse[] responses = new BulkItemResponse[request....
public void onInternalTick (btDynamicsWorld dynamicsWorld, float timeStep) { btCollisionObjectArray objs = dynamicsWorld.getCollisionObjectArray(); dynamicsWorld.clearForces(); int idx = 0; for (int i = 0; i < objs.size(); i++) { btRigidBody body = (btRigidBody)(objs.at(i)); if (body == null || bo...
public void onInternalTick (btDynamicsWorld dynamicsWorld, float timeStep) { btCollisionObjectArray objs = dynamicsWorld.getCollisionObjectArray(); dynamicsWorld.clearForces(); int idx = 0; for (int i = 0; i < objs.size(); i++) { btRigidBody body = (btRigidBody)(objs.at(i)); if (body == null || bo...
public boolean tap (float x, float y, int count, int button) { Ray ray = camera.getPickRay(x, y); rayFrom.set(ray.origin); rayTo.set(ray.direction).scl(50f).add(rayFrom); // 50 meters max from the origin // Because we reuse the ClosestRayResultCallback, we need reset it's values rayTestCB.setCollisionObject...
public boolean tap (float x, float y, int count, int button) { Ray ray = camera.getPickRay(x, y); rayFrom.set(ray.origin); rayTo.set(ray.direction).scl(50f).add(rayFrom); // 50 meters max from the origin // Because we reuse the ClosestRayResultCallback, we need reset it's values rayTestCB.setCollisionObject...
public BulletWorld createWorld () { btDefaultCollisionConfiguration collisionConfiguration = new btSoftBodyRigidBodyCollisionConfiguration(); btCollisionDispatcher dispatcher = new btCollisionDispatcher(collisionConfiguration); btAxisSweep3 broadphase = new btAxisSweep3(Vector3.tmp.set(-1000, -1000, -1000), Vect...
public BulletWorld createWorld () { btDefaultCollisionConfiguration collisionConfiguration = new btSoftBodyRigidBodyCollisionConfiguration(); btCollisionDispatcher dispatcher = new btCollisionDispatcher(collisionConfiguration); btAxisSweep3 broadphase = new btAxisSweep3(tmpV1.set(-1000, -1000, -1000), tmpV2.set(...
public String storeName() { return PurchaseManagerConfig.STORE_NAME_OUYA; }
public String storeName() { return PurchaseManagerConfig.STORE_NAME_ANDROID_OUYA; }
@Test public void testToString() { assertThat("10", is(new ByteSizeValue(10, ByteSizeUnit.BYTES).toString())); assertThat("1.5kb", is(new ByteSizeValue((long) (1024 * 1.5), ByteSizeUnit.BYTES).toString())); assertThat("1.5mb", is(new ByteSizeValue((long) (1024 * 1.5), ByteSizeUnit.KB).toStri...
@Test public void testToString() { assertThat("10b", is(new ByteSizeValue(10, ByteSizeUnit.BYTES).toString())); assertThat("1.5kb", is(new ByteSizeValue((long) (1024 * 1.5), ByteSizeUnit.BYTES).toString())); assertThat("1.5mb", is(new ByteSizeValue((long) (1024 * 1.5), ByteSizeUnit.KB).toStr...