buggy_function
stringlengths
1
391k
fixed_function
stringlengths
0
392k
public void writeContent(final XMLExtendedStreamWriter writer, final ModelMarshallingContext context) throws XMLStreamException { final ModelNode modelNode = context.getModelNode(); writer.writeStartDocument(); writer.writeStartElement(Element.HOST.getLocalName()); if (hasDefinedC...
public void writeContent(final XMLExtendedStreamWriter writer, final ModelMarshallingContext context) throws XMLStreamException { final ModelNode modelNode = context.getModelNode(); writer.writeStartDocument(); writer.writeStartElement(Element.HOST.getLocalName()); if (modelNode.h...
public void setup(ManagementClient managementClient, String containerId) throws Exception { LOGGER.info("RESOURCE_LOCATION=" + RESOURCE_LOCATION); ModelNode op; // setup DB server = Server.createTcpServer("-tcpAllowOthers").start(); Class.forName("or...
public void setup(ManagementClient managementClient, String containerId) throws Exception { LOGGER.info("RESOURCE_LOCATION=" + RESOURCE_LOCATION); ModelNode op; // setup DB server = Server.createTcpServer("-tcpAllowOthers").start(); Class.forName("or...
protected Pair<BigDecimal[], BigDecimal[]> computeRule(int numberOfPoints) { if (numberOfPoints <= 0) { throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_POINTS, numberOfPoints); } if (numberOfPoints == 1) { ...
protected Pair<BigDecimal[], BigDecimal[]> computeRule(int numberOfPoints) { if (numberOfPoints <= 0) { throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_POINTS, numberOfPoints); } if (numberOfPoints == 1) { ...
protected Pair<Double[], Double[]> computeRule(int numberOfPoints) { if (numberOfPoints <= 0) { throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_POINTS, numberOfPoints); } if (numberOfPoints == 1) { ...
protected Pair<Double[], Double[]> computeRule(int numberOfPoints) { if (numberOfPoints <= 0) { throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_POINTS, numberOfPoints); } if (numberOfPoints == 1) { ...
public synchronized void stop(StopContext context) { shutdown.set(true); if (channelClient != null) { channelClient.close(); } }
public synchronized void stop(StopContext context) { shutdown.set(true); if (channelClient != null) { unregister(); } }
protected void doBegin(Object transaction, TransactionDefinition definition) { HibernateTransactionObject txObject = (HibernateTransactionObject) transaction; if (txObject.hasConnectionHolder() && !txObject.getConnectionHolder().isSynchronizedWithTransaction()) { throw new IllegalTransactionStateException( ...
protected void doBegin(Object transaction, TransactionDefinition definition) { HibernateTransactionObject txObject = (HibernateTransactionObject) transaction; if (txObject.hasConnectionHolder() && !txObject.getConnectionHolder().isSynchronizedWithTransaction()) { throw new IllegalTransactionStateException( ...
protected Session openSession(SessionFactory sessionFactory) throws DataAccessResourceFailureException { try { Session session = sessionFactory.openSession(); session.setFlushMode(FlushMode.MANUAL); return session; } catch (HibernateException ex) { throw new DataAccessResourceFailureException("Could ...
protected Session openSession(SessionFactory sessionFactory) throws DataAccessResourceFailureException { try { Session session = SessionFactoryUtils.openSession(sessionFactory); session.setFlushMode(FlushMode.MANUAL); return session; } catch (HibernateException ex) { throw new DataAccessResourceFailu...
protected Session openSession() throws DataAccessResourceFailureException { try { Session session = getSessionFactory().openSession(); session.setFlushMode(FlushMode.MANUAL); return session; } catch (HibernateException ex) { throw new DataAccessResourceFailureException("Could not open Hibernate Sessi...
protected Session openSession() throws DataAccessResourceFailureException { try { Session session = SessionFactoryUtils.openSession(getSessionFactory()); session.setFlushMode(FlushMode.MANUAL); return session; } catch (HibernateException ex) { throw new DataAccessResourceFailureException("Could not o...
public void putArchiveEntry(ArchiveEntry archiveEntry) throws IOException { if(finished) { throw new IOException("Stream has already been finished"); } TarArchiveEntry entry = (TarArchiveEntry) archiveEntry; Map<String, String> paxHeaders = new HashMap<String, String>(); ...
public void putArchiveEntry(ArchiveEntry archiveEntry) throws IOException { if(finished) { throw new IOException("Stream has already been finished"); } TarArchiveEntry entry = (TarArchiveEntry) archiveEntry; Map<String, String> paxHeaders = new HashMap<String, String>(); ...
public Object call() throws Exception { TransactionSynchronizationManager.bindResource(getSessionFactory(), sessionHolder); getNextCallable().call(); return null; } }; }
public Object call() throws Exception { TransactionSynchronizationManager.bindResource(getSessionFactory(), sessionHolder); getNext().call(); return null; } }; }
public Object call() throws Exception { Object result = getNextCallable().call(); if (this.asyncWebRequest.isAsyncCompleted()) { throw new StaleAsyncWebRequestException( "Async request no longer available due to a timeout or a (client) error"); } return result; }
public Object call() throws Exception { Object result = getNext().call(); if (this.asyncWebRequest.isAsyncCompleted()) { throw new StaleAsyncWebRequestException( "Async request no longer available due to a timeout or a (client) error"); } return result; }
public void startAsync_stale() throws Exception { expect(this.request.isAsyncSupported()).andReturn(true); replay(this.request); this.asyncRequest.onComplete(new AsyncEvent(null)); try { this.asyncRequest.startAsync(); fail("expected exception"); } catch (IllegalStateException ex) { assertEquals("...
public void startAsync_stale() throws Exception { expect(this.request.isAsyncSupported()).andReturn(true); replay(this.request); this.asyncRequest.onComplete(new AsyncEvent(null)); try { this.asyncRequest.startAsync(); fail("expected exception"); } catch (IllegalStateException ex) { assertEquals("...
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit unit = phaseContext.getDeploymentUnit(); if (DeploymentTypeMarker.isType(DeploymentType.EAR, unit)) { return; } // wars define resource roots ...
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException { final DeploymentUnit unit = phaseContext.getDeploymentUnit(); if (DeploymentTypeMarker.isType(DeploymentType.EAR, unit)) { return; } // wars define resource roots ...
String logicalName = "-b".equals(arg) ? "public" : arg.substring(2); SecurityActions.setSystemProperty(ServerEnvironment.NETWORK_IP_PREFIX + logicalName, value); } else { System.err.printf("Invalid option '%s'\n", arg); usag...
String logicalName = "-b".equals(arg) ? "public" : arg.substring(2); SecurityActions.setSystemProperty(ServerEnvironment.JBOSS_BIND_ADDRESS_PREFIX + logicalName, value); } else { System.err.printf("Invalid option '%s'\n", arg); ...
private HostEnvironmentResourceDescription(final HostControllerEnvironment environment) { super(RESOURCE_PATH, HostRootDescription.getResourceDescriptionResolver("host.env")); osh = new HostEnvironmentReadHandler(environment); }
private HostEnvironmentResourceDescription(final HostControllerEnvironment environment) { super(RESOURCE_PATH, HostResolver.getResolver("host.env")); osh = new HostEnvironmentReadHandler(environment); }
OperationCancellationException operationCancelledAsynchronously(); /* * JBoss, Home of Professional Open Source. * Copyright 2011, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * Thi...
OperationCancellationException operationCancelledAsynchronously(); /* * JBoss, Home of Professional Open Source. * Copyright 2011, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * Thi...
private void parseContainer(XMLExtendedStreamReader reader, ModelNode subsystemAddress, List<ModelNode> operations) throws XMLStreamException { ModelNode container = Util.getEmptyOperation(ModelDescriptionConstants.ADD, null); String name = null; for (int i = 0; i < reader.getAttributeCoun...
private void parseContainer(XMLExtendedStreamReader reader, ModelNode subsystemAddress, List<ModelNode> operations) throws XMLStreamException { ModelNode container = Util.getEmptyOperation(ModelDescriptionConstants.ADD, null); String name = null; for (int i = 0; i < reader.getAttributeCoun...
public Resource getResource(final String name) { try { final VirtualFile file = root.getChild(name); if (!file.exists()) { return null; } return new VFSEntryResource(file, root.toURL()); } catch (MalformedURLException e) { /...
public Resource getResource(final String name) { try { final VirtualFile file = root.getChild(name); if (!file.exists()) { return null; } return new VFSEntryResource(file, file.toURL()); } catch (MalformedURLException e) { /...
private final Set changes = Collections .synchronizedSet(new LinkedHashSet());;
private final Set changes = Collections .synchronizedSet(new LinkedHashSet());
private TypedValue executeFunctionJLRMethod(ExpressionState state, Method method) throws EvaluationException { Object[] functionArgs = getArguments(state); if (!method.isVarArgs() && method.getParameterTypes().length != functionArgs.length) { throw new SpelEvaluationException(SpelMessage.INCORRECT_NUMBER_OF_AR...
private TypedValue executeFunctionJLRMethod(ExpressionState state, Method method) throws EvaluationException { Object[] functionArgs = getArguments(state); if (!method.isVarArgs() && method.getParameterTypes().length != functionArgs.length) { throw new SpelEvaluationException(SpelMessage.INCORRECT_NUMBER_OF_AR...
public TypedValue execute(EvaluationContext context, Object target, Object... arguments) throws AccessException { try { if (this.argsRequiringConversion != null && arguments != null) { ReflectionHelper.convertArguments( context.getTypeConverter(), arguments, this.method, this.argsRequiringConversi...
public TypedValue execute(EvaluationContext context, Object target, Object... arguments) throws AccessException { try { if (this.argsRequiringConversion != null && arguments != null) { ReflectionHelper.convertArguments( context.getTypeConverter(), arguments, this.method, this.argsRequiringConversi...
private void projectionValidation(Fields projFields) { if (projFields == null) { return; } Fields allFields = this.getOutputFields(); for (String field : projFields) { if (!allFields.contains(field)) { throw new IllegalArgumentException("Tryin...
private void projectionValidation(Fields projFields) { if (projFields == null) { return; } Fields allFields = this.getOutputFields(); for (String field : projFields) { if (!allFields.contains(field)) { throw new IllegalArgumentException("Tryin...
public static final SimpleAttributeDefinition DEFAULT_CLUSTERED_SFSB_CACHE = new SimpleAttributeDefinitionBuilder(EJB3SubsystemModel.DEFAULT_CLUSTERED_SFSB_CACHE, ModelType.STRING, true) .setAllowExpression(true) // .setAllowNull(true) .build();...
public static final SimpleAttributeDefinition DEFAULT_CLUSTERED_SFSB_CACHE = new SimpleAttributeDefinitionBuilder(EJB3SubsystemModel.DEFAULT_CLUSTERED_SFSB_CACHE, ModelType.STRING, true) .setAllowExpression(true) .setAllowNull(true) .build();
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { if (source == null) { return null; } if (SpelMappingContextHolder.contains(source)) { return source; } if (sourceType.isAssignableTo(targetType) && isCopyByReference(sourceType, targetType)) { return source;...
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { if (source == null) { return null; } if (MappingContextHolder.contains(source)) { return source; } if (sourceType.isAssignableTo(targetType) && isCopyByReference(sourceType, targetType)) { return source; }...
protected final int doStartTagInternal() throws JspException { if (this.value != null) { // Find the containing EditorAwareTag (e.g. BindTag), if applicable. EditorAwareTag tag = (EditorAwareTag) TagSupport.findAncestorWithClass(this, EditorAwareTag.class); if (tag == null) { throw new JspException("Tra...
protected final int doStartTagInternal() throws JspException { if (this.value != null) { // Find the containing EditorAwareTag (e.g. BindTag), if applicable. EditorAwareTag tag = (EditorAwareTag) TagSupport.findAncestorWithClass(this, EditorAwareTag.class); if (tag == null) { throw new JspException("Tra...
private String createUrl() throws JspException { HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); StringBuilder url = new StringBuilder(); if (this.type == UrlType.CONTEXT_RELATIVE) { // add applicatio...
private String createUrl() throws JspException { HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); StringBuilder url = new StringBuilder(); if (this.type == UrlType.CONTEXT_RELATIVE) { // add applicatio...
public void execute(final NewOperationContext context, final ModelNode operation) throws OperationFailedException { if (context.hasFailureDescription()) { // abort context.setRollbackOnly(); context.completeStep(); return; } final Map<String,...
public void execute(final NewOperationContext context, final ModelNode operation) throws OperationFailedException { if (context.hasFailureDescription()) { // abort context.setRollbackOnly(); context.completeStep(); return; } final Map<String,...
private void executeTwoPhaseOperation(NewOperationContext context, ModelNode operation, OperationRouting routing) throws OperationFailedException { System.out.println("Executing two-phase"); DomainOperationContext overallContext = new DomainOperationContext(localHostControllerInfo); // Get...
private void executeTwoPhaseOperation(NewOperationContext context, ModelNode operation, OperationRouting routing) throws OperationFailedException { System.out.println("Executing two-phase"); DomainOperationContext overallContext = new DomainOperationContext(localHostControllerInfo); // Get...
public void testRank() { QRSolver solver = new QRSolver(new QRDecompositionImpl(MatrixUtils.createRealMatrix(testData3x3NonSingular))); assertTrue(solver.isNonSingular()); solver = new QRSolver(new QRDecompositionImpl(MatrixUtils.createRealMatrix(testData3x3Singular))); ...
public void testRank() { QRSolver solver = new QRSolver(new QRDecompositionImpl(MatrixUtils.createRealMatrix(testData3x3NonSingular))); assertTrue(solver.isNonSingular()); solver = new QRSolver(new QRDecompositionImpl(MatrixUtils.createRealMatrix(testData3x3Singular))); ...
private ModelNode getModel(OperationContext ctx, PathAddress address) { try { Resource resource = ctx.getRootResource().navigate(address); return Resource.Tools.readModel(resource); } catch (NoSuchElementException e) { return null; } }
private ModelNode getModel(OperationContext ctx, PathAddress address) { try { Resource resource = ctx.readResourceFromRoot(address); return Resource.Tools.readModel(resource); } catch (NoSuchElementException e) { return null; } }
public void execute(OperationContext context, ModelNode operation) { final Resource resource = context.getRootResource().navigate(getBaseAddress()); // Get the model recursively final ModelNode model = Resource.Tools.readModel(resource); try { final ByteArrayOutputStream ...
public void execute(OperationContext context, ModelNode operation) { final Resource resource = context.readResourceFromRoot(getBaseAddress()); // Get the model recursively final ModelNode model = Resource.Tools.readModel(resource); try { final ByteArrayOutputStream baos =...
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { // We get the model as a list of resources descriptions final ModelNode domainModel = operation.get(DOMAIN_MODEL); final ModelNode startRoot = Resource.Tools.readModel(context.getRootResour...
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { // We get the model as a list of resources descriptions final ModelNode domainModel = operation.get(DOMAIN_MODEL); final ModelNode startRoot = Resource.Tools.readModel(context.readResourceF...
public ModelNode getDomainModel() { if (domainModel == null) { domainModel = Resource.Tools.readModel(context.getRootResource()); } return domainModel; } }
public ModelNode getDomainModel() { if (domainModel == null) { domainModel = Resource.Tools.readModel(context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, true)); } return domainModel; } }
public Map<Set<ServerIdentity>, ModelNode> getServerOperations(OperationContext context, ModelNode operation, PathAddress address) { if (HOST_CONTROLLER_LOGGER.isTraceEnabled()) { HOST_CONTROLLER_LOGGER.tracef("Resolving %s", operation); } Set<ModelNode> dontPropagate = context....
public Map<Set<ServerIdentity>, ModelNode> getServerOperations(OperationContext context, ModelNode operation, PathAddress address) { if (HOST_CONTROLLER_LOGGER.isTraceEnabled()) { HOST_CONTROLLER_LOGGER.tracef("Resolving %s", operation); } Set<ModelNode> dontPropagate = context....
public void execute(OperationContext context, ModelNode operation) { final ModelNode opAddr = operation.get(OP_ADDR); PathAddress address = PathAddress.pathAddress(opAddr); String name = address.getLastElement().getValue(); final Resource deploymentResource = context.getRootResource...
public void execute(OperationContext context, ModelNode operation) { final ModelNode opAddr = operation.get(OP_ADDR); PathAddress address = PathAddress.pathAddress(opAddr); String name = address.getLastElement().getValue(); final Resource deploymentResource = context.readResourceFro...
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { validator.validate(operation); String name = operation.require(NAME).asString(); String toReplace = operation.require(TO_REPLACE).asString(); if (name.equals(toReplace)) { ...
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { validator.validate(operation); String name = operation.require(NAME).asString(); String toReplace = operation.require(TO_REPLACE).asString(); if (name.equals(toReplace)) { ...
public void upgrade(ServerHttpRequest request, ServerHttpResponse response, String protocol, WebSocketHandler handler) throws IOException, HandshakeFailureException { StandardWebSocketSessionAdapter session = new StandardWebSocketSessionAdapter(); this.wsSessionInitializer.initialize(request, response, session...
public void upgrade(ServerHttpRequest request, ServerHttpResponse response, String protocol, WebSocketHandler handler) throws IOException, HandshakeFailureException { StandardWebSocketSessionAdapter session = new StandardWebSocketSessionAdapter(); this.wsSessionInitializer.initialize(request, response, protoco...
public void openConnection() throws Exception { List<String> subprotocols = Arrays.asList("abc"); HttpHeaders headers = new HttpHeaders(); headers.setSecWebSocketProtocol(subprotocols); WebSocketClient client = mock(WebSocketClient.class); WebSocketHandler handler = new WebSocketHandlerAdapter(); WebSoc...
public void openConnection() throws Exception { List<String> subprotocols = Arrays.asList("abc"); HttpHeaders headers = new HttpHeaders(); headers.setSecWebSocketProtocol(subprotocols); WebSocketClient client = mock(WebSocketClient.class); WebSocketHandler handler = new WebSocketHandlerAdapter(); WebSoc...
public void tearDown(final ManagementClient managementClient, final String containerId) throws Exception { ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(managementClient.getControllerClient()); final DeploymentPlan undeployPlan = manager.newDeploymentPlan().und...
public void tearDown(final ManagementClient managementClient, final String containerId) throws Exception { ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(managementClient.getControllerClient()); final DeploymentPlan undeployPlan = manager.newDeploymentPlan().und...
public void tearDown(final ManagementClient managementClient, final String containerId) throws Exception { final ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(managementClient.getControllerClient()); final DeploymentPlan undeployPlan = manager.newDeploymentPlan...
public void tearDown(final ManagementClient managementClient, final String containerId) throws Exception { final ServerDeploymentManager manager = ServerDeploymentManager.Factory.create(managementClient.getControllerClient()); final DeploymentPlan undeployPlan = manager.newDeploymentPlan...
public boolean isPlaying () { return track.isPlaying() && !track.isPaused(); }
public boolean isPlaying () { return track.isPlaying(); }
static public String getSimpleName (Class c) { return c.getSimpleName(); }
static public String getSimpleName (Class c) { return c.getName(); }
public boolean isPressed () { return clickListener.isVisualPressed(); }
public boolean isPressed () { return clickListener.isPressed(); }
protected IOSApplication createApplication() { IOSApplicationConfiguration config = new IOSApplicationConfiguration(); return new IOSApplication(new BulletTestCollection(), config); }
protected IOSApplication createApplication() { IOSApplicationConfiguration config = new IOSApplicationConfiguration(); return new IOSApplication(new DownloadTest(), config); }
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 body, ...
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 body, ...
public Suggestion<? extends Entry<? extends Option>> execute(String name, PhraseSuggestionContext suggestion, IndexReader indexReader, CharsRef spare) throws IOException { double realWordErrorLikelihood = suggestion.realworldErrorLikelyhood(); List<PhraseSuggestionContext.DirectCandidate...
public Suggestion<? extends Entry<? extends Option>> execute(String name, PhraseSuggestionContext suggestion, IndexReader indexReader, CharsRef spare) throws IOException { double realWordErrorLikelihood = suggestion.realworldErrorLikelyhood(); List<PhraseSuggestionContext.DirectCandidate...
public void changeState (State<E> newState) { // Keep a record of the previous state previousState = currentState; // Call the exit method of the existing state if (currentState != null) currentState.exit(owner); // Change state to the new state currentState = newState; // Call the entry method of the...
public void changeState (State<E> newState) { // Keep a record of the previous state previousState = currentState; // Call the exit method of the existing state if (currentState != null) currentState.exit(owner); // Change state to the new state currentState = newState; // Call the entry method of the...
private void updateImage () { boolean isPressed = isPressed(); if (isDisabled && style.imageDisabled != null) image.setDrawable(style.imageDisabled); else if (isPressed && style.imageDown != null) image.setDrawable(style.imageDown); else if (isChecked && style.imageChecked != null) image.setDrawable((...
private void updateImage () { boolean isPressed = isPressed(); if (isDisabled() && style.imageDisabled != null) image.setDrawable(style.imageDisabled); else if (isPressed && style.imageDown != null) image.setDrawable(style.imageDown); else if (isChecked && style.imageChecked != null) image.setDrawable...
public void draw (Batch batch, float parentAlpha) { Color fontColor; if (isDisabled && style.disabledFontColor != null) fontColor = style.disabledFontColor; else if (isPressed() && style.downFontColor != null) fontColor = style.downFontColor; else if (isChecked && style.checkedFontColor != null) fontC...
public void draw (Batch batch, float parentAlpha) { Color fontColor; if (isDisabled() && style.disabledFontColor != null) fontColor = style.disabledFontColor; else if (isPressed() && style.downFontColor != null) fontColor = style.downFontColor; else if (isChecked && style.checkedFontColor != null) fon...
private void parseMaterials (ModelData model, JsonValue json, String materialDir) { JsonValue materials = json.get("materials"); if(materials == null) { // we should probably create some default material in this case } else { model.materials.ensureCapacity(materials.size()); for (JsonValue material = ...
private void parseMaterials (ModelData model, JsonValue json, String materialDir) { JsonValue materials = json.get("materials"); if(materials == null) { // we should probably create some default material in this case } else { model.materials.ensureCapacity(materials.size()); for (JsonValue material = ...
public enum Type { Circle, Polygon, Edge, Chain, };
public enum Type { Circle, Edge, Polygon, Chain, };
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.upcast(objs.at(i)); if (body == null ...
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.setM_collisionObje...
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.setM_collisionObje...
public boolean touchDown (int screenX, int screenY, int pointer, int button) { boolean result = false; if (button == Buttons.LEFT) { Ray ray = camera.getPickRay(screenX, screenY); Vector3.tmp.set(ray.direction).scl(10f).add(ray.origin); ClosestRayResultCallback cb = new ClosestRayResultCallback(ray.origin...
public boolean touchDown (int screenX, int screenY, int pointer, int button) { boolean result = false; if (button == Buttons.LEFT) { Ray ray = camera.getPickRay(screenX, screenY); Vector3.tmp.set(ray.direction).scl(10f).add(ray.origin); ClosestRayResultCallback cb = new ClosestRayResultCallback(ray.origin...
private static void formatTeamAdd(Event event, StyledText main, StyledText details) { boldActor(main, event); TeamAddPayload payload = (TeamAddPayload) event.getPayload(); String value; User user = payload.getUser(); if (user != null) value = user.getLogin(); ...
private static void formatTeamAdd(Event event, StyledText main, StyledText details) { boldActor(main, event); TeamAddPayload payload = (TeamAddPayload) event.getPayload(); String value; User user = payload.getUser(); if (user != null) value = user.getLogin(); ...
public void onActivityResult(int requestCode, int resultCode, Intent data) { if ((requestCode == GIST_CREATE || requestCode == GIST_VIEW) && RESULT_OK == resultCode) { forceReload(); return; } super.onActivityResult(requestCode, resultCode, data); }
public void onActivityResult(int requestCode, int resultCode, Intent data) { if ((requestCode == GIST_CREATE || requestCode == GIST_VIEW) && RESULT_OK == resultCode) { forceRefresh(); return; } super.onActivityResult(requestCode, resultCode, data); }
public List<Repository> loadData() throws Exception { User org = RepoListFragment.this.org.get(); if (org == null) return Collections.emptyList(); RecentRepositories recent = recentRepos.get(); List<Repository> repos = cach...
public List<Repository> loadData() throws Exception { User org = RepoListFragment.this.org.get(); if (org == null) return Collections.emptyList(); RecentRepositories recent = recentRepos.get(); List<Repository> repos = cach...
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 () { 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 () { 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(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 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 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 resize (int width, int height) { stage.getViewport().update(width, height); }
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(...
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...
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...
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...
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 () { // 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 run() { try { keepAliveLatch.await(); } catch (InterruptedException e) { // bail out } } }, "es[keepAlive]"); keepAliveThread.setDaemon(false); ...
public void run() { try { keepAliveLatch.await(); } catch (InterruptedException e) { // bail out } } }, "elasticsearch[keepAlive]"); keepAliveThread.setDaem...
public final Set<IntsRef> toFiniteStrings(final TokenStreamToAutomaton ts2a, TokenStream ts) throws IOException { // Analyze surface form: // Create corresponding automaton: labels are bytes // from each analyzed token, with byte 0 used as // separator between tokens: Automaton automato...
public final Set<IntsRef> toFiniteStrings(final TokenStreamToAutomaton ts2a, TokenStream ts) throws IOException { // Analyze surface form: // Create corresponding automaton: labels are bytes // from each analyzed token, with byte 0 used as // separator between tokens: Automaton automato...
public TokenStreamToAutomaton getTokenStreamToAutomaton() { final TokenStreamToAutomaton tsta = super.getTokenStreamToAutomaton(); tsta.setUnicodeArcs(unicodeAware); return tsta; } Automaton toLevenshteinAutomata(Automaton automaton) { final Set<IntsRef> ref = SpecialOperations.ge...
public TokenStreamToAutomaton getTokenStreamToAutomaton() { final TokenStreamToAutomaton tsta = super.getTokenStreamToAutomaton(); tsta.setUnicodeArcs(unicodeAware); return tsta; } Automaton toLevenshteinAutomata(Automaton automaton) { final Set<IntsRef> ref = XSpecialOperations.g...
public int getVersion () { return Integer.parseInt(android.os.Build.VERSION.SDK); }
public int getVersion () { return android.os.Build.VERSION.SDK_INT; }
public void onTouch (MotionEvent event, AndroidInput input) { final int action = event.getAction() & MotionEvent.ACTION_MASK; int pointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_ID_MASK) >> MotionEvent.ACTION_POINTER_ID_SHIFT; int pointerId = event.getPointerId(pointerIndex); int x = 0, y = 0; ...
public void onTouch (MotionEvent event, AndroidInput input) { final int action = event.getAction() & MotionEvent.ACTION_MASK; int pointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> MotionEvent.ACTION_POINTER_INDEX_SHIFT; int pointerId = event.getPointerId(pointerIndex); int x = 0, y...
static private void process (Settings settings, File inputDir, File outputDir, File packFile) throws IOException { if (inputDir.getName().startsWith(".")) return; // Abort if nothing has changed. boolean skip = false; if (settings.incremental) { File[] files = inputDir.listFiles(); if (files == null) re...
static private void process (Settings settings, File inputDir, File outputDir, File packFile) throws IOException { if (inputDir.getName().startsWith(".")) return; // Abort if nothing has changed. boolean skip = false; if (settings.incremental) { File[] files = inputDir.listFiles(); if (files == null) re...
public void execute(RoutingAllocation allocation) throws ElasticSearchException { DiscoveryNode discoNode = allocation.nodes().resolveNode(node); MutableShardRouting shardRouting = null; for (MutableShardRouting routing : allocation.routingNodes().unassigned()) { if (routing.sha...
public void execute(RoutingAllocation allocation) throws ElasticSearchException { DiscoveryNode discoNode = allocation.nodes().resolveNode(node); MutableShardRouting shardRouting = null; for (MutableShardRouting routing : allocation.routingNodes().unassigned()) { if (routing.sha...
public String header(String name) { return request.headers().get(name); }
public String header(String name) { return request.getHeader(name); }
public abstract SortField.Type reducedType(); } interface Builder { IndexFieldData build(Index index, @IndexSettings Settings indexSettings, FieldMapper<?> mapper, IndexFieldDataCache cache); } public interface WithOrdinals<FD extends AtomicFieldData.WithOrdinals> extends IndexFieldDa...
public abstract SortField.Type reducedType(); } interface Builder { IndexFieldData build(Index index, @IndexSettings Settings indexSettings, FieldMapper.Names fieldNames, FieldDataType type, IndexFieldDataCache cache); } public interface WithOrdinals<FD extends AtomicFieldData.WithOrd...
public void parse(XContentParser parser, SearchContext context) throws Exception { byte[] filterSource = parser.binaryValue(); XContentParser fSourceParser = XContentFactory.xContent(filterSource).createParser(filterSource); try { ParsedFilter filter = context.queryParserService(...
public void parse(XContentParser parser, SearchContext context) throws Exception { byte[] filterSource = parser.binaryValue(); XContentParser fSourceParser = XContentFactory.xContent(filterSource).createParser(filterSource); try { ParsedFilter filter = context.queryParserService(...
private static double maxError(double distance) { return distance / 1000.0; }
private static double maxError(double distance) { return distance / 10000.0; }
public void testSearchFilter() throws Exception { createIndex("test"); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenSt...
public void testSearchFilter() throws Exception { createIndex("test"); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenStatus().execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGreenSt...
public void testParsingMultipleShapes() throws IOException { String mapping = XContentFactory.jsonBuilder() .startObject() .startObject("type1") .startObject("properties") .startObject("location1") .field("type", "geo_shape") ...
public void testParsingMultipleShapes() throws IOException { String mapping = XContentFactory.jsonBuilder() .startObject() .startObject("type1") .startObject("properties") .startObject("location1") .field("type", "geo_shape") ...
public void testRandomSorting() throws ElasticSearchException, IOException, InterruptedException, ExecutionException { int numberOfShards = between(1, 10); Random random = getRandom(); prepareCreate("test") .setSettings(ImmutableSettings.builder().put("index.number_of_shards"...
public void testRandomSorting() throws ElasticSearchException, IOException, InterruptedException, ExecutionException { int numberOfShards = between(1, 10); Random random = getRandom(); prepareCreate("test") .setSettings(ImmutableSettings.builder().put("index.number_of_shards"...
public void explainValidateQuery() throws Exception { client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 1)).execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGre...
public void explainValidateQuery() throws Exception { client().admin().indices().prepareCreate("test").setSettings(ImmutableSettings.settingsBuilder().put("index.number_of_shards", 1)).execute().actionGet(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).setWaitForGre...
protected void doExecute(ActionRequest request, ActionListener listener) { listener.onFailure(new InternalException(actionName, request.getHeaders())); } }
protected void doExecute(ActionRequest request, ActionListener listener) { listener.onFailure(new InternalException(actionName, request)); } }
@Override public void processTokenFilters(TokenFiltersBindings tokenFiltersBindings) { tokenFiltersBindings.processTokenFilter("stop", StopTokenFilterFactory.class); tokenFiltersBindings.processTokenFilter("reverse", ReverseTokenFilterFactory.class); tokenFiltersBindings.proc...
@Override public void processTokenFilters(TokenFiltersBindings tokenFiltersBindings) { tokenFiltersBindings.processTokenFilter("stop", StopTokenFilterFactory.class); tokenFiltersBindings.processTokenFilter("reverse", ReverseTokenFilterFactory.class); tokenFiltersBindings.proc...
protected void loadTileset (TiledMap map, Element element, FileHandle tmxFile, AtlasResolver resolver, AtlasTiledMapLoaderParameters parameter) { if (element.getName().equals("tileset")) { String name = element.get("name", null); int firstgid = element.getIntAttribute("firstgid", 1); int tilewidth = eleme...
protected void loadTileset (TiledMap map, Element element, FileHandle tmxFile, AtlasResolver resolver, AtlasTiledMapLoaderParameters parameter) { if (element.getName().equals("tileset")) { String name = element.get("name", null); int firstgid = element.getIntAttribute("firstgid", 1); int tilewidth = eleme...
private void displayGist(Gist gist) { gistId.setVisibility(VISIBLE); description.setVisibility(VISIBLE); gistId.setText(string.gist + " " + gist.getId()); description.setText(gist.getDescription()); GistFile[] gistFiles = gist.getFiles().values().toArray(new GistFile[gist.get...
private void displayGist(Gist gist) { gistId.setVisibility(VISIBLE); description.setVisibility(VISIBLE); gistId.setText(getString(string.gist) + " " + gist.getId()); description.setText(gist.getDescription()); GistFile[] gistFiles = gist.getFiles().values().toArray(new GistFi...
public boolean isVisualPressed () { if (pressed) return true; if (visualPressedTime <= 0) return false; if (visualPressedTime > TimeUtils.nanoTime()) return true; visualPressedTime = 0; return false; }
public boolean isVisualPressed () { if (pressed) return true; if (visualPressedTime <= 0) return false; if (visualPressedTime > TimeUtils.nanoTime() && Gdx.graphics.isContinuousRendering()) return true; visualPressedTime = 0; return false; }
public void insert (int index, short value) { if (index >= size) throw new IndexOutOfBoundsException("index can't be >= size: " + index + " >= " + size); short[] items = this.items; if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f))); if (ordered) System.arraycopy(items, index, items,...
public void insert (int index, short value) { if (index > size) throw new IndexOutOfBoundsException("index can't be > size: " + index + " > " + size); short[] items = this.items; if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f))); if (ordered) System.arraycopy(items, index, items, in...
public void render () { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); if (useStage) { stage.act(Gdx.graphics.getDeltaTime()); stage.getSpriteBatch().disableBlending(); Group root = stage.getRoot(); Array<Actor> actors = root.getChildren(); // for(int i = 0; i < actors.size(); i++) { // actors.get(i).rotat...
public void render () { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); if (useStage) { stage.act(Gdx.graphics.getDeltaTime()); stage.getBatch().disableBlending(); Group root = stage.getRoot(); Array<Actor> actors = root.getChildren(); // for(int i = 0; i < actors.size(); i++) { // actors.get(i).rotation +=...
public void render () { Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.draw(); Gdx.app.log("X", "FPS: " + Gdx.graphics.getFramesPerSecond()); SpriteBatch spriteBatch = (SpriteBatch)stage.getSpriteBatch(); Gdx.app.log("X", "render calls: " + spriteBatch.totalRender...
public void render () { Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.draw(); Gdx.app.log("X", "FPS: " + Gdx.graphics.getFramesPerSecond()); SpriteBatch spriteBatch = (SpriteBatch)stage.getBatch(); Gdx.app.log("X", "render calls: " + spriteBatch.totalRenderCalls)...
public String prettyPrint() { StringBuilder sb = new StringBuilder("routing_table:\n"); for (Map.Entry<String, IndexRoutingTable> entry : indicesRouting.entrySet()) { sb.append(entry.getValue().prettyPrint()).append('\n'); } return sb.toString(); }
public String prettyPrint() { StringBuilder sb = new StringBuilder("routing_table (version ").append(version).append("):\n"); for (Map.Entry<String, IndexRoutingTable> entry : indicesRouting.entrySet()) { sb.append(entry.getValue().prettyPrint()).append('\n'); } return sb...
public MergeMappingException(String[] failures) { super("Merge failed with failures [" + Arrays.toString(failures) + "]"); this.failures = failures; }
public MergeMappingException(String[] failures) { super("Merge failed with failures {" + Arrays.toString(failures) + "}"); this.failures = failures; }
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 boolean scrolled (InputEvent event, int amount) { resetFade(); if (scrollY) setScrollY(amountY + Math.max(areaHeight * 0.9f, maxY * 0.1f) / 4 * amount); else if (scrollX) // setScrollX(amountX + Math.max(areaWidth * 0.9f, maxX * 0.1f) / 4 * amount); return true; } }); } void ...
public boolean scrolled (InputEvent event, int amount) { resetFade(); if (scrollY) setScrollY(amountY + Math.max(areaHeight * 0.9f, maxY * 0.1f) / 4 * amount); else if (scrollX) // setScrollX(amountX + Math.max(areaWidth * 0.9f, maxX * 0.1f) / 4 * amount); return true; } }); } void ...
@Override public void onDrawFrame (javax.microedition.khronos.opengles.GL10 gl) { deltaTime = (System.nanoTime() - lastFrameTime) / 1000000000.0f; lastFrameTime = System.nanoTime(); mean.addValue(deltaTime); synchronized(synch) { if(running) { app.listener.render(); } if(pause) { app....
@Override public void onDrawFrame (javax.microedition.khronos.opengles.GL10 gl) { deltaTime = (System.nanoTime() - lastFrameTime) / 1000000000.0f; lastFrameTime = System.nanoTime(); mean.addValue(deltaTime); synchronized(synch) { if(running) { app.listener.render(); } if(pause) { app....
public void destroy() { canvas.getContext().makeCurrent(); listener.destroy(); }
public void destroy() { canvas.getContext().makeCurrent(); listener.dispose(); }
private void mainLoop( ) { try { graphics.setupDisplay(); } catch (LWJGLException e) { throw new GdxRuntimeException(e); } Keyboard.enableRepeatEvents(true); listener.create(); listener.resize(graphics.getWidth(), graphics.getHeight()); int lastWidth = graphics.getWidth(); int lastHeight ...
private void mainLoop( ) { try { graphics.setupDisplay(); } catch (LWJGLException e) { throw new GdxRuntimeException(e); } Keyboard.enableRepeatEvents(true); listener.create(); listener.resize(graphics.getWidth(), graphics.getHeight()); int lastWidth = graphics.getWidth(); int lastHeight ...
public void destroy (); }
public void dispose (); }
@Override public boolean keyDown (int keycode) { if (keycode == Keys.KEYCODE_SPACE) { app.log("TestCollection", "disposing test '" + tests[testIndex].getClass().getName()); tests[testIndex].destroy(); testIndex++; if (testIndex >= tests.length) testIndex = 0; Box2DTest test = tests[testIndex]; test...
@Override public boolean keyDown (int keycode) { if (keycode == Keys.KEYCODE_SPACE) { app.log("TestCollection", "disposing test '" + tests[testIndex].getClass().getName()); tests[testIndex].dispose(); testIndex++; if (testIndex >= tests.length) testIndex = 0; Box2DTest test = tests[testIndex]; test...
public void destroy( ) { }; }
public void dispose( ) { }; }
public static void main (String[] argv) { new JoglApplication(new com.badlogic.gdx.tests.RotationTest(), "Debug Test", 480, 320, false); }
public static void main (String[] argv) { new JoglApplication(new com.badlogic.gdx.tests.TextureDataTest(), "Debug Test", 480, 320, false); }
public boolean handle (Event event); }
public void handle (Event event); }